Use a standard type rather than TagLib::uchar.

This won't break the ABI compatibility.
This commit is contained in:
Tsuda Kageyu
2015-12-02 18:11:52 +09:00
parent 2cb89b85c9
commit 8bdddaabce
32 changed files with 131 additions and 130 deletions

View File

@ -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<unsigned char>(data[offset + 29]);
}
else
d->comment = data.mid(offset, 30);
offset += 30;
d->genre = uchar(data[offset]);
d->genre = static_cast<unsigned char>(data[offset]);
}

View File

@ -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<EventType>(static_cast<unsigned char>(data[pos++]));
uint time = data.toUInt(pos, true);
pos += 4;
d->synchedEvents.append(SynchedEvent(time, type));

View File

@ -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<unsigned char>(*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;

View File

@ -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<unsigned char>(value >> ((3 - i) * 7) & 0x7f);
return v;
}

View File

@ -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);
}

View File

@ -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<unsigned char>(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<unsigned char>(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<unsigned char>(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<ChannelMode>((static_cast<unsigned char>(data[3]) & 0xC0) >> 6);
// TODO: Add mode extension for completeness