Use a standard type rather than TagLib::ulong.
authorTsuda Kageyu <tsuda.kageyu@gmail.com>
Wed, 2 Dec 2015 15:03:06 +0000 (00:03 +0900)
committerTsuda Kageyu <tsuda.kageyu@gmail.com>
Wed, 2 Dec 2015 15:03:06 +0000 (00:03 +0900)
This won't break the ABI compatibility.

18 files changed:
taglib/asf/asffile.cpp
taglib/it/itfile.cpp
taglib/mod/modfilebase.cpp
taglib/mod/modfilebase.h
taglib/mod/modfileprivate.h
taglib/mpc/mpcproperties.cpp
taglib/mpeg/mpegfile.cpp
taglib/mpeg/xingheader.cpp
taglib/riff/rifffile.cpp
taglib/riff/rifffile.h
taglib/toolkit/tbytevectorstream.cpp
taglib/toolkit/tbytevectorstream.h
taglib/toolkit/tfile.cpp
taglib/toolkit/tfile.h
taglib/toolkit/tfilestream.cpp
taglib/toolkit/tfilestream.h
taglib/toolkit/tiostream.h
taglib/xm/xmfile.cpp

index a5e5ea84b5e779d0e110e93d7910112b8abe0768..dc21dad40f8e17be69b9c8fe6585ce268b438694 100644 (file)
@@ -600,7 +600,7 @@ bool ASF::File::save()
   writeBlock(ByteVector::fromUInt(d->objects.size(), false));
   writeBlock(ByteVector("\x01\x02", 2));
 
-  insert(data, 30, static_cast<ulong>(d->headerSize - 30));
+  insert(data, 30, static_cast<unsigned long>(d->headerSize - 30));
 
   d->headerSize = data.size() + 30;
 
