mirror of
https://github.com/taglib/taglib.git
synced 2025-06-04 01:28:21 -04:00
Silence MSVC warnings concerning narrowing conversions.
This commit is contained in:
parent
ed0305bd3f
commit
75159614fc
@ -71,8 +71,8 @@ namespace TagLib
|
||||
inline String readString(File *file, int length)
|
||||
{
|
||||
ByteVector data = file->readBlock(length);
|
||||
unsigned int size = data.size();
|
||||
while (size >= 2) {
|
||||
size_t size = data.size();
|
||||
while(size >= 2) {
|
||||
if(data[size - 1] != '\0' || data[size - 2] != '\0') {
|
||||
break;
|
||||
}
|
||||
|
@ -125,8 +125,8 @@ namespace
|
||||
#endif
|
||||
|
||||
String ext;
|
||||
const int pos = s.rfind(".");
|
||||
if(pos != -1)
|
||||
const size_t pos = s.rfind(".");
|
||||
if(pos != String::npos())
|
||||
ext = s.substr(pos + 1).upper();
|
||||
|
||||
// If this list is updated, the method defaultFileExtensions() should also be
|
||||
|
@ -82,13 +82,13 @@ bool Mod::File::save()
|
||||
seek(0);
|
||||
writeString(d->tag.title(), 20);
|
||||
StringList lines = d->tag.comment().split("\n");
|
||||
unsigned int n = std::min<unsigned int>(lines.size(), d->properties.instrumentCount());
|
||||
for(unsigned int i = 0; i < n; ++ i) {
|
||||
size_t n = std::min<size_t>(lines.size(), d->properties.instrumentCount());
|
||||
for(size_t i = 0; i < n; ++ i) {
|
||||
writeString(lines[i], 22);
|
||||
seek(8, Current);
|
||||
}
|
||||
|
||||
for(unsigned int i = n; i < d->properties.instrumentCount(); ++ i) {
|
||||
for(size_t i = n; i < d->properties.instrumentCount(); ++ i) {
|
||||
writeString(String(), 22);
|
||||
seek(8, Current);
|
||||
}
|
||||
|
@ -628,8 +628,8 @@ MP4::Tag::saveNew(ByteVector data)
|
||||
long long offset = path.back()->offset + 8;
|
||||
d->file->insert(data, offset, 0);
|
||||
|
||||
updateParents(path, data.size());
|
||||
updateOffsets(data.size(), offset);
|
||||
updateParents(path, static_cast<long>(data.size()));
|
||||
updateOffsets(static_cast<long>(data.size()), offset);
|
||||
|
||||
// Insert the newly created atoms into the tree to keep it up-to-date.
|
||||
|
||||
|
@ -123,7 +123,7 @@ bool TableOfContentsFrame::isOrdered() const
|
||||
|
||||
unsigned int TableOfContentsFrame::entryCount() const
|
||||
{
|
||||
return d->childElements.size();
|
||||
return static_cast<unsigned int>(d->childElements.size());
|
||||
}
|
||||
|
||||
ByteVectorList TableOfContentsFrame::childElements() const
|
||||
@ -261,7 +261,7 @@ TableOfContentsFrame *TableOfContentsFrame::findTopLevel(const ID3v2::Tag *tag)
|
||||
|
||||
void TableOfContentsFrame::parseFields(const ByteVector &data)
|
||||
{
|
||||
unsigned int size = data.size();
|
||||
size_t size = data.size();
|
||||
if(size < 6) {
|
||||
debug("A CTOC frame must contain at least 6 bytes (1 byte element ID terminated by "
|
||||
"null, 1 byte flags, 1 byte entry count and 1 byte child element ID terminated "
|
||||
|
@ -63,7 +63,7 @@ namespace
|
||||
|
||||
for(StringList::ConstIterator it = fields.begin(); it != fields.end(); ++it) {
|
||||
String s = *it;
|
||||
int end = s.find(")");
|
||||
size_t end = s.find(")");
|
||||
|
||||
if(s.startsWith("(") && end > 0) {
|
||||
// "(12)Genre"
|
||||
|
@ -211,14 +211,14 @@ bool Ogg::XiphComment::isEmpty() const
|
||||
|
||||
unsigned int Ogg::XiphComment::fieldCount() const
|
||||
{
|
||||
unsigned int count = 0;
|
||||
size_t count = 0;
|
||||
|
||||
for(FieldConstIterator it = d->fieldListMap.begin(); it != d->fieldListMap.end(); ++it)
|
||||
count += (*it).second.size();
|
||||
|
||||
count += d->pictureList.size();
|
||||
|
||||
return count;
|
||||
return static_cast<unsigned int>(count);
|
||||
}
|
||||
|
||||
const Ogg::FieldListMap &Ogg::XiphComment::fieldListMap() const
|
||||
|
@ -224,7 +224,7 @@ void RIFF::File::removeChunk(unsigned int i)
|
||||
std::vector<Chunk>::iterator it = d->chunks.begin();
|
||||
std::advance(it, i);
|
||||
|
||||
const unsigned int removeSize = it->size + it->padding + 8;
|
||||
const size_t removeSize = it->size + it->padding + 8;
|
||||
removeBlock(it->offset - 8, removeSize);
|
||||
it = d->chunks.erase(it);
|
||||
|
||||
@ -234,7 +234,7 @@ void RIFF::File::removeChunk(unsigned int i)
|
||||
|
||||
void RIFF::File::removeChunk(const ByteVector &name)
|
||||
{
|
||||
for(int i = d->chunks.size() - 1; i >= 0; --i) {
|
||||
for(int i = static_cast<int>(d->chunks.size()) - 1; i >= 0; --i) {
|
||||
if(d->chunks[i].name == name)
|
||||
removeChunk(i);
|
||||
}
|
||||
|
@ -58,7 +58,8 @@ namespace
|
||||
|
||||
#ifdef _WIN32
|
||||
|
||||
len = ::WideCharToMultiByte(CP_UTF8, 0, src, srcLength, dst, dstLength, NULL, NULL);
|
||||
len = ::WideCharToMultiByte(
|
||||
CP_UTF8, 0, src, static_cast<int>(srcLength), dst, static_cast<int>(dstLength), NULL, NULL);
|
||||
|
||||
#else
|
||||
|
||||
@ -91,7 +92,8 @@ namespace
|
||||
|
||||
#ifdef _WIN32
|
||||
|
||||
len = ::MultiByteToWideChar(CP_UTF8, 0, src, srcLength, dst, dstLength);
|
||||
len = ::MultiByteToWideChar(
|
||||
CP_UTF8, 0, src, static_cast<int>(srcLength), dst, static_cast<int>(dstLength));
|
||||
|
||||
#else
|
||||
|
||||
|
@ -14,7 +14,7 @@ class PublicRIFF : public RIFF::File
|
||||
public:
|
||||
PublicRIFF(FileName file) : RIFF::File(file, BigEndian) {};
|
||||
unsigned int riffSize() { return RIFF::File::riffSize(); };
|
||||
unsigned int chunkCount() { return RIFF::File::chunkCount(); };
|
||||
size_t chunkCount() { return RIFF::File::chunkCount(); };
|
||||
long long chunkOffset(unsigned int i) { return RIFF::File::chunkOffset(i); };
|
||||
unsigned int chunkPadding(unsigned int i) { return RIFF::File::chunkPadding(i); };
|
||||
unsigned int chunkDataSize(unsigned int i) { return RIFF::File::chunkDataSize(i); };
|
||||
|
Loading…
x
Reference in New Issue
Block a user