From 6f5874a03571457c38399f1d80dbe9c53e59495b Mon Sep 17 00:00:00 2001 From: Tsuda Kageyu Date: Tue, 1 Dec 2015 22:02:05 +0900 Subject: [PATCH] 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. --- taglib/ape/apefile.cpp | 8 +-- taglib/ape/apeproperties.cpp | 6 +- taglib/ape/apeproperties.h | 4 +- taglib/ape/apetag.cpp | 4 +- taglib/ape/apetag.h | 4 +- taglib/asf/asffile.cpp | 2 +- taglib/dsf/dsffile.cpp | 2 +- taglib/ebml/ebmlelement.cpp | 84 ++++++++++++------------ taglib/flac/flacfile.cpp | 12 ++-- taglib/flac/flacproperties.cpp | 4 +- taglib/flac/flacproperties.h | 4 +- taglib/mp4/mp4atom.cpp | 2 +- taglib/mp4/mp4atom.h | 4 +- taglib/mp4/mp4tag.cpp | 12 ++-- taglib/mp4/mp4tag.h | 2 +- taglib/mpc/mpcfile.cpp | 8 +-- taglib/mpc/mpcproperties.cpp | 6 +- taglib/mpc/mpcproperties.h | 6 +- taglib/mpeg/id3v1/id3v1tag.cpp | 4 +- taglib/mpeg/id3v1/id3v1tag.h | 2 +- taglib/mpeg/id3v2/id3v2tag.cpp | 12 ++-- taglib/mpeg/id3v2/id3v2tag.h | 2 +- taglib/mpeg/mpegfile.cpp | 34 +++++----- taglib/mpeg/mpegfile.h | 12 ++-- taglib/mpeg/mpegproperties.cpp | 4 +- taglib/ogg/flac/oggflacfile.cpp | 8 +-- taglib/ogg/flac/oggflacfile.h | 2 +- taglib/ogg/oggfile.cpp | 6 +- taglib/ogg/oggpage.cpp | 10 +-- taglib/ogg/oggpage.h | 4 +- taglib/ogg/oggpageheader.cpp | 6 +- taglib/ogg/oggpageheader.h | 2 +- taglib/riff/rifffile.cpp | 19 +++--- taglib/riff/rifffile.h | 4 +- taglib/tagutils.cpp | 10 +-- taglib/tagutils.h | 6 +- taglib/toolkit/taglib.h | 3 - taglib/toolkit/tbytevectorstream.cpp | 34 +++++----- taglib/toolkit/tbytevectorstream.h | 12 ++-- taglib/toolkit/tfile.cpp | 26 ++++---- taglib/toolkit/tfile.h | 24 +++---- taglib/toolkit/tfilestream.cpp | 30 ++++----- taglib/toolkit/tfilestream.h | 12 ++-- taglib/toolkit/tiostream.h | 12 ++-- taglib/trueaudio/trueaudiofile.cpp | 6 +- taglib/trueaudio/trueaudioproperties.cpp | 4 +- taglib/trueaudio/trueaudioproperties.h | 4 +- taglib/wavpack/wavpackfile.cpp | 6 +- taglib/wavpack/wavpackproperties.cpp | 8 +-- taglib/wavpack/wavpackproperties.h | 6 +- tests/test_aiff.cpp | 4 +- tests/test_asf.cpp | 4 +- tests/test_file.cpp | 44 ++++++------- tests/test_flac.cpp | 4 +- tests/test_id3v2.cpp | 2 +- tests/test_mp4.cpp | 4 +- tests/test_mpeg.cpp | 16 ++--- tests/test_ogg.cpp | 4 +- tests/test_oggflac.cpp | 6 +- tests/test_opus.cpp | 4 +- tests/test_riff.cpp | 72 ++++++++++---------- tests/test_speex.cpp | 4 +- tests/test_wav.cpp | 6 +- 63 files changed, 340 insertions(+), 342 deletions(-) diff --git a/taglib/ape/apefile.cpp b/taglib/ape/apefile.cpp index 4a54c0e8..18c1ad27 100644 --- a/taglib/ape/apefile.cpp +++ b/taglib/ape/apefile.cpp @@ -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; diff --git a/taglib/ape/apeproperties.cpp b/taglib/ape/apeproperties.cpp index dfc3dea9..dfb02fcc 100644 --- a/taglib/ape/apeproperties.cpp +++ b/taglib/ape/apeproperties.cpp @@ -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. diff --git a/taglib/ape/apeproperties.h b/taglib/ape/apeproperties.h index b06c69d8..9a7317f1 100644 --- a/taglib/ape/apeproperties.h +++ b/taglib/ape/apeproperties.h @@ -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); diff --git a/taglib/ape/apetag.cpp b/taglib/ape/apetag.cpp index 22453b2a..f4258630 100644 --- a/taglib/ape/apetag.cpp +++ b/taglib/ape/apetag.cpp @@ -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()) { diff --git a/taglib/ape/apetag.h b/taglib/ape/apetag.h index 060fd2e4..4adc93cf 100644 --- a/taglib/ape/apetag.h +++ b/taglib/ape/apetag.h @@ -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. diff --git a/taglib/asf/asffile.cpp b/taglib/asf/asffile.cpp index 631244f9..7b17baff 100644 --- a/taglib/asf/asffile.cpp +++ b/taglib/asf/asffile.cpp @@ -193,7 +193,7 @@ private: void ASF::File::FilePrivate::BaseObject::parse(ASF::File *file, unsigned int size) { data.clear(); - if(size > 24 && static_cast(size) <= file->length()) + if(size > 24 && static_cast(size) <= file->length()) data = file->readBlock(size - 24); else data = ByteVector(); diff --git a/taglib/dsf/dsffile.cpp b/taglib/dsf/dsffile.cpp index 179faf01..a737fdb1 100644 --- a/taglib/dsf/dsffile.cpp +++ b/taglib/dsf/dsffile.cpp @@ -143,7 +143,7 @@ bool DSF::File::save() } // Delete the old tag and write the new one - insert(tagData, static_cast(newMetadataOffset), static_cast(oldTagSize)); + insert(tagData, newMetadataOffset, static_cast(oldTagSize)); } return true; diff --git a/taglib/ebml/ebmlelement.cpp b/taglib/ebml/ebmlelement.cpp index 00a9b7e7..030bc9a2 100644 --- a/taglib/ebml/ebmlelement.cpp +++ b/taglib/ebml/ebmlelement.cpp @@ -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 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(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::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(ssize); + size = static_cast(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(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(content.size())) { + == static_cast(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(newVoid.size()) != (freeSpace->d->data - freeSpace->d->position)) + if (static_cast(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::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(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) ); diff --git a/taglib/flac/flacfile.cpp b/taglib/flac/flacfile.cpp index 045dfdec..ca894691 100644 --- a/taglib/flac/flacfile.cpp +++ b/taglib/flac/flacfile.cpp @@ -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 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); diff --git a/taglib/flac/flacproperties.cpp b/taglib/flac/flacproperties.cpp index e5c3e65d..657a3edb 100644 --- a/taglib/flac/flacproperties.cpp +++ b/taglib/flac/flacproperties.cpp @@ -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."); diff --git a/taglib/flac/flacproperties.h b/taglib/flac/flacproperties.h index 260d9b02..fc10d224 100644 --- a/taglib/flac/flacproperties.h +++ b/taglib/flac/flacproperties.h @@ -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; diff --git a/taglib/mp4/mp4atom.cpp b/taglib/mp4/mp4atom.cpp index 872526e8..2b4b1491 100644 --- a/taglib/mp4/mp4atom.cpp +++ b/taglib/mp4/mp4atom.cpp @@ -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); diff --git a/taglib/mp4/mp4atom.h b/taglib/mp4/mp4atom.h index 53bc16a6..2a75a6aa 100644 --- a/taglib/mp4/mp4atom.h +++ b/taglib/mp4/mp4atom.h @@ -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: diff --git a/taglib/mp4/mp4tag.cpp b/taglib/mp4/mp4tag.cpp index 185cbe67..6c95045b 100644 --- a/taglib/mp4/mp4tag.cpp +++ b/taglib/mp4/mp4tag.cpp @@ -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(data.size())); - updateOffsets(static_cast(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); diff --git a/taglib/mp4/mp4tag.h b/taglib/mp4/mp4tag.h index 074d1b1a..76a6ffeb 100644 --- a/taglib/mp4/mp4tag.h +++ b/taglib/mp4/mp4tag.h @@ -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); diff --git a/taglib/mpc/mpcfile.cpp b/taglib/mpc/mpcfile.cpp index 91e2bc6b..87b454cb 100644 --- a/taglib/mpc/mpcfile.cpp +++ b/taglib/mpc/mpcfile.cpp @@ -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; diff --git a/taglib/mpc/mpcproperties.cpp b/taglib/mpc/mpcproperties.cpp index f982630e..05555df1 100644 --- a/taglib/mpc/mpcproperties.cpp +++ b/taglib/mpc/mpcproperties.cpp @@ -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; diff --git a/taglib/mpc/mpcproperties.h b/taglib/mpc/mpcproperties.h index 77cc0c8a..c1cbd821 100644 --- a/taglib/mpc/mpcproperties.h +++ b/taglib/mpc/mpcproperties.h @@ -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; diff --git a/taglib/mpeg/id3v1/id3v1tag.cpp b/taglib/mpeg/id3v1/id3v1tag.cpp index f93d504b..b7a8233a 100644 --- a/taglib/mpeg/id3v1/id3v1tag.cpp +++ b/taglib/mpeg/id3v1/id3v1tag.cpp @@ -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; diff --git a/taglib/mpeg/id3v1/id3v1tag.h b/taglib/mpeg/id3v1/id3v1tag.h index b939a731..dbc15d4d 100644 --- a/taglib/mpeg/id3v1/id3v1tag.h +++ b/taglib/mpeg/id3v1/id3v1tag.h @@ -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. diff --git a/taglib/mpeg/id3v2/id3v2tag.cpp b/taglib/mpeg/id3v2/id3v2tag.cpp index daf514a2..e7e6ff7b 100644 --- a/taglib/mpeg/id3v2/id3v2tag.cpp +++ b/taglib/mpeg/id3v2/id3v2tag.cpp @@ -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); diff --git a/taglib/mpeg/id3v2/id3v2tag.h b/taglib/mpeg/id3v2/id3v2tag.h index 98f77f1a..7e2e756f 100644 --- a/taglib/mpeg/id3v2/id3v2tag.h +++ b/taglib/mpeg/id3v2/id3v2tag.h @@ -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()); /*! diff --git a/taglib/mpeg/mpegfile.cpp b/taglib/mpeg/mpegfile.cpp index 26a1226c..2fe7e5ba 100644 --- a/taglib/mpeg/mpegfile.cpp +++ b/taglib/mpeg/mpegfile.cpp @@ -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(bufferSize()) + size_t size = position < static_cast(bufferSize()) ? static_cast(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; diff --git a/taglib/mpeg/mpegfile.h b/taglib/mpeg/mpegfile.h index 801f7027..7b7310d2 100644 --- a/taglib/mpeg/mpegfile.h +++ b/taglib/mpeg/mpegfile.h @@ -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; diff --git a/taglib/mpeg/mpegproperties.cpp b/taglib/mpeg/mpegproperties.cpp index 7640a38f..da22cfa3 100644 --- a/taglib/mpeg/mpegproperties.cpp +++ b/taglib/mpeg/mpegproperties.cpp @@ -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; diff --git a/taglib/ogg/flac/oggflacfile.cpp b/taglib/ogg/flac/oggflacfile.cpp index bf0e8821..6df85cd8 100644 --- a/taglib/ogg/flac/oggflacfile.cpp +++ b/taglib/ogg/flac/oggflacfile.cpp @@ -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()) diff --git a/taglib/ogg/flac/oggflacfile.h b/taglib/ogg/flac/oggflacfile.h index 69b1b9ec..4c2d7956 100644 --- a/taglib/ogg/flac/oggflacfile.h +++ b/taglib/ogg/flac/oggflacfile.h @@ -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. diff --git a/taglib/ogg/oggfile.cpp b/taglib/ogg/oggfile.cpp index dc6f4def..36da2ac7 100644 --- a/taglib/ogg/oggfile.cpp +++ b/taglib/ogg/oggfile.cpp @@ -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()) { diff --git a/taglib/ogg/oggpage.cpp b/taglib/ogg/oggpage.cpp index a79f1385..2296d8bd 100644 --- a/taglib/ogg/oggpage.cpp +++ b/taglib/ogg/oggpage.cpp @@ -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 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; } diff --git a/taglib/ogg/oggpage.h b/taglib/ogg/oggpage.h index a2331b85..7b744ca7 100644 --- a/taglib/ogg/oggpage.h +++ b/taglib/ogg/oggpage.h @@ -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 diff --git a/taglib/ogg/oggpageheader.cpp b/taglib/ogg/oggpageheader.cpp index 4d3de25c..f00f3720 100644 --- a/taglib/ogg/oggpageheader.cpp +++ b/taglib/ogg/oggpageheader.cpp @@ -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 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) diff --git a/taglib/ogg/oggpageheader.h b/taglib/ogg/oggpageheader.h index 3cdec45b..86f6feb1 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 = 0, long long pageOffset = -1); /*! * Deletes this instance of the PageHeader. diff --git a/taglib/riff/rifffile.cpp b/taglib/riff/rifffile.cpp index 872d5d3a..40b3b5d8 100644 --- a/taglib/riff/rifffile.cpp +++ b/taglib/riff/rifffile.cpp @@ -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(std::max(0, length() - offset)), + name, + data, + offset, + static_cast(std::max(0LL, length() - offset)), static_cast(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) { diff --git a/taglib/riff/rifffile.h b/taglib/riff/rifffile.h index 36a52890..db4390dc 100644 --- a/taglib/riff/rifffile.h +++ b/taglib/riff/rifffile.h @@ -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; diff --git a/taglib/tagutils.cpp b/taglib/tagutils.cpp index 2c556ca7..da04bf7d 100644 --- a/taglib/tagutils.cpp +++ b/taglib/tagutils.cpp @@ -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; diff --git a/taglib/tagutils.h b/taglib/tagutils.h index 0001f34b..b32293bf 100644 --- a/taglib/tagutils.h +++ b/taglib/tagutils.h @@ -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); } } diff --git a/taglib/toolkit/taglib.h b/taglib/toolkit/taglib.h index acf79598..250f828b 100644 --- a/taglib/toolkit/taglib.h +++ b/taglib/toolkit/taglib.h @@ -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, diff --git a/taglib/toolkit/tbytevectorstream.cpp b/taglib/toolkit/tbytevectorstream.cpp index c1aded9d..1c87a82d 100644 --- a/taglib/toolkit/tbytevectorstream.cpp +++ b/taglib/toolkit/tbytevectorstream.cpp @@ -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(d->position + size) > length()) + if(static_cast(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(start + replace); const size_t writePosition = static_cast(start + data.size()); ::memmove( - d->data.data() + writePosition, - d->data.data() + readPosition, + d->data.data() + writePosition, + d->data.data() + readPosition, static_cast(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(ByteVectorStream::length() - readPosition); ::memmove( - d->data.data() + static_cast(writePosition), - d->data.data() + static_cast(readPosition), + d->data.data() + static_cast(writePosition), + d->data.data() + static_cast(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(d->data.size()); + return static_cast(d->data.size()); } -void ByteVectorStream::truncate(offset_t length) +void ByteVectorStream::truncate(long long length) { - d->data.resize(static_cast(length)); + d->data.resize(static_cast(length)); } ByteVector *ByteVectorStream::data() diff --git a/taglib/toolkit/tbytevectorstream.h b/taglib/toolkit/tbytevectorstream.h index 036d9970..101d5731 100644 --- a/taglib/toolkit/tbytevectorstream.h +++ b/taglib/toolkit/tbytevectorstream.h @@ -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(); diff --git a/taglib/toolkit/tfile.cpp b/taglib/toolkit/tfile.cpp index 1096fb84..8966a37c 100644 --- a/taglib/toolkit/tfile.cpp +++ b/taglib/toolkit/tfile.cpp @@ -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(); } diff --git a/taglib/toolkit/tfile.h b/taglib/toolkit/tfile.h index 093bce48..180de13b 100644 --- a/taglib/toolkit/tfile.h +++ b/taglib/toolkit/tfile.h @@ -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. diff --git a/taglib/toolkit/tfilestream.cpp b/taglib/toolkit/tfilestream.cpp index 5075ce63..205bb083 100644 --- a/taglib/toolkit/tfilestream.cpp +++ b/taglib/toolkit/tfilestream.cpp @@ -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(length) > streamLength) + const long long streamLength = FileStream::length(); + if(length > bufferSize() && static_cast(length) > streamLength) length = static_cast(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); diff --git a/taglib/toolkit/tfilestream.h b/taglib/toolkit/tfilestream.h index d4d44e95..f190bce7 100644 --- a/taglib/toolkit/tfilestream.h +++ b/taglib/toolkit/tfilestream.h @@ -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. diff --git a/taglib/toolkit/tiostream.h b/taglib/toolkit/tiostream.h index e856f765..0329c49a 100644 --- a/taglib/toolkit/tiostream.h +++ b/taglib/toolkit/tiostream.h @@ -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. diff --git a/taglib/trueaudio/trueaudiofile.cpp b/taglib/trueaudio/trueaudiofile.cpp index 508d3a59..93057b22 100644 --- a/taglib/trueaudio/trueaudiofile.cpp +++ b/taglib/trueaudio/trueaudiofile.cpp @@ -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; diff --git a/taglib/trueaudio/trueaudioproperties.cpp b/taglib/trueaudio/trueaudioproperties.cpp index 38162b33..3b5f2efa 100644 --- a/taglib/trueaudio/trueaudioproperties.cpp +++ b/taglib/trueaudio/trueaudioproperties.cpp @@ -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."); diff --git a/taglib/trueaudio/trueaudioproperties.h b/taglib/trueaudio/trueaudioproperties.h index f82f9db2..9454b377 100644 --- a/taglib/trueaudio/trueaudioproperties.h +++ b/taglib/trueaudio/trueaudioproperties.h @@ -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; diff --git a/taglib/wavpack/wavpackfile.cpp b/taglib/wavpack/wavpackfile.cpp index 603cd02b..0bddd74f 100644 --- a/taglib/wavpack/wavpackfile.cpp +++ b/taglib/wavpack/wavpackfile.cpp @@ -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; diff --git a/taglib/wavpack/wavpackproperties.cpp b/taglib/wavpack/wavpackproperties.cpp index 659759af..6ea78364 100644 --- a/taglib/wavpack/wavpackproperties.cpp +++ b/taglib/wavpack/wavpackproperties.cpp @@ -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; diff --git a/taglib/wavpack/wavpackproperties.h b/taglib/wavpack/wavpackproperties.h index d3ff0a21..d7646171 100644 --- a/taglib/wavpack/wavpackproperties.h +++ b/taglib/wavpack/wavpackproperties.h @@ -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; diff --git a/tests/test_aiff.cpp b/tests/test_aiff.cpp index 3844fa0b..470f690e 100644 --- a/tests/test_aiff.cpp +++ b/tests/test_aiff.cpp @@ -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() diff --git a/tests/test_asf.cpp b/tests/test_asf.cpp index 119a768a..d34b4960 100644 --- a/tests/test_asf.cpp +++ b/tests/test_asf.cpp @@ -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()); } } diff --git a/tests/test_file.cpp b/tests/test_file.cpp index cb2c3fc2..e1e9af6c 100644 --- a/tests/test_file.cpp +++ b/tests/test_file.cpp @@ -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(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(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()); } }; diff --git a/tests/test_flac.cpp b/tests/test_flac.cpp index 049f2dce..defa450b 100644 --- a/tests/test_flac.cpp +++ b/tests/test_flac.cpp @@ -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)); diff --git a/tests/test_id3v2.cpp b/tests/test_id3v2.cpp index 0f8d0ac8..7514d6e1 100644 --- a/tests/test_id3v2.cpp +++ b/tests/test_id3v2.cpp @@ -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()); diff --git a/tests/test_mp4.cpp b/tests/test_mp4.cpp index 51420870..7a1dbd0a 100644 --- a/tests/test_mp4.cpp +++ b/tests/test_mp4.cpp @@ -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); } } diff --git a/tests/test_mpeg.cpp b/tests/test_mpeg.cpp index cb1c74e4..c0042daa 100644 --- a/tests/test_mpeg.cpp +++ b/tests/test_mpeg.cpp @@ -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()); } } diff --git a/tests/test_ogg.cpp b/tests/test_ogg.cpp index f7993c28..1e7499a2 100644 --- a/tests/test_ogg.cpp +++ b/tests/test_ogg.cpp @@ -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()); diff --git a/tests/test_oggflac.cpp b/tests/test_oggflac.cpp index f0bf4910..55c373f0 100644 --- a/tests/test_oggflac.cpp +++ b/tests/test_oggflac.cpp @@ -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()); diff --git a/tests/test_opus.cpp b/tests/test_opus.cpp index 659df743..3e64839d 100644 --- a/tests/test_opus.cpp +++ b/tests/test_opus.cpp @@ -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()); diff --git a/tests/test_riff.cpp b/tests/test_riff.cpp index 735f1c14..076eec1f 100644 --- a/tests/test_riff.cpp +++ b/tests/test_riff.cpp @@ -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)); diff --git a/tests/test_speex.cpp b/tests/test_speex.cpp index 06d3276f..e13113ad 100644 --- a/tests/test_speex.cpp +++ b/tests/test_speex.cpp @@ -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()); diff --git a/tests/test_wav.cpp b/tests/test_wav.cpp index 057a677a..0aeb91c9 100644 --- a/tests/test_wav.cpp +++ b/tests/test_wav.cpp @@ -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()