diff --git a/taglib/ape/apefile.cpp b/taglib/ape/apefile.cpp index 4d797d1e..c0c9724b 100644 --- a/taglib/ape/apefile.cpp +++ b/taglib/ape/apefile.cpp @@ -58,10 +58,10 @@ public: APELocation(-1), APESize(0), ID3v1Location(-1), - ID3v2Header(0), + ID3v2Header(nullptr), ID3v2Location(-1), ID3v2Size(0), - properties(0) {} + properties(nullptr) {} ~FilePrivate() { @@ -233,10 +233,10 @@ APE::Tag *APE::File::APETag(bool create) void APE::File::strip(int tags) { if(tags & ID3v1) - d->tag.set(ApeID3v1Index, 0); + d->tag.set(ApeID3v1Index, nullptr); if(tags & APE) - d->tag.set(ApeAPEIndex, 0); + d->tag.set(ApeAPEIndex, nullptr); if(!ID3v1Tag()) APETag(true); diff --git a/taglib/ape/apetag.cpp b/taglib/ape/apetag.cpp index 3cf91b2e..51201015 100644 --- a/taglib/ape/apetag.cpp +++ b/taglib/ape/apetag.cpp @@ -52,7 +52,7 @@ namespace bool isKeyValid(const ByteVector &key) { - const char *invalidKeys[] = { "ID3", "TAG", "OGGS", "MP+", 0 }; + const char *invalidKeys[] = { "ID3", "TAG", "OGGS", "MP+", nullptr }; // only allow printable ASCII including space (32..126) @@ -63,7 +63,7 @@ namespace } const String upperKey = String(key).upper(); - for(size_t i = 0; invalidKeys[i] != 0; ++i) { + for(size_t i = 0; invalidKeys[i] != nullptr; ++i) { if(upperKey == invalidKeys[i]) return false; } @@ -76,7 +76,7 @@ class APE::Tag::TagPrivate { public: TagPrivate() : - file(0), + file(nullptr), footerLocation(0) {} File *file; diff --git a/taglib/asf/asffile.cpp b/taglib/asf/asffile.cpp index 921f6f48..ef11041a 100644 --- a/taglib/asf/asffile.cpp +++ b/taglib/asf/asffile.cpp @@ -52,13 +52,13 @@ public: FilePrivate(): headerSize(0), - tag(0), - properties(0), - contentDescriptionObject(0), - extendedContentDescriptionObject(0), - headerExtensionObject(0), - metadataObject(0), - metadataLibraryObject(0) + tag(nullptr), + properties(nullptr), + contentDescriptionObject(nullptr), + extendedContentDescriptionObject(nullptr), + headerExtensionObject(nullptr), + metadataObject(nullptr), + metadataLibraryObject(nullptr) { objects.setAutoDelete(true); } @@ -648,8 +648,8 @@ void ASF::File::read() } seek(2, Current); - FilePrivate::FilePropertiesObject *filePropertiesObject = 0; - FilePrivate::StreamPropertiesObject *streamPropertiesObject = 0; + FilePrivate::FilePropertiesObject *filePropertiesObject = nullptr; + FilePrivate::StreamPropertiesObject *streamPropertiesObject = nullptr; for(int i = 0; i < numObjects; i++) { const ByteVector guid = readBlock(16); if(guid.size() != 16) { diff --git a/taglib/asf/asfutils.h b/taglib/asf/asfutils.h index acadaa1e..501c39e3 100644 --- a/taglib/asf/asfutils.h +++ b/taglib/asf/asfutils.h @@ -37,7 +37,7 @@ namespace TagLib namespace { - inline unsigned short readWORD(File *file, bool *ok = 0) + inline unsigned short readWORD(File *file, bool *ok = nullptr) { const ByteVector v = file->readBlock(2); if(v.size() != 2) { @@ -48,7 +48,7 @@ namespace TagLib return v.toUShort(false); } - inline unsigned int readDWORD(File *file, bool *ok = 0) + inline unsigned int readDWORD(File *file, bool *ok = nullptr) { const ByteVector v = file->readBlock(4); if(v.size() != 4) { @@ -59,7 +59,7 @@ namespace TagLib return v.toUInt(false); } - inline long long readQWORD(File *file, bool *ok = 0) + inline long long readQWORD(File *file, bool *ok = nullptr) { const ByteVector v = file->readBlock(8); if(v.size() != 8) { diff --git a/taglib/audioproperties.cpp b/taglib/audioproperties.cpp index a47a5d1e..ca433fd9 100644 --- a/taglib/audioproperties.cpp +++ b/taglib/audioproperties.cpp @@ -71,7 +71,7 @@ int AudioProperties::sampleRate() const //////////////////////////////////////////////////////////////////////////////// AudioProperties::AudioProperties(ReadStyle) : - d(0) + d(nullptr) { } diff --git a/taglib/fileref.cpp b/taglib/fileref.cpp index cf08b5b6..6e8f9e31 100644 --- a/taglib/fileref.cpp +++ b/taglib/fileref.cpp @@ -72,7 +72,7 @@ namespace return 0; #else if(::strlen(fileName) == 0) - return 0; + return nullptr; #endif ResolverList::ConstIterator it = fileTypeResolvers.begin(); for(; it != fileTypeResolvers.end(); ++it) { @@ -81,7 +81,7 @@ namespace return file; } - return 0; + return nullptr; } File *detectByResolvers(IOStream* stream, bool readAudioProperties, @@ -97,7 +97,7 @@ namespace } } - return 0; + return nullptr; } // Detect the file type based on the file extension. @@ -121,11 +121,11 @@ namespace // that a default file type resolver is created. if(ext.isEmpty()) - return 0; + return nullptr; // .oga can be any audio in the Ogg container. So leave it to content-based detection. - File *file = 0; + File *file = nullptr; if(ext == "MP3") file = new MPEG::File(stream, ID3v2::FrameFactory::instance(), readAudioProperties, audioPropertiesStyle); @@ -171,7 +171,7 @@ namespace delete file; } - return 0; + return nullptr; } // Detect the file type based on the actual content of the stream. @@ -179,7 +179,7 @@ namespace File *detectByContent(IOStream *stream, bool readAudioProperties, AudioProperties::ReadStyle audioPropertiesStyle) { - File *file = 0; + File *file = nullptr; if(MPEG::File::isSupported(stream)) file = new MPEG::File(stream, ID3v2::FrameFactory::instance(), readAudioProperties, audioPropertiesStyle); @@ -218,7 +218,7 @@ namespace delete file; } - return 0; + return nullptr; } // Internal function that supports FileRef::create(). @@ -244,7 +244,7 @@ namespace ext = s.substr(pos + 1).upper(); if(ext.isEmpty()) - return 0; + return nullptr; if(ext == "MP3") return new MPEG::File(fileName, ID3v2::FrameFactory::instance(), readAudioProperties, audioPropertiesStyle); @@ -290,7 +290,7 @@ namespace if(ext == "XM") return new XM::File(fileName, readAudioProperties, audioPropertiesStyle); - return 0; + return nullptr; } } // namespace @@ -298,8 +298,8 @@ class FileRef::FileRefPrivate : public RefCounter { public: FileRefPrivate() : - file(0), - stream(0) {} + file(nullptr), + stream(nullptr) {} ~FileRefPrivate() override { delete file; @@ -354,7 +354,7 @@ Tag *FileRef::tag() const { if(isNull()) { debug("FileRef::tag() - Called without a valid file."); - return 0; + return nullptr; } return d->file->tag(); } @@ -363,7 +363,7 @@ AudioProperties *FileRef::audioProperties() const { if(isNull()) { debug("FileRef::audioProperties() - Called without a valid file."); - return 0; + return nullptr; } return d->file->audioProperties(); } @@ -490,7 +490,7 @@ void FileRef::parse(FileName fileName, bool readAudioProperties, // Stream have to be closed here if failed to resolve file types. delete d->stream; - d->stream = 0; + d->stream = nullptr; } void FileRef::parse(IOStream *stream, bool readAudioProperties, diff --git a/taglib/flac/flacfile.cpp b/taglib/flac/flacfile.cpp index b2599227..bde1cd1b 100644 --- a/taglib/flac/flacfile.cpp +++ b/taglib/flac/flacfile.cpp @@ -65,7 +65,7 @@ public: ID3v2Location(-1), ID3v2OriginalSize(0), ID3v1Location(-1), - properties(0), + properties(nullptr), flacStart(0), streamStart(0), scanned(false) @@ -199,7 +199,7 @@ bool FLAC::File::save() if(commentBlock && (*it)->code() == MetadataBlock::Picture) { // Set the new Vorbis Comment block before the first picture block d->blocks.insert(it, commentBlock); - commentBlock = 0; + commentBlock = nullptr; } ++it; } @@ -373,10 +373,10 @@ void FLAC::File::removePictures() void FLAC::File::strip(int tags) { if(tags & ID3v1) - d->tag.set(FlacID3v1Index, 0); + d->tag.set(FlacID3v1Index, nullptr); if(tags & ID3v2) - d->tag.set(FlacID3v2Index, 0); + d->tag.set(FlacID3v2Index, nullptr); if(tags & XiphComment) { xiphComment()->removeAllFields(); @@ -525,7 +525,7 @@ void FLAC::File::scan() return; } - MetadataBlock *block = 0; + MetadataBlock *block = nullptr; // Found the vorbis-comment if(blockType == MetadataBlock::VorbisComment) { diff --git a/taglib/flac/flacmetadatablock.cpp b/taglib/flac/flacmetadatablock.cpp index 8b795f22..695e559b 100644 --- a/taglib/flac/flacmetadatablock.cpp +++ b/taglib/flac/flacmetadatablock.cpp @@ -37,7 +37,7 @@ public: }; FLAC::MetadataBlock::MetadataBlock() - : d(0) + : d(nullptr) { } diff --git a/taglib/mp4/mp4atom.cpp b/taglib/mp4/mp4atom.cpp index edd615f2..2d57deb6 100644 --- a/taglib/mp4/mp4atom.cpp +++ b/taglib/mp4/mp4atom.cpp @@ -136,7 +136,7 @@ MP4::Atom::~Atom() MP4::Atom * MP4::Atom::find(const char *name1, const char *name2, const char *name3, const char *name4) { - if(name1 == 0) { + if(name1 == nullptr) { return this; } for(AtomList::ConstIterator it = children.begin(); it != children.end(); ++it) { @@ -144,7 +144,7 @@ MP4::Atom::find(const char *name1, const char *name2, const char *name3, const c return (*it)->find(name2, name3, name4); } } - return 0; + return nullptr; } MP4::AtomList @@ -166,7 +166,7 @@ bool MP4::Atom::path(MP4::AtomList &path, const char *name1, const char *name2, const char *name3) { path.append(this); - if(name1 == 0) { + if(name1 == nullptr) { return true; } for(AtomList::ConstIterator it = children.begin(); it != children.end(); ++it) { @@ -204,7 +204,7 @@ MP4::Atoms::find(const char *name1, const char *name2, const char *name3, const return (*it)->find(name2, name3, name4); } } - return 0; + return nullptr; } MP4::AtomList diff --git a/taglib/mp4/mp4atom.h b/taglib/mp4/mp4atom.h index 48873cc9..1578c0e8 100644 --- a/taglib/mp4/mp4atom.h +++ b/taglib/mp4/mp4atom.h @@ -77,8 +77,8 @@ namespace TagLib { public: Atom(File *file); ~Atom(); - Atom *find(const char *name1, const char *name2 = 0, const char *name3 = 0, const char *name4 = 0); - bool path(AtomList &path, const char *name1, const char *name2 = 0, const char *name3 = 0); + Atom *find(const char *name1, const char *name2 = nullptr, const char *name3 = nullptr, const char *name4 = nullptr); + bool path(AtomList &path, const char *name1, const char *name2 = nullptr, const char *name3 = nullptr); AtomList findall(const char *name, bool recursive = false); offset_t offset; offset_t length; @@ -95,8 +95,8 @@ namespace TagLib { public: Atoms(File *file); ~Atoms(); - Atom *find(const char *name1, const char *name2 = 0, const char *name3 = 0, const char *name4 = 0); - AtomList path(const char *name1, const char *name2 = 0, const char *name3 = 0, const char *name4 = 0); + Atom *find(const char *name1, const char *name2 = nullptr, const char *name3 = nullptr, const char *name4 = nullptr); + AtomList path(const char *name1, const char *name2 = nullptr, const char *name3 = nullptr, const char *name4 = nullptr); AtomList atoms; }; } // namespace MP4 diff --git a/taglib/mp4/mp4file.cpp b/taglib/mp4/mp4file.cpp index 1747d62c..37a9a365 100644 --- a/taglib/mp4/mp4file.cpp +++ b/taglib/mp4/mp4file.cpp @@ -55,9 +55,9 @@ class MP4::File::FilePrivate { public: FilePrivate() : - tag(0), - atoms(0), - properties(0) {} + tag(nullptr), + atoms(nullptr), + properties(nullptr) {} ~FilePrivate() { @@ -198,5 +198,5 @@ MP4::File::strip(int tags) bool MP4::File::hasMP4Tag() const { - return (d->atoms->find("moov", "udta", "meta", "ilst") != 0); + return (d->atoms->find("moov", "udta", "meta", "ilst") != nullptr); } diff --git a/taglib/mp4/mp4properties.cpp b/taglib/mp4/mp4properties.cpp index b24cfe24..823987fb 100644 --- a/taglib/mp4/mp4properties.cpp +++ b/taglib/mp4/mp4properties.cpp @@ -144,7 +144,7 @@ MP4::Properties::read(File *file, Atoms *atoms) return; } - MP4::Atom *trak = 0; + MP4::Atom *trak = nullptr; ByteVector data; const MP4::AtomList trakList = moov->findall("trak"); @@ -160,7 +160,7 @@ MP4::Properties::read(File *file, Atoms *atoms) if(data.containsAt("soun", 16)) { break; } - trak = 0; + trak = nullptr; } if(!trak) { debug("MP4: No audio tracks"); diff --git a/taglib/mp4/mp4tag.cpp b/taglib/mp4/mp4tag.cpp index cff5c701..590ace97 100644 --- a/taglib/mp4/mp4tag.cpp +++ b/taglib/mp4/mp4tag.cpp @@ -36,8 +36,8 @@ class MP4::Tag::TagPrivate { public: TagPrivate() : - file(0), - atoms(0) {} + file(nullptr), + atoms(nullptr) {} TagLib::File *file; Atoms *atoms; diff --git a/taglib/mpc/mpcfile.cpp b/taglib/mpc/mpcfile.cpp index 28b4c11c..ab067999 100644 --- a/taglib/mpc/mpcfile.cpp +++ b/taglib/mpc/mpcfile.cpp @@ -50,10 +50,10 @@ public: APELocation(-1), APESize(0), ID3v1Location(-1), - ID3v2Header(0), + ID3v2Header(nullptr), ID3v2Location(-1), ID3v2Size(0), - properties(0) {} + properties(nullptr) {} ~FilePrivate() { @@ -241,17 +241,17 @@ APE::Tag *MPC::File::APETag(bool create) void MPC::File::strip(int tags) { if(tags & ID3v1) - d->tag.set(MPCID3v1Index, 0); + d->tag.set(MPCID3v1Index, nullptr); if(tags & APE) - d->tag.set(MPCAPEIndex, 0); + d->tag.set(MPCAPEIndex, nullptr); if(!ID3v1Tag()) APETag(true); if(tags & ID3v2) { delete d->ID3v2Header; - d->ID3v2Header = 0; + d->ID3v2Header = nullptr; } } diff --git a/taglib/mpeg/id3v1/id3v1tag.cpp b/taglib/mpeg/id3v1/id3v1tag.cpp index cfec2cb1..cc335bda 100644 --- a/taglib/mpeg/id3v1/id3v1tag.cpp +++ b/taglib/mpeg/id3v1/id3v1tag.cpp @@ -42,7 +42,7 @@ class ID3v1::Tag::TagPrivate { public: TagPrivate() : - file(0), + file(nullptr), tagOffset(0), track(0), genre(255) {} diff --git a/taglib/mpeg/id3v2/frames/chapterframe.cpp b/taglib/mpeg/id3v2/frames/chapterframe.cpp index 540c87b5..0794cdf9 100644 --- a/taglib/mpeg/id3v2/frames/chapterframe.cpp +++ b/taglib/mpeg/id3v2/frames/chapterframe.cpp @@ -37,7 +37,7 @@ class ChapterFrame::ChapterFramePrivate { public: ChapterFramePrivate() : - tagHeader(0), + tagHeader(nullptr), startTime(0), endTime(0), startOffset(0), @@ -236,7 +236,7 @@ ChapterFrame *ChapterFrame::findByElementID(const ID3v2::Tag *tag, const ByteVec return frame; } - return 0; + return nullptr; } void ChapterFrame::parseFields(const ByteVector &data) diff --git a/taglib/mpeg/id3v2/frames/commentsframe.cpp b/taglib/mpeg/id3v2/frames/commentsframe.cpp index add0bf2f..07fa1502 100644 --- a/taglib/mpeg/id3v2/frames/commentsframe.cpp +++ b/taglib/mpeg/id3v2/frames/commentsframe.cpp @@ -136,7 +136,7 @@ CommentsFrame *CommentsFrame::findByDescription(const ID3v2::Tag *tag, const Str return frame; } - return 0; + return nullptr; } //////////////////////////////////////////////////////////////////////////////// diff --git a/taglib/mpeg/id3v2/frames/tableofcontentsframe.cpp b/taglib/mpeg/id3v2/frames/tableofcontentsframe.cpp index 9061a9bc..3f16acbe 100644 --- a/taglib/mpeg/id3v2/frames/tableofcontentsframe.cpp +++ b/taglib/mpeg/id3v2/frames/tableofcontentsframe.cpp @@ -36,7 +36,7 @@ class TableOfContentsFrame::TableOfContentsFramePrivate { public: TableOfContentsFramePrivate() : - tagHeader(0), + tagHeader(nullptr), isTopLevel(false), isOrdered(false) { @@ -262,7 +262,7 @@ TableOfContentsFrame *TableOfContentsFrame::findByElementID(const ID3v2::Tag *ta return frame; } - return 0; + return nullptr; } TableOfContentsFrame *TableOfContentsFrame::findTopLevel(const ID3v2::Tag *tag) // static @@ -278,7 +278,7 @@ TableOfContentsFrame *TableOfContentsFrame::findTopLevel(const ID3v2::Tag *tag) return frame; } - return 0; + return nullptr; } void TableOfContentsFrame::parseFields(const ByteVector &data) diff --git a/taglib/mpeg/id3v2/frames/textidentificationframe.cpp b/taglib/mpeg/id3v2/frames/textidentificationframe.cpp index cda40d95..35b10703 100644 --- a/taglib/mpeg/id3v2/frames/textidentificationframe.cpp +++ b/taglib/mpeg/id3v2/frames/textidentificationframe.cpp @@ -337,7 +337,7 @@ PropertyMap TextIdentificationFrame::makeTMCLProperties() const UserTextIdentificationFrame::UserTextIdentificationFrame(String::Type encoding) : TextIdentificationFrame("TXXX", encoding), - d(0) + d(nullptr) { StringList l; l.append(String()); @@ -354,7 +354,7 @@ UserTextIdentificationFrame::UserTextIdentificationFrame(const ByteVector &data) UserTextIdentificationFrame::UserTextIdentificationFrame(const String &description, const StringList &values, String::Type encoding) : TextIdentificationFrame("TXXX", encoding), - d(0) + d(nullptr) { setDescription(description); setText(values); @@ -433,7 +433,7 @@ UserTextIdentificationFrame *UserTextIdentificationFrame::find( if(f && f->description() == description) return f; } - return 0; + return nullptr; } //////////////////////////////////////////////////////////////////////////////// diff --git a/taglib/mpeg/id3v2/frames/uniquefileidentifierframe.cpp b/taglib/mpeg/id3v2/frames/uniquefileidentifierframe.cpp index dd26482a..98fa7546 100644 --- a/taglib/mpeg/id3v2/frames/uniquefileidentifierframe.cpp +++ b/taglib/mpeg/id3v2/frames/uniquefileidentifierframe.cpp @@ -114,7 +114,7 @@ UniqueFileIdentifierFrame *UniqueFileIdentifierFrame::findByOwner(const ID3v2::T return frame; } - return 0; + return nullptr; } void UniqueFileIdentifierFrame::parseFields(const ByteVector &data) diff --git a/taglib/mpeg/id3v2/frames/unsynchronizedlyricsframe.cpp b/taglib/mpeg/id3v2/frames/unsynchronizedlyricsframe.cpp index db089dbf..e6afbc40 100644 --- a/taglib/mpeg/id3v2/frames/unsynchronizedlyricsframe.cpp +++ b/taglib/mpeg/id3v2/frames/unsynchronizedlyricsframe.cpp @@ -134,7 +134,7 @@ UnsynchronizedLyricsFrame *UnsynchronizedLyricsFrame::findByDescription(const ID if(frame && frame->description() == d) return frame; } - return 0; + return nullptr; } //////////////////////////////////////////////////////////////////////////////// // protected members diff --git a/taglib/mpeg/id3v2/frames/urllinkframe.cpp b/taglib/mpeg/id3v2/frames/urllinkframe.cpp index 9e7982d4..2f32e5c8 100644 --- a/taglib/mpeg/id3v2/frames/urllinkframe.cpp +++ b/taglib/mpeg/id3v2/frames/urllinkframe.cpp @@ -185,7 +185,7 @@ UserUrlLinkFrame *UserUrlLinkFrame::find(ID3v2::Tag *tag, const String &descript if(f && f->description() == description) return f; } - return 0; + return nullptr; } //////////////////////////////////////////////////////////////////////////////// diff --git a/taglib/mpeg/id3v2/id3v2footer.cpp b/taglib/mpeg/id3v2/id3v2footer.cpp index 3622724a..2d1ec7d0 100644 --- a/taglib/mpeg/id3v2/id3v2footer.cpp +++ b/taglib/mpeg/id3v2/id3v2footer.cpp @@ -34,7 +34,7 @@ class Footer::FooterPrivate }; Footer::Footer() : - d(0) + d(nullptr) { } diff --git a/taglib/mpeg/id3v2/id3v2frame.cpp b/taglib/mpeg/id3v2/id3v2frame.cpp index 9e3ac82a..b57ce928 100644 --- a/taglib/mpeg/id3v2/id3v2frame.cpp +++ b/taglib/mpeg/id3v2/id3v2frame.cpp @@ -49,7 +49,7 @@ class Frame::FramePrivate { public: FramePrivate() : - header(0) + header(nullptr) {} ~FramePrivate() diff --git a/taglib/mpeg/id3v2/id3v2frame.h b/taglib/mpeg/id3v2/id3v2frame.h index c2db6593..044ac4f8 100644 --- a/taglib/mpeg/id3v2/id3v2frame.h +++ b/taglib/mpeg/id3v2/id3v2frame.h @@ -214,7 +214,7 @@ namespace TagLib { * This is useful for reading strings sequentially. */ String readStringField(const ByteVector &data, String::Type encoding, - int *position = 0); + int *position = nullptr); /*! * Checks a the list of string values to see if they can be used with the diff --git a/taglib/mpeg/id3v2/id3v2framefactory.cpp b/taglib/mpeg/id3v2/id3v2framefactory.cpp index 730784d0..4377dad4 100644 --- a/taglib/mpeg/id3v2/id3v2framefactory.cpp +++ b/taglib/mpeg/id3v2/id3v2framefactory.cpp @@ -130,7 +130,7 @@ Frame *FrameFactory::createFrame(const ByteVector &origData, const Header *tagHe header->frameSize() > data.size()) { delete header; - return 0; + return nullptr; } #ifndef NO_ITUNES_HACKS @@ -147,7 +147,7 @@ Frame *FrameFactory::createFrame(const ByteVector &origData, const Header *tagHe for(ByteVector::ConstIterator it = frameID.begin(); it != frameID.end(); it++) { if( (*it < 'A' || *it > 'Z') && (*it < '0' || *it > '9') ) { delete header; - return 0; + return nullptr; } } diff --git a/taglib/mpeg/id3v2/id3v2tag.cpp b/taglib/mpeg/id3v2/id3v2tag.cpp index 66e35119..a7be802a 100644 --- a/taglib/mpeg/id3v2/id3v2tag.cpp +++ b/taglib/mpeg/id3v2/id3v2tag.cpp @@ -70,11 +70,11 @@ class ID3v2::Tag::TagPrivate { public: TagPrivate() : - factory(0), - file(0), + factory(nullptr), + file(nullptr), tagOffset(0), - extendedHeader(0), - footer(0) + extendedHeader(nullptr), + footer(nullptr) { frameList.setAutoDelete(true); } @@ -404,7 +404,7 @@ void ID3v2::Tag::removeUnsupportedProperties(const StringList &properties) // delete all unknown frames of given type FrameList l = frameList(id); for(FrameList::ConstIterator fit = l.begin(); fit != l.end(); fit++) - if (dynamic_cast(*fit) != 0) + if (dynamic_cast(*fit) != nullptr) removeFrame(*fit); } else if(it->size() == 4){ @@ -416,7 +416,7 @@ void ID3v2::Tag::removeUnsupportedProperties(const StringList &properties) if(it->size() <= 5) continue; // invalid specification String description = it->substr(5); - Frame *frame = 0; + Frame *frame = nullptr; if(id == "TXXX") frame = UserTextIdentificationFrame::find(this, description); else if(id == "WXXX") @@ -493,14 +493,14 @@ void ID3v2::Tag::downgradeFrames(FrameList *frames, FrameList *newFrames) const // iTunes writes and reads TSOA, TSOT, TSOP to ID3v2.3. static const char *unsupportedFrames[] = { "ASPI", "EQU2", "RVA2", "SEEK", "SIGN", "TDRL", "TDTG", - "TMOO", "TPRO", "TSST", 0 + "TMOO", "TPRO", "TSST", nullptr }; #endif - ID3v2::TextIdentificationFrame *frameTDOR = 0; - ID3v2::TextIdentificationFrame *frameTDRC = 0; - ID3v2::TextIdentificationFrame *frameTIPL = 0; - ID3v2::TextIdentificationFrame *frameTMCL = 0; - ID3v2::TextIdentificationFrame *frameTCON = 0; + ID3v2::TextIdentificationFrame *frameTDOR = nullptr; + ID3v2::TextIdentificationFrame *frameTDRC = nullptr; + ID3v2::TextIdentificationFrame *frameTIPL = nullptr; + ID3v2::TextIdentificationFrame *frameTMCL = nullptr; + ID3v2::TextIdentificationFrame *frameTCON = nullptr; for(FrameList::ConstIterator it = d->frameList.begin(); it != d->frameList.end(); it++) { ID3v2::Frame *frame = *it; diff --git a/taglib/mpeg/mpegfile.cpp b/taglib/mpeg/mpegfile.cpp index 91295776..3d3d4b29 100644 --- a/taglib/mpeg/mpegfile.cpp +++ b/taglib/mpeg/mpegfile.cpp @@ -54,7 +54,7 @@ public: APELocation(-1), APEOriginalSize(0), ID3v1Location(-1), - properties(0) {} + properties(nullptr) {} ~FilePrivate() { @@ -89,8 +89,8 @@ namespace public: AdapterFile(IOStream *stream) : File(stream) {} - Tag *tag() const override { return 0; } - AudioProperties *audioProperties() const override { return 0; } + Tag *tag() const override { return nullptr; } + AudioProperties *audioProperties() const override { return nullptr; } bool save() override { return false; } }; } // namespace @@ -343,7 +343,7 @@ bool MPEG::File::strip(int tags, bool freeMemory) d->ID3v2OriginalSize = 0; if(freeMemory) - d->tag.set(ID3v2Index, 0); + d->tag.set(ID3v2Index, nullptr); } if((tags & ID3v1) && d->ID3v1Location >= 0) { @@ -352,7 +352,7 @@ bool MPEG::File::strip(int tags, bool freeMemory) d->ID3v1Location = -1; if(freeMemory) - d->tag.set(ID3v1Index, 0); + d->tag.set(ID3v1Index, nullptr); } if((tags & APE) && d->APELocation >= 0) { @@ -365,7 +365,7 @@ bool MPEG::File::strip(int tags, bool freeMemory) d->APEOriginalSize = 0; if(freeMemory) - d->tag.set(APEIndex, 0); + d->tag.set(APEIndex, nullptr); } return true; diff --git a/taglib/mpeg/mpegproperties.cpp b/taglib/mpeg/mpegproperties.cpp index babad890..8d586c70 100644 --- a/taglib/mpeg/mpegproperties.cpp +++ b/taglib/mpeg/mpegproperties.cpp @@ -38,7 +38,7 @@ class MPEG::Properties::PropertiesPrivate { public: PropertiesPrivate() : - xingHeader(0), + xingHeader(nullptr), length(0), bitrate(0), sampleRate(0), @@ -162,7 +162,7 @@ void MPEG::Properties::read(File *file) d->xingHeader = new XingHeader(file->readBlock(firstHeader.frameLength())); if(!d->xingHeader->isValid()) { delete d->xingHeader; - d->xingHeader = 0; + d->xingHeader = nullptr; } if(d->xingHeader && firstHeader.samplesPerFrame() > 0 && firstHeader.sampleRate() > 0) { diff --git a/taglib/ogg/flac/oggflacfile.cpp b/taglib/ogg/flac/oggflacfile.cpp index 5c2f95c6..b6527e96 100644 --- a/taglib/ogg/flac/oggflacfile.cpp +++ b/taglib/ogg/flac/oggflacfile.cpp @@ -39,8 +39,8 @@ class Ogg::FLAC::File::FilePrivate { public: FilePrivate() : - comment(0), - properties(0), + comment(nullptr), + properties(nullptr), streamStart(0), streamLength(0), scanned(false), diff --git a/taglib/ogg/oggfile.cpp b/taglib/ogg/oggfile.cpp index 86063915..9ffed806 100644 --- a/taglib/ogg/oggfile.cpp +++ b/taglib/ogg/oggfile.cpp @@ -49,8 +49,8 @@ class Ogg::File::FilePrivate { public: FilePrivate() : - firstPageHeader(0), - lastPageHeader(0) + firstPageHeader(nullptr), + lastPageHeader(nullptr) { pages.setAutoDelete(true); } @@ -131,12 +131,12 @@ const Ogg::PageHeader *Ogg::File::firstPageHeader() if(!d->firstPageHeader) { const offset_t firstPageHeaderOffset = find("OggS"); if(firstPageHeaderOffset < 0) - return 0; + return nullptr; d->firstPageHeader = new PageHeader(this, firstPageHeaderOffset); } - return d->firstPageHeader->isValid() ? d->firstPageHeader : 0; + return d->firstPageHeader->isValid() ? d->firstPageHeader : nullptr; } const Ogg::PageHeader *Ogg::File::lastPageHeader() @@ -144,12 +144,12 @@ const Ogg::PageHeader *Ogg::File::lastPageHeader() if(!d->lastPageHeader) { const offset_t lastPageHeaderOffset = rfind("OggS"); if(lastPageHeaderOffset < 0) - return 0; + return nullptr; d->lastPageHeader = new PageHeader(this, lastPageHeaderOffset); } - return d->lastPageHeader->isValid() ? d->lastPageHeader : 0; + return d->lastPageHeader->isValid() ? d->lastPageHeader : nullptr; } bool Ogg::File::save() diff --git a/taglib/ogg/oggpage.cpp b/taglib/ogg/oggpage.cpp index affb55a3..7fcaf4ad 100644 --- a/taglib/ogg/oggpage.cpp +++ b/taglib/ogg/oggpage.cpp @@ -100,7 +100,7 @@ unsigned int pageChecksum(const ByteVector &data) class Ogg::Page::PagePrivate { public: - PagePrivate(File *f = 0, offset_t pageOffset = -1) : + PagePrivate(File *f = nullptr, offset_t pageOffset = -1) : file(f), fileOffset(pageOffset), header(f, pageOffset), diff --git a/taglib/ogg/oggpageheader.h b/taglib/ogg/oggpageheader.h index 29709626..91af3e75 100644 --- a/taglib/ogg/oggpageheader.h +++ b/taglib/ogg/oggpageheader.h @@ -52,7 +52,7 @@ namespace TagLib { * create a page with no (and as such, invalid) data that must be set * later. */ - PageHeader(File *file = 0, offset_t pageOffset = -1); + PageHeader(File *file = nullptr, offset_t pageOffset = -1); /*! * Deletes this instance of the PageHeader. diff --git a/taglib/ogg/opus/opusfile.cpp b/taglib/ogg/opus/opusfile.cpp index d4f191ad..9b181660 100644 --- a/taglib/ogg/opus/opusfile.cpp +++ b/taglib/ogg/opus/opusfile.cpp @@ -41,8 +41,8 @@ class Opus::File::FilePrivate { public: FilePrivate() : - comment(0), - properties(0) {} + comment(nullptr), + properties(nullptr) {} ~FilePrivate() { diff --git a/taglib/ogg/speex/speexfile.cpp b/taglib/ogg/speex/speexfile.cpp index 394cb17b..bb883a31 100644 --- a/taglib/ogg/speex/speexfile.cpp +++ b/taglib/ogg/speex/speexfile.cpp @@ -41,8 +41,8 @@ class Speex::File::FilePrivate { public: FilePrivate() : - comment(0), - properties(0) {} + comment(nullptr), + properties(nullptr) {} ~FilePrivate() { diff --git a/taglib/ogg/vorbis/vorbisfile.cpp b/taglib/ogg/vorbis/vorbisfile.cpp index a7512bec..5b527b85 100644 --- a/taglib/ogg/vorbis/vorbisfile.cpp +++ b/taglib/ogg/vorbis/vorbisfile.cpp @@ -38,8 +38,8 @@ class Vorbis::File::FilePrivate { public: FilePrivate() : - comment(0), - properties(0) {} + comment(nullptr), + properties(nullptr) {} ~FilePrivate() { diff --git a/taglib/riff/aiff/aifffile.cpp b/taglib/riff/aiff/aifffile.cpp index 6ef4c9be..081df55d 100644 --- a/taglib/riff/aiff/aifffile.cpp +++ b/taglib/riff/aiff/aifffile.cpp @@ -38,8 +38,8 @@ class RIFF::AIFF::File::FilePrivate { public: FilePrivate() : - properties(0), - tag(0), + properties(nullptr), + tag(nullptr), hasID3v2(false) {} ~FilePrivate() diff --git a/taglib/riff/wav/wavfile.cpp b/taglib/riff/wav/wavfile.cpp index 8cd84364..e829c5ec 100644 --- a/taglib/riff/wav/wavfile.cpp +++ b/taglib/riff/wav/wavfile.cpp @@ -45,7 +45,7 @@ class RIFF::WAV::File::FilePrivate { public: FilePrivate() : - properties(0), + properties(nullptr), hasID3v2(false), hasInfo(false) {} diff --git a/taglib/tagunion.cpp b/taglib/tagunion.cpp index 3a022550..cf42bd7b 100644 --- a/taglib/tagunion.cpp +++ b/taglib/tagunion.cpp @@ -64,7 +64,7 @@ using namespace TagLib; class TagUnion::TagUnionPrivate { public: - TagUnionPrivate() : tags(3, static_cast(0)) + TagUnionPrivate() : tags(3, static_cast(nullptr)) { } diff --git a/taglib/tagunion.h b/taglib/tagunion.h index 78fd2e29..ff9eab3c 100644 --- a/taglib/tagunion.h +++ b/taglib/tagunion.h @@ -47,7 +47,7 @@ namespace TagLib { * \a third. The TagUnion takes ownership of these tags and will handle * their deletion. */ - TagUnion(Tag *first = 0, Tag *second = 0, Tag *third = 0); + TagUnion(Tag *first = nullptr, Tag *second = nullptr, Tag *third = nullptr); ~TagUnion() override; diff --git a/taglib/tagutils.h b/taglib/tagutils.h index c2bba562..d21edef3 100644 --- a/taglib/tagutils.h +++ b/taglib/tagutils.h @@ -46,7 +46,7 @@ namespace TagLib { offset_t findAPE(File *file, offset_t id3v1Location); ByteVector readHeader(IOStream *stream, unsigned int length, bool skipID3v2, - offset_t *headerOffset = 0); + offset_t *headerOffset = nullptr); } // namespace Utils } // namespace TagLib diff --git a/taglib/toolkit/tbytevector.cpp b/taglib/toolkit/tbytevector.cpp index 70fc4ec4..529773c0 100644 --- a/taglib/toolkit/tbytevector.cpp +++ b/taglib/toolkit/tbytevector.cpp @@ -392,12 +392,12 @@ ByteVector &ByteVector::setData(const char *data) char *ByteVector::data() { detach(); - return (size() > 0) ? (&(*d->data)[d->offset]) : 0; + return (size() > 0) ? (&(*d->data)[d->offset]) : nullptr; } const char *ByteVector::data() const { - return (size() > 0) ? (&(*d->data)[d->offset]) : 0; + return (size() > 0) ? (&(*d->data)[d->offset]) : nullptr; } ByteVector ByteVector::mid(unsigned int index, unsigned int length) const diff --git a/taglib/toolkit/tfilestream.cpp b/taglib/toolkit/tfilestream.cpp index 18a1a1d3..3a0397b7 100644 --- a/taglib/toolkit/tfilestream.cpp +++ b/taglib/toolkit/tfilestream.cpp @@ -96,7 +96,7 @@ namespace typedef FILE* FileHandle; - const FileHandle InvalidFileHandle = 0; + const FileHandle InvalidFileHandle = nullptr; FileHandle openFile(const FileName &path, bool readOnly) { diff --git a/taglib/toolkit/tstring.h b/taglib/toolkit/tstring.h index 0c8d785a..f9146466 100644 --- a/taglib/toolkit/tstring.h +++ b/taglib/toolkit/tstring.h @@ -345,7 +345,7 @@ namespace TagLib { * true and returns the integer. Otherwise it sets \a *ok to false * and the result is undefined. */ - int toInt(bool *ok = 0) const; + int toInt(bool *ok = nullptr) const; /*! * Returns a string with the leading and trailing whitespace stripped. diff --git a/taglib/trueaudio/trueaudiofile.cpp b/taglib/trueaudio/trueaudiofile.cpp index 7361122f..4f2975bd 100644 --- a/taglib/trueaudio/trueaudiofile.cpp +++ b/taglib/trueaudio/trueaudiofile.cpp @@ -55,7 +55,7 @@ public: ID3v2Location(-1), ID3v2OriginalSize(0), ID3v1Location(-1), - properties(0) {} + properties(nullptr) {} ~FilePrivate() { @@ -237,10 +237,10 @@ ID3v2::Tag *TrueAudio::File::ID3v2Tag(bool create) void TrueAudio::File::strip(int tags) { if(tags & ID3v1) - d->tag.set(TrueAudioID3v1Index, 0); + d->tag.set(TrueAudioID3v1Index, nullptr); if(tags & ID3v2) - d->tag.set(TrueAudioID3v2Index, 0); + d->tag.set(TrueAudioID3v2Index, nullptr); if(!ID3v1Tag()) ID3v2Tag(true); diff --git a/taglib/wavpack/wavpackfile.cpp b/taglib/wavpack/wavpackfile.cpp index bdca24ca..9da4c935 100644 --- a/taglib/wavpack/wavpackfile.cpp +++ b/taglib/wavpack/wavpackfile.cpp @@ -54,7 +54,7 @@ public: APELocation(-1), APESize(0), ID3v1Location(-1), - properties(0) {} + properties(nullptr) {} ~FilePrivate() { @@ -221,10 +221,10 @@ APE::Tag *WavPack::File::APETag(bool create) void WavPack::File::strip(int tags) { if(tags & ID3v1) - d->tag.set(WavID3v1Index, 0); + d->tag.set(WavID3v1Index, nullptr); if(tags & APE) - d->tag.set(WavAPEIndex, 0); + d->tag.set(WavAPEIndex, nullptr); if(!ID3v1Tag()) APETag(true); diff --git a/tests/plainfile.h b/tests/plainfile.h index 3250816f..dc808277 100644 --- a/tests/plainfile.h +++ b/tests/plainfile.h @@ -34,8 +34,8 @@ using namespace TagLib; class PlainFile : public File { public: explicit PlainFile(FileName name) : File(name) { } - Tag *tag() const override { return NULL; } - AudioProperties *audioProperties() const override { return NULL; } + Tag *tag() const override { return nullptr; } + AudioProperties *audioProperties() const override { return nullptr; } bool save() override { return false; } void truncate(long length) { File::truncate(length); } diff --git a/tests/test_fileref.cpp b/tests/test_fileref.cpp index 2910803d..dc946fe3 100644 --- a/tests/test_fileref.cpp +++ b/tests/test_fileref.cpp @@ -66,7 +66,7 @@ namespace public: File *createFile(FileName, bool, AudioProperties::ReadStyle) const override { - return 0; + return nullptr; } File *createFileFromStream(IOStream *s, bool, AudioProperties::ReadStyle) const override @@ -391,7 +391,7 @@ public: { { FileRef f(TEST_FILE_PATH_C("xing.mp3")); - CPPUNIT_ASSERT(dynamic_cast(f.file()) != NULL); + CPPUNIT_ASSERT(dynamic_cast(f.file()) != nullptr); } DummyResolver resolver; @@ -399,7 +399,7 @@ public: { FileRef f(TEST_FILE_PATH_C("xing.mp3")); - CPPUNIT_ASSERT(dynamic_cast(f.file()) != NULL); + CPPUNIT_ASSERT(dynamic_cast(f.file()) != nullptr); } DummyStreamResolver streamResolver; @@ -408,7 +408,7 @@ public: { FileStream s(TEST_FILE_PATH_C("xing.mp3")); FileRef f(&s); - CPPUNIT_ASSERT(dynamic_cast(f.file()) != NULL); + CPPUNIT_ASSERT(dynamic_cast(f.file()) != nullptr); } } diff --git a/tests/test_id3v2.cpp b/tests/test_id3v2.cpp index 10a9afb8..d931f03f 100644 --- a/tests/test_id3v2.cpp +++ b/tests/test_id3v2.cpp @@ -60,7 +60,7 @@ class PublicFrame : public ID3v2::Frame public: PublicFrame() : ID3v2::Frame(ByteVector("XXXX\0\0\0\0\0\0", 10)) {} String readStringField(const ByteVector &data, String::Type encoding, - int *position = 0) + int *position = nullptr) { return ID3v2::Frame::readStringField(data, encoding, position); } String toString() const override { return String(); } void parseFields(const ByteVector &) override {} @@ -1242,7 +1242,7 @@ public: tag.removeUnsupportedProperties(properties.unsupportedData()); CPPUNIT_ASSERT(tag.frameList("APIC").isEmpty()); CPPUNIT_ASSERT(tag.frameList("TIPL").isEmpty()); - CPPUNIT_ASSERT_EQUAL((ID3v2::UniqueFileIdentifierFrame *)0, ID3v2::UniqueFileIdentifierFrame::findByOwner(&tag, "http://example.com")); + CPPUNIT_ASSERT_EQUAL((ID3v2::UniqueFileIdentifierFrame *)nullptr, ID3v2::UniqueFileIdentifierFrame::findByOwner(&tag, "http://example.com")); CPPUNIT_ASSERT_EQUAL(frame6, ID3v2::UniqueFileIdentifierFrame::findByOwner(&tag, "http://musicbrainz.org")); } diff --git a/tests/test_it.cpp b/tests/test_it.cpp index 75afb54d..9ea64f52 100644 --- a/tests/test_it.cpp +++ b/tests/test_it.cpp @@ -85,7 +85,7 @@ public: ScopedFileCopy copy("test", ".it"); { IT::File file(copy.fileName().c_str()); - CPPUNIT_ASSERT(file.tag() != 0); + CPPUNIT_ASSERT(file.tag() != nullptr); file.tag()->setTitle(titleAfter); file.tag()->setComment(newComment); file.tag()->setTrackerName("won't be saved"); @@ -104,8 +104,8 @@ private: IT::Properties *p = file.audioProperties(); Mod::Tag *t = file.tag(); - CPPUNIT_ASSERT(0 != p); - CPPUNIT_ASSERT(0 != t); + CPPUNIT_ASSERT(nullptr != p); + CPPUNIT_ASSERT(nullptr != t); CPPUNIT_ASSERT_EQUAL( 0, p->length()); CPPUNIT_ASSERT_EQUAL( 0, p->bitrate()); diff --git a/tests/test_mod.cpp b/tests/test_mod.cpp index 55fd7438..7a1279ce 100644 --- a/tests/test_mod.cpp +++ b/tests/test_mod.cpp @@ -70,7 +70,7 @@ public: ScopedFileCopy copy("test", ".mod"); { Mod::File file(copy.fileName().c_str()); - CPPUNIT_ASSERT(file.tag() != 0); + CPPUNIT_ASSERT(file.tag() != nullptr); file.tag()->setTitle(titleAfter); file.tag()->setComment(newComment); CPPUNIT_ASSERT(file.save()); @@ -110,8 +110,8 @@ private: Mod::Properties *p = file.audioProperties(); Mod::Tag *t = file.tag(); - CPPUNIT_ASSERT(0 != p); - CPPUNIT_ASSERT(0 != t); + CPPUNIT_ASSERT(nullptr != p); + CPPUNIT_ASSERT(nullptr != t); CPPUNIT_ASSERT_EQUAL(0, p->length()); CPPUNIT_ASSERT_EQUAL(0, p->bitrate()); diff --git a/tests/test_riff.cpp b/tests/test_riff.cpp index 4db2eb9b..3da1d410 100644 --- a/tests/test_riff.cpp +++ b/tests/test_riff.cpp @@ -51,8 +51,8 @@ public: void setChunkData(const ByteVector &name, const ByteVector &data) { RIFF::File::setChunkData(name, data); }; - TagLib::Tag* tag() const override { return 0; }; - TagLib::AudioProperties* audioProperties() const override { return 0;}; + TagLib::Tag* tag() const override { return nullptr; }; + TagLib::AudioProperties* audioProperties() const override { return nullptr;}; bool save() override { return false; }; void removeChunk(unsigned int i) { RIFF::File::removeChunk(i); } void removeChunk(const ByteVector &name) { RIFF::File::removeChunk(name); } diff --git a/tests/test_s3m.cpp b/tests/test_s3m.cpp index fd211d22..c4451ada 100644 --- a/tests/test_s3m.cpp +++ b/tests/test_s3m.cpp @@ -73,7 +73,7 @@ public: ScopedFileCopy copy("test", ".s3m"); { S3M::File file(copy.fileName().c_str()); - CPPUNIT_ASSERT(file.tag() != 0); + CPPUNIT_ASSERT(file.tag() != nullptr); file.tag()->setTitle(titleAfter); file.tag()->setComment(newComment); file.tag()->setTrackerName("won't be saved"); @@ -95,8 +95,8 @@ private: S3M::Properties *p = file.audioProperties(); Mod::Tag *t = file.tag(); - CPPUNIT_ASSERT(0 != p); - CPPUNIT_ASSERT(0 != t); + CPPUNIT_ASSERT(nullptr != p); + CPPUNIT_ASSERT(nullptr != t); CPPUNIT_ASSERT_EQUAL( 0, p->length()); CPPUNIT_ASSERT_EQUAL( 0, p->bitrate()); diff --git a/tests/test_xm.cpp b/tests/test_xm.cpp index fcda4f56..5c65a3af 100644 --- a/tests/test_xm.cpp +++ b/tests/test_xm.cpp @@ -127,8 +127,8 @@ public: XM::Properties *p = file.audioProperties(); Mod::Tag *t = file.tag(); - CPPUNIT_ASSERT(0 != p); - CPPUNIT_ASSERT(0 != t); + CPPUNIT_ASSERT(nullptr != p); + CPPUNIT_ASSERT(nullptr != t); CPPUNIT_ASSERT_EQUAL(0, p->length()); CPPUNIT_ASSERT_EQUAL(0, p->bitrate()); @@ -173,8 +173,8 @@ private: XM::Properties *p = file.audioProperties(); Mod::Tag *t = file.tag(); - CPPUNIT_ASSERT(0 != p); - CPPUNIT_ASSERT(0 != t); + CPPUNIT_ASSERT(nullptr != p); + CPPUNIT_ASSERT(nullptr != t); CPPUNIT_ASSERT_EQUAL(0, p->length()); CPPUNIT_ASSERT_EQUAL(0, p->bitrate()); @@ -203,7 +203,7 @@ private: ScopedFileCopy copy("test", ".xm"); { XM::File file(copy.fileName().c_str()); - CPPUNIT_ASSERT(file.tag() != 0); + CPPUNIT_ASSERT(file.tag() != nullptr); file.tag()->setTitle(titleAfter); file.tag()->setComment(comment); file.tag()->setTrackerName(trackerNameAfter);