index 7508cfcbf76c87cf2f895450d877da883017a619..7e140510fdff17df9674452c9290ec4f1fea1d02 100644 (file)
@@ -109,7 +109,7 @@ bool IT::File::save()
   StringList lines = d->tag.comment().split("\n");
   for(unsigned short i = 0; i < instrumentCount; ++ i) {
     seek(192L + length + ((long)i << 2));
-    ulong instrumentOffset = 0;
+    unsigned long instrumentOffset = 0;
     if(!readU32L(instrumentOffset))
       return false;
 
@@ -124,7 +124,7 @@ bool IT::File::save()
 
   for(unsigned short i = 0; i < sampleCount; ++ i) {
     seek(192L + length + ((long)instrumentCount << 2) + ((long)i << 2));
-    ulong sampleOffset = 0;
+    unsigned long sampleOffset = 0;
     if(!readU32L(sampleOffset))
       return false;
 
@@ -151,13 +151,13 @@ bool IT::File::save()
 
   unsigned short special = 0;
   unsigned short messageLength = 0;
-  ulong  messageOffset = 0;
+  unsigned long  messageOffset = 0;
 
   seek(46);
   if(!readU16L(special))
     return false;
 
-  ulong fileSize = File::length();
+  unsigned long fileSize = File::length();
   if(special & Properties::MessageAttached) {
     seek(54);
     if(!readU16L(messageLength) || !readU32L(messageOffset))
index 2ed16ae7fa8272dda1370088eed12238e1a3f3a4..0cc15e865fa8f6ee30ddda141e811585050d721f 100644 (file)
@@ -33,14 +33,14 @@ Mod::FileBase::FileBase(IOStream *stream) : TagLib::File(stream)
 {
 }
 
-void Mod::FileBase::writeString(const String &s, ulong size, char padding)
+void Mod::FileBase::writeString(const String &s, unsigned long size, char padding)
 {
   ByteVector data(s.data(String::Latin1));
   data.resize(size, padding);
   writeBlock(data);
 }
 
-bool Mod::FileBase::readString(String &s, ulong size)
+bool Mod::FileBase::readString(String &s, unsigned long size)
 {
   ByteVector data(readBlock(size));
   if(data.size() < size) return false;
@@ -66,7 +66,7 @@ void Mod::FileBase::writeU16L(unsigned short number)
   writeBlock(ByteVector::fromShort(number, false));
 }
 
-void Mod::FileBase::writeU32L(ulong number)
+void Mod::FileBase::writeU32L(unsigned long number)
 {
   writeBlock(ByteVector::fromUInt(number, false));
 }
@@ -76,7 +76,7 @@ void Mod::FileBase::writeU16B(unsigned short number)
   writeBlock(ByteVector::fromShort(number, true));
 }
 
-void Mod::FileBase::writeU32B(ulong number)
+void Mod::FileBase::writeU32B(unsigned long number)
 {
   writeBlock(ByteVector::fromUInt(number, true));
 }
@@ -97,7 +97,7 @@ bool Mod::FileBase::readU16L(unsigned short &number)
   return true;
 }
 
-bool Mod::FileBase::readU32L(ulong &number) {
+bool Mod::FileBase::readU32L(unsigned long &number) {
   ByteVector data(readBlock(4));
   if(data.size() < 4) return false;
   number = data.toUInt(false);
@@ -112,7 +112,7 @@ bool Mod::FileBase::readU16B(unsigned short &number)
   return true;
 }
 
-bool Mod::FileBase::readU32B(ulong &number) {
+bool Mod::FileBase::readU32B(unsigned long &number) {
   ByteVector data(readBlock(4));
   if(data.size() < 4) return false;
   number = data.toUInt(true);
index 82f3122b0ab8fed76ba0afb1d77041b7b44c885d..5f76ccb085ecd3d1222be8b7c977a578a720c1b2 100644 (file)
@@ -40,19 +40,19 @@ namespace TagLib {
       FileBase(FileName file);
       FileBase(IOStream *stream);
 
-      void writeString(const String &s, ulong size, char padding = 0);
+      void writeString(const String &s, unsigned long size, char padding = 0);
       void writeByte(unsigned char byte);
       void writeU16L(unsigned short number);
-      void writeU32L(ulong number);
+      void writeU32L(unsigned long number);
       void writeU16B(unsigned short number);
-      void writeU32B(ulong number);
+      void writeU32B(unsigned long number);
 
-      bool readString(String &s, ulong size);
+      bool readString(String &s, unsigned long size);
       bool readByte(unsigned char &byte);
       bool readU16L(unsigned short &number);
-      bool readU32L(ulong &number);
+      bool readU32L(unsigned long &number);
       bool readU16B(unsigned short &number);
-      bool readU32B(ulong &number);
+      bool readU32B(unsigned long &number);
     };
 
   }
index a4fc8d3319745ec3b287219be6db60e4afcf20d4..781db74c92880a5093bbef27765430a0bd12d136 100644 (file)
@@ -39,9 +39,9 @@
 
 #define READ_BYTE(setter) READ(setter,unsigned char,readByte)
 #define READ_U16L(setter) READ(setter,unsigned short,readU16L)
-#define READ_U32L(setter) READ(setter,ulong,readU32L)
+#define READ_U32L(setter) READ(setter,unsigned long,readU32L)
 #define READ_U16B(setter) READ(setter,unsigned short,readU16B)
-#define READ_U32B(setter) READ(setter,ulong,readU32B)
+#define READ_U32B(setter) READ(setter,unsigned long,readU32B)
 
 #define READ_STRING(setter,size) \
   { \
@@ -56,9 +56,9 @@
 
 #define READ_BYTE_AS(name) READ_AS(unsigned char,name,readByte)
 #define READ_U16L_AS(name) READ_AS(unsigned short,name,readU16L)
-#define READ_U32L_AS(name) READ_AS(ulong,name,readU32L)
+#define READ_U32L_AS(name) READ_AS(unsigned long,name,readU32L)
 #define READ_U16B_AS(name) READ_AS(unsigned short,name,readU16B)
-#define READ_U32B_AS(name) READ_AS(ulong,name,readU32B)
+#define READ_U32B_AS(name) READ_AS(unsigned long,name,readU32B)
 
 #define READ_STRING_AS(name,size) \
   String name; \
index 9c1274ebfbb988b1440610df002b4523ff23ab50..2e42886e7500313fb8faf710faa9da5ade45e27e 100644 (file)
@@ -247,7 +247,7 @@ void MPC::Properties::readSV8(File *file, long streamLength)
         break;
       }
 
-      const ulong begSilence = readSize(data, pos);
+      const unsigned long begSilence = readSize(data, pos);
       if(pos > dataSize - 2) {
         debug("MPC::Properties::readSV8() - \"SH\" packet is corrupt.");
         break;
index adf7a850bc194288c5e947e36c9eccad785e43ab..716c2cfabcfa555a46b5b9220b8dcea6bbcffaff 100644 (file)
@@ -409,7 +409,7 @@ long MPEG::File::previousFrameOffset(long position)
   ByteVector buffer;
 
   while (position > 0) {
-    long size = ulong(position) < bufferSize() ? position : bufferSize();
+    long size = std::min<long>(position, bufferSize());
     position -= size;
 
     seek(position);
index 5a4961845fdf389525e8b6976f1ac18229b5d211..6e554599cf555333d79892cbb7220d345240bafa 100644 (file)
@@ -103,7 +103,7 @@ void MPEG::XingHeader::parse(const ByteVector &data)
 
     // Xing header found.
 
-    if(data.size() < static_cast<ulong>(offset + 16)) {
+    if(data.size() < static_cast<unsigned long>(offset + 16)) {
       debug("MPEG::XingHeader::parse() -- Xing header found but too short.");
       return;
     }
@@ -127,7 +127,7 @@ void MPEG::XingHeader::parse(const ByteVector &data)
 
       // VBRI header found.
 
-      if(data.size() < static_cast<ulong>(offset + 32)) {
+      if(data.size() < static_cast<unsigned long>(offset + 32)) {
         debug("MPEG::XingHeader::parse() -- VBRI header found but too short.");
         return;
       }
index 8317a57e26abe46831c363cff62d316a58fe826d..2518dd9e5f5879ecb96522d4eccc4e673ff9e477 100644 (file)
@@ -178,7 +178,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.
 
   uint i = d->chunks.size() - 1;
-  ulong offset = d->chunks[i].offset + d->chunks[i].size;
+  unsigned long offset = d->chunks[i].offset + d->chunks[i].size;
 
   // First we update the global size
 
@@ -284,7 +284,7 @@ void RIFF::File::read()
 }
 
 void RIFF::File::writeChunk(const ByteVector &name, const ByteVector &data,
-                            ulong offset, ulong replace, uint leadingPadding)
+                            unsigned long offset, unsigned long replace, uint leadingPadding)
 {
   ByteVector combined;
   if(leadingPadding) {
index 11d2b71a0f38a102084a69c813076541e0b1a2ce..766ae0c4b2fe9c4cdc19dd2e3f06d0eafb54a342 100644 (file)
@@ -145,7 +145,7 @@ namespace TagLib {
 
       void read();
       void writeChunk(const ByteVector &name, const ByteVector &data,
-                      ulong offset, ulong replace = 0,
+                      unsigned long offset, unsigned long replace = 0,
                       uint leadingPadding = 0);
 
       class FilePrivate;
index 230f7c99ec7c7e409e67a721ecd5f291acb15f0c..90bee8e3f2815933d615499274e5a70e5d14a4e8 100644 (file)
@@ -68,7 +68,7 @@ FileName ByteVectorStream::name() const
   return FileName(""); // XXX do we need a name?
 }
 
-ByteVector ByteVectorStream::readBlock(ulong length)
+ByteVector ByteVectorStream::readBlock(unsigned long length)
 {
   if(length == 0)
     return ByteVector();
@@ -88,7 +88,7 @@ void ByteVectorStream::writeBlock(const ByteVector &data)
   d->position += size;
 }
 
-void ByteVectorStream::insert(const ByteVector &data, ulong start, ulong replace)
+void ByteVectorStream::insert(const ByteVector &data, unsigned long start, unsigned long replace)
 {
   long sizeDiff = data.size() - replace;
   if(sizeDiff < 0) {
@@ -96,20 +96,20 @@ void ByteVectorStream::insert(const ByteVector &data, ulong start, ulong replace
   }
   else if(sizeDiff > 0) {
     truncate(length() + sizeDiff);
-    ulong readPosition = start + replace;
-    ulong writePosition = start + data.size();
+    unsigned long readPosition  = start + replace;
+    unsigned long writePosition = start + data.size();
     memmove(d->data.data() + writePosition, d->data.data() + readPosition, length() - sizeDiff - readPosition);
   }
   seek(start);
   writeBlock(data);
 }
 
-void ByteVectorStream::removeBlock(ulong start, ulong length)
+void ByteVectorStream::removeBlock(unsigned long start, unsigned long length)
 {
-  ulong readPosition = start + length;
-  ulong writePosition = start;
-  if(readPosition < ulong(ByteVectorStream::length())) {
-    ulong bytesToMove = ByteVectorStream::length() - readPosition;
+  unsigned long readPosition = start + length;
+  unsigned long writePosition = start;
+  if(readPosition < static_cast<unsigned long>(ByteVectorStream::length())) {
+    unsigned long bytesToMove = ByteVectorStream::length() - readPosition;
     memmove(d->data.data() + writePosition, d->data.data() + readPosition, bytesToMove);
     writePosition += bytesToMove;
   }
index 456b854e0feadb15e69587665573416deda53d37..84327c46dcbeaa193d4b52847e496a3361ca5bd3 100644 (file)
@@ -61,7 +61,7 @@ namespace TagLib {
     /*!
      * Reads a block of size \a length at the current get pointer.
      */
-    ByteVector readBlock(ulong length);
+    ByteVector readBlock(unsigned long length);
 
     /*!
      * Attempts to write the block \a data at the current get pointer.  If the
@@ -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, ulong start = 0, ulong replace = 0);
+    void insert(const ByteVector &data, unsigned long start = 0, unsigned long 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(ulong start = 0, ulong length = 0);
+    void removeBlock(unsigned long start = 0, unsigned long length = 0);
 
     /*!
      * Returns true if the file is read only (or if the file can not be opened).
index 2fca74451a0ae0190eb2d691bdc20f002d2134f4..4e53f50556f58184d6f3a3896ba0338f36a20d59 100644 (file)
@@ -224,7 +224,7 @@ PropertyMap File::setProperties(const PropertyMap &properties)
     return tag()->setProperties(properties);
 }
 
-ByteVector File::readBlock(ulong length)
+ByteVector File::readBlock(unsigned long length)
 {
   return d->stream->readBlock(length);
 }
@@ -404,12 +404,12 @@ long File::rfind(const ByteVector &pattern, long fromOffset, const ByteVector &b
   return -1;
 }
 
-void File::insert(const ByteVector &data, ulong start, ulong replace)
+void File::insert(const ByteVector &data, unsigned long start, unsigned long replace)
 {
   d->stream->insert(data, start, replace);
 }
 
-void File::removeBlock(ulong start, ulong length)
+void File::removeBlock(unsigned long start, unsigned long length)
 {
   d->stream->removeBlock(start, length);
 }
index 7784068497a4260742f946f4a1cebcb77c992a63..33288936d1ab39c953b382281444f70bae4112a1 100644 (file)
@@ -138,7 +138,7 @@ namespace TagLib {
     /*!
      * Reads a block of size \a length at the current get pointer.
      */
-    ByteVector readBlock(ulong length);
+    ByteVector readBlock(unsigned long length);
 
     /*!
      * Attempts to write the block \a data at the current get pointer.  If the
@@ -190,7 +190,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, ulong start = 0, ulong replace = 0);
+    void insert(const ByteVector &data, unsigned long start = 0, unsigned long replace = 0);
 
     /*!
      * Removes a block of the file starting a \a start and continuing for
@@ -199,7 +199,7 @@ namespace TagLib {
      * \note This method is slow since it involves rewriting all of the file
      * after the removed portion.
      */
-    void removeBlock(ulong start = 0, ulong length = 0);
+    void removeBlock(unsigned long start = 0, unsigned long length = 0);
 
     /*!
      * Returns true if the file is read only (or if the file can not be opened).
index 0ced6c79c275733c466c3cc092ca4f6d7308c033..200b7fec8c379ca231b3adc38cbbea938d3112b3 100644 (file)
@@ -172,7 +172,7 @@ FileName FileStream::name() const
   return d->name;
 }
 
-ByteVector FileStream::readBlock(ulong length)
+ByteVector FileStream::readBlock(unsigned long length)
 {
   if(!isOpen()) {
     debug("FileStream::readBlock() -- invalid file.");
@@ -182,7 +182,7 @@ ByteVector FileStream::readBlock(ulong length)
   if(length == 0)
     return ByteVector();
 
-  const ulong streamLength = static_cast<ulong>(FileStream::length());
+  const unsigned long streamLength = static_cast<unsigned long>(FileStream::length());
   if(length > bufferSize() && length > streamLength)
     length = streamLength;
 
@@ -209,7 +209,7 @@ void FileStream::writeBlock(const ByteVector &data)
   writeFile(d->file, data);
 }
 
-void FileStream::insert(const ByteVector &data, ulong start, ulong replace)
+void FileStream::insert(const ByteVector &data, unsigned long start, unsigned long replace)
 {
   if(!isOpen()) {
     debug("FileStream::insert() -- invalid file.");
@@ -243,7 +243,7 @@ void FileStream::insert(const ByteVector &data, ulong start, ulong replace)
   // the *differnce* in the tag sizes.  We want to avoid overwriting parts
   // that aren't yet in memory, so this is necessary.
 
-  ulong bufferLength = bufferSize();
+  unsigned long bufferLength = bufferSize();
 
   while(data.size() - replace > bufferLength)
     bufferLength += bufferSize();
@@ -291,14 +291,14 @@ void FileStream::insert(const ByteVector &data, ulong start, ulong replace)
   }
 }
 
-void FileStream::removeBlock(ulong start, ulong length)
+void FileStream::removeBlock(unsigned long start, unsigned long length)
 {
   if(!isOpen()) {
     debug("FileStream::removeBlock() -- invalid file.");
     return;
   }
 
-  ulong bufferLength = bufferSize();
+  unsigned long bufferLength = bufferSize();
 
   long readPosition = start + length;
   long writePosition = start;
index fa113b738a7fe34ce92644997734dd1c90341459..a871032d625d6430185f0517dc3d33347d0cad0d 100644 (file)
@@ -67,7 +67,7 @@ namespace TagLib {
     /*!
      * Reads a block of size \a length at the current get pointer.
      */
-    ByteVector readBlock(ulong length);
+    ByteVector readBlock(unsigned long length);
 
     /*!
      * Attempts to write the block \a data at the current get pointer.  If the
@@ -87,7 +87,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, ulong start = 0, ulong replace = 0);
+    void insert(const ByteVector &data, unsigned long start = 0, unsigned long replace = 0);
 
     /*!
      * Removes a block of the file starting a \a start and continuing for
@@ -96,7 +96,7 @@ namespace TagLib {
      * \note This method is slow since it involves rewriting all of the file
      * after the removed portion.
      */
-    void removeBlock(ulong start = 0, ulong length = 0);
+    void removeBlock(unsigned long start = 0, unsigned long length = 0);
 
     /*!
      * Returns true if the file is read only (or if the file can not be opened).
index 6bb96b54b765b51019b194bf504e824ae50529e4..110531644a3bd25e869d4fa53a30aeb64664bc97 100644 (file)
@@ -89,7 +89,7 @@ namespace TagLib {
     /*!
      * Reads a block of size \a length at the current get pointer.
      */
-    virtual ByteVector readBlock(ulong length) = 0;
+    virtual ByteVector readBlock(unsigned long length) = 0;
 
     /*!
      * Attempts to write the block \a data at the current get pointer.  If the
@@ -109,7 +109,8 @@ 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, ulong start = 0, ulong replace = 0) = 0;
+    virtual void insert(const ByteVector &data,
+                        unsigned long start = 0, unsigned long replace = 0) = 0;
 
     /*!
      * Removes a block of the file starting a \a start and continuing for
@@ -118,7 +119,7 @@ namespace TagLib {
      * \note This method is slow since it involves rewriting all of the file
      * after the removed portion.
      */
-    virtual void removeBlock(ulong start = 0, ulong length = 0) = 0;
+    virtual void removeBlock(unsigned long start = 0, unsigned long length = 0) = 0;
 
     /*!
      * Returns true if the file is read only (or if the file can not be opened).
index 7fa032c750e11775171d45c82facd2c7226dfd8b..7def0c095d0698a83354d69a48bec769067fa18c 100644 (file)
@@ -31,7 +31,6 @@
 using namespace TagLib;
 using namespace XM;
 using TagLib::uint;
-using TagLib::ulong;
 
 /*!
  * The Reader classes are helpers to make handling of the stripped XM
@@ -198,11 +197,11 @@ public:
   }
 };
 
-class U32Reader : public NumberReader<ulong>
+class U32Reader : public NumberReader<unsigned long>
 {
 public:
-  U32Reader(ulong &value, bool bigEndian = true) :
-    NumberReader<ulong>(value, bigEndian)
+  U32Reader(unsigned long &value, bool bigEndian = true) :
+    NumberReader<unsigned long>(value, bigEndian)
   {
   }
 
@@ -293,7 +292,7 @@ public:
    * Read a unsigned 32 Bit integer into \a number. The byte order
    * is controlled by \a bigEndian.
    */
-  StructReader &u32(ulong &number, bool bigEndian)
+  StructReader &u32(unsigned long &number, bool bigEndian)
   {
     m_readers.append(new U32Reader(number, bigEndian));
     return *this;
@@ -302,7 +301,7 @@ public:
   /*!
    * Read a unsigned 32 Bit little endian integer into \a number.
    */
-  StructReader &u32L(ulong &number)
+  StructReader &u32L(unsigned long &number)
   {
     return u32(number, false);
   }
@@ -310,7 +309,7 @@ public:
   /*!
    * Read a unsigned 32 Bit big endian integer into \a number.
    */
-  StructReader &u32B(ulong &number)
+  StructReader &u32B(unsigned long &number)
   {
     return u32(number, true);
   }
@@ -410,7 +409,7 @@ bool XM::File::save()
   writeString(d->tag.trackerName(), 20);
 
   seek(60);
-  ulong headerSize = 0;
+  unsigned long headerSize = 0;
   if(!readU32L(headerSize))
     return false;
 
@@ -425,7 +424,7 @@ bool XM::File::save()
   // need to read patterns again in order to seek to the instruments:
   for(unsigned short i = 0; i < patternCount; ++ i) {
     seek(pos);
-    ulong patternHeaderLength = 0;
+    unsigned long patternHeaderLength = 0;
     if(!readU32L(patternHeaderLength) || patternHeaderLength < 4)
       return false;
 
@@ -441,7 +440,7 @@ bool XM::File::save()
   uint sampleNameIndex = instrumentCount;
   for(unsigned short i = 0; i < instrumentCount; ++ i) {
     seek(pos);
-    ulong instrumentHeaderSize = 0;
+    unsigned long instrumentHeaderSize = 0;
     if(!readU32L(instrumentHeaderSize) || instrumentHeaderSize < 4)
       return false;
 
@@ -459,7 +458,7 @@ bool XM::File::save()
         return false;
     }
 
-    ulong sampleHeaderSize = 0;
+    unsigned long sampleHeaderSize = 0;
     if(sampleCount > 0) {
       seek(pos + 29);
       if(instrumentHeaderSize < 33U || !readU32L(sampleHeaderSize))
@@ -471,7 +470,7 @@ bool XM::File::save()
     for(unsigned short j = 0; j < sampleCount; ++ j) {
       if(sampleHeaderSize > 4U) {
         seek(pos);
-        ulong sampleLength = 0;
+        unsigned long sampleLength = 0;
         if(!readU32L(sampleLength))
           return false;
 
@@ -532,7 +531,7 @@ void XM::File::read(bool)
         .u16L(bpmSpeed);
 
   uint count = header.read(*this, headerSize - 4U);
-  uint size = std::min(headerSize - 4U, (ulong)header.size());
+  uint size = std::min(headerSize - 4U, (unsigned long)header.size());
 
   READ_ASSERT(count == size);
 
@@ -559,7 +558,7 @@ void XM::File::read(bool)
     pattern.byte(packingType).u16L(rowCount).u16L(dataSize);
 
     uint count = pattern.read(*this, patternHeaderLength - 4U);
-    READ_ASSERT(count == std::min(patternHeaderLength - 4U, (ulong)pattern.size()));
+    READ_ASSERT(count == std::min(patternHeaderLength - 4U, (unsigned long)pattern.size()));
 
     seek(patternHeaderLength - (4 + count) + dataSize, Current);
   }
@@ -582,9 +581,9 @@ void XM::File::read(bool)
 
     // 4 for instrumentHeaderSize
     uint count = 4 + instrument.read(*this, instrumentHeaderSize - 4U);
-    READ_ASSERT(count == std::min(instrumentHeaderSize, (ulong)instrument.size() + 4));
+    READ_ASSERT(count == std::min(instrumentHeaderSize, (unsigned long)instrument.size() + 4));
 
-    ulong sampleHeaderSize = 0;
+    unsigned long sampleHeaderSize = 0;
     long offset = 0;
     if(sampleCount > 0) {
       sumSampleCount += sampleCount;
@@ -594,9 +593,9 @@ void XM::File::read(bool)
       seek(instrumentHeaderSize - count - 4, Current);
 
       for(unsigned short j = 0; j < sampleCount; ++ j) {
-        ulong sampleLength = 0;
-        ulong loopStart    = 0;
-        ulong loopLength   = 0;
+        unsigned long sampleLength = 0;
+        unsigned long loopStart    = 0;
+        unsigned long loopLength   = 0;
         unsigned char volume       = 0;
         unsigned char finetune     = 0;
         unsigned char sampleType   = 0;
@@ -617,7 +616,7 @@ void XM::File::read(bool)
               .string(sampleName, 22);
 
         uint count = sample.read(*this, sampleHeaderSize);
-        READ_ASSERT(count == std::min(sampleHeaderSize, (ulong)sample.size()));
+        READ_ASSERT(count == std::min(sampleHeaderSize, (unsigned long)sample.size()));
         // skip unhandeled header proportion:
         seek(sampleHeaderSize - count, Current);