Navigation Menu

Skip to content

Commit

Permalink
libcore|Xcode: Fixed a bunch of benign integer conversion warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
skyjake committed Oct 15, 2014
1 parent 6b2a8db commit 762081f
Show file tree
Hide file tree
Showing 13 changed files with 17 additions and 12 deletions.
2 changes: 1 addition & 1 deletion doomsday/libcore/include/de/data/arrayvalue.h
Expand Up @@ -147,7 +147,7 @@ class DENG2_PUBLIC ArrayValue : public Value

Value const &front() const { return at(0); }

Value const &back() const { return at(size() - 1); }
Value const &back() const { return at(dint(size()) - 1); }

/**
* Empties the array of all values.
Expand Down
2 changes: 1 addition & 1 deletion doomsday/libcore/include/de/data/date.h
Expand Up @@ -48,7 +48,7 @@ class DENG2_PUBLIC Date : public Time, public LogEntry::Arg::Base
int hours() const { return asDateTime().time().hour(); }
int minutes() const { return asDateTime().time().minute(); }
int seconds() const { return asDateTime().time().second(); }
int daysTo(Date const &other) const { return asDateTime().date().daysTo(other.asDateTime().date()); }
int daysTo(Date const &other) const { return int(asDateTime().date().daysTo(other.asDateTime().date())); }

/**
* Forms a textual representation of the date.
Expand Down
1 change: 1 addition & 0 deletions doomsday/libcore/include/de/data/string.h
Expand Up @@ -84,6 +84,7 @@ class DENG2_PUBLIC String : public QString
String(char const *nullTerminatedCStr);
String(wchar_t const *nullTerminatedWideStr);
String(char const *cStr, size_type length);
String(char const *cStr, dsize length);
String(QChar const *nullTerminatedStr);
String(QChar const *str, size_type length);
String(size_type length, QChar ch);
Expand Down
2 changes: 1 addition & 1 deletion doomsday/libcore/include/de/scriptsys/tokenbuffer.h
Expand Up @@ -89,7 +89,7 @@ class Token
/// @return Length of the token as number of characters.
int size() const {
if(!_begin || !_end) return 0;
return _end - _begin;
return int(_end - _begin);
}

bool isEmpty() const {
Expand Down
2 changes: 1 addition & 1 deletion doomsday/libcore/src/core/logbuffer.cpp
Expand Up @@ -105,7 +105,7 @@ DENG2_PIMPL_NOREF(LogBuffer)
if(!autoFlushTimer->isActive())
{
// Every now and then the buffer will be flushed.
autoFlushTimer->start(FLUSH_INTERVAL.asMilliSeconds());
autoFlushTimer->start(int(FLUSH_INTERVAL.asMilliSeconds()));
}
}
else
Expand Down
2 changes: 1 addition & 1 deletion doomsday/libcore/src/core/loop.cpp
Expand Up @@ -62,7 +62,7 @@ Loop::Loop() : d(new Instance(this))
void Loop::setRate(int freqHz)
{
d->interval = 1.0 / freqHz;
d->timer->setInterval(de::max(duint64(1), d->interval.asMilliSeconds()));
d->timer->setInterval(de::max(1, int(d->interval.asMilliSeconds())));
}

void Loop::start()
Expand Down
2 changes: 1 addition & 1 deletion doomsday/libcore/src/data/bitfield.cpp
Expand Up @@ -242,7 +242,7 @@ String BitField::asText() const
QTextStream os(&str);
os << "BitField (" << d->elements->bitCount() << " bits, " << d->elements->size() << " elements):";
os.setIntegerBase(2);
for(int i = d->packed.size() - 1; i >= 0; --i)
for(int i = int(d->packed.size()) - 1; i >= 0; --i)
{
os << " " << qSetPadChar('0') << qSetFieldWidth(8) << dbyte(d->packed[i])
<< qSetFieldWidth(0);
Expand Down
2 changes: 1 addition & 1 deletion doomsday/libcore/src/data/block.cpp
Expand Up @@ -47,7 +47,7 @@ Block::Block(char const *nullTerminatedCStr)
{}

Block::Block(void const *data, Size length)
: QByteArray(reinterpret_cast<char const *>(data), length), IByteArray(), IBlock()
: QByteArray(reinterpret_cast<char const *>(data), int(length)), IByteArray(), IBlock()
{}

Block::Block(IIStream &stream)
Expand Down
2 changes: 1 addition & 1 deletion doomsday/libcore/src/data/huffman.cpp
Expand Up @@ -125,7 +125,7 @@ struct HuffCode {

struct HuffBuffer {
dbyte *data;
duint size;
dsize size;
};

struct Huffman
Expand Down
6 changes: 5 additions & 1 deletion doomsday/libcore/src/data/string.cpp
Expand Up @@ -62,6 +62,10 @@ String::String(char const *cStr, size_type length)
: QString(QString::fromUtf8(cStr, length))
{}

String::String(char const *cStr, dsize length)
: QString(QString::fromUtf8(cStr, int(length)))
{}

String::String(size_type length, QChar ch) : QString(length, ch)
{}

Expand Down Expand Up @@ -435,7 +439,7 @@ int String::commonPrefixLength(String const &str, Qt::CaseSensitivity sensitivit

dint String::compareWithCase(QChar const *a, QChar const *b, dsize count)
{
return QString(a, count).compare(QString(b, count), Qt::CaseSensitive);
return QString(a, int(count)).compare(QString(b, int(count)), Qt::CaseSensitive);
}

void String::skipSpace(String::const_iterator &i, String::const_iterator const &end)
Expand Down
2 changes: 1 addition & 1 deletion doomsday/libcore/src/filesys/fileindex.cpp
Expand Up @@ -138,7 +138,7 @@ void FileIndex::remove(File const &file)

int FileIndex::size() const
{
return d->index.size();
return int(d->index.size());
}

static bool fileNotInAnyLoadedPackage(File *file)
Expand Down
2 changes: 1 addition & 1 deletion doomsday/libcore/src/scriptsys/nameexpression.cpp
Expand Up @@ -62,7 +62,7 @@ DENG2_PIMPL_NOREF(NameExpression)
// The namespace is derived from another record. Let's look into each
// super-record in turn.
ArrayValue const &supers = where.geta(Record::SUPER_NAME);
for(dsize i = 0; i < supers.size(); ++i)
for(int i = 0; i < int(supers.size()); ++i)
{
if(Variable *found = findInRecord(
name, supers.at(i).as<RecordValue>().dereference(), foundIn))
Expand Down
2 changes: 1 addition & 1 deletion doomsday/libcore/src/scriptsys/process.cpp
Expand Up @@ -240,7 +240,7 @@ void Process::execute()
}

// We will execute until this depth is complete.
duint startDepth = d->depth();
dsize startDepth = d->depth();
if(startDepth == 1)
{
// Mark the start time.
Expand Down

0 comments on commit 762081f

Please sign in to comment.