ByteVector::null is not necessarily be empty or remains the same instance.
Using it in a public header may lead to a linkage error.
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*/)
{
data.clear();
data.append(ByteVector::fromShort(attributeData.size(), false));
- data.append(attributeData.toByteVector(ByteVector::null));
+ data.append(attributeData.toByteVector(""));
return BaseObject::render(file);
}
{
data.clear();
data.append(ByteVector::fromShort(attributeData.size(), false));
- data.append(attributeData.toByteVector(ByteVector::null));
+ data.append(attributeData.toByteVector(""));
return BaseObject::render(file);
}
{
data.clear();
data.append(ByteVector::fromShort(attributeData.size(), false));
- data.append(attributeData.toByteVector(ByteVector::null));
+ data.append(attributeData.toByteVector(""));
return BaseObject::render(file);
}
ByteVector ASF::Picture::render() const
{
if(!isValid())
- return ByteVector::null;
+ return ByteVector();
+
return
ByteVector((char)d->type) +
ByteVector::fromUInt(d->picture.size(), false) +
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)));
if(d->header)
return d->header->frameID();
else
- return ByteVector::null;
+ return ByteVector();
}
TagLib::uint Frame::size() const
while(d->packetToPageMap.size() <= i) {
if(!nextPage()) {
debug("Ogg::File::packet() -- Could not find the requested packet.");
- return ByteVector::null;
+ return ByteVector();
}
}
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];
ByteVector RIFF::File::chunkName(uint i) const
{
if(i >= chunkCount())
- return ByteVector::null;
+ return ByteVector();
return d->chunks[i].name;
}
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);
if(offset - previousOffset >= 1)
l.append(v.mid(previousOffset, offset - previousOffset));
else
- l.append(ByteVector::null);
+ l.append(ByteVector());
previousOffset = offset + pattern.size();
}
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();
}
}
- 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);
return bufferOffset + location;
}
- if(!before.isNull() && buffer.find(before) >= 0) {
+ if(!before.isEmpty() && buffer.find(before) >= 0) {
seek(originalPosition);
return -1;
}
previousPartialMatch = buffer.endsWithPartialMatch(pattern);
- if(!before.isNull())
+ if(!before.isEmpty())
beforePreviousPartialMatch = buffer.endsWithPartialMatch(before);
bufferOffset += bufferSize();
return bufferOffset + location;
}
- if(!before.isNull() && buffer.find(before) >= 0) {
+ if(!before.isEmpty() && buffer.find(before) >= 0) {
seek(originalPosition);
return -1;
}
*/
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
*/
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
{
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<ulong>(FileStream::length());
if(length > bufferSize() && length > streamLength)
return v;
}
else {
- return ByteVector::null;
+ return ByteVector();
}
case UTF16:
{
default:
{
debug("String::data() - Invalid Type value.");
- return ByteVector::null;
+ return ByteVector();
}
}
}
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());
}
};
i.clear();
CPPUNIT_ASSERT(i.isEmpty());
- CPPUNIT_ASSERT(!i.isNull());
+ CPPUNIT_ASSERT(!i.isNull()); // deprecated, but worth it to check.
}
void testFind1()
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()
{ 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