]> granicus.if.org Git - taglib/commitdiff
Use a standard type rather than TagLib::ushort.
authorTsuda Kageyu <tsuda.kageyu@gmail.com>
Wed, 2 Dec 2015 09:59:45 +0000 (18:59 +0900)
committerTsuda Kageyu <tsuda.kageyu@gmail.com>
Wed, 2 Dec 2015 09:59:45 +0000 (18:59 +0900)
This won't break the ABI compatibility.

22 files changed:
taglib/asf/asfutils.h
taglib/it/itfile.cpp
taglib/it/itproperties.cpp
taglib/it/itproperties.h
taglib/mod/modfilebase.cpp
taglib/mod/modfilebase.h
taglib/mod/modfileprivate.h
taglib/mpc/mpcproperties.cpp
taglib/mpeg/id3v2/frames/synchronizedlyricsframe.cpp
taglib/ogg/opus/opusproperties.cpp
taglib/s3m/s3mfile.cpp
taglib/s3m/s3mproperties.cpp
taglib/s3m/s3mproperties.h
taglib/toolkit/tbytevector.cpp
taglib/toolkit/tstring.cpp
taglib/toolkit/tutils.h
taglib/xm/xmfile.cpp
taglib/xm/xmproperties.cpp
taglib/xm/xmproperties.h
tests/test_it.cpp
tests/test_s3m.cpp
tests/test_xm.cpp

