diff --git a/taglib/it/itproperties.cpp b/taglib/it/itproperties.cpp index 0359533d..8b1fc43c 100644 --- a/taglib/it/itproperties.cpp +++ b/taglib/it/itproperties.cpp @@ -55,12 +55,12 @@ public: ushort compatibleVersion; ushort flags; ushort special; - uchar globalVolume; - uchar mixVolume; - uchar tempo; - uchar bpmSpeed; - uchar panningSeparation; - uchar pitchWheelDepth; + unsigned char globalVolume; + unsigned char mixVolume; + unsigned char tempo; + unsigned char bpmSpeed; + unsigned char panningSeparation; + unsigned char pitchWheelDepth; }; IT::Properties::Properties(AudioProperties::ReadStyle propertiesStyle) : @@ -149,32 +149,32 @@ TagLib::ushort IT::Properties::special() const return d->special; } -uchar IT::Properties::globalVolume() const +unsigned char IT::Properties::globalVolume() const { return d->globalVolume; } -uchar IT::Properties::mixVolume() const +unsigned char IT::Properties::mixVolume() const { return d->mixVolume; } -uchar IT::Properties::tempo() const +unsigned char IT::Properties::tempo() const { return d->tempo; } -uchar IT::Properties::bpmSpeed() const +unsigned char IT::Properties::bpmSpeed() const { return d->bpmSpeed; } -uchar IT::Properties::panningSeparation() const +unsigned char IT::Properties::panningSeparation() const { return d->panningSeparation; } -uchar IT::Properties::pitchWheelDepth() const +unsigned char IT::Properties::pitchWheelDepth() const { return d->pitchWheelDepth; } @@ -224,32 +224,32 @@ void IT::Properties::setVersion(ushort version) d->version = version; } -void IT::Properties::setGlobalVolume(uchar globalVolume) +void IT::Properties::setGlobalVolume(unsigned char globalVolume) { d->globalVolume = globalVolume; } -void IT::Properties::setMixVolume(uchar mixVolume) +void IT::Properties::setMixVolume(unsigned char mixVolume) { d->mixVolume = mixVolume; } -void IT::Properties::setTempo(uchar tempo) +void IT::Properties::setTempo(unsigned char tempo) { d->tempo = tempo; } -void IT::Properties::setBpmSpeed(uchar bpmSpeed) +void IT::Properties::setBpmSpeed(unsigned char bpmSpeed) { d->bpmSpeed = bpmSpeed; } -void IT::Properties::setPanningSeparation(uchar panningSeparation) +void IT::Properties::setPanningSeparation(unsigned char panningSeparation) { d->panningSeparation = panningSeparation; } -void IT::Properties::setPitchWheelDepth(uchar pitchWheelDepth) +void IT::Properties::setPitchWheelDepth(unsigned char pitchWheelDepth) { d->pitchWheelDepth = pitchWheelDepth; } diff --git a/taglib/it/itproperties.h b/taglib/it/itproperties.h index 060ad358..e2da6e66 100644 --- a/taglib/it/itproperties.h +++ b/taglib/it/itproperties.h @@ -67,12 +67,12 @@ namespace TagLib { ushort compatibleVersion() const; ushort flags() const; ushort special() const; - uchar globalVolume() const; - uchar mixVolume() const; - uchar tempo() const; - uchar bpmSpeed() const; - uchar panningSeparation() const; - uchar pitchWheelDepth() const; + unsigned char globalVolume() const; + unsigned char mixVolume() const; + unsigned char tempo() const; + unsigned char bpmSpeed() const; + unsigned char panningSeparation() const; + unsigned char pitchWheelDepth() const; void setChannels(int channels); void setLengthInPatterns(ushort lengthInPatterns); @@ -83,12 +83,12 @@ namespace TagLib { void setCompatibleVersion(ushort compatibleVersion); void setFlags (ushort flags); void setSpecial (ushort special); - void setGlobalVolume(uchar globalVolume); - void setMixVolume (uchar mixVolume); - void setTempo (uchar tempo); - void setBpmSpeed (uchar bpmSpeed); - void setPanningSeparation(uchar panningSeparation); - void setPitchWheelDepth (uchar pitchWheelDepth); + void setGlobalVolume(unsigned char globalVolume); + void setMixVolume (unsigned char mixVolume); + void setTempo (unsigned char tempo); + void setBpmSpeed (unsigned char bpmSpeed); + void setPanningSeparation(unsigned char panningSeparation); + void setPitchWheelDepth (unsigned char pitchWheelDepth); private: Properties(const Properties&); diff --git a/taglib/mod/modfilebase.cpp b/taglib/mod/modfilebase.cpp index e074dac8..a73e9367 100644 --- a/taglib/mod/modfilebase.cpp +++ b/taglib/mod/modfilebase.cpp @@ -55,7 +55,7 @@ bool Mod::FileBase::readString(String &s, ulong size) return true; } -void Mod::FileBase::writeByte(uchar byte) +void Mod::FileBase::writeByte(unsigned char byte) { ByteVector data(1, byte); writeBlock(data); @@ -81,7 +81,7 @@ void Mod::FileBase::writeU32B(ulong number) writeBlock(ByteVector::fromUInt(number, true)); } -bool Mod::FileBase::readByte(uchar &byte) +bool Mod::FileBase::readByte(unsigned char &byte) { ByteVector data(readBlock(1)); if(data.size() < 1) return false; diff --git a/taglib/mod/modfilebase.h b/taglib/mod/modfilebase.h index 383bde11..8b483d38 100644 --- a/taglib/mod/modfilebase.h +++ b/taglib/mod/modfilebase.h @@ -41,14 +41,14 @@ namespace TagLib { FileBase(IOStream *stream); void writeString(const String &s, ulong size, char padding = 0); - void writeByte(uchar byte); + void writeByte(unsigned char byte); void writeU16L(ushort number); void writeU32L(ulong number); void writeU16B(ushort number); void writeU32B(ulong number); bool readString(String &s, ulong size); - bool readByte(uchar &byte); + bool readByte(unsigned char &byte); bool readU16L(ushort &number); bool readU32L(ulong &number); bool readU16B(ushort &number); diff --git a/taglib/mod/modfileprivate.h b/taglib/mod/modfileprivate.h index 19a30019..7aa52db1 100644 --- a/taglib/mod/modfileprivate.h +++ b/taglib/mod/modfileprivate.h @@ -37,7 +37,7 @@ setter(number); \ } -#define READ_BYTE(setter) READ(setter,uchar,readByte) +#define READ_BYTE(setter) READ(setter,unsigned char,readByte) #define READ_U16L(setter) READ(setter,ushort,readU16L) #define READ_U32L(setter) READ(setter,ulong,readU32L) #define READ_U16B(setter) READ(setter,ushort,readU16B) @@ -54,7 +54,7 @@ type name = 0; \ READ_ASSERT(read(name)); -#define READ_BYTE_AS(name) READ_AS(uchar,name,readByte) +#define READ_BYTE_AS(name) READ_AS(unsigned char,name,readByte) #define READ_U16L_AS(name) READ_AS(ushort,name,readU16L) #define READ_U32L_AS(name) READ_AS(ulong,name,readU32L) #define READ_U16B_AS(name) READ_AS(ushort,name,readU16B) diff --git a/taglib/mod/modproperties.cpp b/taglib/mod/modproperties.cpp index db5a98e2..86fa3845 100644 --- a/taglib/mod/modproperties.cpp +++ b/taglib/mod/modproperties.cpp @@ -36,7 +36,7 @@ public: int channels; uint instrumentCount; - uchar lengthInPatterns; + unsigned char lengthInPatterns; }; Mod::Properties::Properties(AudioProperties::ReadStyle propertiesStyle) : @@ -85,7 +85,7 @@ TagLib::uint Mod::Properties::instrumentCount() const return d->instrumentCount; } -uchar Mod::Properties::lengthInPatterns() const +unsigned char Mod::Properties::lengthInPatterns() const { return d->lengthInPatterns; } @@ -100,7 +100,7 @@ void Mod::Properties::setInstrumentCount(uint instrumentCount) d->instrumentCount = instrumentCount; } -void Mod::Properties::setLengthInPatterns(uchar lengthInPatterns) +void Mod::Properties::setLengthInPatterns(unsigned char lengthInPatterns) { d->lengthInPatterns = lengthInPatterns; } diff --git a/taglib/mod/modproperties.h b/taglib/mod/modproperties.h index ac4bf7f3..cf0f9e7b 100644 --- a/taglib/mod/modproperties.h +++ b/taglib/mod/modproperties.h @@ -43,12 +43,12 @@ namespace TagLib { int channels() const; uint instrumentCount() const; - uchar lengthInPatterns() const; + unsigned char lengthInPatterns() const; void setChannels(int channels); void setInstrumentCount(uint sampleCount); - void setLengthInPatterns(uchar lengthInPatterns); + void setLengthInPatterns(unsigned char lengthInPatterns); private: friend class File; diff --git a/taglib/mp4/mp4item.cpp b/taglib/mp4/mp4item.cpp index d36e5200..f7edbb55 100644 --- a/taglib/mp4/mp4item.cpp +++ b/taglib/mp4/mp4item.cpp @@ -44,7 +44,7 @@ public: bool m_bool; int m_int; IntPair m_intPair; - uchar m_byte; + unsigned char m_byte; uint m_uint; long long m_longlong; }; @@ -98,7 +98,7 @@ MP4::Item::Item(int value) : d->m_int = value; } -MP4::Item::Item(uchar value) : +MP4::Item::Item(unsigned char value) : d(new ItemPrivate()) { d->m_byte = value; @@ -163,7 +163,7 @@ MP4::Item::toInt() const return d->m_int; } -uchar +unsigned char MP4::Item::toByte() const { return d->m_byte; diff --git a/taglib/mp4/mp4item.h b/taglib/mp4/mp4item.h index 38b6c25e..63fc93bd 100644 --- a/taglib/mp4/mp4item.h +++ b/taglib/mp4/mp4item.h @@ -57,7 +57,7 @@ namespace TagLib { ~Item(); Item(int value); - Item(uchar value); + Item(unsigned char value); Item(uint value); Item(long long value); Item(bool value); @@ -70,7 +70,7 @@ namespace TagLib { AtomDataType atomDataType() const; int toInt() const; - uchar toByte() const; + unsigned char toByte() const; uint toUInt() const; long long toLongLong() const; bool toBool() const; diff --git a/taglib/mp4/mp4tag.cpp b/taglib/mp4/mp4tag.cpp index 84219196..6ad75a87 100644 --- a/taglib/mp4/mp4tag.cpp +++ b/taglib/mp4/mp4tag.cpp @@ -189,7 +189,7 @@ MP4::Tag::parseByte(const MP4::Atom *atom) { ByteVectorList data = parseData(atom); if(!data.isEmpty()) { - addItem(atom->name, (uchar)data[0].at(0)); + addItem(atom->name, static_cast(data[0].at(0))); } } diff --git a/taglib/mpeg/id3v1/id3v1tag.cpp b/taglib/mpeg/id3v1/id3v1tag.cpp index dd32326f..1ca297e2 100644 --- a/taglib/mpeg/id3v1/id3v1tag.cpp +++ b/taglib/mpeg/id3v1/id3v1tag.cpp @@ -50,8 +50,8 @@ public: String album; String year; String comment; - uchar track; - uchar genre; + unsigned char track; + unsigned char genre; }; //////////////////////////////////////////////////////////////////////////////// @@ -251,12 +251,12 @@ void ID3v1::Tag::parse(const ByteVector &data) // ID3v1.1 detected d->comment = stringHandler->parse(data.mid(offset, 28)); - d->track = uchar(data[offset + 29]); + d->track = static_cast(data[offset + 29]); } else d->comment = data.mid(offset, 30); offset += 30; - d->genre = uchar(data[offset]); + d->genre = static_cast(data[offset]); } diff --git a/taglib/mpeg/id3v2/frames/eventtimingcodesframe.cpp b/taglib/mpeg/id3v2/frames/eventtimingcodesframe.cpp index 70214bad..6a3f7d26 100644 --- a/taglib/mpeg/id3v2/frames/eventtimingcodesframe.cpp +++ b/taglib/mpeg/id3v2/frames/eventtimingcodesframe.cpp @@ -109,7 +109,7 @@ void EventTimingCodesFrame::parseFields(const ByteVector &data) int pos = 1; d->synchedEvents.clear(); while(pos + 4 < end) { - EventType type = EventType(uchar(data[pos++])); + EventType type = static_cast(static_cast(data[pos++])); uint time = data.toUInt(pos, true); pos += 4; d->synchedEvents.append(SynchedEvent(time, type)); diff --git a/taglib/mpeg/id3v2/id3v2header.cpp b/taglib/mpeg/id3v2/id3v2header.cpp index 6e567193..69d700ee 100644 --- a/taglib/mpeg/id3v2/id3v2header.cpp +++ b/taglib/mpeg/id3v2/id3v2header.cpp @@ -212,7 +212,7 @@ void Header::parse(const ByteVector &data) } for(ByteVector::ConstIterator it = sizeData.begin(); it != sizeData.end(); it++) { - if(uchar(*it) >= 128) { + if(static_cast(*it) >= 128) { d->tagSize = 0; debug("TagLib::ID3v2::Header::parse() - One of the size bytes in the id3v2 header was greater than the allowed 128."); return; diff --git a/taglib/mpeg/id3v2/id3v2synchdata.cpp b/taglib/mpeg/id3v2/id3v2synchdata.cpp index 4acfd914..03767371 100644 --- a/taglib/mpeg/id3v2/id3v2synchdata.cpp +++ b/taglib/mpeg/id3v2/id3v2synchdata.cpp @@ -67,7 +67,7 @@ ByteVector SynchData::fromUInt(uint value) ByteVector v(4, 0); for(int i = 0; i < 4; i++) - v[i] = uchar(value >> ((3 - i) * 7) & 0x7f); + v[i] = static_cast(value >> ((3 - i) * 7) & 0x7f); return v; } diff --git a/taglib/mpeg/mpegfile.cpp b/taglib/mpeg/mpegfile.cpp index 523f804c..adf7a850 100644 --- a/taglib/mpeg/mpegfile.cpp +++ b/taglib/mpeg/mpegfile.cpp @@ -45,12 +45,12 @@ namespace * starts with \e 111 is a bit more tricky, hence these functions. */ - inline bool firstSyncByte(uchar byte) + inline bool firstSyncByte(unsigned char byte) { return (byte == 0xFF); } - inline bool secondSynchByte(uchar byte) + inline bool secondSynchByte(unsigned char byte) { return ((byte & 0xE0) == 0xE0); } diff --git a/taglib/mpeg/mpegheader.cpp b/taglib/mpeg/mpegheader.cpp index 0c9a0f1c..01cc6c57 100644 --- a/taglib/mpeg/mpegheader.cpp +++ b/taglib/mpeg/mpegheader.cpp @@ -164,7 +164,7 @@ MPEG::Header &MPEG::Header::operator=(const Header &h) void MPEG::Header::parse(const ByteVector &data) { - if(data.size() < 4 || uchar(data[0]) != 0xff) { + if(data.size() < 4 || static_cast(data[0]) != 0xff) { debug("MPEG::Header::parse() -- First byte did not match MPEG synch."); return; } @@ -219,7 +219,7 @@ void MPEG::Header::parse(const ByteVector &data) // The bitrate index is encoded as the first 4 bits of the 3rd byte, // i.e. 1111xxxx - int i = uchar(data[2]) >> 4; + int i = static_cast(data[2]) >> 4; d->bitrate = bitrates[versionIndex][layerIndex][i]; @@ -233,7 +233,7 @@ void MPEG::Header::parse(const ByteVector &data) // The sample rate index is encoded as two bits in the 3nd byte, i.e. xxxx11xx - i = uchar(data[2]) >> 2 & 0x03; + i = static_cast(data[2]) >> 2 & 0x03; d->sampleRate = sampleRates[d->version][i]; @@ -245,7 +245,7 @@ void MPEG::Header::parse(const ByteVector &data) // The channel mode is encoded as a 2 bit value at the end of the 3nd byte, // i.e. xxxxxx11 - d->channelMode = ChannelMode((uchar(data[3]) & 0xC0) >> 6); + d->channelMode = static_cast((static_cast(data[3]) & 0xC0) >> 6); // TODO: Add mode extension for completeness diff --git a/taglib/ogg/oggpageheader.cpp b/taglib/ogg/oggpageheader.cpp index b9333135..54c6c259 100644 --- a/taglib/ogg/oggpageheader.cpp +++ b/taglib/ogg/oggpageheader.cpp @@ -222,7 +222,7 @@ ByteVector Ogg::PageHeader::render() const ByteVector pageSegments = lacingValues(); - data.append(char(uchar(pageSegments.size()))); + data.append(static_cast(pageSegments.size())); data.append(pageSegments); return data; @@ -263,7 +263,7 @@ void Ogg::PageHeader::read() // length portion of the page header. After reading the number of page // segments we'll then read in the corresponding data for this count. - int pageSegmentCount = uchar(data[26]); + int pageSegmentCount = static_cast(data[26]); ByteVector pageSegments = d->file->readBlock(pageSegmentCount); @@ -279,10 +279,10 @@ void Ogg::PageHeader::read() int packetSize = 0; for(int i = 0; i < pageSegmentCount; i++) { - d->dataSize += uchar(pageSegments[i]); - packetSize += uchar(pageSegments[i]); + d->dataSize += static_cast(pageSegments[i]); + packetSize += static_cast(pageSegments[i]); - if(uchar(pageSegments[i]) < 255) { + if(static_cast(pageSegments[i]) < 255) { d->packetSizes.append(packetSize); packetSize = 0; } @@ -313,10 +313,10 @@ ByteVector Ogg::PageHeader::lacingValues() const div_t n = div(*it, 255); for(int i = 0; i < n.quot; i++) - data.append(char(uchar(255))); + data.append(static_cast(255)); if(it != --sizes.end() || d->lastPacketCompleted) - data.append(char(uchar(n.rem))); + data.append(static_cast(n.rem)); } return data; diff --git a/taglib/ogg/opus/opusproperties.cpp b/taglib/ogg/opus/opusproperties.cpp index c8aff624..365658f8 100644 --- a/taglib/ogg/opus/opusproperties.cpp +++ b/taglib/ogg/opus/opusproperties.cpp @@ -130,11 +130,11 @@ void Opus::Properties::read(File *file) uint pos = 8; // *Version* (8 bits, unsigned) - d->opusVersion = uchar(data.at(pos)); + d->opusVersion = static_cast(data.at(pos)); pos += 1; // *Output Channel Count* 'C' (8 bits, unsigned) - d->channels = uchar(data.at(pos)); + d->channels = static_cast(data.at(pos)); pos += 1; // *Pre-skip* (16 bits, unsigned, little endian) diff --git a/taglib/ogg/vorbis/vorbisproperties.cpp b/taglib/ogg/vorbis/vorbisproperties.cpp index d9dfc0a8..cef0b395 100644 --- a/taglib/ogg/vorbis/vorbisproperties.cpp +++ b/taglib/ogg/vorbis/vorbisproperties.cpp @@ -156,7 +156,7 @@ void Vorbis::Properties::read(File *file) d->vorbisVersion = data.toUInt(pos, false); pos += 4; - d->channels = uchar(data[pos]); + d->channels = static_cast(data[pos]); pos += 1; d->sampleRate = data.toUInt(pos, false); diff --git a/taglib/riff/aiff/aiffproperties.cpp b/taglib/riff/aiff/aiffproperties.cpp index f074fae3..020ac6cf 100644 --- a/taglib/riff/aiff/aiffproperties.cpp +++ b/taglib/riff/aiff/aiffproperties.cpp @@ -186,6 +186,7 @@ void RIFF::AIFF::Properties::read(File *file) if(data.size() >= 23) { d->compressionType = data.mid(18, 4); - d->compressionName = String(data.mid(23, static_cast(data[22])), String::Latin1); + d->compressionName + = String(data.mid(23, static_cast(data[22])), String::Latin1); } } diff --git a/taglib/riff/riffutils.h b/taglib/riff/riffutils.h index c9270dff..42977efe 100644 --- a/taglib/riff/riffutils.h +++ b/taglib/riff/riffutils.h @@ -40,7 +40,7 @@ namespace TagLib return false; for(ByteVector::ConstIterator it = name.begin(); it != name.end(); ++it) { - const uchar c = static_cast(*it); + const int c = static_cast(*it); if(c < 32 || 127 < c) return false; } diff --git a/taglib/s3m/s3mfile.cpp b/taglib/s3m/s3mfile.cpp index f15d740b..c83e09d7 100644 --- a/taglib/s3m/s3mfile.cpp +++ b/taglib/s3m/s3mfile.cpp @@ -110,7 +110,7 @@ bool S3M::File::save() int channels = 0; for(int i = 0; i < 32; ++ i) { - uchar setting = 0; + unsigned char setting = 0; if(!readByte(setting)) return false; // or if(setting >= 128)? diff --git a/taglib/s3m/s3mproperties.cpp b/taglib/s3m/s3mproperties.cpp index 6f93eec3..de2d1ebe 100644 --- a/taglib/s3m/s3mproperties.cpp +++ b/taglib/s3m/s3mproperties.cpp @@ -51,10 +51,10 @@ public: ushort flags; ushort trackerVersion; ushort fileFormatVersion; - uchar globalVolume; - uchar masterVolume; - uchar tempo; - uchar bpmSpeed; + unsigned char globalVolume; + unsigned char masterVolume; + unsigned char tempo; + unsigned char bpmSpeed; }; S3M::Properties::Properties(AudioProperties::ReadStyle propertiesStyle) : @@ -133,22 +133,22 @@ TagLib::ushort S3M::Properties::fileFormatVersion() const return d->fileFormatVersion; } -uchar S3M::Properties::globalVolume() const +unsigned char S3M::Properties::globalVolume() const { return d->globalVolume; } -uchar S3M::Properties::masterVolume() const +unsigned char S3M::Properties::masterVolume() const { return d->masterVolume; } -uchar S3M::Properties::tempo() const +unsigned char S3M::Properties::tempo() const { return d->tempo; } -uchar S3M::Properties::bpmSpeed() const +unsigned char S3M::Properties::bpmSpeed() const { return d->bpmSpeed; } @@ -193,22 +193,22 @@ void S3M::Properties::setFileFormatVersion(ushort fileFormatVersion) d->fileFormatVersion = fileFormatVersion; } -void S3M::Properties::setGlobalVolume(uchar globalVolume) +void S3M::Properties::setGlobalVolume(unsigned char globalVolume) { d->globalVolume = globalVolume; } -void S3M::Properties::setMasterVolume(uchar masterVolume) +void S3M::Properties::setMasterVolume(unsigned char masterVolume) { d->masterVolume = masterVolume; } -void S3M::Properties::setTempo(uchar tempo) +void S3M::Properties::setTempo(unsigned char tempo) { d->tempo = tempo; } -void S3M::Properties::setBpmSpeed(uchar bpmSpeed) +void S3M::Properties::setBpmSpeed(unsigned char bpmSpeed) { d->bpmSpeed = bpmSpeed; } diff --git a/taglib/s3m/s3mproperties.h b/taglib/s3m/s3mproperties.h index 4499627f..f77d2204 100644 --- a/taglib/s3m/s3mproperties.h +++ b/taglib/s3m/s3mproperties.h @@ -58,10 +58,10 @@ namespace TagLib { ushort flags() const; ushort trackerVersion() const; ushort fileFormatVersion() const; - uchar globalVolume() const; - uchar masterVolume() const; - uchar tempo() const; - uchar bpmSpeed() const; + unsigned char globalVolume() const; + unsigned char masterVolume() const; + unsigned char tempo() const; + unsigned char bpmSpeed() const; void setChannels(int channels); @@ -72,10 +72,10 @@ namespace TagLib { void setFlags (ushort flags); void setTrackerVersion (ushort trackerVersion); void setFileFormatVersion(ushort fileFormatVersion); - void setGlobalVolume (uchar globalVolume); - void setMasterVolume (uchar masterVolume); - void setTempo (uchar tempo); - void setBpmSpeed (uchar bpmSpeed); + void setGlobalVolume (unsigned char globalVolume); + void setMasterVolume (unsigned char masterVolume); + void setTempo (unsigned char tempo); + void setBpmSpeed (unsigned char bpmSpeed); private: Properties(const Properties&); diff --git a/taglib/toolkit/tbytevector.cpp b/taglib/toolkit/tbytevector.cpp index fbdc8b7c..71bcb43a 100644 --- a/taglib/toolkit/tbytevector.cpp +++ b/taglib/toolkit/tbytevector.cpp @@ -177,7 +177,7 @@ T toNumber(const ByteVector &v, size_t offset, size_t length, bool mostSignifica T sum = 0; for(size_t i = 0; i < length; i++) { const size_t shift = (mostSignificantByteFirst ? length - 1 - i : i) * 8; - sum |= static_cast(static_cast(v[offset + i])) << shift; + sum |= static_cast(static_cast(v[offset + i])) << shift; } return sum; @@ -259,7 +259,7 @@ long double toFloat80(const ByteVector &v, size_t offset) return 0.0; } - uchar bytes[10]; + unsigned char bytes[10]; ::memcpy(bytes, v.data() + offset, 10); if(ENDIAN == Utils::LittleEndian) { @@ -695,7 +695,7 @@ TagLib::uint ByteVector::checksum() const { uint sum = 0; for(ByteVector::ConstIterator it = begin(); it != end(); ++it) - sum = (sum << 8) ^ crcTable[((sum >> 24) & 0xff) ^ uchar(*it)]; + sum = (sum << 8) ^ crcTable[((sum >> 24) & 0xff) ^ static_cast(*it)]; return sum; } diff --git a/taglib/toolkit/tstring.cpp b/taglib/toolkit/tstring.cpp index 9d68a23f..f9884da7 100644 --- a/taglib/toolkit/tstring.cpp +++ b/taglib/toolkit/tstring.cpp @@ -133,7 +133,7 @@ namespace data.resize(length); for(size_t i = 0; i < length; ++i) - data[i] = static_cast(s[i]); + data[i] = static_cast(s[i]); } // Converts a UTF-8 string into UTF-16(without BOM/CPU byte order) @@ -337,7 +337,7 @@ String::String(wchar_t c, Type t) : } String::String(char c, Type t) : - d(new StringPrivate(1, static_cast(c))) + d(new StringPrivate(1, static_cast(c))) { if(t != Latin1 && t != UTF8) { debug("String::String() -- char should not contain UTF16."); @@ -661,7 +661,7 @@ bool String::operator==(const char *s) const const wchar_t *p = toCWString(); while(*p != L'\0' || *s != '\0') { - if(*p++ != static_cast(*s++)) + if(*p++ != static_cast(*s++)) return false; } return true; @@ -703,7 +703,7 @@ String &String::operator+=(const char *s) detach(); for(int i = 0; s[i] != 0; i++) - d->data += uchar(s[i]); + d->data += static_cast(s[i]); return *this; } @@ -719,7 +719,7 @@ String &String::operator+=(char c) { detach(); - d->data += uchar(c); + d->data += static_cast(c); return *this; } diff --git a/taglib/xm/xmfile.cpp b/taglib/xm/xmfile.cpp index 5919abac..fc337ba4 100644 --- a/taglib/xm/xmfile.cpp +++ b/taglib/xm/xmfile.cpp @@ -147,10 +147,10 @@ private: uint m_size; }; -class ByteReader : public ValueReader +class ByteReader : public ValueReader { public: - ByteReader(uchar &byte) : ValueReader(byte) {} + ByteReader(unsigned char &byte) : ValueReader(byte) {} uint read(TagLib::File &file, uint limit) { @@ -258,7 +258,7 @@ public: /*! * Read a byte into \a byte. */ - StructReader &byte(uchar &byte) + StructReader &byte(unsigned char &byte) { m_readers.append(new ByteReader(byte)); return *this; @@ -553,7 +553,7 @@ void XM::File::read(bool) READ_U32L_AS(patternHeaderLength); READ_ASSERT(patternHeaderLength >= 4); - uchar packingType = 0; + unsigned char packingType = 0; ushort rowCount = 0; ushort dataSize = 0; StructReader pattern; @@ -575,7 +575,7 @@ void XM::File::read(bool) READ_ASSERT(instrumentHeaderSize >= 4); String instrumentName; - uchar instrumentType = 0; + unsigned char instrumentType = 0; ushort sampleCount = 0; StructReader instrument; @@ -598,12 +598,12 @@ void XM::File::read(bool) ulong sampleLength = 0; ulong loopStart = 0; ulong loopLength = 0; - uchar volume = 0; - uchar finetune = 0; - uchar sampleType = 0; - uchar panning = 0; - uchar noteNumber = 0; - uchar compression = 0; + unsigned char volume = 0; + unsigned char finetune = 0; + unsigned char sampleType = 0; + unsigned char panning = 0; + unsigned char noteNumber = 0; + unsigned char compression = 0; String sampleName; StructReader sample; sample.u32L(sampleLength) diff --git a/tests/test_bytevector.cpp b/tests/test_bytevector.cpp index 2848c6ce..5d82fedb 100644 --- a/tests/test_bytevector.cpp +++ b/tests/test_bytevector.cpp @@ -211,12 +211,12 @@ public: CPPUNIT_ASSERT_EQUAL((unsigned short)0xFF01, ByteVector("\xFF\x01", 2).toUShort()); CPPUNIT_ASSERT_EQUAL((unsigned short)0x01FF, ByteVector("\xFF\x01", 2).toUShort(false)); - const uchar PI32LE[] = { 0x00, 0xdb, 0x0f, 0x49, 0x40 }; - const uchar PI32BE[] = { 0x00, 0x40, 0x49, 0x0f, 0xdb }; - const uchar PI64LE[] = { 0x00, 0x18, 0x2d, 0x44, 0x54, 0xfb, 0x21, 0x09, 0x40 }; - const uchar PI64BE[] = { 0x00, 0x40, 0x09, 0x21, 0xfb, 0x54, 0x44, 0x2d, 0x18 }; - const uchar PI80LE[] = { 0x00, 0x00, 0xc0, 0x68, 0x21, 0xa2, 0xda, 0x0f, 0xc9, 0x00, 0x40 }; - const uchar PI80BE[] = { 0x00, 0x40, 0x00, 0xc9, 0x0f, 0xda, 0xa2, 0x21, 0x68, 0xc0, 0x00 }; + const unsigned char PI32LE[] = { 0x00, 0xdb, 0x0f, 0x49, 0x40 }; + const unsigned char PI32BE[] = { 0x00, 0x40, 0x49, 0x0f, 0xdb }; + const unsigned char PI64LE[] = { 0x00, 0x18, 0x2d, 0x44, 0x54, 0xfb, 0x21, 0x09, 0x40 }; + const unsigned char PI64BE[] = { 0x00, 0x40, 0x09, 0x21, 0xfb, 0x54, 0x44, 0x2d, 0x18 }; + const unsigned char PI80LE[] = { 0x00, 0x00, 0xc0, 0x68, 0x21, 0xa2, 0xda, 0x0f, 0xc9, 0x00, 0x40 }; + const unsigned char PI80BE[] = { 0x00, 0x40, 0x00, 0xc9, 0x0f, 0xda, 0xa2, 0x21, 0x68, 0xc0, 0x00 }; ByteVector pi32le(reinterpret_cast(PI32LE), 5); CPPUNIT_ASSERT_EQUAL(31415, static_cast(pi32le.toFloat32LE(1) * 10000)); diff --git a/tests/test_id3v2.cpp b/tests/test_id3v2.cpp index c6592bbe..b6257e8c 100644 --- a/tests/test_id3v2.cpp +++ b/tests/test_id3v2.cpp @@ -338,7 +338,7 @@ public: CPPUNIT_ASSERT_EQUAL(String("ident"), f.identification()); CPPUNIT_ASSERT_EQUAL(15.0f / 512.0f, f.volumeAdjustment(ID3v2::RelativeVolumeFrame::FrontRight)); - CPPUNIT_ASSERT_EQUAL((uchar)8, + CPPUNIT_ASSERT_EQUAL((unsigned char)8, f.peakVolume(ID3v2::RelativeVolumeFrame::FrontRight).bitsRepresentingPeak); CPPUNIT_ASSERT_EQUAL(ByteVector("\x45"), f.peakVolume(ID3v2::RelativeVolumeFrame::FrontRight).peakVolume); diff --git a/tests/test_it.cpp b/tests/test_it.cpp index 3270eb25..7bb9084b 100644 --- a/tests/test_it.cpp +++ b/tests/test_it.cpp @@ -116,12 +116,12 @@ private: 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((TagLib::uchar)128, p->globalVolume()); - CPPUNIT_ASSERT_EQUAL((TagLib::uchar) 48, p->mixVolume()); - CPPUNIT_ASSERT_EQUAL((TagLib::uchar)125, p->tempo()); - CPPUNIT_ASSERT_EQUAL((TagLib::uchar) 6, p->bpmSpeed()); - CPPUNIT_ASSERT_EQUAL((TagLib::uchar)128, p->panningSeparation()); - CPPUNIT_ASSERT_EQUAL((TagLib::uchar) 0, p->pitchWheelDepth()); + CPPUNIT_ASSERT_EQUAL((unsigned char)128, p->globalVolume()); + CPPUNIT_ASSERT_EQUAL((unsigned char) 48, p->mixVolume()); + CPPUNIT_ASSERT_EQUAL((unsigned char)125, p->tempo()); + CPPUNIT_ASSERT_EQUAL((unsigned char) 6, p->bpmSpeed()); + CPPUNIT_ASSERT_EQUAL((unsigned char)128, p->panningSeparation()); + CPPUNIT_ASSERT_EQUAL((unsigned char) 0, p->pitchWheelDepth()); CPPUNIT_ASSERT_EQUAL(title, t->title()); CPPUNIT_ASSERT_EQUAL(String(), t->artist()); CPPUNIT_ASSERT_EQUAL(String(), t->album()); diff --git a/tests/test_mod.cpp b/tests/test_mod.cpp index c62a870b..b150c7fb 100644 --- a/tests/test_mod.cpp +++ b/tests/test_mod.cpp @@ -111,7 +111,7 @@ private: CPPUNIT_ASSERT_EQUAL(0, p->sampleRate()); CPPUNIT_ASSERT_EQUAL(8, p->channels()); CPPUNIT_ASSERT_EQUAL(31U, p->instrumentCount()); - CPPUNIT_ASSERT_EQUAL((uchar)1, p->lengthInPatterns()); + CPPUNIT_ASSERT_EQUAL((unsigned char)1, p->lengthInPatterns()); CPPUNIT_ASSERT_EQUAL(title, t->title()); CPPUNIT_ASSERT_EQUAL(String(), t->artist()); CPPUNIT_ASSERT_EQUAL(String(), t->album()); diff --git a/tests/test_s3m.cpp b/tests/test_s3m.cpp index 997c5653..41579d3c 100644 --- a/tests/test_s3m.cpp +++ b/tests/test_s3m.cpp @@ -105,10 +105,10 @@ private: 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((TagLib::uchar) 64, p->globalVolume()); - CPPUNIT_ASSERT_EQUAL((TagLib::uchar) 48, p->masterVolume()); - CPPUNIT_ASSERT_EQUAL((TagLib::uchar)125, p->tempo()); - CPPUNIT_ASSERT_EQUAL((TagLib::uchar) 6, p->bpmSpeed()); + CPPUNIT_ASSERT_EQUAL((unsigned char) 64, p->globalVolume()); + CPPUNIT_ASSERT_EQUAL((unsigned char) 48, p->masterVolume()); + CPPUNIT_ASSERT_EQUAL((unsigned char)125, p->tempo()); + CPPUNIT_ASSERT_EQUAL((unsigned char) 6, p->bpmSpeed()); CPPUNIT_ASSERT_EQUAL(title, t->title()); CPPUNIT_ASSERT_EQUAL(String(), t->artist()); CPPUNIT_ASSERT_EQUAL(String(), t->album());