From 3e4cf3a1b815340796780eb8ae0e648b2d1a72f3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=B4me=20Duval?= Date: Sat, 4 May 2013 15:04:32 +0200 Subject: [PATCH] PowerStatus: some 64 bit fixes --- src/apps/powerstatus/PowerStatusView.cpp | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/src/apps/powerstatus/PowerStatusView.cpp b/src/apps/powerstatus/PowerStatusView.cpp index 62ef64e4d7..c7a6968243 100644 --- a/src/apps/powerstatus/PowerStatusView.cpp +++ b/src/apps/powerstatus/PowerStatusView.cpp @@ -321,10 +321,11 @@ PowerStatusView::_SetLabel(char* buffer, size_t bufferLength) close = ")"; } - if (!fShowTime && fPercent >= 0) - snprintf(buffer, bufferLength, "%s%ld%%%s", open, fPercent, close); - else if (fShowTime && fTimeLeft >= 0) { - snprintf(buffer, bufferLength, "%s%ld:%02ld%s", + if (!fShowTime && fPercent >= 0) { + snprintf(buffer, bufferLength, "%s%" B_PRId32 "%%%s", open, fPercent, + close); + } else if (fShowTime && fTimeLeft >= 0) { + snprintf(buffer, bufferLength, "%s%" B_PRId32 ":%02" B_PRId32 "%s", open, fTimeLeft / 3600, (fTimeLeft / 60) % 60, close); } } @@ -372,11 +373,12 @@ PowerStatusView::Update(bool force) close = ")"; } if (fHasBattery) { - size_t length = snprintf(text, sizeof(text), "%s%ld%%%s", - open, fPercent, close); + size_t length = snprintf(text, sizeof(text), "%s%" B_PRId32 + "%%%s", open, fPercent, close); if (fTimeLeft) { length += snprintf(text + length, sizeof(text) - length, - "\n%ld:%02ld", fTimeLeft / 3600, (fTimeLeft / 60) % 60); + "\n%" B_PRId32 ":%02" B_PRId32, fTimeLeft / 3600, + (fTimeLeft / 60) % 60); } const char* state = NULL;