Camera: Remove Remove unused variables & functions

For build-system CFLAGS clean-up, remove unused variables and
functions.

Bug: 18632512
Change-Id: I9da5c3cdfe0ed32d18126ae9c2339bfac8cb0429
diff --git a/camera/QCamera2/HAL/QCamera2HWI.cpp b/camera/QCamera2/HAL/QCamera2HWI.cpp
index d8f5933..51222ba 100644
--- a/camera/QCamera2/HAL/QCamera2HWI.cpp
+++ b/camera/QCamera2/HAL/QCamera2HWI.cpp
@@ -6177,7 +6177,6 @@
 {
     int running = 1;
     int ret;
-    uint8_t is_active = FALSE;
 
     QCamera2HardwareInterface *pme = (QCamera2HardwareInterface *)obj;
     QCameraCmdThread *cmdThread = &pme->mDefferedWorkThread;
@@ -6197,11 +6196,9 @@
         switch (cmd) {
         case CAMERA_CMD_TYPE_START_DATA_PROC:
             CDBG_HIGH("%s: start data proc", __func__);
-            is_active = TRUE;
             break;
         case CAMERA_CMD_TYPE_STOP_DATA_PROC:
             CDBG_HIGH("%s: stop data proc", __func__);
-            is_active = FALSE;
             // signal cmd is completed
             cam_sem_post(&cmdThread->sync_sem);
             break;
diff --git a/camera/QCamera2/HAL3/QCamera3Channel.cpp b/camera/QCamera2/HAL3/QCamera3Channel.cpp
index e3d9881..37adf99 100644
--- a/camera/QCamera2/HAL3/QCamera3Channel.cpp
+++ b/camera/QCamera2/HAL3/QCamera3Channel.cpp
@@ -761,7 +761,6 @@
     ATRACE_CALL();
     int rc = 0;
     mIsType = isType;
-    cam_stream_type_t streamType;
 
     if ((uint32_t)mMemory.getCnt() > (mNumBufs - 1)) {
         ALOGE("%s: Trying to register more buffers than initially requested",
@@ -778,7 +777,6 @@
         }
     }
 
-    streamType = mStreams[0]->getMyType();
     rc = mMemory.registerBuffer(buffer);
     if (ALREADY_EXISTS == rc) {
         return NO_ERROR;
diff --git a/camera/QCamera2/HAL3/QCamera3HWI.cpp b/camera/QCamera2/HAL3/QCamera3HWI.cpp
index 6892e31..babf912 100644
--- a/camera/QCamera2/HAL3/QCamera3HWI.cpp
+++ b/camera/QCamera2/HAL3/QCamera3HWI.cpp
@@ -1414,15 +1414,10 @@
 int64_t QCamera3HardwareInterface::getMinFrameDuration(const camera3_capture_request_t *request)
 {
     bool hasJpegStream = false;
-    bool hasRawStream = false;
     for (uint32_t i = 0; i < request->num_output_buffers; i ++) {
         const camera3_stream_t *stream = request->output_buffers[i].stream;
         if (stream->format == HAL_PIXEL_FORMAT_BLOB)
             hasJpegStream = true;
-        else if (stream->format == HAL_PIXEL_FORMAT_RAW_OPAQUE ||
-                stream->format == HAL_PIXEL_FORMAT_RAW10 ||
-                stream->format == HAL_PIXEL_FORMAT_RAW16)
-            hasRawStream = true;
     }
 
     if (!hasJpegStream)
@@ -3078,6 +3073,11 @@
     if (IS_META_AVAILABLE(CAM_INTF_META_JPEG_THUMB_SIZE, metadata)) {
         cam_dimension_t *thumb_size = (cam_dimension_t *)POINTER_OF_META(
                 CAM_INTF_META_JPEG_THUMB_SIZE, metadata);
+        // Note: cam_dimension_t should have the right layout, but for safety just copy it.
+        int32_t thumbnail_size[2];
+        thumbnail_size[0] = thumb_size->width;
+        thumbnail_size[1] = thumb_size->height;
+        camMetadata.update(ANDROID_JPEG_THUMBNAIL_SIZE, thumbnail_size, 2);
     }
     if (IS_META_AVAILABLE(CAM_INTF_META_PRIVATE_DATA, metadata)) {
         int32_t *privateData = (int32_t *)
@@ -3456,8 +3456,6 @@
                                                    const char *type,
                                                    uint32_t frameNumber)
 {
-    uint32_t frm_num = 0;
-
     //Some sanity checks
     if (meta.tuning_sensor_data_size > TUNING_SENSOR_DATA_MAX) {
         ALOGE("%s : Tuning sensor data size bigger than expected %d: %d",
@@ -6387,8 +6385,6 @@
         char gps_methods[GPS_PROCESSING_METHOD_SIZE];
         const char *gps_methods_src = (const char *)
                 frame_settings.find(ANDROID_JPEG_GPS_PROCESSING_METHOD).data.u8;
-        uint32_t count = frame_settings.find(
-                ANDROID_JPEG_GPS_PROCESSING_METHOD).count;
         memset(gps_methods, '\0', sizeof(gps_methods));
         strncpy(gps_methods, gps_methods_src, sizeof(gps_methods)-1);
         rc = AddSetParmEntryToBatch(hal_metadata, CAM_INTF_META_JPEG_GPS_PROC_METHODS, sizeof(gps_methods), gps_methods);
diff --git a/camera/QCamera2/HAL3/QCamera3PostProc.cpp b/camera/QCamera2/HAL3/QCamera3PostProc.cpp
index a56375f..272757a 100644
--- a/camera/QCamera2/HAL3/QCamera3PostProc.cpp
+++ b/camera/QCamera2/HAL3/QCamera3PostProc.cpp
@@ -260,7 +260,6 @@
         jpeg_settings_t *jpeg_settings)
 {
     CDBG("%s : E", __func__);
-    int32_t ret = NO_ERROR;
 
     if ((NULL == frame) || (NULL == jpeg_settings)) {
         return BAD_VALUE;
@@ -322,10 +321,6 @@
 
     CDBG("%s : X", __func__);
     return NO_ERROR;
-
-on_error:
-    CDBG("%s : X with error %d", __func__, ret);
-    return ret;
 }
 
 /*===========================================================================
@@ -464,7 +459,6 @@
  *==========================================================================*/
 int32_t QCamera3PostProcessor::processData(mm_camera_super_buf_t *frame)
 {
-    QCamera3HardwareInterface* hal_obj = (QCamera3HardwareInterface*)m_parent->mUserData;
     pthread_mutex_lock(&mReprocJobLock);
     // enqueue to post proc input queue
     m_inputPPQ.enqueue((void *)frame);
diff --git a/camera/QCamera2/stack/common/cam_types.h b/camera/QCamera2/stack/common/cam_types.h
index 8e742df..aab081c 100644
--- a/camera/QCamera2/stack/common/cam_types.h
+++ b/camera/QCamera2/stack/common/cam_types.h
@@ -56,7 +56,6 @@
  *  dump the image to the file
  **/
 #define CAM_DUMP_TO_FILE(path, name, index, extn, p_addr, len) ({ \
-  int rc = 0; \
   char filename[CAM_FN_CNT]; \
   if (index >= 0) \
     snprintf(filename, CAM_FN_CNT-1, "%s/%s%d.%s", path, name, index, extn); \
@@ -64,7 +63,7 @@
     snprintf(filename, CAM_FN_CNT-1, "%s/%s.%s", path, name, extn); \
   FILE *fp = fopen(filename, "w+"); \
   if (fp) { \
-    rc = fwrite(p_addr, 1, len, fp); \
+    fwrite(p_addr, 1, len, fp); \
     ALOGE("%s:%d] written size %d", __func__, __LINE__, len); \
     fclose(fp); \
   } else { \
diff --git a/camera/QCamera2/stack/mm-camera-test/src/mm_qcamera_main_menu.c b/camera/QCamera2/stack/mm-camera-test/src/mm_qcamera_main_menu.c
index fd68f73..a276698 100644
--- a/camera/QCamera2/stack/mm-camera-test/src/mm_qcamera_main_menu.c
+++ b/camera/QCamera2/stack/mm-camera-test/src/mm_qcamera_main_menu.c
@@ -1664,7 +1664,6 @@
     menu_id_change_t current_menu_id = MENU_ID_MAIN, next_menu_id;
     camera_action_t action_id;
     int action_param;
-    uint8_t previewing = 0;
     int isZSL = 0;
     uint8_t wnr_enabled = 0;
     mm_camera_lib_handle lib_handle;
@@ -1749,7 +1748,6 @@
                     CDBG_ERROR("%s:mm_camera_lib_start_stream() err=%d\n", __func__, rc);
                     goto ERROR;
                 }
-                previewing = 1;
                 break;
 
             case ACTION_STOP_PREVIEW:
@@ -1759,7 +1757,6 @@
                     CDBG_ERROR("%s:mm_camera_lib_stop_stream() err=%d\n", __func__, rc);
                     goto ERROR;
                 }
-                previewing = 0;
                 break;
 
             case ACTION_SET_WHITE_BALANCE:
diff --git a/camera/QCamera2/stack/mm-camera-test/src/mm_qcamera_snapshot.c b/camera/QCamera2/stack/mm-camera-test/src/mm_qcamera_snapshot.c
index 0f5e4dd..fbd50fa 100644
--- a/camera/QCamera2/stack/mm-camera-test/src/mm_qcamera_snapshot.c
+++ b/camera/QCamera2/stack/mm-camera-test/src/mm_qcamera_snapshot.c
@@ -252,7 +252,6 @@
                                           void *user_data)
 {
 
-    int rc;
     int i = 0;
     mm_camera_test_obj_t *pme = (mm_camera_test_obj_t *)user_data;
     mm_camera_channel_t *channel = NULL;
@@ -270,7 +269,6 @@
     }
     if (NULL == channel) {
         CDBG_ERROR("%s: Wrong channel id (%d)", __func__, bufs->ch_id);
-        rc = -1;
         goto EXIT;
     }
 
@@ -283,7 +281,6 @@
     }
     if (NULL == m_stream) {
         CDBG_ERROR("%s: cannot find snapshot stream", __func__);
-        rc = -1;
         goto EXIT;
     }
 
@@ -296,7 +293,6 @@
     }
     if (NULL == m_frame) {
         CDBG_ERROR("%s: main frame is NULL", __func__);
-        rc = -1;
         goto EXIT;
     }
 
diff --git a/camera/QCamera2/stack/mm-jpeg-interface/test/mm_jpeg_test.c b/camera/QCamera2/stack/mm-jpeg-interface/test/mm_jpeg_test.c
index 8533978..97ac22c 100644
--- a/camera/QCamera2/stack/mm-jpeg-interface/test/mm_jpeg_test.c
+++ b/camera/QCamera2/stack/mm-jpeg-interface/test/mm_jpeg_test.c
@@ -42,10 +42,9 @@
  *  dump the image to the file
  **/
 #define DUMP_TO_FILE(filename, p_addr, len) ({ \
-  int rc = 0; \
   FILE *fp = fopen(filename, "w+"); \
   if (fp) { \
-    rc = fwrite(p_addr, 1, len, fp); \
+    fwrite(p_addr, 1, len, fp); \
     fclose(fp); \
   } else { \
     CDBG_ERROR("%s:%d] cannot dump image", __func__, __LINE__); \
@@ -220,7 +219,6 @@
 
 int mm_jpeg_test_read(mm_jpeg_intf_test_t *p_obj, int idx)
 {
-  int rc = 0;
   FILE *fp = NULL;
   int file_size = 0;
   fp = fopen(p_obj->filename[idx], "rb");
diff --git a/camera/QCamera2/stack/mm-jpeg-interface/test/mm_jpegdec_test.c b/camera/QCamera2/stack/mm-jpeg-interface/test/mm_jpegdec_test.c
index 46ba7ec..982b9cd 100644
--- a/camera/QCamera2/stack/mm-jpeg-interface/test/mm_jpegdec_test.c
+++ b/camera/QCamera2/stack/mm-jpeg-interface/test/mm_jpegdec_test.c
@@ -34,7 +34,7 @@
 
 #define MIN(a,b)  (((a) < (b)) ? (a) : (b))
 #define MAX(a,b)  (((a) > (b)) ? (a) : (b))
-#define CLAMP(x, min, max) MIN(MAX((x), (min)), (max))
+#define CLAMP(x, min, max) x = MIN(MAX((x), (min)), (max))
 
 #define TIME_IN_US(r) ((uint64_t)r.tv_sec * 1000000LL + r.tv_usec)
 struct timeval dtime[2];
@@ -48,10 +48,9 @@
  *  dump the image to the file
  **/
 #define DUMP_TO_FILE(filename, p_addr, len) ({ \
-  int rc = 0; \
   FILE *fp = fopen(filename, "w+"); \
   if (fp) { \
-    rc = fwrite(p_addr, 1, len, fp); \
+    fwrite(p_addr, 1, len, fp); \
     fclose(fp); \
   } else { \
     CDBG_ERROR("%s:%d] cannot dump image", __func__, __LINE__); \
@@ -68,11 +67,6 @@
   int format;
 } jpeg_test_input_t;
 
-static jpeg_test_input_t jpeg_input[] = {
-  {"/data/test.jpg", 5248, 3936, "/data/test.yuv",
-      MM_JPEG_COLOR_FORMAT_YCBCRLP_H2V2}
-};
-
 typedef struct {
   char *filename;
   int width;
diff --git a/camera/mm-image-codec/qomx_core/qomx_core.c b/camera/mm-image-codec/qomx_core/qomx_core.c
index 5336f55..41d11e0 100644
--- a/camera/mm-image-codec/qomx_core/qomx_core.c
+++ b/camera/mm-image-codec/qomx_core/qomx_core.c
@@ -177,7 +177,6 @@
 {
   OMX_ERRORTYPE rc = OMX_ErrorNone;
   int comp_idx = 0, inst_idx = 0;
-  char libName[BUFF_SIZE] = {0};
   void *p_obj = NULL;
   OMX_COMPONENTTYPE *p_comp = NULL;
   omx_core_component_t *p_core_comp = NULL;