Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit e5729fac authored by Colin Cross's avatar Colin Cross
Browse files

libcameraservice: fix 64-bit print format warnings

Use PRId64 from inttypes.h to print nsecs_t (int64_t)
Use %zu to print size_t

Change-Id: I135620e0388db33587a8a7da393b48a45cb7275a
parent 24e1bd71
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -196,7 +196,7 @@ void CameraService::onDeviceStatusChanged(int cameraId,
             */
        }

        ALOGV("%s: After unplug, disconnected %d clients",
        ALOGV("%s: After unplug, disconnected %zu clients",
              __FUNCTION__, clientsToDisconnect.size());
    }

+4 −2
Original line number Diff line number Diff line
@@ -18,6 +18,8 @@
#define ATRACE_TAG ATRACE_TAG_CAMERA
//#define LOG_NDEBUG 0

#include <inttypes.h>

#include <utils/Log.h>
#include <utils/Trace.h>
#include <utils/Vector.h>
@@ -585,8 +587,8 @@ CaptureSequencer::CaptureState CaptureSequencer::manageStandardCaptureWait(
            ALOGE("No timestamp field in capture frame!");
        }
        if (entry.data.i64[0] != mCaptureTimestamp) {
            ALOGW("Mismatched capture timestamps: Metadata frame %lld,"
                    " captured buffer %lld",
            ALOGW("Mismatched capture timestamps: Metadata frame %" PRId64 ","
                    " captured buffer %" PRId64,
                    entry.data.i64[0],
                    mCaptureTimestamp);
        }
+1 −1
Original line number Diff line number Diff line
@@ -168,7 +168,7 @@ status_t FrameProcessor::processFaceDetect(const CameraMetadata &frame,
                continue;
            }
            if (faceScores[i] > 100) {
                ALOGW("%s: Face index %d with out of range score %d",
                ALOGW("%s: Face index %zu with out of range score %d",
                        __FUNCTION__, i, faceScores[i]);
            }

+2 −2
Original line number Diff line number Diff line
@@ -197,7 +197,7 @@ void JpegCompressor::jpegErrorHandler(j_common_ptr cinfo) {
void JpegCompressor::jpegInitDestination(j_compress_ptr cinfo) {
    ALOGV("%s", __FUNCTION__);
    JpegDestination *dest= static_cast<JpegDestination*>(cinfo->dest);
    ALOGV("%s: Setting destination to %p, size %d",
    ALOGV("%s: Setting destination to %p, size %zu",
            __FUNCTION__, dest->parent->mJpegBuffer->data, kMaxJpegSize);
    dest->next_output_byte = (JOCTET*)(dest->parent->mJpegBuffer->data);
    dest->free_in_buffer = kMaxJpegSize;
@@ -213,7 +213,7 @@ boolean JpegCompressor::jpegEmptyOutputBuffer(j_compress_ptr /*cinfo*/) {
void JpegCompressor::jpegTermDestination(j_compress_ptr cinfo) {
    (void) cinfo; // TODO: clean up
    ALOGV("%s", __FUNCTION__);
    ALOGV("%s: Done writing JPEG data. %d bytes left in buffer",
    ALOGV("%s: Done writing JPEG data. %zu bytes left in buffer",
            __FUNCTION__, cinfo->dest->free_in_buffer);
}

+8 −8
Original line number Diff line number Diff line
@@ -233,7 +233,7 @@ status_t JpegProcessor::processNewCapture() {
    size_t heapSize = mCaptureHeap->getSize();
    if (jpegSize > heapSize) {
        ALOGW("%s: JPEG image is larger than expected, truncating "
                "(got %d, expected at most %d bytes)",
                "(got %zu, expected at most %zu bytes)",
                __FUNCTION__, jpegSize, heapSize);
        jpegSize = heapSize;
    }
@@ -326,13 +326,13 @@ size_t JpegProcessor::findJpegSize(uint8_t* jpegBuffer, size_t maxSize) {
            size_t offset = size - MARKER_LENGTH;
            uint8_t *end = jpegBuffer + offset;
            if (checkJpegStart(jpegBuffer) && checkJpegEnd(end)) {
                ALOGV("Found JPEG transport header, img size %d", size);
                ALOGV("Found JPEG transport header, img size %zu", size);
                return size;
            } else {
                ALOGW("Found JPEG transport header with bad Image Start/End");
            }
        } else {
            ALOGW("Found JPEG transport header with bad size %d", size);
            ALOGW("Found JPEG transport header with bad size %zu", size);
        }
    }

@@ -348,15 +348,15 @@ size_t JpegProcessor::findJpegSize(uint8_t* jpegBuffer, size_t maxSize) {
        segment_t *segment = (segment_t*)(jpegBuffer + size);
        uint8_t type = checkJpegMarker(segment->marker);
        if (type == 0) { // invalid marker, no more segments, begin JPEG data
            ALOGV("JPEG stream found beginning at offset %d", size);
            ALOGV("JPEG stream found beginning at offset %zu", size);
            break;
        }
        if (type == EOI || size > maxSize - sizeof(segment_t)) {
            ALOGE("Got premature End before JPEG data, offset %d", size);
            ALOGE("Got premature End before JPEG data, offset %zu", size);
            return 0;
        }
        size_t length = ntohs(segment->length);
        ALOGV("JFIF Segment, type %x length %x", type, length);
        ALOGV("JFIF Segment, type %x length %zx", type, length);
        size += length + MARKER_LENGTH;
    }

@@ -376,10 +376,10 @@ size_t JpegProcessor::findJpegSize(uint8_t* jpegBuffer, size_t maxSize) {
    }

    if (size > maxSize) {
        ALOGW("JPEG size %d too large, reducing to maxSize %d", size, maxSize);
        ALOGW("JPEG size %zu too large, reducing to maxSize %zu", size, maxSize);
        size = maxSize;
    }
    ALOGV("Final JPEG size %d", size);
    ALOGV("Final JPEG size %zu", size);
    return size;
}

Loading