Fix various 64 bit related warnings

Mostly printf() format strings and signed-unsigned comparisons.
Fixes the x86_64 build.
This commit is contained in:
Ingo Weinhold 2013-12-06 14:13:30 +01:00
parent bff0809603
commit dac7b7c980
10 changed files with 40 additions and 38 deletions

View File

@ -1181,7 +1181,7 @@ ram_disk_raw_device_read(void* _cookie, off_t pos, void* buffer,
if (pos >= device->DeviceSize())
return B_BAD_VALUE;
if (pos + length > device->DeviceSize())
if (pos + (off_t)length > device->DeviceSize())
length = device->DeviceSize() - pos;
IORequest request;
@ -1211,7 +1211,7 @@ ram_disk_raw_device_write(void* _cookie, off_t pos, const void* buffer,
if (pos >= device->DeviceSize())
return B_BAD_VALUE;
if (pos + length > device->DeviceSize())
if (pos + (off_t)length > device->DeviceSize())
length = device->DeviceSize() - pos;
IORequest request;

View File

@ -50,7 +50,7 @@ public:
return B_BAD_VALUE;
size_t toCopy = *bufferSize;
if (offset + toCopy > size)
if (offset + (off_t)toCopy > size)
toCopy = size - offset;
if (toCopy > 0)

View File

@ -109,23 +109,24 @@ void dbg_printf_end();
#define DEBUG_CONTEXT(x) \
{ \
dbg_printf_begin(); \
__out(DEBUG_APP " [%Ld: %5ld] ", system_time(), DEBUG_THREAD); \
__out(DEBUG_APP " [%" B_PRIdBIGTIME ": %5" B_PRId32 "] ", \
system_time(), DEBUG_THREAD); \
x; \
dbg_printf_end(); \
}
#define DEBUG_CONTEXT_FUNCTION(prefix, x) \
{ \
dbg_printf_begin(); \
__out(DEBUG_APP " [%Ld: %5ld] %s" prefix, system_time(), DEBUG_THREAD, \
__PRETTY_FUNCTION__); \
__out(DEBUG_APP " [%" B_PRIdBIGTIME ": %5" B_PRId32 "] %s" prefix, \
system_time(), DEBUG_THREAD, __PRETTY_FUNCTION__); \
x; \
dbg_printf_end(); \
}
#define DEBUG_CONTEXT_LINE(x) \
{ \
dbg_printf_begin(); \
__out(DEBUG_APP " [%Ld: %5ld] %s:%d: ", system_time(), DEBUG_THREAD, \
__PRETTY_FUNCTION__, __LINE__); \
__out(DEBUG_APP " [%" B_PRIdBIGTIME ": %5" B_PRId32 "] %s:%d: ", \
system_time(), DEBUG_THREAD, __PRETTY_FUNCTION__, __LINE__); \
x; \
dbg_printf_end(); \
}

View File

@ -800,7 +800,7 @@ Volume::_AddInitialPackagesFromActivationFile()
RETURN_ERROR(errno);
}
if (st.st_size > kMaxActivationFileSize) {
if (st.st_size > (off_t)kMaxActivationFileSize) {
ERROR("The packages activation file is too big.\n");
RETURN_ERROR(B_BAD_DATA);
}

View File

@ -621,8 +621,9 @@ class SendSignal : public AbstractTraceEntry {
virtual void AddDump(TraceOutput& out)
{
out.Print("signal send: target: %ld, signal: %lu (%s), "
"flags: 0x%lx", fTarget, fSignal, signal_name(fSignal), fFlags);
out.Print("signal send: target: %" B_PRId32 ", signal: %" B_PRIu32
" (%s), flags: %#" B_PRIx32, fTarget, fSignal,
signal_name(fSignal), fFlags);
}
private:
@ -644,10 +645,10 @@ class SigAction : public AbstractTraceEntry {
virtual void AddDump(TraceOutput& out)
{
out.Print("signal action: signal: %lu (%s), "
"action: {handler: %p, flags: 0x%x, mask: 0x%llx}", fSignal,
signal_name(fSignal), fAction.sa_handler, fAction.sa_flags,
(long long)fAction.sa_mask);
out.Print("signal action: signal: %" B_PRIu32 " (%s), "
"action: {handler: %p, flags: %#x, mask: %#" B_PRIx64 "}",
fSignal, signal_name(fSignal), fAction.sa_handler,
fAction.sa_flags, (uint64)fAction.sa_mask);
}
private:

View File

@ -412,7 +412,7 @@ class PreSyscall : public AbstractTraceEntry {
}
if (printValue)
out.Print("%s0x%llx", (i == 0 ? "" : ", "), value);
out.Print("%s%#" B_PRIx64, (i == 0 ? "" : ", "), value);
}
}
@ -448,7 +448,7 @@ class PostSyscall : public AbstractTraceEntry {
virtual void AddDump(TraceOutput& out)
{
out.Print("syscall post: %s() -> 0x%llx",
out.Print("syscall post: %s() -> %#" B_PRIx64,
get_syscall_name(fSyscall), fReturnValue);
}

View File

@ -216,7 +216,7 @@ public:
virtual void AddDump(TraceOutput& out)
{
out.Print("team forked, new thread %ld", fForkedThread);
out.Print("team forked, new thread %" B_PRId32, fForkedThread);
}
private:
@ -310,7 +310,7 @@ public:
virtual void AddDump(TraceOutput& out)
{
out.Print("team set job control state, team %ld, "
out.Print("team set job control state, team %" B_PRId32 ", "
"new state: %s, signal: %d",
fTeam, job_control_state_name(fNewState), fSignal);
}
@ -334,8 +334,8 @@ public:
virtual void AddDump(TraceOutput& out)
{
out.Print("team wait for child, child: %ld, "
"flags: 0x%lx", fChild, fFlags);
out.Print("team wait for child, child: %" B_PRId32 ", "
"flags: %#" B_PRIx32, fChild, fFlags);
}
private:
@ -367,13 +367,13 @@ public:
virtual void AddDump(TraceOutput& out)
{
if (fTeam >= 0) {
out.Print("team wait for child done, team: %ld, "
"state: %s, status: 0x%lx, reason: 0x%x, signal: %d\n",
out.Print("team wait for child done, team: %" B_PRId32 ", "
"state: %s, status: %#" B_PRIx32 ", reason: %#x, signal: %d\n",
fTeam, job_control_state_name(fState), fStatus, fReason,
fSignal);
} else {
out.Print("team wait for child failed, error: "
"0x%lx, ", fTeam);
"%#" B_PRIx32 ", ", fTeam);
}
}

View File

@ -155,8 +155,8 @@ class SetMinimalCommitment : public VMCacheTraceEntry {
virtual void AddDump(TraceOutput& out)
{
out.Print("vm cache set min commitment: cache: %p, "
"commitment: %lld -> %lld", fCache, fOldCommitment,
fCommitment);
"commitment: %" B_PRIdOFF " -> %" B_PRIdOFF, fCache,
fOldCommitment, fCommitment);
}
private:
@ -178,8 +178,8 @@ class Resize : public VMCacheTraceEntry {
virtual void AddDump(TraceOutput& out)
{
out.Print("vm cache resize: cache: %p, size: %lld -> %lld", fCache,
fOldSize, fSize);
out.Print("vm cache resize: cache: %p, size: %" B_PRIdOFF " -> %"
B_PRIdOFF, fCache, fOldSize, fSize);
}
private:
@ -323,8 +323,8 @@ class InsertPage : public VMCacheTraceEntry {
virtual void AddDump(TraceOutput& out)
{
out.Print("vm cache insert page: cache: %p, page: %p, offset: %lld",
fCache, fPage, fOffset);
out.Print("vm cache insert page: cache: %p, page: %p, offset: %"
B_PRIdOFF, fCache, fPage, fOffset);
}
private:

View File

@ -272,7 +272,7 @@ public:
virtual void AddDump(TraceOutput& out)
{
out.Print("page reserve: %lu", fCount);
out.Print("page reserve: %" B_PRIu32, fCount);
}
private:
@ -291,7 +291,7 @@ public:
virtual void AddDump(TraceOutput& out)
{
out.Print("page unreserve: %lu", fCount);
out.Print("page unreserve: %" B_PRId32, fCount);
}
private:
@ -376,7 +376,7 @@ public:
virtual void AddDump(TraceOutput& out)
{
out.Print("page scrubbing: %lu", fCount);
out.Print("page scrubbing: %" B_PRId32, fCount);
}
private:
@ -395,7 +395,7 @@ public:
virtual void AddDump(TraceOutput& out)
{
out.Print("page scrubbed: %lu", fCount);
out.Print("page scrubbed: %" B_PRId32, fCount);
}
private:

View File

@ -188,7 +188,7 @@ class SelectBegin : public SelectTraceEntry {
virtual void AddDump(TraceOutput& out)
{
SelectTraceEntry::AddDump(out, "select begin: ");
out.Print(", timeout: %lld", fTimeout);
out.Print(", timeout: %" B_PRIdBIGTIME, fTimeout);
}
private:
@ -213,7 +213,7 @@ class SelectDone : public SelectTraceEntry {
if (fStatus == B_OK)
SelectTraceEntry::AddDump(out, "select done: ");
else
out.Print("select done: error: 0x%lx", fStatus);
out.Print("select done: error: %#" B_PRIx32, fStatus);
}
private:
@ -319,7 +319,7 @@ class PollBegin : public PollTraceEntry {
{
out.Print("poll begin: ");
PollTraceEntry::AddDump(out);
out.Print(", timeout: %lld", fTimeout);
out.Print(", timeout: %" B_PRIdBIGTIME, fTimeout);
}
private:
@ -343,7 +343,7 @@ class PollDone : public PollTraceEntry {
out.Print("poll done: count: %d: ", fResult);
PollTraceEntry::AddDump(out);
} else
out.Print("poll done: error: 0x%x", fResult);
out.Print("poll done: error: %#x", fResult);
}
private: