Change the size type of containers from uint to size_t

This commit is contained in:
Tsuda Kageyu
2013-03-23 13:42:46 +09:00
parent 83b6fdef72
commit 56c85a2d68
80 changed files with 760 additions and 775 deletions

View File

@ -82,7 +82,7 @@ bool Mod::File::save()
seek(0);
writeString(d->tag.title(), 20);
StringList lines = d->tag.comment().split("\n");
uint n = std::min(lines.size(), d->properties.instrumentCount());
uint n = std::min(static_cast<uint>(lines.size()), d->properties.instrumentCount());
for(uint i = 0; i < n; ++ i) {
writeString(lines[i], 22);
seek(8, Current);

View File

@ -44,8 +44,8 @@ bool Mod::FileBase::readString(String &s, uint size)
{
ByteVector data(readBlock(size));
if(data.size() < size) return false;
int index = data.find((char) 0);
if(index > -1)
const size_t index = data.find((char) 0);
if(index != ByteVector::npos)
{
data.resize(index);
}
@ -63,22 +63,22 @@ void Mod::FileBase::writeByte(uchar byte)
void Mod::FileBase::writeU16L(ushort number)
{
writeBlock(ByteVector::fromShort(number, false));
writeBlock(ByteVector::fromUInt16(number, false));
}
void Mod::FileBase::writeU32L(uint number)
{
writeBlock(ByteVector::fromUInt(number, false));
writeBlock(ByteVector::fromUInt32(number, false));
}
void Mod::FileBase::writeU16B(ushort number)
{
writeBlock(ByteVector::fromShort(number, true));
writeBlock(ByteVector::fromUInt16(number, true));
}
void Mod::FileBase::writeU32B(uint number)
{
writeBlock(ByteVector::fromUInt(number, true));
writeBlock(ByteVector::fromUInt32(number, true));
}
bool Mod::FileBase::readByte(uchar &byte)
@ -93,14 +93,14 @@ bool Mod::FileBase::readU16L(ushort &number)
{
ByteVector data(readBlock(2));
if(data.size() < 2) return false;
number = data.toUShort(false);
number = data.toUInt16(false);
return true;
}
bool Mod::FileBase::readU32L(uint &number) {
ByteVector data(readBlock(4));
if(data.size() < 4) return false;
number = data.toUInt(false);
number = data.toUInt32(false);
return true;
}
@ -108,13 +108,13 @@ bool Mod::FileBase::readU16B(ushort &number)
{
ByteVector data(readBlock(2));
if(data.size() < 2) return false;
number = data.toUShort(true);
number = data.toUInt16(true);
return true;
}
bool Mod::FileBase::readU32B(uint &number) {
ByteVector data(readBlock(4));
if(data.size() < 4) return false;
number = data.toUInt(true);
number = data.toUInt32(true);
return true;
}