Replace use of C style casts
This commit is contained in:
@@ -306,7 +306,7 @@ void SingleApplicationPrivate::readInitMessageHeader(QLocalSocket *sock) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (sock->bytesAvailable() < (qint64) sizeof(quint64)) {
|
||||
if (sock->bytesAvailable() < static_cast<qint64>(sizeof(quint64))) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -321,7 +321,7 @@ void SingleApplicationPrivate::readInitMessageHeader(QLocalSocket *sock) {
|
||||
info.stage = StageBody;
|
||||
info.msgLen = msgLen;
|
||||
|
||||
if (sock->bytesAvailable() >= (qint64) msgLen) {
|
||||
if (sock->bytesAvailable() >= static_cast<qint64>(msgLen)) {
|
||||
readInitMessageBody(sock);
|
||||
}
|
||||
|
||||
@@ -336,7 +336,7 @@ void SingleApplicationPrivate::readInitMessageBody(QLocalSocket *sock) {
|
||||
}
|
||||
|
||||
ConnectionInfo &info = connectionMap[sock];
|
||||
if (sock->bytesAvailable() < (qint64)info.msgLen) {
|
||||
if (sock->bytesAvailable() < static_cast<qint64>(info.msgLen)) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -306,7 +306,7 @@ void SingleCoreApplicationPrivate::readInitMessageHeader(QLocalSocket *sock) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (sock->bytesAvailable() < (qint64)sizeof(quint64)) {
|
||||
if (sock->bytesAvailable() < static_cast<qint64>(sizeof(quint64))) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -321,7 +321,7 @@ void SingleCoreApplicationPrivate::readInitMessageHeader(QLocalSocket *sock) {
|
||||
info.stage = StageBody;
|
||||
info.msgLen = msgLen;
|
||||
|
||||
if (sock->bytesAvailable() >= (qint64) msgLen) {
|
||||
if (sock->bytesAvailable() >= static_cast<qint64>(msgLen)) {
|
||||
readInitMessageBody(sock);
|
||||
}
|
||||
|
||||
@@ -336,7 +336,7 @@ void SingleCoreApplicationPrivate::readInitMessageBody(QLocalSocket *sock) {
|
||||
}
|
||||
|
||||
ConnectionInfo &info = connectionMap[sock];
|
||||
if (sock->bytesAvailable() < (qint64)info.msgLen) {
|
||||
if (sock->bytesAvailable() < static_cast<qint64>(info.msgLen)) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
4
3rdparty/taglib/asf/asfattribute.cpp
vendored
4
3rdparty/taglib/asf/asfattribute.cpp
vendored
@@ -282,7 +282,7 @@ ByteVector ASF::Attribute::render(const String &name, int kind) const {
|
||||
|
||||
if (kind == 0) {
|
||||
data = renderString(name, true) +
|
||||
ByteVector::fromShort((int)d->type, false) +
|
||||
ByteVector::fromShort(static_cast<int>(d->type), false) +
|
||||
ByteVector::fromShort(data.size(), false) +
|
||||
data;
|
||||
}
|
||||
@@ -291,7 +291,7 @@ ByteVector ASF::Attribute::render(const String &name, int kind) const {
|
||||
data = ByteVector::fromShort(kind == 2 ? d->language : 0, false) +
|
||||
ByteVector::fromShort(d->stream, false) +
|
||||
ByteVector::fromShort(nameData.size(), false) +
|
||||
ByteVector::fromShort((int)d->type, false) +
|
||||
ByteVector::fromShort(static_cast<int>(d->type), false) +
|
||||
ByteVector::fromUInt(data.size(), false) +
|
||||
nameData +
|
||||
data;
|
||||
|
||||
6
3rdparty/taglib/asf/asffile.cpp
vendored
6
3rdparty/taglib/asf/asffile.cpp
vendored
@@ -179,7 +179,7 @@ class ASF::File::FilePrivate::CodecListObject : public ASF::File::FilePrivate::B
|
||||
void ASF::File::FilePrivate::BaseObject::parse(ASF::File *file, unsigned int size) {
|
||||
|
||||
data.clear();
|
||||
if (size > 24 && size <= (unsigned int)(file->length()))
|
||||
if (size > 24 && size <= static_cast<unsigned int>(file->length()))
|
||||
data = file->readBlock(size - 24);
|
||||
else
|
||||
data = ByteVector();
|
||||
@@ -384,7 +384,7 @@ void ASF::File::FilePrivate::HeaderExtensionObject::parse(ASF::File *file, unsig
|
||||
else {
|
||||
obj = new UnknownObject(guid);
|
||||
}
|
||||
obj->parse(file, (unsigned int)size);
|
||||
obj->parse(file, static_cast<unsigned int>(size));
|
||||
objects.append(obj);
|
||||
dataPos += size;
|
||||
}
|
||||
@@ -632,7 +632,7 @@ void ASF::File::read() {
|
||||
setValid(false);
|
||||
break;
|
||||
}
|
||||
long size = (long)readQWORD(this, &ok);
|
||||
long size = static_cast<long>(readQWORD(this, &ok));
|
||||
if (!ok) {
|
||||
setValid(false);
|
||||
break;
|
||||
|
||||
4
3rdparty/taglib/asf/asfpicture.cpp
vendored
4
3rdparty/taglib/asf/asfpicture.cpp
vendored
@@ -117,7 +117,7 @@ ByteVector ASF::Picture::render() const {
|
||||
if (!isValid())
|
||||
return ByteVector();
|
||||
|
||||
return ByteVector((char)d->type) +
|
||||
return ByteVector(static_cast<char>(d->type)) +
|
||||
ByteVector::fromUInt(d->picture.size(), false) +
|
||||
renderString(d->mimeType) +
|
||||
renderString(d->description) +
|
||||
@@ -131,7 +131,7 @@ void ASF::Picture::parse(const ByteVector &bytes) {
|
||||
if (bytes.size() < 9)
|
||||
return;
|
||||
int pos = 0;
|
||||
d->type = (Type)bytes[0];
|
||||
d->type = static_cast<Type>(bytes[0]);
|
||||
++pos;
|
||||
const unsigned int dataLen = bytes.toUInt(pos, false);
|
||||
pos += 4;
|
||||
|
||||
10
3rdparty/taglib/dsdiff/dsdifffile.cpp
vendored
10
3rdparty/taglib/dsdiff/dsdifffile.cpp
vendored
@@ -855,9 +855,7 @@ void DSDIFF::File::read(bool readProperties, Properties::ReadStyle propertiesSty
|
||||
if (lengthDSDSamplesTimeChannels == 0) {
|
||||
// DST compressed signal : need to compute length of DSD uncompressed frames
|
||||
if (dstFrameRate > 0)
|
||||
lengthDSDSamplesTimeChannels = (unsigned long long)dstNumFrames *
|
||||
(unsigned long long)sampleRate /
|
||||
(unsigned long long)dstFrameRate;
|
||||
lengthDSDSamplesTimeChannels = static_cast<unsigned long long>(dstNumFrames) * static_cast<unsigned long long>(sampleRate) / static_cast<unsigned long long>(dstFrameRate);
|
||||
else
|
||||
lengthDSDSamplesTimeChannels = 0;
|
||||
}
|
||||
@@ -870,11 +868,7 @@ void DSDIFF::File::read(bool readProperties, Properties::ReadStyle propertiesSty
|
||||
if (lengthDSDSamplesTimeChannels > 0)
|
||||
bitrate = (audioDataSizeinBytes * 8 * sampleRate) / lengthDSDSamplesTimeChannels / 1000;
|
||||
|
||||
d->properties = new Properties(sampleRate,
|
||||
channels,
|
||||
lengthDSDSamplesTimeChannels,
|
||||
bitrate,
|
||||
propertiesStyle);
|
||||
d->properties = new Properties(sampleRate, channels, lengthDSDSamplesTimeChannels, bitrate, propertiesStyle);
|
||||
}
|
||||
|
||||
if (!ID3v2Tag()) {
|
||||
|
||||
16
3rdparty/taglib/it/itfile.cpp
vendored
16
3rdparty/taglib/it/itfile.cpp
vendored
@@ -101,7 +101,7 @@ bool IT::File::save() {
|
||||
// write comment as instrument and sample names:
|
||||
StringList lines = d->tag.comment().split("\n");
|
||||
for (unsigned short i = 0; i < instrumentCount; ++i) {
|
||||
seek(192L + length + ((long)i << 2));
|
||||
seek(192L + length + (static_cast<long>(i) << 2));
|
||||
unsigned long instrumentOffset = 0;
|
||||
if (!readU32L(instrumentOffset))
|
||||
return false;
|
||||
@@ -116,14 +116,14 @@ bool IT::File::save() {
|
||||
}
|
||||
|
||||
for (unsigned short i = 0; i < sampleCount; ++i) {
|
||||
seek(192L + length + ((long)instrumentCount << 2) + ((long)i << 2));
|
||||
seek(192L + length + (static_cast<long>(instrumentCount) << 2) + (static_cast<long>(i) << 2));
|
||||
unsigned long sampleOffset = 0;
|
||||
if (!readU32L(sampleOffset))
|
||||
return false;
|
||||
|
||||
seek(sampleOffset + 20);
|
||||
|
||||
if ((unsigned int)(i + instrumentCount) < lines.size())
|
||||
if (static_cast<unsigned int>(i + instrumentCount) < lines.size())
|
||||
writeString(lines[i + instrumentCount], 25);
|
||||
else
|
||||
writeString(String(), 25);
|
||||
@@ -140,7 +140,7 @@ bool IT::File::save() {
|
||||
// terminating NUL but it does not hurt to add one:
|
||||
if (message.size() > 7999)
|
||||
message.resize(7999);
|
||||
message.append((char)0);
|
||||
message.append(static_cast<char>(0));
|
||||
|
||||
unsigned short special = 0;
|
||||
unsigned short messageLength = 0;
|
||||
@@ -225,7 +225,7 @@ void IT::File::read(bool) {
|
||||
seek(messageOffset);
|
||||
ByteVector messageBytes = readBlock(messageLength);
|
||||
READ_ASSERT(messageBytes.size() == messageLength);
|
||||
int index = messageBytes.find((char)0);
|
||||
int index = messageBytes.find(static_cast<char>(0));
|
||||
if (index > -1)
|
||||
messageBytes.resize(index, 0);
|
||||
messageBytes.replace('\r', '\n');
|
||||
@@ -244,7 +244,7 @@ void IT::File::read(bool) {
|
||||
// But this always gives 64 channels for all my files anyway.
|
||||
// Strangely VLC does report other values. I wonder how VLC
|
||||
// gets it's values.
|
||||
if ((unsigned char)pannings[i] < 128 && volumes[i] > 0)
|
||||
if (static_cast<unsigned char>(pannings[i]) < 128 && volumes[i] > 0)
|
||||
++channels;
|
||||
}
|
||||
d->properties.setChannels(channels);
|
||||
@@ -266,7 +266,7 @@ void IT::File::read(bool) {
|
||||
// e.g. VLC seems to interpret a nil as a space. I
|
||||
// don't know what is the proper behaviour.
|
||||
for (unsigned short i = 0; i < instrumentCount; ++i) {
|
||||
seek(192L + length + ((long)i << 2));
|
||||
seek(192L + length + (static_cast<long>(i) << 2));
|
||||
READ_U32L_AS(instrumentOffset);
|
||||
seek(instrumentOffset);
|
||||
|
||||
@@ -282,7 +282,7 @@ void IT::File::read(bool) {
|
||||
}
|
||||
|
||||
for (unsigned short i = 0; i < sampleCount; ++i) {
|
||||
seek(192L + length + ((long)instrumentCount << 2) + ((long)i << 2));
|
||||
seek(192L + length + (static_cast<long>(instrumentCount) << 2) + (static_cast<long>(i) << 2));
|
||||
READ_U32L_AS(sampleOffset);
|
||||
|
||||
seek(sampleOffset);
|
||||
|
||||
2
3rdparty/taglib/mod/modfilebase.cpp
vendored
2
3rdparty/taglib/mod/modfilebase.cpp
vendored
@@ -44,7 +44,7 @@ bool Mod::FileBase::readString(String &s, unsigned long size) {
|
||||
|
||||
ByteVector data(readBlock(size));
|
||||
if (data.size() < size) return false;
|
||||
int index = data.find((char)0);
|
||||
int index = data.find(static_cast<char>(0));
|
||||
if (index > -1) {
|
||||
data.resize(index);
|
||||
}
|
||||
|
||||
6
3rdparty/taglib/mp4/mp4tag.cpp
vendored
6
3rdparty/taglib/mp4/mp4tag.cpp
vendored
@@ -78,7 +78,7 @@ MP4::Tag::Tag(Strawberry_TagLib::TagLib::File *file, MP4::Atoms *atoms) : d(new
|
||||
addItem(atom->name, StringList(String(val.data, String::UTF8)));
|
||||
}
|
||||
else {
|
||||
addItem(atom->name, (int)(val.data.toShort()));
|
||||
addItem(atom->name, static_cast<int>((val.data.toShort())));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -169,7 +169,7 @@ void MP4::Tag::parseInt(const MP4::Atom *atom) {
|
||||
|
||||
ByteVectorList data = parseData(atom);
|
||||
if (!data.isEmpty()) {
|
||||
addItem(atom->name, (int)data[0].toShort());
|
||||
addItem(atom->name, static_cast<int>(data[0].toShort()));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -205,7 +205,7 @@ void MP4::Tag::parseGnre(const MP4::Atom *atom) {
|
||||
|
||||
ByteVectorList data = parseData(atom);
|
||||
if (!data.isEmpty()) {
|
||||
int idx = (int)data[0].toShort();
|
||||
int idx = static_cast<int>(data[0].toShort());
|
||||
if (idx > 0) {
|
||||
addItem("\251gen", StringList(ID3v1::genre(idx - 1)));
|
||||
}
|
||||
|
||||
8
3rdparty/taglib/mpc/mpcproperties.cpp
vendored
8
3rdparty/taglib/mpc/mpcproperties.cpp
vendored
@@ -299,22 +299,22 @@ void MPC::Properties::readSV7(const ByteVector &data, long streamLength) {
|
||||
|
||||
// convert gain info
|
||||
if (d->trackGain != 0) {
|
||||
int tmp = (int)((64.82 - (short)d->trackGain / 100.) * 256. + .5);
|
||||
int tmp = static_cast<int>((64.82 - static_cast<short>(d->trackGain) / 100.) * 256. + .5);
|
||||
if (tmp >= (1 << 16) || tmp < 0) tmp = 0;
|
||||
d->trackGain = tmp;
|
||||
}
|
||||
|
||||
if (d->albumGain != 0) {
|
||||
int tmp = (int)((64.82 - d->albumGain / 100.) * 256. + .5);
|
||||
int tmp = static_cast<int>((64.82 - d->albumGain / 100.) * 256. + .5);
|
||||
if (tmp >= (1 << 16) || tmp < 0) tmp = 0;
|
||||
d->albumGain = tmp;
|
||||
}
|
||||
|
||||
if (d->trackPeak != 0)
|
||||
d->trackPeak = (int)(log10((double)d->trackPeak) * 20 * 256 + .5);
|
||||
d->trackPeak = static_cast<int>(log10(static_cast<double>(d->trackPeak)) * 20 * 256 + .5);
|
||||
|
||||
if (d->albumPeak != 0)
|
||||
d->albumPeak = (int)(log10((double)d->albumPeak) * 20 * 256 + .5);
|
||||
d->albumPeak = static_cast<int>(log10(static_cast<double>(d->albumPeak)) * 20 * 256 + .5);
|
||||
|
||||
bool trueGapless = (gapless >> 31) & 0x0001;
|
||||
if (trueGapless) {
|
||||
|
||||
@@ -123,7 +123,7 @@ void AttachedPictureFrame::parseFields(const ByteVector &data) {
|
||||
return;
|
||||
}
|
||||
|
||||
d->type = (Strawberry_TagLib::TagLib::ID3v2::AttachedPictureFrame::Type)data[pos++];
|
||||
d->type = static_cast<ID3v2::AttachedPictureFrame::Type>(data[pos++]);
|
||||
d->description = readStringField(data, d->textEncoding, &pos);
|
||||
|
||||
d->data = data.mid(pos);
|
||||
@@ -185,7 +185,7 @@ void AttachedPictureFrameV22::parseFields(const ByteVector &data) {
|
||||
d->mimeType = "image/" + fixedString;
|
||||
}
|
||||
|
||||
d->type = (Strawberry_TagLib::TagLib::ID3v2::AttachedPictureFrame::Type)data[pos++];
|
||||
d->type = static_cast<ID3v2::AttachedPictureFrame::Type>(data[pos++]);
|
||||
d->description = readStringField(data, d->textEncoding, &pos);
|
||||
|
||||
d->data = data.mid(pos);
|
||||
|
||||
@@ -93,7 +93,7 @@ void PopularimeterFrame::parseFields(const ByteVector &data) {
|
||||
d->rating = 0;
|
||||
d->counter = 0;
|
||||
if (pos < size) {
|
||||
d->rating = (unsigned char)(data[pos++]);
|
||||
d->rating = static_cast<unsigned char>(data[pos++]);
|
||||
if (pos < size) {
|
||||
d->counter = data.toUInt(static_cast<unsigned int>(pos));
|
||||
}
|
||||
|
||||
@@ -142,7 +142,7 @@ void RelativeVolumeFrame::parseFields(const ByteVector &data) {
|
||||
|
||||
// Each channel is at least 4 bytes.
|
||||
|
||||
while (pos <= (int)data.size() - 4) {
|
||||
while (pos <= static_cast<int>(data.size()) - 4) {
|
||||
|
||||
ChannelType type = ChannelType(data[pos]);
|
||||
pos += 1;
|
||||
|
||||
@@ -309,7 +309,7 @@ ByteVector TableOfContentsFrame::renderFields() const {
|
||||
if (d->isOrdered)
|
||||
flags += 1;
|
||||
data.append(flags);
|
||||
data.append((char)(entryCount()));
|
||||
data.append(static_cast<char>(entryCount()));
|
||||
ByteVectorList::ConstIterator it = d->childElements.begin();
|
||||
while (it != d->childElements.end()) {
|
||||
data.append(*it);
|
||||
|
||||
8
3rdparty/taglib/s3m/s3mfile.cpp
vendored
8
3rdparty/taglib/s3m/s3mfile.cpp
vendored
@@ -116,12 +116,12 @@ bool S3M::File::save() {
|
||||
StringList lines = d->tag.comment().split("\n");
|
||||
// write comment as sample names:
|
||||
for (unsigned short i = 0; i < sampleCount; ++i) {
|
||||
seek(96L + length + ((long)i << 1));
|
||||
seek(96L + length + (static_cast<long>(i) << 1));
|
||||
|
||||
unsigned short instrumentOffset = 0;
|
||||
if (!readU16L(instrumentOffset))
|
||||
return false;
|
||||
seek(((long)instrumentOffset << 4) + 48);
|
||||
seek((static_cast<long>(instrumentOffset) << 4) + 48);
|
||||
|
||||
if (i < lines.size())
|
||||
writeString(lines[i], 27);
|
||||
@@ -202,10 +202,10 @@ void S3M::File::read(bool) {
|
||||
// instead samples (SCRS).
|
||||
StringList comment;
|
||||
for (unsigned short i = 0; i < sampleCount; ++i) {
|
||||
seek(96L + length + ((long)i << 1));
|
||||
seek(96L + length + (static_cast<long>(i) << 1));
|
||||
|
||||
READ_U16L_AS(sampleHeaderOffset);
|
||||
seek((long)sampleHeaderOffset << 4);
|
||||
seek(static_cast<long>(sampleHeaderOffset) << 4);
|
||||
|
||||
READ_BYTE_AS(sampleType);
|
||||
READ_STRING_AS(dosFileName, 13);
|
||||
|
||||
6
3rdparty/taglib/toolkit/tbytevector.cpp
vendored
6
3rdparty/taglib/toolkit/tbytevector.cpp
vendored
@@ -848,8 +848,8 @@ ByteVector ByteVector::fromBase64(const ByteVector &input) {
|
||||
|
||||
ByteVector output(len);
|
||||
|
||||
const unsigned char *src = (const unsigned char *)input.data();
|
||||
unsigned char *dst = (unsigned char *)output.data();
|
||||
const unsigned char *src = reinterpret_cast<const unsigned char*>(input.data());
|
||||
unsigned char *dst = reinterpret_cast<unsigned char*>(output.data());
|
||||
|
||||
while (4 <= len) {
|
||||
|
||||
@@ -899,7 +899,7 @@ ByteVector ByteVector::fromBase64(const ByteVector &input) {
|
||||
|
||||
// Only return output if we processed all bytes
|
||||
if (len == 0) {
|
||||
output.resize(static_cast<unsigned int>(dst - (unsigned char *)output.data()));
|
||||
output.resize(static_cast<unsigned int>(dst - reinterpret_cast<unsigned char*>(output.data())));
|
||||
return output;
|
||||
}
|
||||
return ByteVector();
|
||||
|
||||
4
3rdparty/taglib/xm/xmfile.cpp
vendored
4
3rdparty/taglib/xm/xmfile.cpp
vendored
@@ -115,7 +115,7 @@ class StringReader : public ValueReader<String> {
|
||||
|
||||
ByteVector data = file.readBlock(std::min(m_size, limit));
|
||||
unsigned int count = data.size();
|
||||
int index = data.find((char)0);
|
||||
int index = data.find(static_cast<char>(0));
|
||||
if (index > -1) {
|
||||
data.resize(index);
|
||||
}
|
||||
@@ -481,7 +481,7 @@ void XM::File::read(bool) {
|
||||
.u16L(bpmSpeed);
|
||||
|
||||
unsigned int count = header.read(*this, headerSize - 4U);
|
||||
unsigned int size = std::min(headerSize - 4U, (unsigned long)header.size());
|
||||
unsigned int size = std::min(headerSize - 4U, static_cast<unsigned long>(header.size()));
|
||||
|
||||
READ_ASSERT(count == size);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user