From e453c0f4a7d0014d73e9b499aa1fe813dc64c084 Mon Sep 17 00:00:00 2001 From: Alex Smith Date: Sat, 28 Jul 2012 13:40:09 +0100 Subject: [PATCH] 64-bit printf warning fixes in libroot. --- src/system/libroot/os/debug.c | 6 +++--- src/system/libroot/posix/malloc/arch-specific.cpp | 5 +++-- src/system/libroot/posix/stdlib/pty.cpp | 4 ++-- src/system/libroot/posix/sys/uname.c | 2 +- src/system/libroot/posix/syslog.cpp | 2 +- 5 files changed, 10 insertions(+), 9 deletions(-) diff --git a/src/system/libroot/os/debug.c b/src/system/libroot/os/debug.c index 7ef95aa28a..a952edc96a 100644 --- a/src/system/libroot/os/debug.c +++ b/src/system/libroot/os/debug.c @@ -60,7 +60,7 @@ bool _rtDebugFlag = true; void debugger(const char *message) { - debug_printf("%ld: DEBUGGER: %s\n", find_thread(NULL), message); + debug_printf("%" B_PRId32 ": DEBUGGER: %s\n", find_thread(NULL), message); _kern_debugger(message); } @@ -261,8 +261,8 @@ _debuggerAssert(const char *file, int line, const char *message) "Assert failed: File: %s, Line: %d, %s", file, line, message); - debug_printf("%ld: ASSERT: %s:%d %s\n", find_thread(NULL), file, line, - buffer); + debug_printf("%" B_PRId32 ": ASSERT: %s:%d %s\n", find_thread(NULL), file, + line, buffer); _kern_debugger(buffer); return 0; diff --git a/src/system/libroot/posix/malloc/arch-specific.cpp b/src/system/libroot/posix/malloc/arch-specific.cpp index 6151fa6407..c9e311c134 100644 --- a/src/system/libroot/posix/malloc/arch-specific.cpp +++ b/src/system/libroot/posix/malloc/arch-specific.cpp @@ -76,8 +76,9 @@ init_after_fork(void) sHeapArea = area_for((void*)sFreeHeapBase); if (sHeapArea < 0) { // Where is it gone? - debug_printf("hoard: init_after_fork(): thread %ld, Heap area not " - "found! Base address: %p\n", find_thread(NULL), sHeapBase); + debug_printf("hoard: init_after_fork(): thread %" B_PRId32 ", Heap " + "area not found! Base address: %p\n", find_thread(NULL), + sHeapBase); exit(1); } } diff --git a/src/system/libroot/posix/stdlib/pty.cpp b/src/system/libroot/posix/stdlib/pty.cpp index 2da52c50d6..78c43bcb99 100644 --- a/src/system/libroot/posix/stdlib/pty.cpp +++ b/src/system/libroot/posix/stdlib/pty.cpp @@ -37,8 +37,8 @@ ptsname(int masterFD) static char buffer[32]; char letter = 'p'; - snprintf(buffer, sizeof(buffer), "/dev/tt/%c%lx", char(letter + index / 16), - index % 16); + snprintf(buffer, sizeof(buffer), "/dev/tt/%c%" B_PRIx32, + char(letter + index / 16), index % 16); return buffer; } diff --git a/src/system/libroot/posix/sys/uname.c b/src/system/libroot/posix/sys/uname.c index 717f009fd0..8fe5be1d3c 100644 --- a/src/system/libroot/posix/sys/uname.c +++ b/src/system/libroot/posix/sys/uname.c @@ -41,7 +41,7 @@ uname(struct utsname *info) strlcat(info->version, systemInfo.kernel_build_date, sizeof(info->version)); strlcat(info->version, " ", sizeof(info->version)); strlcat(info->version, systemInfo.kernel_build_time, sizeof(info->version)); - snprintf(info->release, sizeof(info->release), "%lld", + snprintf(info->release, sizeof(info->release), "%" B_PRId64, systemInfo.kernel_version); // TODO: make this better diff --git a/src/system/libroot/posix/syslog.cpp b/src/system/libroot/posix/syslog.cpp index 7ed66d97de..97d5b3c08f 100644 --- a/src/system/libroot/posix/syslog.cpp +++ b/src/system/libroot/posix/syslog.cpp @@ -95,7 +95,7 @@ message_to_console(syslog_context *context, const char *text, va_list args) if (context->ident[0]) fprintf(stderr, "'%s' ", context->ident); if (context->options & LOG_PID) - fprintf(stderr, "[%ld] ", find_thread(NULL)); + fprintf(stderr, "[%" B_PRId32 "] ", find_thread(NULL)); vfprintf(stderr, text, args); fputc('\n', stderr);