mirror of
https://github.com/taglib/taglib.git
synced 2025-06-04 01:28:21 -04:00
Fix VC++ x64 warnings
This commit is contained in:
parent
64447598e5
commit
d3af7c0b02
@ -250,13 +250,13 @@ MP4::Item::toString() const
|
||||
case TypeStringList:
|
||||
return d->m_stringList.toString(" / ");
|
||||
case TypeByteVectorList:
|
||||
for(size_t i = 0; i < d->m_byteVectorList.size(); i++) {
|
||||
for(TagLib::uint i = 0; i < d->m_byteVectorList.size(); i++) {
|
||||
SPRINTF(tmp, "[%d bytes of data]", d->m_byteVectorList[i].size());
|
||||
desc.append(tmp);
|
||||
}
|
||||
return desc.toString(", ");
|
||||
case TypeCoverArtList:
|
||||
for(size_t i = 0; i < d->m_coverArtList.size(); i++) {
|
||||
for(TagLib::uint i = 0; i < d->m_coverArtList.size(); i++) {
|
||||
SPRINTF(tmp, "[%d bytes of data]", d->m_coverArtList[i].data().size());
|
||||
desc.append(tmp);
|
||||
}
|
||||
|
@ -95,7 +95,7 @@ TagLib::uint RIFF::File::riffSize() const
|
||||
|
||||
TagLib::uint RIFF::File::chunkCount() const
|
||||
{
|
||||
return d->chunks.size();
|
||||
return static_cast<TagLib::uint>(d->chunks.size());
|
||||
}
|
||||
|
||||
TagLib::uint RIFF::File::chunkDataSize(uint i) const
|
||||
@ -181,8 +181,7 @@ void RIFF::File::setChunkData(const ByteVector &name, const ByteVector &data, bo
|
||||
|
||||
// Couldn't find an existing chunk, so let's create a new one.
|
||||
|
||||
uint i = d->chunks.size() - 1;
|
||||
offset_t offset = d->chunks[i].offset + d->chunks[i].size;
|
||||
offset_t offset = d->chunks.back().offset + d->chunks.back().size;
|
||||
|
||||
// First we update the global size
|
||||
|
||||
@ -201,7 +200,7 @@ void RIFF::File::setChunkData(const ByteVector &name, const ByteVector &data, bo
|
||||
// And update our internal structure
|
||||
|
||||
if(offset & 1) {
|
||||
d->chunks[i].padding = 1;
|
||||
d->chunks.back().padding = 1;
|
||||
offset++;
|
||||
}
|
||||
|
||||
|
@ -210,10 +210,10 @@ namespace TagLib {
|
||||
return sum;
|
||||
}
|
||||
|
||||
uint size = sizeof(T);
|
||||
uint last = data.size() > size ? size - 1 : data.size() - 1;
|
||||
const size_t size = sizeof(T);
|
||||
const size_t last = data.size() > size ? size - 1 : data.size() - 1;
|
||||
|
||||
for(uint i = 0; i <= last; i++)
|
||||
for(size_t i = 0; i <= last; i++)
|
||||
sum |= (T) uchar(data[i]) << ((mostSignificantByteFirst ? last - i : i) * 8);
|
||||
|
||||
return sum;
|
||||
@ -222,11 +222,11 @@ namespace TagLib {
|
||||
template <class T>
|
||||
ByteVector fromNumber(T value, bool mostSignificantByteFirst)
|
||||
{
|
||||
int size = sizeof(T);
|
||||
const TagLib::uint size = sizeof(T);
|
||||
|
||||
ByteVector v(size, 0);
|
||||
|
||||
for(int i = 0; i < size; i++)
|
||||
for(TagLib::uint i = 0; i < size; i++)
|
||||
v[i] = uchar(value >> ((mostSignificantByteFirst ? size - 1 - i : i) * 8) & 0xff);
|
||||
|
||||
return v;
|
||||
@ -238,15 +238,20 @@ using namespace TagLib;
|
||||
class ByteVector::ByteVectorPrivate : public RefCounter
|
||||
{
|
||||
public:
|
||||
ByteVectorPrivate() : RefCounter(), size(0) {}
|
||||
ByteVectorPrivate(const std::vector<char> &v) : RefCounter(), data(v), size(v.size()) {}
|
||||
ByteVectorPrivate(TagLib::uint len, char value) : RefCounter(), data(len, value), size(len) {}
|
||||
ByteVectorPrivate()
|
||||
: RefCounter(), size(0) {}
|
||||
|
||||
ByteVectorPrivate(const std::vector<char> &v)
|
||||
: RefCounter(), data(v), size(static_cast<TagLib::uint>(v.size())) {}
|
||||
|
||||
ByteVectorPrivate(TagLib::uint len, char value)
|
||||
: RefCounter(), data(len, value), size(len) {}
|
||||
|
||||
std::vector<char> data;
|
||||
|
||||
// std::vector<T>::size() is very slow, so we'll cache the value
|
||||
|
||||
uint size;
|
||||
TagLib::uint size;
|
||||
};
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
@ -340,7 +345,7 @@ ByteVector &ByteVector::setData(const char *data, uint length)
|
||||
|
||||
ByteVector &ByteVector::setData(const char *data)
|
||||
{
|
||||
return setData(data, ::strlen(data));
|
||||
return setData(data, static_cast<TagLib::uint>(::strlen(data)));
|
||||
}
|
||||
|
||||
char *ByteVector::data()
|
||||
@ -369,7 +374,7 @@ ByteVector ByteVector::mid(uint index, uint length) const
|
||||
endIt = d->data.end();
|
||||
|
||||
v.d->data.insert(v.d->data.begin(), ConstIterator(d->data.begin() + index), endIt);
|
||||
v.d->size = v.d->data.size();
|
||||
v.d->size = static_cast<TagLib::uint>(v.d->data.size());
|
||||
|
||||
return v;
|
||||
}
|
||||
|
@ -64,7 +64,7 @@ namespace {
|
||||
size_t fread(void *ptr, size_t size, size_t nmemb, HANDLE stream)
|
||||
{
|
||||
DWORD readLen;
|
||||
ReadFile(stream, ptr, size * nmemb, &readLen, NULL);
|
||||
ReadFile(stream, ptr, static_cast<DWORD>(size * nmemb), &readLen, NULL);
|
||||
|
||||
return (readLen / size);
|
||||
}
|
||||
@ -72,7 +72,7 @@ namespace {
|
||||
size_t fwrite(const void *ptr, size_t size, size_t nmemb, HANDLE stream)
|
||||
{
|
||||
DWORD writtenLen;
|
||||
WriteFile(stream, ptr, size * nmemb, &writtenLen, NULL);
|
||||
WriteFile(stream, ptr, static_cast<DWORD>(size * nmemb), &writtenLen, NULL);
|
||||
|
||||
return writtenLen;
|
||||
}
|
||||
@ -264,7 +264,7 @@ void FileStream::insert(const ByteVector &data, offset_t start, uint replace)
|
||||
|
||||
// In case we've already reached the end of file...
|
||||
|
||||
buffer.resize(bytesRead);
|
||||
buffer.resize(static_cast<TagLib::uint>(bytesRead));
|
||||
|
||||
// Ok, here's the main loop. We want to loop until the read fails, which
|
||||
// means that we hit the end of the file.
|
||||
@ -276,7 +276,7 @@ void FileStream::insert(const ByteVector &data, offset_t start, uint replace)
|
||||
|
||||
seek(readPosition);
|
||||
bytesRead = fread(aboutToOverwrite.data(), sizeof(char), bufferLength, d->file);
|
||||
aboutToOverwrite.resize(bytesRead);
|
||||
aboutToOverwrite.resize(static_cast<TagLib::uint>(bytesRead));
|
||||
readPosition += bufferLength;
|
||||
|
||||
// Check to see if we just read the last block. We need to call clear()
|
||||
|
@ -194,7 +194,7 @@ List<T> &List<T>::clear()
|
||||
template <class T>
|
||||
TagLib::uint List<T>::size() const
|
||||
{
|
||||
return d->list.size();
|
||||
return static_cast<TagLib::uint>(d->list.size());
|
||||
}
|
||||
|
||||
template <class T>
|
||||
|
@ -95,8 +95,7 @@ String::String(const std::string &s, Type t)
|
||||
return;
|
||||
}
|
||||
|
||||
int length = s.length();
|
||||
d->data.resize(length);
|
||||
d->data.resize(s.length());
|
||||
wstring::iterator targetIt = d->data.begin();
|
||||
|
||||
for(std::string::const_iterator it = s.begin(); it != s.end(); it++) {
|
||||
@ -128,12 +127,12 @@ String::String(const char *s, Type t)
|
||||
return;
|
||||
}
|
||||
|
||||
int length = ::strlen(s);
|
||||
const size_t length = ::strlen(s);
|
||||
d->data.resize(length);
|
||||
|
||||
wstring::iterator targetIt = d->data.begin();
|
||||
|
||||
for(int i = 0; i < length; i++) {
|
||||
for(size_t i = 0; i < length; i++) {
|
||||
*targetIt = uchar(s[i]);
|
||||
++targetIt;
|
||||
}
|
||||
@ -217,12 +216,12 @@ std::string String::to8Bit(bool unicode) const
|
||||
return s;
|
||||
}
|
||||
|
||||
const int outputBufferSize = d->data.size() * 3 + 1;
|
||||
const size_t outputBufferSize = d->data.size() * 3 + 1;
|
||||
|
||||
Unicode::UTF16 *sourceBuffer = new Unicode::UTF16[d->data.size() + 1];
|
||||
Unicode::UTF8 *targetBuffer = new Unicode::UTF8[outputBufferSize];
|
||||
|
||||
for(unsigned int i = 0; i < d->data.size(); i++)
|
||||
for(size_t i = 0; i < d->data.size(); i++)
|
||||
sourceBuffer[i] = Unicode::UTF16(d->data[i]);
|
||||
|
||||
const Unicode::UTF16 *source = sourceBuffer;
|
||||
@ -237,7 +236,7 @@ std::string String::to8Bit(bool unicode) const
|
||||
debug("String::to8Bit() - Unicode conversion error.");
|
||||
}
|
||||
|
||||
int newSize = target - targetBuffer;
|
||||
const size_t newSize = target - targetBuffer;
|
||||
s.resize(newSize);
|
||||
targetBuffer[newSize] = 0;
|
||||
|
||||
@ -296,21 +295,22 @@ String::ConstIterator String::end() const
|
||||
|
||||
int String::find(const String &s, int offset) const
|
||||
{
|
||||
wstring::size_type position = d->data.find(s.d->data, offset);
|
||||
const size_t position
|
||||
= d->data.find(s.d->data, offset == -1 ? wstring::npos : offset);
|
||||
|
||||
if(position != wstring::npos)
|
||||
return position;
|
||||
return static_cast<int>(position);
|
||||
else
|
||||
return -1;
|
||||
}
|
||||
|
||||
int String::rfind(const String &s, int offset) const
|
||||
{
|
||||
wstring::size_type position =
|
||||
const size_t position =
|
||||
d->data.rfind(s.d->data, offset == -1 ? wstring::npos : offset);
|
||||
|
||||
if(position != wstring::npos)
|
||||
return position;
|
||||
return static_cast<int>(position);
|
||||
else
|
||||
return -1;
|
||||
}
|
||||
@ -320,7 +320,7 @@ StringList String::split(const String &separator) const
|
||||
StringList list;
|
||||
for(int index = 0;;)
|
||||
{
|
||||
int sep = find(separator, index);
|
||||
const int sep = find(separator, index);
|
||||
if(sep < 0)
|
||||
{
|
||||
list.append(substr(index, size() - index));
|
||||
@ -375,7 +375,7 @@ String String::upper() const
|
||||
|
||||
TagLib::uint String::size() const
|
||||
{
|
||||
return d->data.size();
|
||||
return static_cast<TagLib::uint>(d->data.size());
|
||||
}
|
||||
|
||||
TagLib::uint String::length() const
|
||||
@ -385,12 +385,12 @@ TagLib::uint String::length() const
|
||||
|
||||
bool String::isEmpty() const
|
||||
{
|
||||
return d->data.size() == 0;
|
||||
return (d->data.size() == 0);
|
||||
}
|
||||
|
||||
bool String::isNull() const
|
||||
{
|
||||
return d == null.d;
|
||||
return (d == null.d);
|
||||
}
|
||||
|
||||
ByteVector String::data(Type t) const
|
||||
@ -408,7 +408,7 @@ ByteVector String::data(Type t) const
|
||||
case UTF8:
|
||||
{
|
||||
std::string s = to8Bit(true);
|
||||
v.setData(s.c_str(), s.length());
|
||||
v.setData(s.c_str(), static_cast<TagLib::uint>(s.length()));
|
||||
break;
|
||||
}
|
||||
case UTF16:
|
||||
@ -462,11 +462,11 @@ int String::toInt(bool *ok) const
|
||||
{
|
||||
int value = 0;
|
||||
|
||||
uint size = d->data.size();
|
||||
bool negative = size > 0 && d->data[0] == '-';
|
||||
uint start = negative ? 1 : 0;
|
||||
uint i = start;
|
||||
const size_t size = d->data.size();
|
||||
const bool negative = size > 0 && d->data[0] == '-';
|
||||
const size_t start = negative ? 1 : 0;
|
||||
|
||||
size_t i = start;
|
||||
for(; i < size && d->data[i] >= '0' && d->data[i] <= '9'; i++)
|
||||
value = value * 10 + (d->data[i] - '0');
|
||||
|
||||
@ -532,7 +532,7 @@ String String::number(int n) // static
|
||||
|
||||
bool negative = n < 0;
|
||||
|
||||
if(negative)
|
||||
if(negative)
|
||||
n = n * -1;
|
||||
|
||||
while(n > 0) {
|
||||
@ -546,7 +546,7 @@ String String::number(int n) // static
|
||||
if(negative)
|
||||
s += '-';
|
||||
|
||||
for(int i = charStack.d->data.size() - 1; i >= 0; i--)
|
||||
for(size_t i = charStack.d->data.size() - 1; i >= 0; i--)
|
||||
s += charStack.d->data[i];
|
||||
|
||||
return s;
|
||||
@ -686,11 +686,11 @@ String &String::operator=(const char *s)
|
||||
|
||||
d = new StringPrivate;
|
||||
|
||||
int length = ::strlen(s);
|
||||
const size_t length = ::strlen(s);
|
||||
d->data.resize(length);
|
||||
|
||||
wstring::iterator targetIt = d->data.begin();
|
||||
for(int i = 0; i < length; i++) {
|
||||
for(size_t i = 0; i < length; i++) {
|
||||
*targetIt = uchar(s[i]);
|
||||
++targetIt;
|
||||
}
|
||||
@ -764,7 +764,7 @@ void String::prepare(Type t)
|
||||
}
|
||||
case UTF8:
|
||||
{
|
||||
int bufferSize = d->data.size() + 1;
|
||||
const size_t bufferSize = d->data.size() + 1;
|
||||
Unicode::UTF8 *sourceBuffer = new Unicode::UTF8[bufferSize];
|
||||
Unicode::UTF16 *targetBuffer = new Unicode::UTF16[bufferSize];
|
||||
|
||||
@ -785,10 +785,10 @@ void String::prepare(Type t)
|
||||
debug("String::prepare() - Unicode conversion error.");
|
||||
}
|
||||
|
||||
int newSize = target != targetBuffer ? target - targetBuffer - 1 : 0;
|
||||
const size_t newSize = target != targetBuffer ? target - targetBuffer - 1 : 0;
|
||||
d->data.resize(newSize);
|
||||
|
||||
for(int i = 0; i < newSize; i++)
|
||||
for(size_t i = 0; i < newSize; i++)
|
||||
d->data[i] = targetBuffer[i];
|
||||
|
||||
delete [] sourceBuffer;
|
||||
|
Loading…
x
Reference in New Issue
Block a user