Remove the definition of offset_t.

The definition of offset_t has changed over time, and it's just equivalent to long long now.
We no longer have a good reason to keep it.
This commit is contained in:
Tsuda Kageyu
2015-12-01 22:02:05 +09:00
parent 2f29f0e1d0
commit 6f5874a035
63 changed files with 340 additions and 342 deletions

View File

@ -72,13 +72,13 @@ public:
delete properties;
}
offset_t APELocation;
long long APELocation;
uint APESize;
offset_t ID3v1Location;
long long ID3v1Location;
ID3v2::Header *ID3v2Header;
offset_t ID3v2Location;
long long ID3v2Location;
uint ID3v2Size;
DoubleTagUnion tag;
@ -284,7 +284,7 @@ void APE::File::read(bool readProperties)
if(readProperties) {
offset_t streamLength;
long long streamLength;
if(d->hasAPE)
streamLength = d->APELocation;

View File

@ -63,7 +63,7 @@ public:
// public members
////////////////////////////////////////////////////////////////////////////////
APE::AudioProperties::AudioProperties(File *file, offset_t streamLength, ReadStyle) :
APE::AudioProperties::AudioProperties(File *file, long long streamLength, ReadStyle) :
TagLib::AudioProperties(),
d(new PropertiesPrivate())
{
@ -135,10 +135,10 @@ namespace
}
}
void APE::AudioProperties::read(File *file, offset_t streamLength)
void APE::AudioProperties::read(File *file, long long streamLength)
{
// First, we assume that the file pointer is set at the first descriptor.
offset_t offset = file->tell();
long long offset = file->tell();
int version = headerVersion(file->readBlock(6));
// Next, we look for the descriptor.

View File

@ -53,7 +53,7 @@ namespace TagLib {
* Create an instance of APE::Properties with the data read from the
* APE::File \a file.
*/
AudioProperties(File *file, offset_t streamLength, ReadStyle style = Average);
AudioProperties(File *file, long long streamLength, ReadStyle style = Average);
/*!
* Destroys this APE::AudioProperties instance.
@ -116,7 +116,7 @@ namespace TagLib {
int version() const;
private:
void read(File *file, offset_t streamLength);
void read(File *file, long long streamLength);
void analyzeCurrent(File *file);
void analyzeOld(File *file);

View File

@ -62,7 +62,7 @@ APE::Tag::Tag() :
{
}
APE::Tag::Tag(TagLib::File *file, offset_t footerLocation) :
APE::Tag::Tag(TagLib::File *file, long long footerLocation) :
TagLib::Tag(),
d(new TagPrivate())
{
@ -414,7 +414,7 @@ bool APE::Tag::isEmpty() const
// protected methods
////////////////////////////////////////////////////////////////////////////////
void APE::Tag::read(TagLib::File *file, offset_t footerLocation)
void APE::Tag::read(TagLib::File *file, long long footerLocation)
{
if(file && file->isValid()) {

View File

@ -69,7 +69,7 @@ namespace TagLib {
* Create an APE tag and parse the data in \a file with APE footer at
* \a tagOffset.
*/
Tag(TagLib::File *file, offset_t footerLocation);
Tag(TagLib::File *file, long long footerLocation);
/*!
* Destroys this Tag instance.
@ -201,7 +201,7 @@ namespace TagLib {
/*!
* Reads from the file specified in the constructor.
*/
void read(TagLib::File *file, offset_t footerLocation);
void read(TagLib::File *file, long long footerLocation);
/*!
* Parses the body of the tag in \a data.

View File

@ -193,7 +193,7 @@ private:
void ASF::File::FilePrivate::BaseObject::parse(ASF::File *file, unsigned int size)
{
data.clear();
if(size > 24 && static_cast<offset_t>(size) <= file->length())
if(size > 24 && static_cast<long long>(size) <= file->length())
data = file->readBlock(size - 24);
else
data = ByteVector();

View File

@ -143,7 +143,7 @@ bool DSF::File::save()
}
// Delete the old tag and write the new one
insert(tagData, static_cast<offset_t>(newMetadataOffset), static_cast<size_t>(oldTagSize));
insert(tagData, newMetadataOffset, static_cast<size_t>(oldTagSize));
}
return true;

View File

@ -30,32 +30,32 @@ using namespace TagLib;
class EBML::Element::ElementPrivate
{
public:
public:
// The id of this element.
ulli id;
// The position of the element, where the header begins.
offset_t position;
long long position;
// The size of the element as read from the header. Note: Actually an ulli but
// due to the variable integer size limited, thus offset_t is ok.
offset_t size;
// due to the variable integer size limited, thus long long is ok.
long long size;
// The position of the element's data.
offset_t data;
long long data;
// The element's children.
List<Element *> children;
// True: Treated this element as container and read children.
bool populated;
// The parent element. If NULL (0) this is the document root.
Element *parent;
// The file used to read and write.
File *document;
// Destructor: Clean up all children.
~ElementPrivate()
{
@ -63,36 +63,36 @@ public:
delete *i;
}
}
// Reads a variable length integer from the file at the given position
// and saves its value to result. If cutOne is true the first one of the
// binary representation of the result is removed (required for size). If
// cutOne is false the one will remain in the result (required for id).
// This method returns the position directly after the read integer.
offset_t readVInt(offset_t position, ulli *result, bool cutOne = true)
long long readVInt(long long position, ulli *result, bool cutOne = true)
{
document->seek(position);
// Determine the length of the integer
char firstByte = document->readBlock(1)[0];
uint byteSize = 1;
for(uint i = 0; i < 8 && ((firstByte << i) & (1 << 7)) == 0; ++i)
++byteSize;
// Load the integer
document->seek(position);
ByteVector vint = document->readBlock(byteSize);
// Cut the one if requested
if(cutOne)
vint[0] = (vint[0] & (~(1 << (8 - byteSize))));
// Store the result and return the current position
if(result)
*result = static_cast<ulli>(vint.toInt64BE(0));
return position + byteSize;
}
// Returns a BytVector containing the given number in the variable integer
// format. Truncates numbers > 2^56 (^ means potency in this case).
// If addOne is true, the ByteVector will remain the One to determine the
@ -102,7 +102,7 @@ public:
ByteVector createVInt(ulli number, bool addOne = true, bool shortest = true)
{
ByteVector vint = ByteVector::fromUInt64BE(number);
// Do we actually need to calculate the length of the variable length
// integer? If not, then prepend the 0b0000 0001 if necessary and return the
// vint.
@ -111,15 +111,15 @@ public:
vint[0] = 1;
return vint;
}
// Calculate the minimal length of the variable length integer
size_t byteSize = vint.size();
for(size_t i = 0; byteSize > 0 && vint[i] == 0; ++i)
--byteSize;
if(!addOne)
return ByteVector(vint.data() + vint.size() - byteSize, byteSize);
ulli firstByte = (1 << (vint.size() - byteSize));
// The most significant byte loses #bytSize bits for storing information.
// Therefore, we might need to increase byteSize.
@ -130,11 +130,11 @@ public:
vint[firstBytePosition] |= (1 << firstBytePosition);
return ByteVector(vint.data() + firstBytePosition, byteSize);
}
// Returns a void element within this element which is at least "least" in
// size. Uses best fit method. Returns a null pointer if no suitable element
// was found.
Element *searchVoid(offset_t least = 0L)
Element *searchVoid(long long least = 0L)
{
Element *currentBest = 0;
for(List<Element *>::Iterator i = children.begin(); i != children.end(); ++i) {
@ -149,7 +149,7 @@ public:
}
return currentBest;
}
// Replaces this element by a Void element. Returns true on success and false
// on error.
bool makeVoid()
@ -168,12 +168,12 @@ public:
data = position + header.size();
size = leftSize;
return true;
// XXX: We actually should merge Voids, if possible.
}
// Reading constructor: Reads all unknown information from the file.
ElementPrivate(File *p_document, Element *p_parent = 0, offset_t p_position = 0) :
ElementPrivate(File *p_document, Element *p_parent = 0, long long p_position = 0) :
id(0),
position(p_position),
data(0),
@ -184,19 +184,19 @@ public:
if(parent) {
ulli ssize;
data = readVInt(readVInt(position, &id, false), &ssize);
size = static_cast<offset_t>(ssize);
size = static_cast<long long>(ssize);
}
else {
document->seek(0, File::End);
size = document->tell();
}
}
// Writing constructor: Takes given information, calculates missing information
// and writes everything to the file.
// Tries to use void elements if available in the parent.
ElementPrivate(ulli p_id, File *p_document, Element *p_parent,
offset_t p_position, offset_t p_size) :
long long p_position, long long p_size) :
id(p_id),
position(p_position),
size(p_size),
@ -209,7 +209,7 @@ public:
data = position + content.size();
// space for children
content.resize(static_cast<size_t>(data - position + size));
Element *freeSpace;
if (!(freeSpace = searchVoid(content.size()))) {
// We have to make room
@ -237,7 +237,7 @@ public:
else {
document->seek(freeSpace->d->position);
if((freeSpace->d->size + freeSpace->d->data - freeSpace->d->position)
== static_cast<offset_t>(content.size())) {
== static_cast<long long>(content.size())) {
// Write to file
document->writeBlock(content);
// Update parent
@ -251,9 +251,9 @@ public:
else {
ulli newSize = freeSpace->d->size - content.size();
ByteVector newVoid(createVInt(Void, false).append(createVInt(newSize, true, false)));
// Check if the original size of the size field was really 8 byte
if (static_cast<offset_t>(newVoid.size()) != (freeSpace->d->data - freeSpace->d->position))
if (static_cast<long long>(newVoid.size()) != (freeSpace->d->data - freeSpace->d->position))
newVoid = createVInt(Void, false).append(createVInt(newSize));
// Update freeSpace
freeSpace->d->size = newSize;
@ -414,7 +414,7 @@ bool EBML::Element::removeChildren(bool useVoid)
// in a row where a huge Void would be more appropriate.
if (d->children.isEmpty())
return false;
for(List<Element *>::Iterator i = d->children.begin(); i != d->children.end(); ++i)
removeChild(*i, useVoid);
return true;
@ -424,7 +424,7 @@ bool EBML::Element::removeChild(Element *element, bool useVoid)
{
if (!d->children.contains(element))
return false;
if(!useVoid || !element->d->makeVoid()) {
d->document->removeBlock(element->d->position, static_cast<size_t>(element->d->size));
// Update parents
@ -473,9 +473,9 @@ void EBML::Element::populate()
{
if(!d->populated) {
d->populated = true;
offset_t end = d->data + d->size;
for(offset_t i = d->data; i < end;) {
long long end = d->data + d->size;
for(long long i = d->data; i < end;) {
Element *elem = new Element(
new ElementPrivate(d->document, this, i)
);

View File

@ -78,10 +78,10 @@ public:
}
const ID3v2::FrameFactory *ID3v2FrameFactory;
offset_t ID3v2Location;
long long ID3v2Location;
uint ID3v2OriginalSize;
offset_t ID3v1Location;
long long ID3v1Location;
TripleTagUnion tag;
@ -89,8 +89,8 @@ public:
ByteVector xiphCommentData;
List<MetadataBlock *> blocks;
offset_t flacStart;
offset_t streamStart;
long long flacStart;
long long streamStart;
bool scanned;
bool hasXiphComment;
@ -372,7 +372,7 @@ void FLAC::File::read(bool readProperties)
const ByteVector infoData = d->blocks.front()->render();
offset_t streamLength;
long long streamLength;
if(d->hasID3v1)
streamLength = d->ID3v1Location - d->streamStart;
@ -393,7 +393,7 @@ void FLAC::File::scan()
if(!isValid())
return;
offset_t nextBlockOffset;
long long nextBlockOffset;
if(d->hasID3v2)
nextBlockOffset = find("fLaC", d->ID3v2Location + d->ID3v2OriginalSize);

View File

@ -55,7 +55,7 @@ public:
// public members
////////////////////////////////////////////////////////////////////////////////
FLAC::AudioProperties::AudioProperties(const ByteVector &data, offset_t streamLength, ReadStyle) :
FLAC::AudioProperties::AudioProperties(const ByteVector &data, long long streamLength, ReadStyle) :
TagLib::AudioProperties(),
d(new PropertiesPrivate())
{
@ -121,7 +121,7 @@ ByteVector FLAC::AudioProperties::signature() const
// private members
////////////////////////////////////////////////////////////////////////////////
void FLAC::AudioProperties::read(const ByteVector &data, offset_t streamLength)
void FLAC::AudioProperties::read(const ByteVector &data, long long streamLength)
{
if(data.size() < 18) {
debug("FLAC::AudioProperties::read() - FLAC properties must contain at least 18 bytes.");

View File

@ -49,7 +49,7 @@ namespace TagLib {
* Creates an instance of FLAC::AudioProperties with the data read from
* the ByteVector \a data.
*/
AudioProperties(const ByteVector &data, offset_t streamLength, ReadStyle style = Average);
AudioProperties(const ByteVector &data, long long streamLength, ReadStyle style = Average);
/*!
* Destroys this FLAC::AudioProperties instance.
@ -124,7 +124,7 @@ namespace TagLib {
ByteVector signature() const;
private:
void read(const ByteVector &data, offset_t streamLength);
void read(const ByteVector &data, long long streamLength);
class PropertiesPrivate;
PropertiesPrivate *d;

View File

@ -142,7 +142,7 @@ MP4::Atoms::Atoms(File *file)
atoms.setAutoDelete(true);
file->seek(0, File::End);
offset_t end = file->tell();
long long end = file->tell();
file->seek(0);
while(file->tell() + 8 <= end) {
MP4::Atom *atom = new MP4::Atom(file);

View File

@ -82,8 +82,8 @@ namespace TagLib {
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);
AtomList findall(const char *name, bool recursive = false);
offset_t offset;
offset_t length;
long long offset;
long long length;
TagLib::ByteVector name;
AtomList children;
private:

View File

@ -541,7 +541,7 @@ MP4::Tag::updateParents(const AtomList &path, long delta, int ignore)
}
void
MP4::Tag::updateOffsets(long delta, offset_t offset)
MP4::Tag::updateOffsets(long delta, long long offset)
{
MP4::Atom *moov = d->atoms->find("moov");
if(moov) {
@ -625,11 +625,11 @@ MP4::Tag::saveNew(ByteVector data)
data = renderAtom("udta", data);
}
offset_t offset = path.back()->offset + 8;
long long offset = path.back()->offset + 8;
d->file->insert(data, offset, 0);
updateParents(path, static_cast<long>(data.size()));
updateOffsets(static_cast<long>(data.size()), offset);
updateParents(path, data.size());
updateOffsets(data.size(), offset);
}
void
@ -638,8 +638,8 @@ MP4::Tag::saveExisting(ByteVector data, const AtomList &path)
AtomList::ConstIterator it = path.end();
MP4::Atom *ilst = *(--it);
offset_t offset = ilst->offset;
offset_t length = ilst->length;
long long offset = ilst->offset;
long long length = ilst->length;
MP4::Atom *meta = *(--it);
AtomList::ConstIterator index = meta->children.find(ilst);

View File

@ -143,7 +143,7 @@ namespace TagLib {
ByteVector renderCovr(const ByteVector &name, const Item &item) const;
void updateParents(const AtomList &path, long delta, int ignore = 0);
void updateOffsets(long delta, offset_t offset);
void updateOffsets(long delta, long long offset);
void saveNew(ByteVector data);
void saveExisting(ByteVector data, const AtomList &path);

View File

@ -64,13 +64,13 @@ public:
delete properties;
}
offset_t APELocation;
long long APELocation;
uint APESize;
offset_t ID3v1Location;
long long ID3v1Location;
ID3v2::Header *ID3v2Header;
offset_t ID3v2Location;
long long ID3v2Location;
uint ID3v2Size;
DoubleTagUnion tag;
@ -294,7 +294,7 @@ void MPC::File::read(bool readProperties)
if(readProperties) {
offset_t streamLength;
long long streamLength;
if(d->hasAPE)
streamLength = d->APELocation;

View File

@ -72,7 +72,7 @@ public:
// public members
////////////////////////////////////////////////////////////////////////////////
MPC::AudioProperties::AudioProperties(File *file, offset_t streamLength, ReadStyle) :
MPC::AudioProperties::AudioProperties(File *file, long long streamLength, ReadStyle) :
TagLib::AudioProperties(),
d(new PropertiesPrivate())
{
@ -202,7 +202,7 @@ namespace
const unsigned short sftable [8] = { 44100, 48000, 37800, 32000, 0, 0, 0, 0 };
}
void MPC::AudioProperties::readSV8(File *file, offset_t streamLength)
void MPC::AudioProperties::readSV8(File *file, long long streamLength)
{
bool readSH = false, readRG = false;
@ -295,7 +295,7 @@ void MPC::AudioProperties::readSV8(File *file, offset_t streamLength)
}
}
void MPC::AudioProperties::readSV7(const ByteVector &data, offset_t streamLength)
void MPC::AudioProperties::readSV7(const ByteVector &data, long long streamLength)
{
if(data.startsWith("MP+")) {
d->version = data[3] & 15;

View File

@ -49,7 +49,7 @@ namespace TagLib {
* Creates an instance of MPC::AudioProperties with the data read directly
* from a MPC::File.
*/
AudioProperties(File *file, offset_t streamLength, ReadStyle style = Average);
AudioProperties(File *file, long long streamLength, ReadStyle style = Average);
/*!
* Destroys this MPC::Properties instance.
@ -131,8 +131,8 @@ namespace TagLib {
int albumPeak() const;
private:
void readSV7(const ByteVector &data, offset_t streamLength);
void readSV8(File *file, offset_t streamLength);
void readSV7(const ByteVector &data, long long streamLength);
void readSV8(File *file, long long streamLength);
class PropertiesPrivate;
PropertiesPrivate *d;

View File

@ -65,7 +65,7 @@ public:
TagPrivate() : file(0), tagOffset(-1), track(0), genre(255) {}
File *file;
offset_t tagOffset;
long long tagOffset;
String title;
String artist;
@ -85,7 +85,7 @@ ID3v1::Tag::Tag() : TagLib::Tag()
d = new TagPrivate;
}
ID3v1::Tag::Tag(File *file, offset_t tagOffset) : TagLib::Tag()
ID3v1::Tag::Tag(File *file, long long tagOffset) : TagLib::Tag()
{
d = new TagPrivate;
d->file = file;

View File

@ -71,7 +71,7 @@ namespace TagLib {
* Create an ID3v1 tag and parse the data in \a file starting at
* \a tagOffset.
*/
Tag(File *file, offset_t tagOffset);
Tag(File *file, long long tagOffset);
/*!
* Destroys this Tag instance.

View File

@ -76,8 +76,8 @@ namespace
const DefaultStringHandler defaultStringHandler;
const TagLib::StringHandler *stringHandler = &defaultStringHandler;
const offset_t MinPaddingSize = 1024;
const offset_t MaxPaddingSize = 1024 * 1024;
const long long MinPaddingSize = 1024;
const long long MaxPaddingSize = 1024 * 1024;
}
class ID3v2::Tag::TagPrivate
@ -99,7 +99,7 @@ public:
}
File *file;
offset_t tagOffset;
long long tagOffset;
const FrameFactory *factory;
Header header;
@ -121,7 +121,7 @@ ID3v2::Tag::Tag() :
d->factory = FrameFactory::instance();
}
ID3v2::Tag::Tag(File *file, offset_t tagOffset, const FrameFactory *factory) :
ID3v2::Tag::Tag(File *file, long long tagOffset, const FrameFactory *factory) :
TagLib::Tag(),
d(new TagPrivate())
{
@ -794,7 +794,7 @@ ByteVector ID3v2::Tag::render(int version) const
// Compute the amount of padding, and append that to tagData.
offset_t paddingSize = d->header.tagSize() - (tagData.size() - Header::size());
long long paddingSize = d->header.tagSize() - (tagData.size() - Header::size());
if(paddingSize <= 0) {
paddingSize = MinPaddingSize;
@ -802,7 +802,7 @@ ByteVector ID3v2::Tag::render(int version) const
else {
// Padding won't increase beyond 1% of the file size or 1MB.
offset_t threshold = d->file ? d->file->length() / 100 : 0;
long long threshold = d->file ? d->file->length() / 100 : 0;
threshold = std::max(threshold, MinPaddingSize);
threshold = std::min(threshold, MaxPaddingSize);

View File

@ -125,7 +125,7 @@ namespace TagLib {
*
* \see FrameFactory
*/
Tag(File *file, offset_t tagOffset,
Tag(File *file, long long tagOffset,
const FrameFactory *factory = FrameFactory::instance());
/*!

View File

@ -86,14 +86,14 @@ public:
const ID3v2::FrameFactory *ID3v2FrameFactory;
offset_t ID3v2Location;
long long ID3v2Location;
uint ID3v2OriginalSize;
offset_t APELocation;
offset_t APEFooterLocation;
long long APELocation;
long long APEFooterLocation;
uint APEOriginalSize;
offset_t ID3v1Location;
long long ID3v1Location;
TripleTagUnion tag;
@ -352,7 +352,7 @@ void MPEG::File::setID3v2FrameFactory(const ID3v2::FrameFactory *factory)
d->ID3v2FrameFactory = factory;
}
offset_t MPEG::File::nextFrameOffset(offset_t position)
long long MPEG::File::nextFrameOffset(long long position)
{
bool foundLastSyncPattern = false;
@ -378,13 +378,13 @@ offset_t MPEG::File::nextFrameOffset(offset_t position)
}
}
offset_t MPEG::File::previousFrameOffset(offset_t position)
long long MPEG::File::previousFrameOffset(long long position)
{
bool foundFirstSyncPattern = false;
ByteVector buffer;
while (position > 0) {
size_t size = position < static_cast<offset_t>(bufferSize())
size_t size = position < static_cast<long long>(bufferSize())
? static_cast<size_t>(position) : bufferSize();
position -= size;
@ -407,9 +407,9 @@ offset_t MPEG::File::previousFrameOffset(offset_t position)
return -1;
}
offset_t MPEG::File::firstFrameOffset()
long long MPEG::File::firstFrameOffset()
{
offset_t position = 0;
long long position = 0;
if(hasID3v2Tag())
position = d->ID3v2Location + ID3v2Tag()->header()->completeTagSize();
@ -417,9 +417,9 @@ offset_t MPEG::File::firstFrameOffset()
return nextFrameOffset(position);
}
offset_t MPEG::File::lastFrameOffset()
long long MPEG::File::lastFrameOffset()
{
offset_t position;
long long position;
if(hasAPETag())
position = d->APELocation - 1;
@ -497,7 +497,7 @@ void MPEG::File::read(bool readProperties)
ID3v1Tag(true);
}
offset_t MPEG::File::findID3v2()
long long MPEG::File::findID3v2()
{
if(!isValid())
return -1;
@ -522,22 +522,22 @@ offset_t MPEG::File::findID3v2()
// at the beginning of the file.
// We don't care about the inefficiency of the code, since this is a seldom case.
const offset_t tagOffset = find(headerID);
const long long tagOffset = find(headerID);
if(tagOffset < 0)
return -1;
const offset_t frameOffset = firstFrameOffset();
const long long frameOffset = firstFrameOffset();
if(frameOffset < tagOffset)
return -1;
return tagOffset;
}
offset_t MPEG::File::findID3v1()
long long MPEG::File::findID3v1()
{
if(isValid()) {
seek(-128, End);
offset_t p = tell();
long long p = tell();
if(readBlock(3) == ID3v1::Tag::fileIdentifier())
return p;
@ -550,7 +550,7 @@ void MPEG::File::findAPE()
if(isValid()) {
seek(d->hasID3v1 ? -160 : -32, End);
offset_t p = tell();
long long p = tell();
if(readBlock(8) == APE::Tag::fileIdentifier()) {
d->APEFooterLocation = p;

View File

@ -284,24 +284,24 @@ namespace TagLib {
/*!
* Returns the position in the file of the first MPEG frame.
*/
offset_t firstFrameOffset();
long long firstFrameOffset();
/*!
* Returns the position in the file of the next MPEG frame,
* using the current position as start
*/
offset_t nextFrameOffset(offset_t position);
long long nextFrameOffset(long long position);
/*!
* Returns the position in the file of the previous MPEG frame,
* using the current position as start
*/
offset_t previousFrameOffset(offset_t position);
long long previousFrameOffset(long long position);
/*!
* Returns the position in the file of the last MPEG frame.
*/
offset_t lastFrameOffset();
long long lastFrameOffset();
/*!
* Returns whether or not the file on disk actually has an ID3v1 tag.
@ -329,8 +329,8 @@ namespace TagLib {
File &operator=(const File &);
void read(bool readProperties);
offset_t findID3v2();
offset_t findID3v1();
long long findID3v2();
long long findID3v1();
void findAPE();
class FilePrivate;

View File

@ -152,7 +152,7 @@ void MPEG::AudioProperties::read(File *file)
{
// Only the first frame is required if we have a VBR header.
const offset_t first = file->firstFrameOffset();
const long long first = file->firstFrameOffset();
if(first < 0) {
debug("MPEG::AudioProperties::read() -- Could not find a valid first MPEG frame in the stream.");
return;
@ -194,7 +194,7 @@ void MPEG::AudioProperties::read(File *file)
d->bitrate = firstHeader.bitrate();
offset_t streamLength = file->length() - first;
long long streamLength = file->length() - first;
if(file->hasID3v1Tag())
streamLength -= 128;

View File

@ -57,8 +57,8 @@ public:
AudioProperties *properties;
ByteVector streamInfoData;
ByteVector xiphCommentData;
offset_t streamStart;
offset_t streamLength;
long long streamStart;
long long streamLength;
bool scanned;
bool hasXiphComment;
@ -180,7 +180,7 @@ ByteVector Ogg::FLAC::File::xiphCommentData()
return d->xiphCommentData;
}
offset_t Ogg::FLAC::File::streamLength()
long long Ogg::FLAC::File::streamLength()
{
scan();
return d->streamLength;
@ -197,7 +197,7 @@ void Ogg::FLAC::File::scan()
return;
int ipacket = 0;
offset_t overhead = 0;
long long overhead = 0;
ByteVector metadataHeader = packet(ipacket);
if(metadataHeader.isEmpty())

View File

@ -123,7 +123,7 @@ namespace TagLib {
* Returns the length of the audio-stream, used by FLAC::Properties for
* calculating the bitrate.
*/
offset_t streamLength();
long long streamLength();
/*!
* Returns whether or not the file on disk actually has a XiphComment.

View File

@ -157,7 +157,7 @@ const Ogg::PageHeader *Ogg::File::firstPageHeader()
if(d->firstPageHeader)
return d->firstPageHeader->isValid() ? d->firstPageHeader : 0;
offset_t firstPageHeaderOffset = find("OggS");
long long firstPageHeaderOffset = find("OggS");
if(firstPageHeaderOffset < 0)
return 0;
@ -171,7 +171,7 @@ const Ogg::PageHeader *Ogg::File::lastPageHeader()
if(d->lastPageHeader)
return d->lastPageHeader->isValid() ? d->lastPageHeader : 0;
offset_t lastPageHeaderOffset = rfind("OggS");
long long lastPageHeaderOffset = rfind("OggS");
if(lastPageHeaderOffset < 0)
return 0;
@ -224,7 +224,7 @@ Ogg::File::File(IOStream *stream) : TagLib::File(stream)
bool Ogg::File::nextPage()
{
offset_t nextPageOffset;
long long nextPageOffset;
int currentPacket;
if(d->pages.isEmpty()) {

View File

@ -35,7 +35,7 @@ using namespace TagLib;
class Ogg::Page::PagePrivate
{
public:
PagePrivate(File *f = 0, offset_t pageOffset = -1) :
PagePrivate(File *f = 0, long long pageOffset = -1) :
file(f),
fileOffset(pageOffset),
packetOffset(0),
@ -50,8 +50,8 @@ public:
}
File *file;
offset_t fileOffset;
offset_t packetOffset;
long long fileOffset;
long long packetOffset;
int dataSize;
List<int> packetSizes;
PageHeader header;
@ -63,7 +63,7 @@ public:
// public members
////////////////////////////////////////////////////////////////////////////////
Ogg::Page::Page(Ogg::File *file, offset_t pageOffset)
Ogg::Page::Page(Ogg::File *file, long long pageOffset)
{
d = new PagePrivate(file, pageOffset);
}
@ -73,7 +73,7 @@ Ogg::Page::~Page()
delete d;
}
offset_t Ogg::Page::fileOffset() const
long long Ogg::Page::fileOffset() const
{
return d->fileOffset;
}

View File

@ -55,14 +55,14 @@ namespace TagLib {
/*!
* Read an Ogg page from the \a file at the position \a pageOffset.
*/
Page(File *file, offset_t pageOffset);
Page(File *file, long long pageOffset);
virtual ~Page();
/*!
* Returns the page's position within the file (in bytes).
*/
offset_t fileOffset() const;
long long fileOffset() const;
/*!
* Returns a pointer to the header for this page. This pointer will become

View File

@ -39,7 +39,7 @@ using namespace TagLib;
class Ogg::PageHeader::PageHeaderPrivate
{
public:
PageHeaderPrivate(File *f, offset_t pageOffset) :
PageHeaderPrivate(File *f, long long pageOffset) :
file(f),
fileOffset(pageOffset),
isValid(false),
@ -55,7 +55,7 @@ public:
{}
File *file;
offset_t fileOffset;
long long fileOffset;
bool isValid;
List<int> packetSizes;
bool firstPacketContinued;
@ -73,7 +73,7 @@ public:
// public members
////////////////////////////////////////////////////////////////////////////////
Ogg::PageHeader::PageHeader(Ogg::File *file, offset_t pageOffset)
Ogg::PageHeader::PageHeader(Ogg::File *file, long long pageOffset)
{
d = new PageHeaderPrivate(file, pageOffset);
if(file && pageOffset >= 0)

View File

@ -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 = 0, long long pageOffset = -1);
/*!
* Deletes this instance of the PageHeader.

View File

@ -38,7 +38,7 @@ namespace
struct Chunk
{
ByteVector name;
offset_t offset;
long long offset;
TagLib::uint size;
char padding;
};
@ -121,7 +121,7 @@ TagLib::uint RIFF::File::chunkDataSize(uint i) const
return d->chunks[i].size;
}
offset_t RIFF::File::chunkOffset(uint i) const
long long RIFF::File::chunkOffset(uint i) const
{
return d->chunks[i].offset;
}
@ -199,7 +199,7 @@ void RIFF::File::setChunkData(const ByteVector &name, const ByteVector &data, bo
// Couldn't find an existing chunk, so let's create a new one.
offset_t offset = d->chunks.back().offset + d->chunks.back().size;
long long offset = d->chunks.back().offset + d->chunks.back().size;
// First we update the global size
@ -212,10 +212,10 @@ void RIFF::File::setChunkData(const ByteVector &name, const ByteVector &data, bo
// Now add the chunk to the file
writeChunk(
name,
data,
offset,
static_cast<uint>(std::max<offset_t>(0, length() - offset)),
name,
data,
offset,
static_cast<uint>(std::max(0LL, length() - offset)),
static_cast<uint>(offset & 1));
// And update our internal structure
@ -303,7 +303,7 @@ void RIFF::File::read()
// check padding
chunk.padding = 0;
offset_t uPosNotPadded = tell();
long long uPosNotPadded = tell();
if(uPosNotPadded & 1) {
ByteVector iByte = readBlock(1);
if((iByte.size() != 1) || (iByte[0] != 0)) {
@ -320,7 +320,8 @@ void RIFF::File::read()
}
void RIFF::File::writeChunk(const ByteVector &name, const ByteVector &data,
offset_t offset, TagLib::uint replace, TagLib::uint leadingPadding)
long long offset, TagLib::uint replace,
TagLib::uint leadingPadding)
{
ByteVector combined;
if(leadingPadding) {

View File

@ -74,7 +74,7 @@ namespace TagLib {
/*!
* \return The offset within the file for the selected chunk number.
*/
offset_t chunkOffset(uint i) const;
long long chunkOffset(uint i) const;
/*!
* \return The size of the chunk data.
@ -148,7 +148,7 @@ namespace TagLib {
void read();
void writeChunk(const ByteVector &name, const ByteVector &data,
offset_t offset, uint replace = 0,
long long offset, uint replace = 0,
uint leadingPadding = 0);
class FilePrivate;

View File

@ -33,13 +33,13 @@
using namespace TagLib;
offset_t Utils::findID3v1(File *file)
long long Utils::findID3v1(File *file)
{
if(!file->isValid())
return -1;
file->seek(-128, File::End);
const offset_t p = file->tell();
const long long p = file->tell();
if(file->readBlock(3) == ID3v1::Tag::fileIdentifier())
return p;
@ -47,7 +47,7 @@ offset_t Utils::findID3v1(File *file)
return -1;
}
offset_t Utils::findID3v2(File *file)
long long Utils::findID3v2(File *file)
{
if(!file->isValid())
return -1;
@ -60,7 +60,7 @@ offset_t Utils::findID3v2(File *file)
return -1;
}
offset_t Utils::findAPE(File *file, offset_t id3v1Location)
long long Utils::findAPE(File *file, long long id3v1Location)
{
if(!file->isValid())
return -1;
@ -70,7 +70,7 @@ offset_t Utils::findAPE(File *file, offset_t id3v1Location)
else
file->seek(-32, File::End);
const offset_t p = file->tell();
const long long p = file->tell();
if(file->readBlock(8) == APE::Tag::fileIdentifier())
return p;

View File

@ -36,11 +36,11 @@ namespace TagLib {
namespace Utils {
offset_t findID3v1(File *file);
long long findID3v1(File *file);
offset_t findID3v2(File *file);
long long findID3v2(File *file);
offset_t findAPE(File *file, offset_t id3v1Location);
long long findAPE(File *file, long long id3v1Location);
}
}

View File

@ -57,9 +57,6 @@ namespace TagLib
// long/ulong can be either 32-bit or 64-bit wide.
typedef unsigned long ulong;
// Offset or length type for I/O streams. Always signed 64-bit.
typedef long long offset_t;
enum ByteOrder
{
LittleEndian,

View File

@ -40,7 +40,7 @@ public:
ByteVectorStreamPrivate(const ByteVector &data);
ByteVector data;
offset_t position;
long long position;
};
ByteVectorStream::ByteVectorStreamPrivate::ByteVectorStreamPrivate(const ByteVector &data) :
@ -81,14 +81,14 @@ ByteVector ByteVectorStream::readBlock(size_t length)
void ByteVectorStream::writeBlock(const ByteVector &data)
{
const size_t size = data.size();
if(static_cast<offset_t>(d->position + size) > length())
if(static_cast<long long>(d->position + size) > length())
truncate(d->position + size);
::memcpy(d->data.data() + d->position, data.data(), size);
d->position += size;
}
void ByteVectorStream::insert(const ByteVector &data, offset_t start, size_t replace)
void ByteVectorStream::insert(const ByteVector &data, long long start, size_t replace)
{
if(data.size() < replace) {
removeBlock(start + data.size(), replace - data.size());
@ -100,23 +100,23 @@ void ByteVectorStream::insert(const ByteVector &data, offset_t start, size_t rep
const size_t readPosition = static_cast<size_t>(start + replace);
const size_t writePosition = static_cast<size_t>(start + data.size());
::memmove(
d->data.data() + writePosition,
d->data.data() + readPosition,
d->data.data() + writePosition,
d->data.data() + readPosition,
static_cast<size_t>(length() - sizeDiff - readPosition));
}
seek(start);
writeBlock(data);
}
void ByteVectorStream::removeBlock(offset_t start, size_t length)
void ByteVectorStream::removeBlock(long long start, size_t length)
{
const offset_t readPosition = start + length;
offset_t writePosition = start;
const long long readPosition = start + length;
long long writePosition = start;
if(readPosition < ByteVectorStream::length()) {
size_t bytesToMove = static_cast<size_t>(ByteVectorStream::length() - readPosition);
::memmove(
d->data.data() + static_cast<ptrdiff_t>(writePosition),
d->data.data() + static_cast<ptrdiff_t>(readPosition),
d->data.data() + static_cast<ptrdiff_t>(writePosition),
d->data.data() + static_cast<ptrdiff_t>(readPosition),
bytesToMove);
writePosition += bytesToMove;
}
@ -134,7 +134,7 @@ bool ByteVectorStream::isOpen() const
return true;
}
void ByteVectorStream::seek(offset_t offset, Position p)
void ByteVectorStream::seek(long long offset, Position p)
{
switch(p) {
case Beginning:
@ -153,19 +153,19 @@ void ByteVectorStream::clear()
{
}
offset_t ByteVectorStream::tell() const
long long ByteVectorStream::tell() const
{
return d->position;
}
offset_t ByteVectorStream::length()
long long ByteVectorStream::length()
{
return static_cast<offset_t>(d->data.size());
return static_cast<long long>(d->data.size());
}
void ByteVectorStream::truncate(offset_t length)
void ByteVectorStream::truncate(long long length)
{
d->data.resize(static_cast<uint>(length));
d->data.resize(static_cast<size_t>(length));
}
ByteVector *ByteVectorStream::data()

View File

@ -81,7 +81,7 @@ namespace TagLib {
* \note This method is slow since it requires rewriting all of the file
* after the insertion point.
*/
void insert(const ByteVector &data, offset_t start = 0, size_t replace = 0);
void insert(const ByteVector &data, long long start = 0, size_t replace = 0);
/*!
* Removes a block of the file starting a \a start and continuing for
@ -90,7 +90,7 @@ namespace TagLib {
* \note This method is slow since it involves rewriting all of the file
* after the removed portion.
*/
void removeBlock(offset_t start = 0, size_t length = 0);
void removeBlock(long long start = 0, size_t length = 0);
/*!
* Returns true if the file is read only (or if the file can not be opened).
@ -109,7 +109,7 @@ namespace TagLib {
*
* \see Position
*/
void seek(offset_t offset, Position p = Beginning);
void seek(long long offset, Position p = Beginning);
/*!
* Reset the end-of-file and error flags on the file.
@ -119,17 +119,17 @@ namespace TagLib {
/*!
* Returns the current offset within the file.
*/
offset_t tell() const;
long long tell() const;
/*!
* Returns the length of the file.
*/
offset_t length();
long long length();
/*!
* Truncates the file to a \a length.
*/
void truncate(offset_t length);
void truncate(long long length);
ByteVector *data();

View File

@ -119,14 +119,14 @@ void File::writeBlock(const ByteVector &data)
d->stream()->writeBlock(data);
}
offset_t File::find(const ByteVector &pattern, offset_t fromOffset, const ByteVector &before)
long long File::find(const ByteVector &pattern, long long fromOffset, const ByteVector &before)
{
if(!d->stream() || pattern.size() > bufferSize())
return -1;
// The position in the file that the current buffer starts at.
offset_t bufferOffset = fromOffset;
long long bufferOffset = fromOffset;
// These variables are used to keep track of a partial match that happens at
// the end of a buffer.
@ -137,7 +137,7 @@ offset_t File::find(const ByteVector &pattern, offset_t fromOffset, const ByteVe
// Save the location of the current read pointer. We will restore the
// position using seek() before all returns.
offset_t originalPosition = tell();
long long originalPosition = tell();
// Start the search at the offset.
@ -223,7 +223,7 @@ offset_t File::find(const ByteVector &pattern, offset_t fromOffset, const ByteVe
}
offset_t File::rfind(const ByteVector &pattern, offset_t fromOffset, const ByteVector &before)
long long File::rfind(const ByteVector &pattern, long long fromOffset, const ByteVector &before)
{
if(!d->stream() || pattern.size() > bufferSize())
return -1;
@ -231,15 +231,15 @@ offset_t File::rfind(const ByteVector &pattern, offset_t fromOffset, const ByteV
// Save the location of the current read pointer. We will restore the
// position using seek() before all returns.
offset_t originalPosition = tell();
long long originalPosition = tell();
// Start the search at the offset.
if(fromOffset == 0)
fromOffset = length();
offset_t bufferLength = bufferSize();
offset_t bufferOffset = fromOffset + pattern.size();
long long bufferLength = bufferSize();
long long bufferOffset = fromOffset + pattern.size();
// See the notes in find() for an explanation of this algorithm.
@ -285,12 +285,12 @@ offset_t File::rfind(const ByteVector &pattern, offset_t fromOffset, const ByteV
return -1;
}
void File::insert(const ByteVector &data, offset_t start, size_t replace)
void File::insert(const ByteVector &data, long long start, size_t replace)
{
d->stream()->insert(data, start, replace);
}
void File::removeBlock(offset_t start, size_t length)
void File::removeBlock(long long start, size_t length)
{
d->stream()->removeBlock(start, length);
}
@ -310,12 +310,12 @@ bool File::isValid() const
return isOpen() && d->valid;
}
void File::seek(offset_t offset, Position p)
void File::seek(long long offset, Position p)
{
d->stream()->seek(offset, IOStream::Position(p));
}
void File::truncate(offset_t length)
void File::truncate(long long length)
{
d->stream()->truncate(length);
}
@ -325,12 +325,12 @@ void File::clear()
d->stream()->clear();
}
offset_t File::tell() const
long long File::tell() const
{
return d->stream()->tell();
}
offset_t File::length()
long long File::length()
{
return d->stream()->length();
}

View File

@ -158,9 +158,9 @@ namespace TagLib {
* \note This has the practical limitation that \a pattern can not be longer
* than the buffer size used by readBlock(). Currently this is 1024 bytes.
*/
offset_t find(const ByteVector &pattern,
offset_t fromOffset = 0,
const ByteVector &before = ByteVector());
long long find(const ByteVector &pattern,
long long fromOffset = 0,
const ByteVector &before = ByteVector());
/*!
* Returns the offset in the file that \a pattern occurs at or -1 if it can
@ -174,9 +174,9 @@ namespace TagLib {
* \note This has the practical limitation that \a pattern can not be longer
* than the buffer size used by readBlock(). Currently this is 1024 bytes.
*/
offset_t rfind(const ByteVector &pattern,
offset_t fromOffset = 0,
const ByteVector &before = ByteVector());
long long rfind(const ByteVector &pattern,
long long fromOffset = 0,
const ByteVector &before = ByteVector());
/*!
* Insert \a data at position \a start in the file overwriting \a replace
@ -185,7 +185,7 @@ namespace TagLib {
* \note This method is slow since it requires rewriting all of the file
* after the insertion point.
*/
void insert(const ByteVector &data, offset_t start = 0, size_t replace = 0);
void insert(const ByteVector &data, long long start = 0, size_t replace = 0);
/*!
* Removes a block of the file starting a \a start and continuing for
@ -194,7 +194,7 @@ namespace TagLib {
* \note This method is slow since it involves rewriting all of the file
* after the removed portion.
*/
void removeBlock(offset_t start = 0, size_t length = 0);
void removeBlock(long long start = 0, size_t length = 0);
/*!
* Returns true if the file is read only (or if the file can not be opened).
@ -218,7 +218,7 @@ namespace TagLib {
*
* \see Position
*/
void seek(offset_t offset, Position p = Beginning);
void seek(long long offset, Position p = Beginning);
/*!
* Reset the end-of-file and error flags on the file.
@ -228,12 +228,12 @@ namespace TagLib {
/*!
* Returns the current offset within the file.
*/
offset_t tell() const;
long long tell() const;
/*!
* Returns the length of the file.
*/
offset_t length();
long long length();
/*!
* Returns description of the audio file and its tags.
@ -270,7 +270,7 @@ namespace TagLib {
/*!
* Truncates the file to a \a length.
*/
void truncate(offset_t length);
void truncate(long long length);
/*!
* Returns the buffer size that is used for internal buffering.

View File

@ -185,8 +185,8 @@ ByteVector FileStream::readBlock(size_t length)
if(length == 0)
return ByteVector();
const offset_t streamLength = FileStream::length();
if(length > bufferSize() && static_cast<offset_t>(length) > streamLength)
const long long streamLength = FileStream::length();
if(length > bufferSize() && static_cast<long long>(length) > streamLength)
length = static_cast<size_t>(streamLength);
ByteVector buffer(length);
@ -212,7 +212,7 @@ void FileStream::writeBlock(const ByteVector &data)
writeFile(d->file, data);
}
void FileStream::insert(const ByteVector &data, offset_t start, size_t replace)
void FileStream::insert(const ByteVector &data, long long start, size_t replace)
{
if(!isOpen()) {
debug("FileStream::insert() -- invalid file.");
@ -253,8 +253,8 @@ void FileStream::insert(const ByteVector &data, offset_t start, size_t replace)
// Set where to start the reading and writing.
offset_t readPosition = start + replace;
offset_t writePosition = start;
long long readPosition = start + replace;
long long writePosition = start;
ByteVector buffer = data;
ByteVector aboutToOverwrite(bufferLength);
@ -294,7 +294,7 @@ void FileStream::insert(const ByteVector &data, offset_t start, size_t replace)
}
}
void FileStream::removeBlock(offset_t start, size_t length)
void FileStream::removeBlock(long long start, size_t length)
{
if(!isOpen()) {
debug("FileStream::removeBlock() -- invalid file.");
@ -303,8 +303,8 @@ void FileStream::removeBlock(offset_t start, size_t length)
size_t bufferLength = bufferSize();
offset_t readPosition = start + length;
offset_t writePosition = start;
long long readPosition = start + length;
long long writePosition = start;
ByteVector buffer(bufferLength, 0);
@ -341,7 +341,7 @@ bool FileStream::isOpen() const
return (d->file != InvalidFileHandle);
}
void FileStream::seek(offset_t offset, Position p)
void FileStream::seek(long long offset, Position p)
{
if(!isOpen()) {
debug("FileStream::seek() -- invalid file.");
@ -412,7 +412,7 @@ void FileStream::clear()
#endif
}
offset_t FileStream::tell() const
long long FileStream::tell() const
{
#ifdef _WIN32
@ -437,7 +437,7 @@ offset_t FileStream::tell() const
#endif
}
offset_t FileStream::length()
long long FileStream::length()
{
if(!isOpen()) {
debug("FileStream::length() -- invalid file.");
@ -461,10 +461,10 @@ offset_t FileStream::length()
#else
const offset_t currentPosition = tell();
const long long currentPosition = tell();
seek(0, End);
offset_t endPosition = tell();
long long endPosition = tell();
seek(currentPosition, Beginning);
@ -482,11 +482,11 @@ size_t FileStream::bufferSize()
// protected members
////////////////////////////////////////////////////////////////////////////////
void FileStream::truncate(offset_t length)
void FileStream::truncate(long long length)
{
#ifdef _WIN32
const offset_t currentPos = tell();
const long long currentPos = tell();
seek(length);

View File

@ -85,7 +85,7 @@ namespace TagLib {
* \note This method is slow since it requires rewriting all of the file
* after the insertion point.
*/
void insert(const ByteVector &data, offset_t start = 0, size_t replace = 0);
void insert(const ByteVector &data, long long start = 0, size_t replace = 0);
/*!
* Removes a block of the file starting a \a start and continuing for
@ -94,7 +94,7 @@ namespace TagLib {
* \note This method is slow since it involves rewriting all of the file
* after the removed portion.
*/
void removeBlock(offset_t start = 0, size_t length = 0);
void removeBlock(long long start = 0, size_t length = 0);
/*!
* Returns true if the file is read only (or if the file can not be opened).
@ -113,7 +113,7 @@ namespace TagLib {
*
* \see Position
*/
void seek(offset_t offset, Position p = Beginning);
void seek(long long offset, Position p = Beginning);
/*!
* Reset the end-of-file and error flags on the file.
@ -123,17 +123,17 @@ namespace TagLib {
/*!
* Returns the current offset within the file.
*/
offset_t tell() const;
long long tell() const;
/*!
* Returns the length of the file.
*/
offset_t length();
long long length();
/*!
* Truncates the file to a \a length.
*/
void truncate(offset_t length);
void truncate(long long length);
/*!
* Returns the buffer size that is used for internal buffering.

View File

@ -114,7 +114,7 @@ namespace TagLib {
* \note This method is slow since it requires rewriting all of the file
* after the insertion point.
*/
virtual void insert(const ByteVector &data, offset_t start = 0, size_t replace = 0) = 0;
virtual void insert(const ByteVector &data, long long start = 0, size_t replace = 0) = 0;
/*!
* Removes a block of the file starting a \a start and continuing for
@ -123,7 +123,7 @@ namespace TagLib {
* \note This method is slow since it involves rewriting all of the file
* after the removed portion.
*/
virtual void removeBlock(offset_t start = 0, size_t length = 0) = 0;
virtual void removeBlock(long long start = 0, size_t length = 0) = 0;
/*!
* Returns true if the file is read only (or if the file can not be opened).
@ -142,7 +142,7 @@ namespace TagLib {
*
* \see Position
*/
virtual void seek(offset_t offset, Position p = Beginning) = 0;
virtual void seek(long long offset, Position p = Beginning) = 0;
/*!
* Reset the end-of-stream and error flags on the stream.
@ -152,17 +152,17 @@ namespace TagLib {
/*!
* Returns the current offset within the stream.
*/
virtual offset_t tell() const = 0;
virtual long long tell() const = 0;
/*!
* Returns the length of the stream.
*/
virtual offset_t length() = 0;
virtual long long length() = 0;
/*!
* Truncates the stream to a \a length.
*/
virtual void truncate(offset_t length) = 0;
virtual void truncate(long long length) = 0;
private:
// Noncopyable. Derived classes as well.

View File

@ -67,10 +67,10 @@ public:
}
const ID3v2::FrameFactory *ID3v2FrameFactory;
offset_t ID3v2Location;
long long ID3v2Location;
uint ID3v2OriginalSize;
offset_t ID3v1Location;
long long ID3v1Location;
DoubleTagUnion tag;
@ -271,7 +271,7 @@ void TrueAudio::File::read(bool readProperties)
if(readProperties) {
offset_t streamLength;
long long streamLength;
if(d->hasID3v1)
streamLength = d->ID3v1Location;

View File

@ -60,7 +60,7 @@ public:
// public members
////////////////////////////////////////////////////////////////////////////////
TrueAudio::AudioProperties::AudioProperties(const ByteVector &data, offset_t streamLength, ReadStyle) :
TrueAudio::AudioProperties::AudioProperties(const ByteVector &data, long long streamLength, ReadStyle) :
TagLib::AudioProperties(),
d(new PropertiesPrivate())
{
@ -121,7 +121,7 @@ int TrueAudio::AudioProperties::ttaVersion() const
// private members
////////////////////////////////////////////////////////////////////////////////
void TrueAudio::AudioProperties::read(const ByteVector &data, offset_t streamLength)
void TrueAudio::AudioProperties::read(const ByteVector &data, long long streamLength)
{
if(data.size() < 4) {
debug("TrueAudio::AudioProperties::read() -- data is too short.");

View File

@ -52,7 +52,7 @@ namespace TagLib {
* Creates an instance of TrueAudio::AudioProperties with the data read from
* the ByteVector \a data.
*/
AudioProperties(const ByteVector &data, offset_t streamLength, ReadStyle style = Average);
AudioProperties(const ByteVector &data, long long streamLength, ReadStyle style = Average);
/*!
* Destroys this TrueAudio::AudioProperties instance.
@ -115,7 +115,7 @@ namespace TagLib {
int ttaVersion() const;
private:
void read(const ByteVector &data, offset_t streamLength);
void read(const ByteVector &data, long long streamLength);
class PropertiesPrivate;
PropertiesPrivate *d;

View File

@ -63,10 +63,10 @@ public:
delete properties;
}
offset_t APELocation;
long long APELocation;
uint APESize;
offset_t ID3v1Location;
long long ID3v1Location;
DoubleTagUnion tag;
@ -259,7 +259,7 @@ void WavPack::File::read(bool readProperties)
if(readProperties) {
offset_t streamLength;
long long streamLength;
if(d->hasAPE)
streamLength = d->APELocation;

View File

@ -65,7 +65,7 @@ public:
// public members
////////////////////////////////////////////////////////////////////////////////
WavPack::AudioProperties::AudioProperties(File *file, offset_t streamLength, ReadStyle) :
WavPack::AudioProperties::AudioProperties(File *file, long long streamLength, ReadStyle) :
TagLib::AudioProperties(),
d(new PropertiesPrivate())
{
@ -153,7 +153,7 @@ namespace
#define FINAL_BLOCK 0x1000
void WavPack::AudioProperties::read(File *file, offset_t streamLength)
void WavPack::AudioProperties::read(File *file, long long streamLength)
{
long offset = 0;
@ -203,9 +203,9 @@ void WavPack::AudioProperties::read(File *file, offset_t streamLength)
}
}
TagLib::uint WavPack::AudioProperties::seekFinalIndex(File *file, offset_t streamLength)
TagLib::uint WavPack::AudioProperties::seekFinalIndex(File *file, long long streamLength)
{
const offset_t offset = file->rfind("wvpk", streamLength);
const long long offset = file->rfind("wvpk", streamLength);
if(offset == -1)
return 0;

View File

@ -54,7 +54,7 @@ namespace TagLib {
/*!
* Creates an instance of WavPack::AudioProperties.
*/
AudioProperties(File *file, offset_t streamLength, ReadStyle style = Average);
AudioProperties(File *file, long long streamLength, ReadStyle style = Average);
/*!
* Destroys this WavPack::AudioProperties instance.
@ -122,8 +122,8 @@ namespace TagLib {
int version() const;
private:
void read(File *file, offset_t streamLength);
uint seekFinalIndex(File *file, offset_t streamLength);
void read(File *file, long long streamLength);
uint seekFinalIndex(File *file, long long streamLength);
class PropertiesPrivate;
PropertiesPrivate *d;

View File

@ -87,8 +87,8 @@ public:
CPPUNIT_ASSERT_EQUAL(String("Title1"), f.tag()->title());
f.save();
CPPUNIT_ASSERT_EQUAL((offset_t)7030, f.length());
CPPUNIT_ASSERT_EQUAL((offset_t)-1, f.find("Title2"));
CPPUNIT_ASSERT_EQUAL(7030LL, f.length());
CPPUNIT_ASSERT_EQUAL(-1LL, f.find("Title2"));
}
void testFuzzedFile1()

View File

@ -287,10 +287,10 @@ public:
ASF::File f(copy.fileName().c_str());
f.tag()->setTitle(std::string(128 * 1024, 'X').c_str());
f.save();
CPPUNIT_ASSERT_EQUAL((offset_t)297578, f.length());
CPPUNIT_ASSERT_EQUAL(297578LL, f.length());
f.tag()->setTitle(std::string(16 * 1024, 'X').c_str());
f.save();
CPPUNIT_ASSERT_EQUAL((offset_t)68202, f.length());
CPPUNIT_ASSERT_EQUAL(68202LL, f.length());
}
}

View File

@ -57,19 +57,19 @@ public:
}
{
PlainFile file(name.c_str());
CPPUNIT_ASSERT_EQUAL((offset_t)10, file.length());
CPPUNIT_ASSERT_EQUAL(10LL, file.length());
CPPUNIT_ASSERT_EQUAL((offset_t)2, file.find(ByteVector("23", 2)));
CPPUNIT_ASSERT_EQUAL((offset_t)2, file.find(ByteVector("23", 2), 2));
CPPUNIT_ASSERT_EQUAL((offset_t)7, file.find(ByteVector("23", 2), 3));
CPPUNIT_ASSERT_EQUAL(2LL, file.find(ByteVector("23", 2)));
CPPUNIT_ASSERT_EQUAL(2LL, file.find(ByteVector("23", 2), 2));
CPPUNIT_ASSERT_EQUAL(7LL, file.find(ByteVector("23", 2), 3));
file.seek(0);
const ByteVector v = file.readBlock(static_cast<size_t>(file.length()));
CPPUNIT_ASSERT_EQUAL((size_t)10, v.size());
CPPUNIT_ASSERT_EQUAL((offset_t)v.find("23"), file.find("23"));
CPPUNIT_ASSERT_EQUAL((offset_t)v.find("23", 2), file.find("23", 2));
CPPUNIT_ASSERT_EQUAL((offset_t)v.find("23", 3), file.find("23", 3));
CPPUNIT_ASSERT_EQUAL((long long)v.find("23"), file.find("23"));
CPPUNIT_ASSERT_EQUAL((long long)v.find("23", 2), file.find("23", 2));
CPPUNIT_ASSERT_EQUAL((long long)v.find("23", 3), file.find("23", 3));
}
}
@ -85,19 +85,19 @@ public:
}
{
PlainFile file(name.c_str());
CPPUNIT_ASSERT_EQUAL((offset_t)10, file.length());
CPPUNIT_ASSERT_EQUAL(10LL, file.length());
CPPUNIT_ASSERT_EQUAL((offset_t)7, file.rfind(ByteVector("23", 2)));
CPPUNIT_ASSERT_EQUAL((offset_t)7, file.rfind(ByteVector("23", 2), 7));
CPPUNIT_ASSERT_EQUAL((offset_t)2, file.rfind(ByteVector("23", 2), 6));
CPPUNIT_ASSERT_EQUAL(7LL, file.rfind(ByteVector("23", 2)));
CPPUNIT_ASSERT_EQUAL(7LL, file.rfind(ByteVector("23", 2), 7));
CPPUNIT_ASSERT_EQUAL(2LL, file.rfind(ByteVector("23", 2), 6));
file.seek(0);
const ByteVector v = file.readBlock(static_cast<size_t>(file.length()));
CPPUNIT_ASSERT_EQUAL((size_t)10, v.size());
CPPUNIT_ASSERT_EQUAL((offset_t)v.rfind("23"), file.rfind("23"));
CPPUNIT_ASSERT_EQUAL((offset_t)v.rfind("23", 7), file.rfind("23", 7));
CPPUNIT_ASSERT_EQUAL((offset_t)v.rfind("23", 6), file.rfind("23", 6));
CPPUNIT_ASSERT_EQUAL((long long)v.rfind("23"), file.rfind("23"));
CPPUNIT_ASSERT_EQUAL((long long)v.rfind("23", 7), file.rfind("23", 7));
CPPUNIT_ASSERT_EQUAL((long long)v.rfind("23", 6), file.rfind("23", 6));
}
}
@ -107,22 +107,22 @@ public:
std::string name = copy.fileName();
PlainFile f(name.c_str());
CPPUNIT_ASSERT_EQUAL((offset_t)0, f.tell());
CPPUNIT_ASSERT_EQUAL((offset_t)4328, f.length());
CPPUNIT_ASSERT_EQUAL(0LL, f.tell());
CPPUNIT_ASSERT_EQUAL(4328LL, f.length());
f.seek(100, File::Beginning);
CPPUNIT_ASSERT_EQUAL((offset_t)100, f.tell());
CPPUNIT_ASSERT_EQUAL(100LL, f.tell());
f.seek(100, File::Current);
CPPUNIT_ASSERT_EQUAL((offset_t)200, f.tell());
CPPUNIT_ASSERT_EQUAL(200LL, f.tell());
f.seek(-300, File::Current);
CPPUNIT_ASSERT_EQUAL((offset_t)200, f.tell());
CPPUNIT_ASSERT_EQUAL(200LL, f.tell());
f.seek(-100, File::End);
CPPUNIT_ASSERT_EQUAL((offset_t)4228, f.tell());
CPPUNIT_ASSERT_EQUAL(4228LL, f.tell());
f.seek(-100, File::Current);
CPPUNIT_ASSERT_EQUAL((offset_t)4128, f.tell());
CPPUNIT_ASSERT_EQUAL(4128LL, f.tell());
f.seek(300, File::Current);
CPPUNIT_ASSERT_EQUAL((offset_t)4428, f.tell());
CPPUNIT_ASSERT_EQUAL(4428LL, f.tell());
}
};

View File

@ -293,7 +293,7 @@ public:
{
FLAC::File f(copy.fileName().c_str());
CPPUNIT_ASSERT(!f.hasID3v1Tag());
CPPUNIT_ASSERT_EQUAL((offset_t)4692, f.length());
CPPUNIT_ASSERT_EQUAL(4692LL, f.length());
f.seek(0x0100);
audioStream = f.readBlock(4436);
@ -301,7 +301,7 @@ public:
f.ID3v1Tag(true)->setTitle("01234 56789 ABCDE FGHIJ");
f.save();
CPPUNIT_ASSERT(f.hasID3v1Tag());
CPPUNIT_ASSERT_EQUAL((offset_t)4820, f.length());
CPPUNIT_ASSERT_EQUAL(4820LL, f.length());
f.seek(0x0100);
CPPUNIT_ASSERT_EQUAL(audioStream, f.readBlock(4436));

View File

@ -1153,7 +1153,7 @@ public:
{
MPEG::File f(copy.fileName().c_str());
CPPUNIT_ASSERT(f.hasID3v2Tag());
CPPUNIT_ASSERT_EQUAL((offset_t)3594, f.length());
CPPUNIT_ASSERT_EQUAL(3594LL, f.length());
CPPUNIT_ASSERT_EQUAL((TagLib::uint)1505, f.ID3v2Tag()->header()->completeTagSize());
CPPUNIT_ASSERT_EQUAL(String("Artist A"), f.ID3v2Tag()->artist());
CPPUNIT_ASSERT_EQUAL(44100, f.audioProperties()->sampleRate());

View File

@ -205,7 +205,7 @@ public:
MP4::Atoms atoms(&f);
MP4::Atom *moov = atoms.atoms[0];
CPPUNIT_ASSERT_EQUAL(offset_t(77), moov->length);
CPPUNIT_ASSERT_EQUAL(77LL, moov->length);
f.tag()->setItem("pgap", true);
f.save();
@ -218,7 +218,7 @@ public:
MP4::Atoms atoms(&f);
MP4::Atom *moov = atoms.atoms[0];
// original size + 'pgap' size + padding
CPPUNIT_ASSERT_EQUAL(offset_t(77 + 25 + 974), moov->length);
CPPUNIT_ASSERT_EQUAL(77 + 25 + 974LL, moov->length);
}
}

View File

@ -85,7 +85,7 @@ public:
CPPUNIT_ASSERT_EQUAL(44100, f.audioProperties()->sampleRate());
CPPUNIT_ASSERT(!f.audioProperties()->xingHeader());
offset_t last = f.lastFrameOffset();
long long last = f.lastFrameOffset();
f.seek(last);
MPEG::Header lastHeader(f.readBlock(4));
@ -98,7 +98,7 @@ public:
lastHeader = MPEG::Header(f.readBlock(4));
}
CPPUNIT_ASSERT_EQUAL((offset_t)28213, last);
CPPUNIT_ASSERT_EQUAL(28213LL, last);
CPPUNIT_ASSERT_EQUAL(209, lastHeader.frameLength());
}
@ -199,20 +199,20 @@ public:
{
MPEG::File f(TEST_FILE_PATH_C("ape.mp3"));
CPPUNIT_ASSERT(f.isValid());
CPPUNIT_ASSERT_EQUAL((offset_t)0x0000, f.firstFrameOffset());
CPPUNIT_ASSERT_EQUAL((offset_t)0x1FD6, f.lastFrameOffset());
CPPUNIT_ASSERT_EQUAL(0x0000LL, f.firstFrameOffset());
CPPUNIT_ASSERT_EQUAL(0x1FD6LL, f.lastFrameOffset());
}
{
MPEG::File f(TEST_FILE_PATH_C("ape-id3v1.mp3"));
CPPUNIT_ASSERT(f.isValid());
CPPUNIT_ASSERT_EQUAL((offset_t)0x0000, f.firstFrameOffset());
CPPUNIT_ASSERT_EQUAL((offset_t)0x1FD6, f.lastFrameOffset());
CPPUNIT_ASSERT_EQUAL(0x0000LL, f.firstFrameOffset());
CPPUNIT_ASSERT_EQUAL(0x1FD6LL, f.lastFrameOffset());
}
{
MPEG::File f(TEST_FILE_PATH_C("ape-id3v2.mp3"));
CPPUNIT_ASSERT(f.isValid());
CPPUNIT_ASSERT_EQUAL((offset_t)0x041A, f.firstFrameOffset());
CPPUNIT_ASSERT_EQUAL((offset_t)0x23F0, f.lastFrameOffset());
CPPUNIT_ASSERT_EQUAL(0x041ALL, f.firstFrameOffset());
CPPUNIT_ASSERT_EQUAL(0x23F0LL, f.lastFrameOffset());
}
}

View File

@ -59,7 +59,7 @@ public:
{
Ogg::Vorbis::File f(newname.c_str());
CPPUNIT_ASSERT(f.isValid());
CPPUNIT_ASSERT_EQUAL((offset_t)136383, f.length());
CPPUNIT_ASSERT_EQUAL(136383LL, f.length());
CPPUNIT_ASSERT_EQUAL(19, f.lastPageHeader()->pageSequenceNumber());
CPPUNIT_ASSERT_EQUAL((size_t)30, f.packet(0).size());
CPPUNIT_ASSERT_EQUAL((size_t)131127, f.packet(1).size());
@ -75,7 +75,7 @@ public:
{
Ogg::Vorbis::File f(newname.c_str());
CPPUNIT_ASSERT(f.isValid());
CPPUNIT_ASSERT_EQUAL((offset_t)4370, f.length());
CPPUNIT_ASSERT_EQUAL(4370LL, f.length());
CPPUNIT_ASSERT_EQUAL(3, f.lastPageHeader()->pageSequenceNumber());
CPPUNIT_ASSERT_EQUAL((size_t)30, f.packet(0).size());
CPPUNIT_ASSERT_EQUAL((size_t)60, f.packet(1).size());

View File

@ -37,7 +37,7 @@ public:
CPPUNIT_ASSERT_EQUAL(String("The Artist"), f.tag()->artist());
f.seek(0, File::End);
CPPUNIT_ASSERT_EQUAL((offset_t)9134, f.tell());
CPPUNIT_ASSERT_EQUAL(9134LL, f.tell());
}
}
@ -64,7 +64,7 @@ public:
{
Ogg::FLAC::File f(newname.c_str());
CPPUNIT_ASSERT(f.isValid());
CPPUNIT_ASSERT_EQUAL((offset_t)141141, f.length());
CPPUNIT_ASSERT_EQUAL(141141LL, f.length());
CPPUNIT_ASSERT_EQUAL(21, f.lastPageHeader()->pageSequenceNumber());
CPPUNIT_ASSERT_EQUAL((size_t)51, f.packet(0).size());
CPPUNIT_ASSERT_EQUAL((size_t)131126, f.packet(1).size());
@ -81,7 +81,7 @@ public:
{
Ogg::FLAC::File f(newname.c_str());
CPPUNIT_ASSERT(f.isValid());
CPPUNIT_ASSERT_EQUAL((offset_t)9128, f.length());
CPPUNIT_ASSERT_EQUAL(9128LL, f.length());
CPPUNIT_ASSERT_EQUAL(5, f.lastPageHeader()->pageSequenceNumber());
CPPUNIT_ASSERT_EQUAL((size_t)51, f.packet(0).size());
CPPUNIT_ASSERT_EQUAL((size_t)59, f.packet(1).size());

View File

@ -80,7 +80,7 @@ public:
{
Ogg::Opus::File f(newname.c_str());
CPPUNIT_ASSERT(f.isValid());
CPPUNIT_ASSERT_EQUAL((offset_t)167534, f.length());
CPPUNIT_ASSERT_EQUAL(167534LL, f.length());
CPPUNIT_ASSERT_EQUAL(27, f.lastPageHeader()->pageSequenceNumber());
CPPUNIT_ASSERT_EQUAL((size_t)19, f.packet(0).size());
CPPUNIT_ASSERT_EQUAL((size_t)131380, f.packet(1).size());
@ -97,7 +97,7 @@ public:
{
Ogg::Opus::File f(newname.c_str());
CPPUNIT_ASSERT(f.isValid());
CPPUNIT_ASSERT_EQUAL((offset_t)35521, f.length());
CPPUNIT_ASSERT_EQUAL(35521LL, f.length());
CPPUNIT_ASSERT_EQUAL(11, f.lastPageHeader()->pageSequenceNumber());
CPPUNIT_ASSERT_EQUAL((size_t)19, f.packet(0).size());
CPPUNIT_ASSERT_EQUAL((size_t)313, f.packet(1).size());

View File

@ -15,7 +15,7 @@ public:
PublicRIFF(FileName file) : RIFF::File(file, BigEndian) {};
TagLib::uint riffSize() { return RIFF::File::riffSize(); };
TagLib::uint chunkCount() { return RIFF::File::chunkCount(); };
offset_t chunkOffset(TagLib::uint i) { return RIFF::File::chunkOffset(i); };
long long chunkOffset(TagLib::uint i) { return RIFF::File::chunkOffset(i); };
TagLib::uint chunkPadding(TagLib::uint i) { return RIFF::File::chunkPadding(i); };
TagLib::uint chunkDataSize(TagLib::uint i) { return RIFF::File::chunkDataSize(i); };
ByteVector chunkName(TagLib::uint i) { return RIFF::File::chunkName(i); };
@ -53,7 +53,7 @@ public:
{
PublicRIFF f(filename.c_str());
CPPUNIT_ASSERT_EQUAL(ByteVector("TEST"), f.chunkName(2));
CPPUNIT_ASSERT_EQUAL(offset_t(0x1728 + 8), f.chunkOffset(2));
CPPUNIT_ASSERT_EQUAL(0x1728 + 8LL, f.chunkOffset(2));
f.setChunkData("TEST", "foo");
}
@ -62,7 +62,7 @@ public:
CPPUNIT_ASSERT_EQUAL(ByteVector("TEST"), f.chunkName(2));
CPPUNIT_ASSERT_EQUAL(ByteVector("foo"), f.chunkData(2));
CPPUNIT_ASSERT_EQUAL(TagLib::uint(3), f.chunkDataSize(2));
CPPUNIT_ASSERT_EQUAL(offset_t(0x1728 + 8), f.chunkOffset(2));
CPPUNIT_ASSERT_EQUAL(0x1728 + 8LL, f.chunkOffset(2));
f.setChunkData("SSND", "abcd");
@ -95,18 +95,18 @@ public:
{
PublicRIFF f(filename.c_str());
CPPUNIT_ASSERT_EQUAL(offset_t(0xff0 + 8), f.chunkOffset(2));
CPPUNIT_ASSERT_EQUAL(0xff0 + 8LL, f.chunkOffset(2));
CPPUNIT_ASSERT_EQUAL(TagLib::uint(311), f.chunkDataSize(2));
CPPUNIT_ASSERT_EQUAL(ByteVector("SSND"), f.chunkName(2));
CPPUNIT_ASSERT_EQUAL(TagLib::uint(1), f.chunkPadding(2));
CPPUNIT_ASSERT_EQUAL(offset_t(4400), f.length());
CPPUNIT_ASSERT_EQUAL(4400LL, f.length());
CPPUNIT_ASSERT_EQUAL(TagLib::uint(4399 - 8), f.riffSize());
f.setChunkData("TEST", "abcd");
CPPUNIT_ASSERT_EQUAL(offset_t(4088), f.chunkOffset(2));
CPPUNIT_ASSERT_EQUAL(4088LL, f.chunkOffset(2));
CPPUNIT_ASSERT_EQUAL(TagLib::uint(311), f.chunkDataSize(2));
CPPUNIT_ASSERT_EQUAL(ByteVector("SSND"), f.chunkName(2));
CPPUNIT_ASSERT_EQUAL(TagLib::uint(1), f.chunkPadding(2));
CPPUNIT_ASSERT_EQUAL(offset_t(4408), f.chunkOffset(3));
CPPUNIT_ASSERT_EQUAL(4408LL, f.chunkOffset(3));
CPPUNIT_ASSERT_EQUAL(TagLib::uint(4), f.chunkDataSize(3));
CPPUNIT_ASSERT_EQUAL(ByteVector("TEST"), f.chunkName(3));
CPPUNIT_ASSERT_EQUAL(TagLib::uint(0), f.chunkPadding(3));
@ -114,15 +114,15 @@ public:
}
{
PublicRIFF f(filename.c_str());
CPPUNIT_ASSERT_EQUAL(offset_t(4088), f.chunkOffset(2));
CPPUNIT_ASSERT_EQUAL(4088LL, f.chunkOffset(2));
CPPUNIT_ASSERT_EQUAL(TagLib::uint(311), f.chunkDataSize(2));
CPPUNIT_ASSERT_EQUAL(ByteVector("SSND"), f.chunkName(2));
CPPUNIT_ASSERT_EQUAL(TagLib::uint(1), f.chunkPadding(2));
CPPUNIT_ASSERT_EQUAL(offset_t(4408), f.chunkOffset(3));
CPPUNIT_ASSERT_EQUAL(4408LL, f.chunkOffset(3));
CPPUNIT_ASSERT_EQUAL(TagLib::uint(4), f.chunkDataSize(3));
CPPUNIT_ASSERT_EQUAL(ByteVector("TEST"), f.chunkName(3));
CPPUNIT_ASSERT_EQUAL(TagLib::uint(0), f.chunkPadding(3));
CPPUNIT_ASSERT_EQUAL(offset_t(4412), f.length());
CPPUNIT_ASSERT_EQUAL(4412LL, f.length());
}
}
@ -133,18 +133,18 @@ public:
{
PublicRIFF f(filename.c_str());
CPPUNIT_ASSERT_EQUAL(offset_t(0xff0 + 8), f.chunkOffset(2));
CPPUNIT_ASSERT_EQUAL(0xff0 + 8LL, f.chunkOffset(2));
CPPUNIT_ASSERT_EQUAL(TagLib::uint(311), f.chunkDataSize(2));
CPPUNIT_ASSERT_EQUAL(ByteVector("SSND"), f.chunkName(2));
CPPUNIT_ASSERT_EQUAL(TagLib::uint(0), f.chunkPadding(2));
CPPUNIT_ASSERT_EQUAL(offset_t(4399), f.length());
CPPUNIT_ASSERT_EQUAL(4399LL, f.length());
CPPUNIT_ASSERT_EQUAL(TagLib::uint(4399 - 8), f.riffSize());
f.setChunkData("TEST", "abcd");
CPPUNIT_ASSERT_EQUAL(offset_t(4088), f.chunkOffset(2));
CPPUNIT_ASSERT_EQUAL(4088LL, f.chunkOffset(2));
CPPUNIT_ASSERT_EQUAL(TagLib::uint(311), f.chunkDataSize(2));
CPPUNIT_ASSERT_EQUAL(ByteVector("SSND"), f.chunkName(2));
CPPUNIT_ASSERT_EQUAL(TagLib::uint(1), f.chunkPadding(2));
CPPUNIT_ASSERT_EQUAL(offset_t(4408), f.chunkOffset(3));
CPPUNIT_ASSERT_EQUAL(4408LL, f.chunkOffset(3));
CPPUNIT_ASSERT_EQUAL(TagLib::uint(4), f.chunkDataSize(3));
CPPUNIT_ASSERT_EQUAL(ByteVector("TEST"), f.chunkName(3));
CPPUNIT_ASSERT_EQUAL(TagLib::uint(0), f.chunkPadding(3));
@ -152,15 +152,15 @@ public:
}
{
PublicRIFF f(filename.c_str());
CPPUNIT_ASSERT_EQUAL(offset_t(4088), f.chunkOffset(2));
CPPUNIT_ASSERT_EQUAL(4088LL, f.chunkOffset(2));
CPPUNIT_ASSERT_EQUAL(TagLib::uint(311), f.chunkDataSize(2));
CPPUNIT_ASSERT_EQUAL(ByteVector("SSND"), f.chunkName(2));
CPPUNIT_ASSERT_EQUAL(TagLib::uint(1), f.chunkPadding(2));
CPPUNIT_ASSERT_EQUAL(offset_t(4408), f.chunkOffset(3));
CPPUNIT_ASSERT_EQUAL(4408LL, f.chunkOffset(3));
CPPUNIT_ASSERT_EQUAL(TagLib::uint(4), f.chunkDataSize(3));
CPPUNIT_ASSERT_EQUAL(ByteVector("TEST"), f.chunkName(3));
CPPUNIT_ASSERT_EQUAL(TagLib::uint(0), f.chunkPadding(3));
CPPUNIT_ASSERT_EQUAL(offset_t(4412), f.length());
CPPUNIT_ASSERT_EQUAL(4412LL, f.length());
}
}
@ -171,18 +171,18 @@ public:
{
PublicRIFF f(filename.c_str());
CPPUNIT_ASSERT_EQUAL(offset_t(0xff0 + 8), f.chunkOffset(2));
CPPUNIT_ASSERT_EQUAL(0xff0 + 8LL, f.chunkOffset(2));
CPPUNIT_ASSERT_EQUAL(TagLib::uint(311), f.chunkDataSize(2));
CPPUNIT_ASSERT_EQUAL(ByteVector("SSND"), f.chunkName(2));
CPPUNIT_ASSERT_EQUAL(TagLib::uint(0), f.chunkPadding(2));
CPPUNIT_ASSERT_EQUAL(offset_t(4399), f.length());
CPPUNIT_ASSERT_EQUAL(4399LL, f.length());
CPPUNIT_ASSERT_EQUAL(TagLib::uint(4399 - 8), f.riffSize());
f.setChunkData("TEST", "abc");
CPPUNIT_ASSERT_EQUAL(offset_t(4088), f.chunkOffset(2));
CPPUNIT_ASSERT_EQUAL(4088LL, f.chunkOffset(2));
CPPUNIT_ASSERT_EQUAL(TagLib::uint(311), f.chunkDataSize(2));
CPPUNIT_ASSERT_EQUAL(ByteVector("SSND"), f.chunkName(2));
CPPUNIT_ASSERT_EQUAL(TagLib::uint(1), f.chunkPadding(2));
CPPUNIT_ASSERT_EQUAL(offset_t(4408), f.chunkOffset(3));
CPPUNIT_ASSERT_EQUAL(4408LL, f.chunkOffset(3));
CPPUNIT_ASSERT_EQUAL(TagLib::uint(3), f.chunkDataSize(3));
CPPUNIT_ASSERT_EQUAL(ByteVector("TEST"), f.chunkName(3));
CPPUNIT_ASSERT_EQUAL(TagLib::uint(1), f.chunkPadding(3));
@ -190,15 +190,15 @@ public:
}
{
PublicRIFF f(filename.c_str());
CPPUNIT_ASSERT_EQUAL(offset_t(4088), f.chunkOffset(2));
CPPUNIT_ASSERT_EQUAL(4088LL, f.chunkOffset(2));
CPPUNIT_ASSERT_EQUAL(TagLib::uint(311), f.chunkDataSize(2));
CPPUNIT_ASSERT_EQUAL(ByteVector("SSND"), f.chunkName(2));
CPPUNIT_ASSERT_EQUAL(TagLib::uint(1), f.chunkPadding(2));
CPPUNIT_ASSERT_EQUAL(offset_t(4408), f.chunkOffset(3));
CPPUNIT_ASSERT_EQUAL(4408LL, f.chunkOffset(3));
CPPUNIT_ASSERT_EQUAL(TagLib::uint(3), f.chunkDataSize(3));
CPPUNIT_ASSERT_EQUAL(ByteVector("TEST"), f.chunkName(3));
CPPUNIT_ASSERT_EQUAL(TagLib::uint(1), f.chunkPadding(3));
CPPUNIT_ASSERT_EQUAL(offset_t(4412), f.length());
CPPUNIT_ASSERT_EQUAL(4412LL, f.length());
}
}
@ -210,17 +210,17 @@ public:
PublicRIFF f(filename.c_str());
CPPUNIT_ASSERT_EQUAL(ByteVector("COMM"), f.chunkName(0));
CPPUNIT_ASSERT_EQUAL(offset_t(0x000C + 8), f.chunkOffset(0));
CPPUNIT_ASSERT_EQUAL(0x000C + 8LL, f.chunkOffset(0));
CPPUNIT_ASSERT_EQUAL(ByteVector("SSND"), f.chunkName(1));
CPPUNIT_ASSERT_EQUAL(offset_t(0x0026 + 8), f.chunkOffset(1));
CPPUNIT_ASSERT_EQUAL(0x0026 + 8LL, f.chunkOffset(1));
CPPUNIT_ASSERT_EQUAL(ByteVector("TEST"), f.chunkName(2));
CPPUNIT_ASSERT_EQUAL(offset_t(0x1728 + 8), f.chunkOffset(2));
CPPUNIT_ASSERT_EQUAL(0x1728 + 8LL, f.chunkOffset(2));
const ByteVector data(0x400, ' ');
f.setChunkData("SSND", data);
CPPUNIT_ASSERT_EQUAL(offset_t(0x000C + 8), f.chunkOffset(0));
CPPUNIT_ASSERT_EQUAL(offset_t(0x0026 + 8), f.chunkOffset(1));
CPPUNIT_ASSERT_EQUAL(offset_t(0x042E + 8), f.chunkOffset(2));
CPPUNIT_ASSERT_EQUAL(0x000C + 8LL, f.chunkOffset(0));
CPPUNIT_ASSERT_EQUAL(0x0026 + 8LL, f.chunkOffset(1));
CPPUNIT_ASSERT_EQUAL(0x042E + 8LL, f.chunkOffset(2));
f.seek(f.chunkOffset(0) - 8);
CPPUNIT_ASSERT_EQUAL(ByteVector("COMM"), f.readBlock(4));
@ -230,9 +230,9 @@ public:
CPPUNIT_ASSERT_EQUAL(ByteVector("TEST"), f.readBlock(4));
f.setChunkData(0, data);
CPPUNIT_ASSERT_EQUAL(offset_t(0x000C + 8), f.chunkOffset(0));
CPPUNIT_ASSERT_EQUAL(offset_t(0x0414 + 8), f.chunkOffset(1));
CPPUNIT_ASSERT_EQUAL(offset_t(0x081C + 8), f.chunkOffset(2));
CPPUNIT_ASSERT_EQUAL(0x000C + 8LL, f.chunkOffset(0));
CPPUNIT_ASSERT_EQUAL(0x0414 + 8LL, f.chunkOffset(1));
CPPUNIT_ASSERT_EQUAL(0x081C + 8LL, f.chunkOffset(2));
f.seek(f.chunkOffset(0) - 8);
CPPUNIT_ASSERT_EQUAL(ByteVector("COMM"), f.readBlock(4));
@ -242,8 +242,8 @@ public:
CPPUNIT_ASSERT_EQUAL(ByteVector("TEST"), f.readBlock(4));
f.removeChunk("SSND");
CPPUNIT_ASSERT_EQUAL(offset_t(0x000C + 8), f.chunkOffset(0));
CPPUNIT_ASSERT_EQUAL(offset_t(0x0414 + 8), f.chunkOffset(1));
CPPUNIT_ASSERT_EQUAL(0x000C + 8LL, f.chunkOffset(0));
CPPUNIT_ASSERT_EQUAL(0x0414 + 8LL, f.chunkOffset(1));
f.seek(f.chunkOffset(0) - 8);
CPPUNIT_ASSERT_EQUAL(ByteVector("COMM"), f.readBlock(4));
@ -251,7 +251,7 @@ public:
CPPUNIT_ASSERT_EQUAL(ByteVector("TEST"), f.readBlock(4));
f.removeChunk(0);
CPPUNIT_ASSERT_EQUAL(offset_t(0x000C + 8), f.chunkOffset(0));
CPPUNIT_ASSERT_EQUAL(0x000C + 8LL, f.chunkOffset(0));
f.seek(f.chunkOffset(0) - 8);
CPPUNIT_ASSERT_EQUAL(ByteVector("TEST"), f.readBlock(4));

View File

@ -45,7 +45,7 @@ public:
{
Ogg::Speex::File f(newname.c_str());
CPPUNIT_ASSERT(f.isValid());
CPPUNIT_ASSERT_EQUAL((offset_t)156330, f.length());
CPPUNIT_ASSERT_EQUAL(156330LL, f.length());
CPPUNIT_ASSERT_EQUAL(23, f.lastPageHeader()->pageSequenceNumber());
CPPUNIT_ASSERT_EQUAL((size_t)80, f.packet(0).size());
CPPUNIT_ASSERT_EQUAL((size_t)131116, f.packet(1).size());
@ -62,7 +62,7 @@ public:
{
Ogg::Speex::File f(newname.c_str());
CPPUNIT_ASSERT(f.isValid());
CPPUNIT_ASSERT_EQUAL((offset_t)24317, f.length());
CPPUNIT_ASSERT_EQUAL(24317LL, f.length());
CPPUNIT_ASSERT_EQUAL(7, f.lastPageHeader()->pageSequenceNumber());
CPPUNIT_ASSERT_EQUAL((size_t)80, f.packet(0).size());
CPPUNIT_ASSERT_EQUAL((size_t)49, f.packet(1).size());

View File

@ -192,7 +192,7 @@ public:
ScopedFileCopy copy("duplicate_tags", ".wav");
RIFF::WAV::File f(copy.fileName().c_str());
CPPUNIT_ASSERT_EQUAL((offset_t)17052, f.length());
CPPUNIT_ASSERT_EQUAL(17052LL, f.length());
// duplicate_tags.wav has duplicate ID3v2/INFO tags.
// title() returns "Title2" if can't skip the second tag.
@ -204,8 +204,8 @@ public:
CPPUNIT_ASSERT_EQUAL(String("Title1"), f.InfoTag()->title());
f.save();
CPPUNIT_ASSERT_EQUAL((offset_t)15898, f.length());
CPPUNIT_ASSERT_EQUAL((offset_t)-1, f.find("Title2"));
CPPUNIT_ASSERT_EQUAL(15898LL, f.length());
CPPUNIT_ASSERT_EQUAL(-1LL, f.find("Title2"));
}
void testFuzzedFile1()