Switch the return type of File::save() from void to bool to provide a little

bit of feedback on whether or not the safe operation worked.

CCMAIL:83882@bugs.kde.org


git-svn-id: svn://anonsvn.kde.org/home/kde/trunk/kdesupport/taglib@323165 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
This commit is contained in:
Scott Wheeler
2004-06-23 18:35:52 +00:00
parent 5f2e59150c
commit 420541441c
7 changed files with 39 additions and 28 deletions

View File

@ -176,8 +176,13 @@ const Ogg::PageHeader *Ogg::File::lastPageHeader()
return d->lastPageHeader->isValid() ? d->lastPageHeader : 0;
}
void Ogg::File::save()
bool Ogg::File::save()
{
if(readOnly()) {
debug("Ogg::File::save() - Cannot save to a read only file.");
return false;
}
List<int> pageGroup;
for(List<int>::ConstIterator it = d->dirtyPages.begin(); it != d->dirtyPages.end(); ++it) {
@ -191,6 +196,8 @@ void Ogg::File::save()
writePageGroup(pageGroup);
d->dirtyPages.clear();
d->dirtyPackets.clear();
return true;
}
////////////////////////////////////////////////////////////////////////////////

View File

@ -73,7 +73,7 @@ namespace TagLib {
*/
const PageHeader *lastPageHeader();
virtual void save();
virtual bool save();
protected:
/*!

View File

@ -79,7 +79,7 @@ Vorbis::Properties *Vorbis::File::audioProperties() const
return d->properties;
}
void Vorbis::File::save()
bool Vorbis::File::save()
{
ByteVector v(vorbisCommentHeaderID);
@ -89,7 +89,7 @@ void Vorbis::File::save()
setPacket(1, v);
Ogg::File::save();
return Ogg::File::save();
}
////////////////////////////////////////////////////////////////////////////////

View File

@ -83,7 +83,7 @@ namespace TagLib {
*/
virtual Properties *audioProperties() const;
virtual void save();
virtual bool save();
private:
File(const File &);