libgui: 64 bit compile issues (part deux)
- nsecs_t printed with PRId64
- int64_t/uint64_t print issues
- some size_t printing issues.
- missing argument to BQ_LOGV
Change-Id: I493f2b578e801dc38c44f8c536faa45266720402
diff --git a/libs/gui/BufferQueueConsumer.cpp b/libs/gui/BufferQueueConsumer.cpp
index f3f26ac..36e3c06 100644
--- a/libs/gui/BufferQueueConsumer.cpp
+++ b/libs/gui/BufferQueueConsumer.cpp
@@ -14,6 +14,8 @@
* limitations under the License.
*/
+#include <inttypes.h>
+
#define LOG_TAG "BufferQueueConsumer"
#define ATRACE_TAG ATRACE_TAG_GRAPHICS
//#define LOG_NDEBUG 0
@@ -104,14 +106,16 @@
// This buffer is set to display in the near future, or
// desiredPresent is garbage. Either way we don't want to drop
// the previous buffer just to get this on the screen sooner.
- BQ_LOGV("acquireBuffer: nodrop desire=%lld expect=%lld "
- "(%lld) now=%lld", desiredPresent, expectedPresent,
+ BQ_LOGV("acquireBuffer: nodrop desire=%" PRId64 " expect=%"
+ PRId64 " (%" PRId64 ") now=%" PRId64,
+ desiredPresent, expectedPresent,
desiredPresent - expectedPresent,
systemTime(CLOCK_MONOTONIC));
break;
}
- BQ_LOGV("acquireBuffer: drop desire=%lld expect=%lld size=%d",
+ BQ_LOGV("acquireBuffer: drop desire=%" PRId64 " expect=%" PRId64
+ " size=%zu",
desiredPresent, expectedPresent, mCore->mQueue.size());
if (mCore->stillTracking(front)) {
// Front buffer is still in mSlots, so mark the slot as free
@@ -125,15 +129,16 @@
nsecs_t desiredPresent = front->mTimestamp;
if (desiredPresent > expectedPresent &&
desiredPresent < expectedPresent + MAX_REASONABLE_NSEC) {
- BQ_LOGV("acquireBuffer: defer desire=%lld expect=%lld "
- "(%lld) now=%lld", desiredPresent, expectedPresent,
+ BQ_LOGV("acquireBuffer: defer desire=%" PRId64 " expect=%" PRId64
+ " (%" PRId64 ") now=%" PRId64,
+ desiredPresent, expectedPresent,
desiredPresent - expectedPresent,
systemTime(CLOCK_MONOTONIC));
return PRESENT_LATER;
}
- BQ_LOGV("acquireBuffer: accept desire=%lld expect=%lld "
- "(%lld) now=%lld", desiredPresent, expectedPresent,
+ BQ_LOGV("acquireBuffer: accept desire=%" PRId64 " expect=%" PRId64 " "
+ "(%" PRId64 ") now=%" PRId64, desiredPresent, expectedPresent,
desiredPresent - expectedPresent,
systemTime(CLOCK_MONOTONIC));
}
@@ -142,7 +147,7 @@
*outBuffer = *front;
ATRACE_BUFFER_INDEX(slot);
- BQ_LOGV("acquireBuffer: acquiring { slot=%d/%llu buffer=%p }",
+ BQ_LOGV("acquireBuffer: acquiring { slot=%d/%" PRIu64 " buffer=%p }",
slot, front->mFrameNumber, front->mGraphicBuffer->handle);
// If the front buffer is still being tracked, update its slot state
if (mCore->stillTracking(front)) {
diff --git a/libs/gui/BufferQueueCore.cpp b/libs/gui/BufferQueueCore.cpp
index 593b6f1..40e6884 100644
--- a/libs/gui/BufferQueueCore.cpp
+++ b/libs/gui/BufferQueueCore.cpp
@@ -173,7 +173,8 @@
const int minBufferCount = mUseAsyncBuffer ? 2 : 1;
if (count < minBufferCount || count > BufferQueueDefs::NUM_BUFFER_SLOTS) {
BQ_LOGV("setDefaultMaxBufferCount: invalid count %d, should be in "
- "[%d, %d]", minBufferCount, BufferQueueDefs::NUM_BUFFER_SLOTS);
+ "[%d, %d]",
+ count, minBufferCount, BufferQueueDefs::NUM_BUFFER_SLOTS);
return BAD_VALUE;
}
@@ -212,8 +213,8 @@
bool BufferQueueCore::stillTracking(const BufferItem* item) const {
const BufferSlot& slot = mSlots[item->mSlot];
- BQ_LOGV("stillTracking: item { slot=%d/%llu buffer=%p } "
- "slot { slot=%d/%llu buffer=%p }",
+ BQ_LOGV("stillTracking: item { slot=%d/%" PRIu64 " buffer=%p } "
+ "slot { slot=%d/%" PRIu64 " buffer=%p }",
item->mSlot, item->mFrameNumber,
(item->mGraphicBuffer.get() ? item->mGraphicBuffer->handle : 0),
item->mSlot, slot.mFrameNumber,
diff --git a/libs/gui/BufferQueueProducer.cpp b/libs/gui/BufferQueueProducer.cpp
index f536a59..7017ddf 100644
--- a/libs/gui/BufferQueueProducer.cpp
+++ b/libs/gui/BufferQueueProducer.cpp
@@ -14,6 +14,8 @@
* limitations under the License.
*/
+#include <inttypes.h>
+
#define LOG_TAG "BufferQueueProducer"
#define ATRACE_TAG ATRACE_TAG_GRAPHICS
//#define LOG_NDEBUG 0
@@ -209,9 +211,10 @@
// our slots are empty but we have many buffers in the queue. This can
// cause us to run out of memory if we outrun the consumer. Wait here if
// it looks like we have too many buffers queued up.
- bool tooManyBuffers = mCore->mQueue.size() > maxBufferCount;
+ bool tooManyBuffers = mCore->mQueue.size()
+ > static_cast<size_t>(maxBufferCount);
if (tooManyBuffers) {
- BQ_LOGV("%s: queue size is %d, waiting", caller,
+ BQ_LOGV("%s: queue size is %zu, waiting", caller,
mCore->mQueue.size());
}
@@ -367,7 +370,8 @@
eglDestroySyncKHR(eglDisplay, eglFence);
}
- BQ_LOGV("dequeueBuffer: returning slot=%d/%llu buf=%p flags=%#x", *outSlot,
+ BQ_LOGV("dequeueBuffer: returning slot=%d/%" PRIu64 " buf=%p flags=%#x",
+ *outSlot,
mSlots[*outSlot].mFrameNumber,
mSlots[*outSlot].mGraphicBuffer->handle, returnFlags);
@@ -560,8 +564,8 @@
return BAD_VALUE;
}
- BQ_LOGV("queueBuffer: slot=%d/%llu time=%llu crop=[%d,%d,%d,%d] "
- "transform=%#x scale=%s",
+ BQ_LOGV("queueBuffer: slot=%d/%" PRIu64 " time=%" PRIu64
+ " crop=[%d,%d,%d,%d] transform=%#x scale=%s",
slot, mCore->mFrameCounter + 1, timestamp,
crop.left, crop.top, crop.right, crop.bottom,
transform, BufferItem::scalingModeName(scalingMode));
diff --git a/libs/gui/Sensor.cpp b/libs/gui/Sensor.cpp
index 70180f8..f161aeb 100644
--- a/libs/gui/Sensor.cpp
+++ b/libs/gui/Sensor.cpp
@@ -14,6 +14,7 @@
* limitations under the License.
*/
+#include <inttypes.h>
#include <stdint.h>
#include <sys/types.h>
#include <sys/limits.h>
@@ -67,7 +68,8 @@
if (hwSensor->maxDelay > INT_MAX) {
// Max delay is declared as a 64 bit integer for 64 bit architectures. But it should
// always fit in a 32 bit integer, log error and cap it to INT_MAX.
- ALOGE("Sensor maxDelay overflow error %s %lld", mName.string(), hwSensor->maxDelay);
+ ALOGE("Sensor maxDelay overflow error %s %" PRId64, mName.string(),
+ static_cast<int64_t>(hwSensor->maxDelay));
mMaxDelay = INT_MAX;
} else {
mMaxDelay = (int32_t) hwSensor->maxDelay;
diff --git a/libs/gui/StreamSplitter.cpp b/libs/gui/StreamSplitter.cpp
index 83e08fb..771b263 100644
--- a/libs/gui/StreamSplitter.cpp
+++ b/libs/gui/StreamSplitter.cpp
@@ -14,6 +14,8 @@
* limitations under the License.
*/
+#include <inttypes.h>
+
#define LOG_TAG "StreamSplitter"
#define ATRACE_TAG ATRACE_TAG_GRAPHICS
//#define LOG_NDEBUG 0
@@ -63,7 +65,7 @@
}
if (mBuffers.size() > 0) {
- ALOGE("%d buffers still being tracked", mBuffers.size());
+ ALOGE("%zu buffers still being tracked", mBuffers.size());
}
}
@@ -126,7 +128,7 @@
LOG_ALWAYS_FATAL_IF(status != NO_ERROR,
"acquiring buffer from input failed (%d)", status);
- ALOGV("acquired buffer %#llx from input",
+ ALOGV("acquired buffer %#" PRIx64 " from input",
bufferItem.mGraphicBuffer->getId());
status = mInput->detachBuffer(bufferItem.mBuf);
@@ -176,7 +178,7 @@
"queueing buffer to output failed (%d)", status);
}
- ALOGV("queued buffer %#llx to output %p",
+ ALOGV("queued buffer %#" PRIx64 " to output %p",
bufferItem.mGraphicBuffer->getId(), output->get());
}
}
@@ -199,7 +201,8 @@
"detaching buffer from output failed (%d)", status);
}
- ALOGV("detached buffer %#llx from output %p", buffer->getId(), from.get());
+ ALOGV("detached buffer %#" PRIx64 " from output %p",
+ buffer->getId(), from.get());
const sp<BufferTracker>& tracker = mBuffers.editValueFor(buffer->getId());
@@ -209,7 +212,7 @@
// Check to see if this is the last outstanding reference to this buffer
size_t releaseCount = tracker->incrementReleaseCountLocked();
- ALOGV("buffer %#llx reference count %d (of %d)", buffer->getId(),
+ ALOGV("buffer %#" PRIx64 " reference count %zu (of %zu)", buffer->getId(),
releaseCount, mOutputs.size());
if (releaseCount < mOutputs.size()) {
return;
@@ -233,7 +236,7 @@
LOG_ALWAYS_FATAL_IF(status != NO_ERROR,
"releasing buffer to input failed (%d)", status);
- ALOGV("released buffer %#llx to input", buffer->getId());
+ ALOGV("released buffer %#" PRIx64 " to input", buffer->getId());
// We no longer need to track the buffer once it has been returned to the
// input