index 21dbd03421aa37e8e70d93c30ef1c73b1d91b8ee..9a9494134ea4c3f6de5e68df818b31e94acb1c09 100644 (file)
@@ -35,7 +35,7 @@ namespace TagLib
   namespace ASF
   {
 
-    inline ushort readWORD(File *file, bool *ok = 0)
+    inline unsigned short readWORD(File *file, bool *ok = 0)
     {
       const ByteVector v = file->readBlock(2);
       if(v.size() != 2) {
index 51ad8ac1afdc7720597c2fc2f56c816166b4bc34..7508cfcbf76c87cf2f895450d877da883017a619 100644 (file)
@@ -96,9 +96,9 @@ bool IT::File::save()
 
   seek(2, Current);
 
-  ushort length = 0;
-  ushort instrumentCount = 0;
-  ushort sampleCount = 0;
+  unsigned short length = 0;
+  unsigned short instrumentCount = 0;
+  unsigned short sampleCount = 0;
 
   if(!readU16L(length) || !readU16L(instrumentCount) || !readU16L(sampleCount))
     return false;
@@ -107,7 +107,7 @@ bool IT::File::save()
 
   // write comment as instrument and sample names:
   StringList lines = d->tag.comment().split("\n");
-  for(ushort i = 0; i < instrumentCount; ++ i) {
+  for(unsigned short i = 0; i < instrumentCount; ++ i) {
     seek(192L + length + ((long)i << 2));
     ulong instrumentOffset = 0;
     if(!readU32L(instrumentOffset))
@@ -122,7 +122,7 @@ bool IT::File::save()
     writeByte(0);
   }
 
-  for(ushort i = 0; i < sampleCount; ++ i) {
+  for(unsigned short i = 0; i < sampleCount; ++ i) {
     seek(192L + length + ((long)instrumentCount << 2) + ((long)i << 2));
     ulong sampleOffset = 0;
     if(!readU32L(sampleOffset))
@@ -149,8 +149,8 @@ bool IT::File::save()
     message.resize(7999);
   message.append((char)0);
 
-  ushort special = 0;
-  ushort messageLength = 0;
+  unsigned short special = 0;
+  unsigned short messageLength = 0;
   ulong  messageOffset = 0;
 
   seek(46);
@@ -259,8 +259,8 @@ void IT::File::read(bool)
   d->properties.setChannels(channels);
 
   // real length might be shorter because of skips and terminator
-  ushort realLength = 0;
-  for(ushort i = 0; i < length; ++ i) {
+  unsigned short realLength = 0;
+  for(unsigned short i = 0; i < length; ++ i) {
     READ_BYTE_AS(order);
     if(order == 255) break;
     if(order != 254) ++ realLength;
@@ -274,7 +274,7 @@ void IT::File::read(bool)
   //       Currently I just discard anything after a nil, but
   //       e.g. VLC seems to interprete a nil as a space. I
   //       don't know what is the proper behaviour.
-  for(ushort i = 0; i < instrumentCount; ++ i) {
+  for(unsigned short i = 0; i < instrumentCount; ++ i) {
     seek(192L + length + ((long)i << 2));
     READ_U32L_AS(instrumentOffset);
     seek(instrumentOffset);
@@ -290,7 +290,7 @@ void IT::File::read(bool)
     comment.append(instrumentName);
   }
 
-  for(ushort i = 0; i < sampleCount; ++ i) {
+  for(unsigned short i = 0; i < sampleCount; ++ i) {
     seek(192L + length + ((long)instrumentCount << 2) + ((long)i << 2));
     READ_U32L_AS(sampleOffset);
 
index 8b1fc43c02f45ecdb93cf9f12144a8b436734268..426a6f2d3bf2d05d92749cff8ad003110f880924 100644 (file)
@@ -46,15 +46,15 @@ public:
   {
   }
 
-  int    channels;
-  ushort lengthInPatterns;
-  ushort instrumentCount;
-  ushort sampleCount;
-  ushort patternCount;
-  ushort version;
-  ushort compatibleVersion;
-  ushort flags;
-  ushort special;
+  int            channels;
+  unsigned short lengthInPatterns;
+  unsigned short instrumentCount;
+  unsigned short sampleCount;
+  unsigned short patternCount;
+  unsigned short version;
+  unsigned short compatibleVersion;
+  unsigned short flags;
+  unsigned short special;
   unsigned char  globalVolume;
   unsigned char  mixVolume;
   unsigned char  tempo;
@@ -104,7 +104,7 @@ int IT::Properties::channels() const
   return d->channels;
 }
 
-TagLib::ushort IT::Properties::lengthInPatterns() const
+unsigned short IT::Properties::lengthInPatterns() const
 {
   return d->lengthInPatterns;
 }
@@ -114,37 +114,37 @@ bool IT::Properties::stereo() const
   return d->flags & Stereo;
 }
 
-TagLib::ushort IT::Properties::instrumentCount() const
+unsigned short IT::Properties::instrumentCount() const
 {
   return d->instrumentCount;
 }
 
-TagLib::ushort IT::Properties::sampleCount() const
+unsigned short IT::Properties::sampleCount() const
 {
   return d->sampleCount;
 }
 
-TagLib::ushort IT::Properties::patternCount() const
+unsigned short IT::Properties::patternCount() const
 {
   return d->patternCount;
 }
 
-TagLib::ushort IT::Properties::version() const
+unsigned short IT::Properties::version() const
 {
   return d->version;
 }
 
-TagLib::ushort IT::Properties::compatibleVersion() const
+unsigned short IT::Properties::compatibleVersion() const
 {
   return d->compatibleVersion;
 }
 
-TagLib::ushort IT::Properties::flags() const
+unsigned short IT::Properties::flags() const
 {
   return d->flags;
 }
 
-TagLib::ushort IT::Properties::special() const
+unsigned short IT::Properties::special() const
 {
   return d->special;
 }
@@ -184,42 +184,42 @@ void IT::Properties::setChannels(int channels)
   d->channels = channels;
 }
 
-void IT::Properties::setLengthInPatterns(ushort lengthInPatterns)
+void IT::Properties::setLengthInPatterns(unsigned short lengthInPatterns)
 {
   d->lengthInPatterns = lengthInPatterns;
 }
 
-void IT::Properties::setInstrumentCount(ushort instrumentCount)
+void IT::Properties::setInstrumentCount(unsigned short instrumentCount)
 {
   d->instrumentCount = instrumentCount;
 }
 
-void IT::Properties::setSampleCount(ushort sampleCount)
+void IT::Properties::setSampleCount(unsigned short sampleCount)
 {
   d->sampleCount = sampleCount;
 }
 
-void IT::Properties::setPatternCount(ushort patternCount)
+void IT::Properties::setPatternCount(unsigned short patternCount)
 {
   d->patternCount = patternCount;
 }
 
-void IT::Properties::setFlags(ushort flags)
+void IT::Properties::setFlags(unsigned short flags)
 {
   d->flags = flags;
 }
 
-void IT::Properties::setSpecial(ushort special)
+void IT::Properties::setSpecial(unsigned short special)
 {
   d->special = special;
 }
 
-void IT::Properties::setCompatibleVersion(ushort compatibleVersion)
+void IT::Properties::setCompatibleVersion(unsigned short compatibleVersion)
 {
   d->compatibleVersion = compatibleVersion;
 }
 
-void IT::Properties::setVersion(ushort version)
+void IT::Properties::setVersion(unsigned short version)
 {
   d->version = version;
 }
index e2da6e66d0acdee64cd9585ada52336eee3a367b..d65a8c28e7823303d94df7c08e9cc0dddb19152f 100644 (file)
@@ -58,15 +58,15 @@ namespace TagLib {
       int sampleRate()           const;
       int channels()             const;
 
-      ushort lengthInPatterns()  const;
-      bool   stereo()            const;
-      ushort instrumentCount()   const;
-      ushort sampleCount()       const;
-      ushort patternCount()      const;
-      ushort version()           const;
-      ushort compatibleVersion() const;
-      ushort flags()             const;
-      ushort special()           const;
+      unsigned short lengthInPatterns()  const;
+      bool           stereo()            const;
+      unsigned short instrumentCount()   const;
+      unsigned short sampleCount()       const;
+      unsigned short patternCount()      const;
+      unsigned short version()           const;
+      unsigned short compatibleVersion() const;
+      unsigned short flags()             const;
+      unsigned short special()           const;
       unsigned char  globalVolume()      const;
       unsigned char  mixVolume()         const;
       unsigned char  tempo()             const;
@@ -75,14 +75,14 @@ namespace TagLib {
       unsigned char  pitchWheelDepth()   const;
 
       void setChannels(int channels);
-      void setLengthInPatterns(ushort lengthInPatterns);
-      void setInstrumentCount(ushort instrumentCount);
-      void setSampleCount (ushort sampleCount);
-      void setPatternCount(ushort patternCount);
-      void setVersion     (ushort version);
-      void setCompatibleVersion(ushort compatibleVersion);
-      void setFlags       (ushort flags);
-      void setSpecial     (ushort special);
+      void setLengthInPatterns(unsigned short lengthInPatterns);
+      void setInstrumentCount(unsigned short instrumentCount);
+      void setSampleCount (unsigned short sampleCount);
+      void setPatternCount(unsigned short patternCount);
+      void setVersion     (unsigned short version);
+      void setCompatibleVersion(unsigned short compatibleVersion);
+      void setFlags       (unsigned short flags);
+      void setSpecial     (unsigned short special);
       void setGlobalVolume(unsigned char globalVolume);
       void setMixVolume   (unsigned char mixVolume);
       void setTempo       (unsigned char tempo);
index a73e9367f9835d8e2d6a36168ee3cd72c092c843..2ed16ae7fa8272dda1370088eed12238e1a3f3a4 100644 (file)
@@ -61,7 +61,7 @@ void Mod::FileBase::writeByte(unsigned char byte)
   writeBlock(data);
 }
 
-void Mod::FileBase::writeU16L(ushort number)
+void Mod::FileBase::writeU16L(unsigned short number)
 {
   writeBlock(ByteVector::fromShort(number, false));
 }
@@ -71,7 +71,7 @@ void Mod::FileBase::writeU32L(ulong number)
   writeBlock(ByteVector::fromUInt(number, false));
 }
 
-void Mod::FileBase::writeU16B(ushort number)
+void Mod::FileBase::writeU16B(unsigned short number)
 {
   writeBlock(ByteVector::fromShort(number, true));
 }
@@ -89,7 +89,7 @@ bool Mod::FileBase::readByte(unsigned char &byte)
   return true;
 }
 
-bool Mod::FileBase::readU16L(ushort &number)
+bool Mod::FileBase::readU16L(unsigned short &number)
 {
   ByteVector data(readBlock(2));
   if(data.size() < 2) return false;
@@ -104,7 +104,7 @@ bool Mod::FileBase::readU32L(ulong &number) {
   return true;
 }
 
-bool Mod::FileBase::readU16B(ushort &number)
+bool Mod::FileBase::readU16B(unsigned short &number)
 {
   ByteVector data(readBlock(2));
   if(data.size() < 2) return false;
index 8b483d3820c60c2d0a6e680a53abb72210e78359..82f3122b0ab8fed76ba0afb1d77041b7b44c885d 100644 (file)
@@ -42,16 +42,16 @@ namespace TagLib {
 
       void writeString(const String &s, ulong size, char padding = 0);
       void writeByte(unsigned char byte);
-      void writeU16L(ushort number);
+      void writeU16L(unsigned short number);
       void writeU32L(ulong number);
-      void writeU16B(ushort number);
+      void writeU16B(unsigned short number);
       void writeU32B(ulong number);
 
       bool readString(String &s, ulong size);
       bool readByte(unsigned char &byte);
-      bool readU16L(ushort &number);
+      bool readU16L(unsigned short &number);
       bool readU32L(ulong &number);
-      bool readU16B(ushort &number);
+      bool readU16B(unsigned short &number);
       bool readU32B(ulong &number);
     };
 
index 7aa52db1fa4a2dae62813d174e4ce26a6b36ec3d..a4fc8d3319745ec3b287219be6db60e4afcf20d4 100644 (file)
@@ -38,9 +38,9 @@
   }
 
 #define READ_BYTE(setter) READ(setter,unsigned char,readByte)
-#define READ_U16L(setter) READ(setter,ushort,readU16L)
+#define READ_U16L(setter) READ(setter,unsigned short,readU16L)
 #define READ_U32L(setter) READ(setter,ulong,readU32L)
-#define READ_U16B(setter) READ(setter,ushort,readU16B)
+#define READ_U16B(setter) READ(setter,unsigned short,readU16B)
 #define READ_U32B(setter) READ(setter,ulong,readU32B)
 
 #define READ_STRING(setter,size) \
@@ -55,9 +55,9 @@
   READ_ASSERT(read(name));
 
 #define READ_BYTE_AS(name) READ_AS(unsigned char,name,readByte)
-#define READ_U16L_AS(name) READ_AS(ushort,name,readU16L)
+#define READ_U16L_AS(name) READ_AS(unsigned short,name,readU16L)
 #define READ_U32L_AS(name) READ_AS(ulong,name,readU32L)
-#define READ_U16B_AS(name) READ_AS(ushort,name,readU16B)
+#define READ_U16B_AS(name) READ_AS(unsigned short,name,readU16B)
 #define READ_U32B_AS(name) READ_AS(ulong,name,readU32B)
 
 #define READ_STRING_AS(name,size) \
index 9437f22e0e48ba622522a46ca03f075090536254..9c1274ebfbb988b1440610df002b4523ff23ab50 100644 (file)
@@ -253,7 +253,7 @@ void MPC::Properties::readSV8(File *file, long streamLength)
         break;
       }
 
-      const ushort flags = data.toUShort(pos, true);
+      const unsigned short flags = data.toUShort(pos, true);
       pos += 2;
 
       d->sampleRate = sftable[(flags >> 13) & 0x07];
index 2ab464819b069db0c0262301268bc044054dfa8d..1d42e1c8aed4a6014debf64a5f36f34cd6c9dd40 100644 (file)
@@ -171,7 +171,7 @@ void SynchronizedLyricsFrame::parseFields(const ByteVector &data)
    */
   String::Type encWithEndianness = d->textEncoding;
   if(d->textEncoding == String::UTF16) {
-    ushort bom = data.toUShort(6, true);
+    unsigned short bom = data.toUShort(6, true);
     if(bom == 0xfffe) {
       encWithEndianness = String::UTF16LE;
     } else if(bom == 0xfeff) {
@@ -184,7 +184,7 @@ void SynchronizedLyricsFrame::parseFields(const ByteVector &data)
     String::Type enc = d->textEncoding;
     // If a UTF16 string has no BOM, use the encoding found above.
     if(enc == String::UTF16 && pos + 1 < end) {
-      ushort bom = data.toUShort(pos, true);
+      unsigned short bom = data.toUShort(pos, true);
       if(bom != 0xfffe && bom != 0xfeff) {
         enc = encWithEndianness;
       }
index 365658f8b16f2df791818bcdf0a7605372838e17..43858da63f79174aa3edaa8a30505cc4852b9177 100644 (file)
@@ -138,7 +138,7 @@ void Opus::Properties::read(File *file)
   pos += 1;
 
   // *Pre-skip* (16 bits, unsigned, little endian)
-  const ushort preSkip = data.toUShort(pos, false);
+  const unsigned short preSkip = data.toUShort(pos, false);
   pos += 2;
 
   // *Input Sample Rate* (32 bits, unsigned, little endian)
index c83e09d7f07d8a7de2bf1a4d7251798591cb4018..923a80adc850d3c046cfb27d8d655f4faef8dfa4 100644 (file)
@@ -100,8 +100,8 @@ bool S3M::File::save()
 
   seek(32);
 
-  ushort length = 0;
-  ushort sampleCount = 0;
+  unsigned short length = 0;
+  unsigned short sampleCount = 0;
 
   if(!readU16L(length) || !readU16L(sampleCount))
     return false;
@@ -123,10 +123,10 @@ bool S3M::File::save()
 
   StringList lines = d->tag.comment().split("\n");
   // write comment as sample names:
-  for(ushort i = 0; i < sampleCount; ++ i) {
+  for(unsigned short i = 0; i < sampleCount; ++ i) {
     seek(96L + length + ((long)i << 1));
 
-    ushort instrumentOffset = 0;
+    unsigned short instrumentOffset = 0;
     if(!readU16L(instrumentOffset))
       return false;
     seek(((long)instrumentOffset << 4) + 48);
@@ -193,8 +193,8 @@ void S3M::File::read(bool)
   d->properties.setChannels(channels);
 
   seek(96);
-  ushort realLength = 0;
-  for(ushort i = 0; i < length; ++ i) {
+  unsigned short realLength = 0;
+  for(unsigned short i = 0; i < length; ++ i) {
     READ_BYTE_AS(order);
     if(order == 255) break;
     if(order != 254) ++ realLength;
@@ -208,7 +208,7 @@ void S3M::File::read(bool)
   //       However, there I never found instruments (SCRI) but
   //       instead samples (SCRS).
   StringList comment;
-  for(ushort i = 0; i < sampleCount; ++ i) {
+  for(unsigned short i = 0; i < sampleCount; ++ i) {
     seek(96L + length + ((long)i << 1));
 
     READ_U16L_AS(sampleHeaderOffset);
index de2d1ebe5208b6b13d48a2ac6c9ba8e08e118915..9633a0feb44f10f042dd17ea3b0fe1aae9b5142a 100644 (file)
@@ -43,14 +43,14 @@ public:
   {
   }
 
-  ushort lengthInPatterns;
-  int    channels;
-  bool   stereo;
-  ushort sampleCount;
-  ushort patternCount;
-  ushort flags;
-  ushort trackerVersion;
-  ushort fileFormatVersion;
+  unsigned short lengthInPatterns;
+  int            channels;
+  bool           stereo;
+  unsigned short sampleCount;
+  unsigned short patternCount;
+  unsigned short flags;
+  unsigned short trackerVersion;
+  unsigned short fileFormatVersion;
   unsigned char  globalVolume;
   unsigned char  masterVolume;
   unsigned char  tempo;
@@ -98,7 +98,7 @@ int S3M::Properties::channels() const
   return d->channels;
 }
 
-TagLib::ushort S3M::Properties::lengthInPatterns() const
+unsigned short S3M::Properties::lengthInPatterns() const
 {
   return d->lengthInPatterns;
 }
@@ -108,27 +108,27 @@ bool S3M::Properties::stereo() const
   return d->stereo;
 }
 
-TagLib::ushort S3M::Properties::sampleCount() const
+unsigned short S3M::Properties::sampleCount() const
 {
   return d->sampleCount;
 }
 
-TagLib::ushort S3M::Properties::patternCount() const
+unsigned short S3M::Properties::patternCount() const
 {
   return d->patternCount;
 }
 
-TagLib::ushort S3M::Properties::flags() const
+unsigned short S3M::Properties::flags() const
 {
   return d->flags;
 }
 
-TagLib::ushort S3M::Properties::trackerVersion() const
+unsigned short S3M::Properties::trackerVersion() const
 {
   return d->trackerVersion;
 }
 
-TagLib::ushort S3M::Properties::fileFormatVersion() const
+unsigned short S3M::Properties::fileFormatVersion() const
 {
   return d->fileFormatVersion;
 }
@@ -153,7 +153,7 @@ unsigned char S3M::Properties::bpmSpeed() const
   return d->bpmSpeed;
 }
 
-void S3M::Properties::setLengthInPatterns(ushort lengthInPatterns)
+void S3M::Properties::setLengthInPatterns(unsigned short lengthInPatterns)
 {
   d->lengthInPatterns = lengthInPatterns;
 }
@@ -168,27 +168,27 @@ void S3M::Properties::setStereo(bool stereo)
   d->stereo = stereo;
 }
 
-void S3M::Properties::setSampleCount(ushort sampleCount)
+void S3M::Properties::setSampleCount(unsigned short sampleCount)
 {
   d->sampleCount = sampleCount;
 }
 
-void S3M::Properties::setPatternCount(ushort patternCount)
+void S3M::Properties::setPatternCount(unsigned short patternCount)
 {
   d->patternCount = patternCount;
 }
 
-void S3M::Properties::setFlags(ushort flags)
+void S3M::Properties::setFlags(unsigned short flags)
 {
   d->flags = flags;
 }
 
-void S3M::Properties::setTrackerVersion(ushort trackerVersion)
+void S3M::Properties::setTrackerVersion(unsigned short trackerVersion)
 {
   d->trackerVersion = trackerVersion;
 }
 
-void S3M::Properties::setFileFormatVersion(ushort fileFormatVersion)
+void S3M::Properties::setFileFormatVersion(unsigned short fileFormatVersion)
 {
   d->fileFormatVersion = fileFormatVersion;
 }
index f77d22040f6691ed571d107b19e0b45a116182b8..4b14e97ff90ce4454c55f190a3ed34cceca3fd80 100644 (file)
@@ -51,13 +51,13 @@ namespace TagLib {
       int sampleRate()           const;
       int channels()             const;
 
-      ushort lengthInPatterns()  const;
-      bool   stereo()            const;
-      ushort sampleCount()       const;
-      ushort patternCount()      const;
-      ushort flags()             const;
-      ushort trackerVersion()    const;
-      ushort fileFormatVersion() const;
+      unsigned short lengthInPatterns()  const;
+      bool           stereo()            const;
+      unsigned short sampleCount()       const;
+      unsigned short patternCount()      const;
+      unsigned short flags()             const;
+      unsigned short trackerVersion()    const;
+      unsigned short fileFormatVersion() const;
       unsigned char  globalVolume()      const;
       unsigned char  masterVolume()      const;
       unsigned char  tempo()             const;
@@ -65,13 +65,13 @@ namespace TagLib {
 
       void setChannels(int channels);
 
-      void setLengthInPatterns (ushort lengthInPatterns);
+      void setLengthInPatterns (unsigned short lengthInPatterns);
       void setStereo           (bool stereo);
-      void setSampleCount      (ushort sampleCount);
-      void setPatternCount     (ushort patternCount);
-      void setFlags            (ushort flags);
-      void setTrackerVersion   (ushort trackerVersion);
-      void setFileFormatVersion(ushort fileFormatVersion);
+      void setSampleCount      (unsigned short sampleCount);
+      void setPatternCount     (unsigned short patternCount);
+      void setFlags            (unsigned short flags);
+      void setTrackerVersion   (unsigned short trackerVersion);
+      void setFileFormatVersion(unsigned short fileFormatVersion);
       void setGlobalVolume     (unsigned char globalVolume);
       void setMasterVolume     (unsigned char masterVolume);
       void setTempo            (unsigned char tempo);
index 71bcb43ac65c33e0ad6158729dad9627af185bed..6aff6423a994b606e55a9f01fdb8ca64ec041e98 100644 (file)
@@ -364,7 +364,7 @@ ByteVector ByteVector::fromUInt(uint value, bool mostSignificantByteFirst)
 
 ByteVector ByteVector::fromShort(short value, bool mostSignificantByteFirst)
 {
-  return fromNumber<ushort>(value, mostSignificantByteFirst);
+  return fromNumber<unsigned short>(value, mostSignificantByteFirst);
 }
 
 ByteVector ByteVector::fromLongLong(long long value, bool mostSignificantByteFirst)
index f9884da70ed4f82b694f8f16d6519b7f7fb14bf4..6ad805281bbb1a6920919b9cbc8a520c6f13ac2b 100644 (file)
@@ -174,7 +174,7 @@ namespace
     if(length > 0) {
       if(swap) {
         for(size_t i = 0; i < length; ++i)
-          data[i] = Utils::byteSwap(static_cast<TagLib::ushort>(s[i]));
+          data[i] = Utils::byteSwap(static_cast<unsigned short>(s[i]));
       }
       else {
         ::wmemcpy(&data[0], s, length);
@@ -194,7 +194,7 @@ namespace
       }
 
       // Uses memcpy instead of reinterpret_cast to avoid an alignment exception.
-      TagLib::ushort bom;
+      unsigned short bom;
       ::memcpy(&bom, s, 2);
 
       if(bom == 0xfeff)
@@ -215,7 +215,7 @@ namespace
 
     data.resize(length / 2);
     for(size_t i = 0; i < length / 2; ++i) {
-      TagLib::ushort c;
+      unsigned short c;
       ::memcpy(&c, s, 2);
       if(swap)
         c = Utils::byteSwap(c);
index 9855ed91b2286e76c4da6cb11ba88c5b2dd7ad98..4e2c13ce76e9c542a1a074c1a06c0d3b82c8112a 100644 (file)
@@ -59,7 +59,7 @@ namespace TagLib
     /*!
      * Reverses the order of bytes in an 16-bit integer.
      */
-    inline ushort byteSwap(ushort x)
+    inline unsigned short byteSwap(unsigned short x)
     {
 #if defined(HAVE_BOOST_BYTESWAP)
 
index fc337ba4f0bcab211b78504b4d22684321a57095..7fa032c750e11775171d45c82facd2c7226dfd8b 100644 (file)
@@ -31,7 +31,6 @@
 using namespace TagLib;
 using namespace XM;
 using TagLib::uint;
-using TagLib::ushort;
 using TagLib::ulong;
 
 /*!
@@ -180,11 +179,11 @@ protected:
   bool bigEndian;
 };
 
-class U16Reader : public NumberReader<ushort>
+class U16Reader : public NumberReader<unsigned short>
 {
 public:
-  U16Reader(ushort &value, bool bigEndian)
-  : NumberReader<ushort>(value, bigEndian) {}
+  U16Reader(unsigned short &value, bool bigEndian)
+  : NumberReader<unsigned short>(value, bigEndian) {}
 
   uint read(TagLib::File &file, uint limit)
   {
@@ -268,7 +267,7 @@ public:
    * Read a unsigned 16 Bit integer into \a number. The byte order
    * is controlled by \a bigEndian.
    */
-  StructReader &u16(ushort &number, bool bigEndian)
+  StructReader &u16(unsigned short &number, bool bigEndian)
   {
     m_readers.append(new U16Reader(number, bigEndian));
     return *this;
@@ -277,7 +276,7 @@ public:
   /*!
    * Read a unsigned 16 Bit little endian integer into \a number.
    */
-  StructReader &u16L(ushort &number)
+  StructReader &u16L(unsigned short &number)
   {
     return u16(number, false);
   }
@@ -285,7 +284,7 @@ public:
   /*!
    * Read a unsigned 16 Bit big endian integer into \a number.
    */
-  StructReader &u16B(ushort &number)
+  StructReader &u16B(unsigned short &number)
   {
     return u16(number, true);
   }
@@ -416,22 +415,22 @@ bool XM::File::save()
     return false;
 
   seek(70);
-  ushort patternCount = 0;
-  ushort instrumentCount = 0;
+  unsigned short patternCount = 0;
+  unsigned short instrumentCount = 0;
   if(!readU16L(patternCount) || !readU16L(instrumentCount))
     return false;
 
   long pos = 60 + headerSize; // should be long long in taglib2.
 
   // need to read patterns again in order to seek to the instruments:
-  for(ushort i = 0; i < patternCount; ++ i) {
+  for(unsigned short i = 0; i < patternCount; ++ i) {
     seek(pos);
     ulong patternHeaderLength = 0;
     if(!readU32L(patternHeaderLength) || patternHeaderLength < 4)
       return false;
 
     seek(pos + 7);
-    ushort dataSize = 0;
+    unsigned short dataSize = 0;
     if (!readU16L(dataSize))
       return false;
 
@@ -440,7 +439,7 @@ bool XM::File::save()
 
   const StringList lines = d->tag.comment().split("\n");
   uint sampleNameIndex = instrumentCount;
-  for(ushort i = 0; i < instrumentCount; ++ i) {
+  for(unsigned short i = 0; i < instrumentCount; ++ i) {
     seek(pos);
     ulong instrumentHeaderSize = 0;
     if(!readU32L(instrumentHeaderSize) || instrumentHeaderSize < 4)
@@ -453,7 +452,7 @@ bool XM::File::save()
     else
       writeString(lines[i], len);
 
-    ushort sampleCount = 0;
+    unsigned short sampleCount = 0;
     if(instrumentHeaderSize >= 29U) {
       seek(pos + 27);
       if(!readU16L(sampleCount))
@@ -469,7 +468,7 @@ bool XM::File::save()
 
     pos += instrumentHeaderSize;
 
-    for(ushort j = 0; j < sampleCount; ++ j) {
+    for(unsigned short j = 0; j < sampleCount; ++ j) {
       if(sampleHeaderSize > 4U) {
         seek(pos);
         ulong sampleLength = 0;
@@ -513,14 +512,14 @@ void XM::File::read(bool)
   READ_U32L_AS(headerSize);
   READ_ASSERT(headerSize >= 4);
 
-  ushort length          = 0;
-  ushort restartPosition = 0;
-  ushort channels        = 0;
-  ushort patternCount    = 0;
-  ushort instrumentCount = 0;
-  ushort flags    = 0;
-  ushort tempo    = 0;
-  ushort bpmSpeed = 0;
+  unsigned short length          = 0;
+  unsigned short restartPosition = 0;
+  unsigned short channels        = 0;
+  unsigned short patternCount    = 0;
+  unsigned short instrumentCount = 0;
+  unsigned short flags    = 0;
+  unsigned short tempo    = 0;
+  unsigned short bpmSpeed = 0;
 
   StructReader header;
   header.u16L(length)
@@ -549,13 +548,13 @@ void XM::File::read(bool)
   seek(60 + headerSize);
 
   // read patterns:
-  for(ushort i = 0; i < patternCount; ++ i) {
+  for(unsigned short i = 0; i < patternCount; ++ i) {
     READ_U32L_AS(patternHeaderLength);
     READ_ASSERT(patternHeaderLength >= 4);
 
     unsigned char  packingType = 0;
-    ushort rowCount = 0;
-    ushort dataSize = 0;
+    unsigned short rowCount = 0;
+    unsigned short dataSize = 0;
     StructReader pattern;
     pattern.byte(packingType).u16L(rowCount).u16L(dataSize);
 
@@ -570,13 +569,13 @@ void XM::File::read(bool)
   uint sumSampleCount = 0;
 
   // read instruments:
-  for(ushort i = 0; i < instrumentCount; ++ i) {
+  for(unsigned short i = 0; i < instrumentCount; ++ i) {
     READ_U32L_AS(instrumentHeaderSize);
     READ_ASSERT(instrumentHeaderSize >= 4);
 
     String instrumentName;
     unsigned char  instrumentType = 0;
-    ushort sampleCount = 0;
+    unsigned short sampleCount = 0;
 
     StructReader instrument;
     instrument.string(instrumentName, 22).byte(instrumentType).u16L(sampleCount);
@@ -594,7 +593,7 @@ void XM::File::read(bool)
       // skip unhandeled header proportion:
       seek(instrumentHeaderSize - count - 4, Current);
 
-      for(ushort j = 0; j < sampleCount; ++ j) {
+      for(unsigned short j = 0; j < sampleCount; ++ j) {
         ulong sampleLength = 0;
         ulong loopStart    = 0;
         ulong loopLength   = 0;
index 3d4a3c3827ac2f40aaabfc6e6efc1eea04acfb01..9a7fa6b25ed7a992cfb33e48a83dab024cf1a0e2 100644 (file)
@@ -41,16 +41,16 @@ public:
   {
   }
 
-  ushort lengthInPatterns;
-  int    channels;
-  ushort version;
-  ushort restartPosition;
-  ushort patternCount;
-  ushort instrumentCount;
+  unsigned short lengthInPatterns;
+  int            channels;
+  unsigned short version;
+  unsigned short restartPosition;
+  unsigned short patternCount;
+  unsigned short instrumentCount;
   uint   sampleCount;
-  ushort flags;
-  ushort tempo;
-  ushort bpmSpeed;
+  unsigned short flags;
+  unsigned short tempo;
+  unsigned short bpmSpeed;
 };
 
 XM::Properties::Properties(AudioProperties::ReadStyle propertiesStyle) :
@@ -94,27 +94,27 @@ int XM::Properties::channels() const
   return d->channels;
 }
 
-TagLib::ushort XM::Properties::lengthInPatterns() const
+unsigned short XM::Properties::lengthInPatterns() const
 {
   return d->lengthInPatterns;
 }
 
-TagLib::ushort XM::Properties::version() const
+unsigned short XM::Properties::version() const
 {
   return d->version;
 }
 
-TagLib::ushort XM::Properties::restartPosition() const
+unsigned short XM::Properties::restartPosition() const
 {
   return d->restartPosition;
 }
 
-TagLib::ushort XM::Properties::patternCount() const
+unsigned short XM::Properties::patternCount() const
 {
   return d->patternCount;
 }
 
-TagLib::ushort XM::Properties::instrumentCount() const
+unsigned short XM::Properties::instrumentCount() const
 {
   return d->instrumentCount;
 }
@@ -124,22 +124,22 @@ TagLib::uint XM::Properties::sampleCount() const
   return d->sampleCount;
 }
 
-TagLib::ushort XM::Properties::flags() const
+unsigned short XM::Properties::flags() const
 {
   return d->flags;
 }
 
-TagLib::ushort XM::Properties::tempo() const
+unsigned short XM::Properties::tempo() const
 {
   return d->tempo;
 }
 
-TagLib::ushort XM::Properties::bpmSpeed() const
+unsigned short XM::Properties::bpmSpeed() const
 {
   return d->bpmSpeed;
 }
 
-void XM::Properties::setLengthInPatterns(ushort lengthInPatterns)
+void XM::Properties::setLengthInPatterns(unsigned short lengthInPatterns)
 {
   d->lengthInPatterns = lengthInPatterns;
 }
@@ -149,22 +149,22 @@ void XM::Properties::setChannels(int channels)
   d->channels = channels;
 }
 
-void XM::Properties::setVersion(ushort version)
+void XM::Properties::setVersion(unsigned short version)
 {
   d->version = version;
 }
 
-void XM::Properties::setRestartPosition(ushort restartPosition)
+void XM::Properties::setRestartPosition(unsigned short restartPosition)
 {
   d->restartPosition = restartPosition;
 }
 
-void XM::Properties::setPatternCount(ushort patternCount)
+void XM::Properties::setPatternCount(unsigned short patternCount)
 {
   d->patternCount = patternCount;
 }
 
-void XM::Properties::setInstrumentCount(ushort instrumentCount)
+void XM::Properties::setInstrumentCount(unsigned short instrumentCount)
 {
   d->instrumentCount = instrumentCount;
 }
@@ -174,17 +174,17 @@ void XM::Properties::setSampleCount(uint sampleCount)
   d->sampleCount = sampleCount;
 }
 
-void XM::Properties::setFlags(ushort flags)
+void XM::Properties::setFlags(unsigned short flags)
 {
   d->flags = flags;
 }
 
-void XM::Properties::setTempo(ushort tempo)
+void XM::Properties::setTempo(unsigned short tempo)
 {
   d->tempo = tempo;
 }
 
-void XM::Properties::setBpmSpeed(ushort bpmSpeed)
+void XM::Properties::setBpmSpeed(unsigned short bpmSpeed)
 {
   d->bpmSpeed = bpmSpeed;
 }
index f929982baedf4454e648da53c3e9134c8525c9d3..4fdf8b4bb56901439971f9320e21839156834b72 100644 (file)
@@ -46,27 +46,27 @@ namespace TagLib {
       int sampleRate()           const;
       int channels()             const;
 
-      ushort lengthInPatterns() const;
-      ushort version()          const;
-      ushort restartPosition()  const;
-      ushort patternCount()     const;
-      ushort instrumentCount()  const;
+      unsigned short lengthInPatterns() const;
+      unsigned short version()          const;
+      unsigned short restartPosition()  const;
+      unsigned short patternCount()     const;
+      unsigned short instrumentCount()  const;
       uint   sampleCount()      const;
-      ushort flags()            const;
-      ushort tempo()            const;
-      ushort bpmSpeed()         const;
+      unsigned short flags()            const;
+      unsigned short tempo()            const;
+      unsigned short bpmSpeed()         const;
 
       void setChannels(int channels);
 
-      void setLengthInPatterns(ushort lengthInPatterns);
-      void setVersion(ushort version);
-      void setRestartPosition(ushort restartPosition);
-      void setPatternCount(ushort patternCount);
-      void setInstrumentCount(ushort instrumentCount);
+      void setLengthInPatterns(unsigned short lengthInPatterns);
+      void setVersion(unsigned short version);
+      void setRestartPosition(unsigned short restartPosition);
+      void setPatternCount(unsigned short patternCount);
+      void setInstrumentCount(unsigned short instrumentCount);
       void setSampleCount(uint sampleCount);
-      void setFlags(ushort flags);
-      void setTempo(ushort tempo);
-      void setBpmSpeed(ushort bpmSpeed);
+      void setFlags(unsigned short flags);
+      void setTempo(unsigned short tempo);
+      void setBpmSpeed(unsigned short bpmSpeed);
 
     private:
       Properties(const Properties&);
index 7bb9084b91d05c34b99943afe7989c8f7206b764..24cfb1a61a4ea2115fa8f4e626dc3269530fe925 100644 (file)
@@ -108,14 +108,14 @@ private:
     CPPUNIT_ASSERT_EQUAL( 0, p->bitrate());
     CPPUNIT_ASSERT_EQUAL( 0, p->sampleRate());
     CPPUNIT_ASSERT_EQUAL(64, p->channels());
-    CPPUNIT_ASSERT_EQUAL((TagLib::ushort)  0, p->lengthInPatterns());
+    CPPUNIT_ASSERT_EQUAL((unsigned short)  0, p->lengthInPatterns());
     CPPUNIT_ASSERT_EQUAL(true, p->stereo());
-    CPPUNIT_ASSERT_EQUAL((TagLib::ushort)  0, p->instrumentCount());
-    CPPUNIT_ASSERT_EQUAL((TagLib::ushort)  5, p->sampleCount());
-    CPPUNIT_ASSERT_EQUAL((TagLib::ushort)  1, p->patternCount());
-    CPPUNIT_ASSERT_EQUAL((TagLib::ushort)535, p->version());
-    CPPUNIT_ASSERT_EQUAL((TagLib::ushort)532, p->compatibleVersion());
-    CPPUNIT_ASSERT_EQUAL((TagLib::ushort)  9, p->flags());
+    CPPUNIT_ASSERT_EQUAL((unsigned short)  0, p->instrumentCount());
+    CPPUNIT_ASSERT_EQUAL((unsigned short)  5, p->sampleCount());
+    CPPUNIT_ASSERT_EQUAL((unsigned short)  1, p->patternCount());
+    CPPUNIT_ASSERT_EQUAL((unsigned short)535, p->version());
+    CPPUNIT_ASSERT_EQUAL((unsigned short)532, p->compatibleVersion());
+    CPPUNIT_ASSERT_EQUAL((unsigned short)  9, p->flags());
     CPPUNIT_ASSERT_EQUAL((unsigned char)128, p->globalVolume());
     CPPUNIT_ASSERT_EQUAL((unsigned char) 48, p->mixVolume());
     CPPUNIT_ASSERT_EQUAL((unsigned char)125, p->tempo());
index 41579d3c60ec6b9e4ed8b4ec273ce5922651c06a..8133e2159c3b07caa440e30a519379405e4df91e 100644 (file)
@@ -98,13 +98,13 @@ private:
     CPPUNIT_ASSERT_EQUAL( 0, p->bitrate());
     CPPUNIT_ASSERT_EQUAL( 0, p->sampleRate());
     CPPUNIT_ASSERT_EQUAL(16, p->channels());
-    CPPUNIT_ASSERT_EQUAL((TagLib::ushort)   0, p->lengthInPatterns());
+    CPPUNIT_ASSERT_EQUAL((unsigned short)   0, p->lengthInPatterns());
     CPPUNIT_ASSERT_EQUAL(false, p->stereo());
-    CPPUNIT_ASSERT_EQUAL((TagLib::ushort)   5, p->sampleCount());
-    CPPUNIT_ASSERT_EQUAL((TagLib::ushort)   1, p->patternCount());
-    CPPUNIT_ASSERT_EQUAL((TagLib::ushort)   0, p->flags());
-    CPPUNIT_ASSERT_EQUAL((TagLib::ushort)4896, p->trackerVersion());
-    CPPUNIT_ASSERT_EQUAL((TagLib::ushort)   2, p->fileFormatVersion());
+    CPPUNIT_ASSERT_EQUAL((unsigned short)   5, p->sampleCount());
+    CPPUNIT_ASSERT_EQUAL((unsigned short)   1, p->patternCount());
+    CPPUNIT_ASSERT_EQUAL((unsigned short)   0, p->flags());
+    CPPUNIT_ASSERT_EQUAL((unsigned short)4896, p->trackerVersion());
+    CPPUNIT_ASSERT_EQUAL((unsigned short)   2, p->fileFormatVersion());
     CPPUNIT_ASSERT_EQUAL((unsigned char) 64, p->globalVolume());
     CPPUNIT_ASSERT_EQUAL((unsigned char) 48, p->masterVolume());
     CPPUNIT_ASSERT_EQUAL((unsigned char)125, p->tempo());
index 48e6ec2ceb8b0f03685f103507907f150a8bb903..e4527c7432eeb190d3a5229c0922a3b6184282b8 100644 (file)
@@ -130,14 +130,14 @@ public:
     CPPUNIT_ASSERT_EQUAL(0, p->bitrate());
     CPPUNIT_ASSERT_EQUAL(0, p->sampleRate());
     CPPUNIT_ASSERT_EQUAL(8, p->channels());
-    CPPUNIT_ASSERT_EQUAL((TagLib::ushort)  1, p->lengthInPatterns());
-    CPPUNIT_ASSERT_EQUAL((TagLib::ushort)  0, p->version());
-    CPPUNIT_ASSERT_EQUAL((TagLib::ushort)  0 , p->restartPosition());
-    CPPUNIT_ASSERT_EQUAL((TagLib::ushort)  1, p->patternCount());
-    CPPUNIT_ASSERT_EQUAL((TagLib::ushort)  0, p->instrumentCount());
-    CPPUNIT_ASSERT_EQUAL((TagLib::ushort)  1, p->flags());
-    CPPUNIT_ASSERT_EQUAL((TagLib::ushort)  6, p->tempo());
-    CPPUNIT_ASSERT_EQUAL((TagLib::ushort)125, p->bpmSpeed());
+    CPPUNIT_ASSERT_EQUAL((unsigned short)  1, p->lengthInPatterns());
+    CPPUNIT_ASSERT_EQUAL((unsigned short)  0, p->version());
+    CPPUNIT_ASSERT_EQUAL((unsigned short)  0 , p->restartPosition());
+    CPPUNIT_ASSERT_EQUAL((unsigned short)  1, p->patternCount());
+    CPPUNIT_ASSERT_EQUAL((unsigned short)  0, p->instrumentCount());
+    CPPUNIT_ASSERT_EQUAL((unsigned short)  1, p->flags());
+    CPPUNIT_ASSERT_EQUAL((unsigned short)  6, p->tempo());
+    CPPUNIT_ASSERT_EQUAL((unsigned short)125, p->bpmSpeed());
     CPPUNIT_ASSERT_EQUAL(titleBefore, t->title());
     CPPUNIT_ASSERT_EQUAL(String(), t->artist());
     CPPUNIT_ASSERT_EQUAL(String(), t->album());
@@ -176,14 +176,14 @@ private:
     CPPUNIT_ASSERT_EQUAL(0, p->bitrate());
     CPPUNIT_ASSERT_EQUAL(0, p->sampleRate());
     CPPUNIT_ASSERT_EQUAL(8, p->channels());
-    CPPUNIT_ASSERT_EQUAL((TagLib::ushort)  1, p->lengthInPatterns());
-    CPPUNIT_ASSERT_EQUAL((TagLib::ushort)260, p->version());
-    CPPUNIT_ASSERT_EQUAL((TagLib::ushort)  0, p->restartPosition());
-    CPPUNIT_ASSERT_EQUAL((TagLib::ushort)  1, p->patternCount());
-    CPPUNIT_ASSERT_EQUAL((TagLib::ushort)128, p->instrumentCount());
-    CPPUNIT_ASSERT_EQUAL((TagLib::ushort)  1, p->flags());
-    CPPUNIT_ASSERT_EQUAL((TagLib::ushort)  6, p->tempo());
-    CPPUNIT_ASSERT_EQUAL((TagLib::ushort)125, p->bpmSpeed());
+    CPPUNIT_ASSERT_EQUAL((unsigned short)  1, p->lengthInPatterns());
+    CPPUNIT_ASSERT_EQUAL((unsigned short)260, p->version());
+    CPPUNIT_ASSERT_EQUAL((unsigned short)  0, p->restartPosition());
+    CPPUNIT_ASSERT_EQUAL((unsigned short)  1, p->patternCount());
+    CPPUNIT_ASSERT_EQUAL((unsigned short)128, p->instrumentCount());
+    CPPUNIT_ASSERT_EQUAL((unsigned short)  1, p->flags());
+    CPPUNIT_ASSERT_EQUAL((unsigned short)  6, p->tempo());
+    CPPUNIT_ASSERT_EQUAL((unsigned short)125, p->bpmSpeed());
     CPPUNIT_ASSERT_EQUAL(title, t->title());
     CPPUNIT_ASSERT_EQUAL(String(), t->artist());
     CPPUNIT_ASSERT_EQUAL(String(), t->album());