diff --git a/taglib/asf/asffile.cpp b/taglib/asf/asffile.cpp index e8a68d81..02fe83c3 100644 --- a/taglib/asf/asffile.cpp +++ b/taglib/asf/asffile.cpp @@ -196,7 +196,7 @@ void ASF::File::FilePrivate::BaseObject::parse(ASF::File *file, unsigned int siz if(size > 24 && size <= (unsigned int)(file->length())) data = file->readBlock(size - 24); else - data = ByteVector::null; + data = ByteVector(); } ByteVector ASF::File::FilePrivate::BaseObject::render(ASF::File * /*file*/) @@ -312,7 +312,7 @@ ByteVector ASF::File::FilePrivate::ExtendedContentDescriptionObject::render(ASF: { data.clear(); data.append(ByteVector::fromShort(attributeData.size(), false)); - data.append(attributeData.toByteVector(ByteVector::null)); + data.append(attributeData.toByteVector("")); return BaseObject::render(file); } @@ -336,7 +336,7 @@ ByteVector ASF::File::FilePrivate::MetadataObject::render(ASF::File *file) { data.clear(); data.append(ByteVector::fromShort(attributeData.size(), false)); - data.append(attributeData.toByteVector(ByteVector::null)); + data.append(attributeData.toByteVector("")); return BaseObject::render(file); } @@ -360,7 +360,7 @@ ByteVector ASF::File::FilePrivate::MetadataLibraryObject::render(ASF::File *file { data.clear(); data.append(ByteVector::fromShort(attributeData.size(), false)); - data.append(attributeData.toByteVector(ByteVector::null)); + data.append(attributeData.toByteVector("")); return BaseObject::render(file); } diff --git a/taglib/asf/asfpicture.cpp b/taglib/asf/asfpicture.cpp index cdf6e758..f772052f 100644 --- a/taglib/asf/asfpicture.cpp +++ b/taglib/asf/asfpicture.cpp @@ -132,7 +132,8 @@ ASF::Picture& ASF::Picture::operator=(const ASF::Picture& other) ByteVector ASF::Picture::render() const { if(!isValid()) - return ByteVector::null; + return ByteVector(); + return ByteVector((char)d->type) + ByteVector::fromUInt(d->picture.size(), false) + diff --git a/taglib/mp4/mp4tag.cpp b/taglib/mp4/mp4tag.cpp index 52f66906..47c802ce 100644 --- a/taglib/mp4/mp4tag.cpp +++ b/taglib/mp4/mp4tag.cpp @@ -428,7 +428,7 @@ MP4::Tag::renderFreeForm(const String &name, const MP4::Item &item) const StringList header = StringList::split(name, ":"); if(header.size() != 3) { debug("MP4: Invalid free-form item name \"" + name + "\""); - return ByteVector::null; + return ByteVector(); } ByteVector data; data.append(renderAtom("mean", ByteVector::fromUInt(0) + header[1].data(String::UTF8))); diff --git a/taglib/mpeg/id3v2/id3v2frame.cpp b/taglib/mpeg/id3v2/id3v2frame.cpp index a130d003..91eec328 100644 --- a/taglib/mpeg/id3v2/id3v2frame.cpp +++ b/taglib/mpeg/id3v2/id3v2frame.cpp @@ -170,7 +170,7 @@ ByteVector Frame::frameID() const if(d->header) return d->header->frameID(); else - return ByteVector::null; + return ByteVector(); } TagLib::uint Frame::size() const diff --git a/taglib/ogg/oggfile.cpp b/taglib/ogg/oggfile.cpp index dfd81ec6..82781412 100644 --- a/taglib/ogg/oggfile.cpp +++ b/taglib/ogg/oggfile.cpp @@ -92,7 +92,7 @@ ByteVector Ogg::File::packet(uint i) while(d->packetToPageMap.size() <= i) { if(!nextPage()) { debug("Ogg::File::packet() -- Could not find the requested packet."); - return ByteVector::null; + return ByteVector(); } } @@ -125,7 +125,7 @@ ByteVector Ogg::File::packet(uint i) if(pageIndex == d->pages.size()) { if(!nextPage()) { debug("Ogg::File::packet() -- Could not find the requested packet."); - return ByteVector::null; + return ByteVector(); } } d->currentPacketPage = d->pages[pageIndex]; diff --git a/taglib/riff/rifffile.cpp b/taglib/riff/rifffile.cpp index efd4f642..7d427a46 100644 --- a/taglib/riff/rifffile.cpp +++ b/taglib/riff/rifffile.cpp @@ -117,7 +117,7 @@ TagLib::uint RIFF::File::chunkPadding(uint i) const ByteVector RIFF::File::chunkName(uint i) const { if(i >= chunkCount()) - return ByteVector::null; + return ByteVector(); return d->chunks[i].name; } @@ -125,7 +125,7 @@ ByteVector RIFF::File::chunkName(uint i) const ByteVector RIFF::File::chunkData(uint i) { if(i >= chunkCount()) - return ByteVector::null; + return ByteVector(); seek(d->chunks[i].offset); return readBlock(d->chunks[i].size); diff --git a/taglib/toolkit/tbytevectorlist.cpp b/taglib/toolkit/tbytevectorlist.cpp index 7ea893f1..40e088d8 100644 --- a/taglib/toolkit/tbytevectorlist.cpp +++ b/taglib/toolkit/tbytevectorlist.cpp @@ -55,7 +55,7 @@ ByteVectorList ByteVectorList::split(const ByteVector &v, const ByteVector &patt if(offset - previousOffset >= 1) l.append(v.mid(previousOffset, offset - previousOffset)); else - l.append(ByteVector::null); + l.append(ByteVector()); previousOffset = offset + pattern.size(); } diff --git a/taglib/toolkit/tbytevectorstream.cpp b/taglib/toolkit/tbytevectorstream.cpp index dc480a26..230f7c99 100644 --- a/taglib/toolkit/tbytevectorstream.cpp +++ b/taglib/toolkit/tbytevectorstream.cpp @@ -71,7 +71,7 @@ FileName ByteVectorStream::name() const ByteVector ByteVectorStream::readBlock(ulong length) { if(length == 0) - return ByteVector::null; + return ByteVector(); ByteVector v = d->data.mid(d->position, length); d->position += v.size(); diff --git a/taglib/toolkit/tfile.cpp b/taglib/toolkit/tfile.cpp index a01c3460..2fca7445 100644 --- a/taglib/toolkit/tfile.cpp +++ b/taglib/toolkit/tfile.cpp @@ -289,7 +289,7 @@ long File::find(const ByteVector &pattern, long fromOffset, const ByteVector &be } } - if(!before.isNull() && beforePreviousPartialMatch >= 0 && int(bufferSize()) > beforePreviousPartialMatch) { + if(!before.isEmpty() && beforePreviousPartialMatch >= 0 && int(bufferSize()) > beforePreviousPartialMatch) { const int beforeOffset = (bufferSize() - beforePreviousPartialMatch); if(buffer.containsAt(before, 0, beforeOffset)) { seek(originalPosition); @@ -305,7 +305,7 @@ long File::find(const ByteVector &pattern, long fromOffset, const ByteVector &be return bufferOffset + location; } - if(!before.isNull() && buffer.find(before) >= 0) { + if(!before.isEmpty() && buffer.find(before) >= 0) { seek(originalPosition); return -1; } @@ -314,7 +314,7 @@ long File::find(const ByteVector &pattern, long fromOffset, const ByteVector &be previousPartialMatch = buffer.endsWithPartialMatch(pattern); - if(!before.isNull()) + if(!before.isEmpty()) beforePreviousPartialMatch = buffer.endsWithPartialMatch(before); bufferOffset += bufferSize(); @@ -387,7 +387,7 @@ long File::rfind(const ByteVector &pattern, long fromOffset, const ByteVector &b return bufferOffset + location; } - if(!before.isNull() && buffer.find(before) >= 0) { + if(!before.isEmpty() && buffer.find(before) >= 0) { seek(originalPosition); return -1; } diff --git a/taglib/toolkit/tfile.h b/taglib/toolkit/tfile.h index fe4efcba..77840684 100644 --- a/taglib/toolkit/tfile.h +++ b/taglib/toolkit/tfile.h @@ -165,7 +165,7 @@ namespace TagLib { */ long find(const ByteVector &pattern, long fromOffset = 0, - const ByteVector &before = ByteVector::null); + const ByteVector &before = ByteVector()); /*! * Returns the offset in the file that \a pattern occurs at or -1 if it can @@ -181,7 +181,7 @@ namespace TagLib { */ long rfind(const ByteVector &pattern, long fromOffset = 0, - const ByteVector &before = ByteVector::null); + const ByteVector &before = ByteVector()); /*! * Insert \a data at position \a start in the file overwriting \a replace diff --git a/taglib/toolkit/tfilestream.cpp b/taglib/toolkit/tfilestream.cpp index 65f37d52..0ced6c79 100644 --- a/taglib/toolkit/tfilestream.cpp +++ b/taglib/toolkit/tfilestream.cpp @@ -176,11 +176,11 @@ ByteVector FileStream::readBlock(ulong length) { if(!isOpen()) { debug("FileStream::readBlock() -- invalid file."); - return ByteVector::null; + return ByteVector(); } if(length == 0) - return ByteVector::null; + return ByteVector(); const ulong streamLength = static_cast(FileStream::length()); if(length > bufferSize() && length > streamLength) diff --git a/taglib/toolkit/tstring.cpp b/taglib/toolkit/tstring.cpp index d623d237..479b4069 100644 --- a/taglib/toolkit/tstring.cpp +++ b/taglib/toolkit/tstring.cpp @@ -426,7 +426,7 @@ ByteVector String::data(Type t) const return v; } else { - return ByteVector::null; + return ByteVector(); } case UTF16: { @@ -472,7 +472,7 @@ ByteVector String::data(Type t) const default: { debug("String::data() - Invalid Type value."); - return ByteVector::null; + return ByteVector(); } } } diff --git a/tests/test_apetag.cpp b/tests/test_apetag.cpp index 1a66cdd5..2f027958 100644 --- a/tests/test_apetag.cpp +++ b/tests/test_apetag.cpp @@ -98,22 +98,22 @@ public: CPPUNIT_ASSERT(unsuccessful.contains("A")); CPPUNIT_ASSERT(unsuccessful.contains("MP+")); } - + void testTextBinary() { APE::Item item = APE::Item("DUMMY", "Test Text"); CPPUNIT_ASSERT_EQUAL(String("Test Text"), item.toString()); - CPPUNIT_ASSERT_EQUAL(ByteVector::null, item.binaryData()); - + CPPUNIT_ASSERT_EQUAL(ByteVector(), item.binaryData()); + ByteVector data("Test Data"); item.setBinaryData(data); CPPUNIT_ASSERT(item.values().isEmpty()); CPPUNIT_ASSERT_EQUAL(String::null, item.toString()); CPPUNIT_ASSERT_EQUAL(data, item.binaryData()); - + item.setValue("Test Text 2"); CPPUNIT_ASSERT_EQUAL(String("Test Text 2"), item.toString()); - CPPUNIT_ASSERT_EQUAL(ByteVector::null, item.binaryData()); + CPPUNIT_ASSERT_EQUAL(ByteVector(), item.binaryData()); } }; diff --git a/tests/test_bytevector.cpp b/tests/test_bytevector.cpp index 0ab68921..b9e31f87 100644 --- a/tests/test_bytevector.cpp +++ b/tests/test_bytevector.cpp @@ -128,7 +128,7 @@ public: i.clear(); CPPUNIT_ASSERT(i.isEmpty()); - CPPUNIT_ASSERT(!i.isNull()); + CPPUNIT_ASSERT(!i.isNull()); // deprecated, but worth it to check. } void testFind1() diff --git a/tests/test_bytevectorstream.cpp b/tests/test_bytevectorstream.cpp index b0fec90b..7f6df152 100644 --- a/tests/test_bytevectorstream.cpp +++ b/tests/test_bytevectorstream.cpp @@ -56,7 +56,7 @@ public: CPPUNIT_ASSERT_EQUAL(ByteVector("a"), stream.readBlock(1)); CPPUNIT_ASSERT_EQUAL(ByteVector("bc"), stream.readBlock(2)); CPPUNIT_ASSERT_EQUAL(ByteVector("d"), stream.readBlock(3)); - CPPUNIT_ASSERT_EQUAL(ByteVector::null, stream.readBlock(3)); + CPPUNIT_ASSERT_EQUAL(ByteVector(""), stream.readBlock(3)); } void testRemoveBlock() diff --git a/tests/test_id3v2.cpp b/tests/test_id3v2.cpp index 5088841f..036ab2c7 100644 --- a/tests/test_id3v2.cpp +++ b/tests/test_id3v2.cpp @@ -38,7 +38,7 @@ class PublicFrame : public ID3v2::Frame { return ID3v2::Frame::readStringField(data, encoding, positon); } virtual String toString() const { return String::null; } virtual void parseFields(const ByteVector &) {} - virtual ByteVector renderFields() const { return ByteVector::null; } + virtual ByteVector renderFields() const { return ByteVector(); } }; class TestID3v2 : public CppUnit::TestFixture