OSDN Git Service

Fix unused parameter and signedness warnings.
authorTomasz Wasilczyk <twasilczyk@google.com>
Fri, 7 Apr 2017 21:54:24 +0000 (14:54 -0700)
committerTomasz Wasilczyk <twasilczyk@google.com>
Fri, 7 Apr 2017 21:54:24 +0000 (14:54 -0700)
Test: it builds.
Bug: b/37159108
Change-Id: I092e9318eb4952cb9799a3c6f4be2d7c24b7706c

jni/Android.mk [changed mode: 0755->0644]
jni/jpegutil.cpp
jni/jpegutil.h
jni/jpegutilnative.cpp
jni/tinyplanet.cc

old mode 100755 (executable)
new mode 100644 (file)
index 80c827a..d8c66a2
@@ -9,7 +9,8 @@ LOCAL_SDK_VERSION := 17
 LOCAL_MODULE    := libjni_tinyplanet
 LOCAL_SRC_FILES := tinyplanet.cc
 
-LOCAL_CFLAGS    += -ffast-math -O3 -funroll-loops
+LOCAL_CFLAGS += -ffast-math -O3 -funroll-loops
+LOCAL_CFLAGS += -Wall -Wextra -Werror
 LOCAL_ARM_MODE := arm
 
 include $(BUILD_SHARED_LIBRARY)
@@ -17,7 +18,6 @@ include $(BUILD_SHARED_LIBRARY)
 # JpegUtil
 include $(CLEAR_VARS)
 
-LOCAL_CFLAGS := -std=c++11
 LOCAL_NDK_STL_VARIANT := c++_static
 LOCAL_LDFLAGS   := -llog -ldl -ljnigraphics
 LOCAL_SDK_VERSION := 17
@@ -26,7 +26,9 @@ LOCAL_SRC_FILES := jpegutil.cpp jpegutilnative.cpp
 
 LOCAL_STATIC_LIBRARIES := libjpeg_static_ndk
 
-LOCAL_CFLAGS    += -ffast-math -O3 -funroll-loops
+LOCAL_CFLAGS := -std=c++11
+LOCAL_CFLAGS += -ffast-math -O3 -funroll-loops
+LOCAL_CFLAGS += -Wall -Wextra -Werror
 LOCAL_ARM_MODE := arm
 
 include $(BUILD_SHARED_LIBRARY)
index 02705be..8029869 100644 (file)
@@ -230,7 +230,7 @@ int jpegutil::Compress(int img_width, int img_height,
     return true;
   };
 
-  dest.term_destination = [](j_compress_ptr cinfo) {
+  dest.term_destination = [](j_compress_ptr cinfo __unused) {
     // do nothing to terminate the output buffer
   };
 
@@ -339,7 +339,7 @@ int jpegutil::Compress(
   const Plane cbP = {width / 2, height / 2, cbBuf, cbPStride, cbRStride};
   const Plane crP = {width / 2, height / 2, crBuf, crPStride, crRStride};
 
-  auto flush = [](size_t numBytes) {
+  auto flush = [](size_t numBytes __unused) {
     // do nothing
   };
 
index 720b9de..a8066ed 100644 (file)
@@ -181,7 +181,7 @@ template <unsigned int ROWS>
 const std::array<unsigned char*, ROWS> jpegutil::RowIterator<ROWS>::LoadAt(
     int y_base) {
   std::array<unsigned char*, ROWS> buf_ptrs;
-  for (int i = 0; i < ROWS; i++) {
+  for (unsigned int i = 0; i < ROWS; i++) {
     buf_ptrs[i] = &buf_[padded_row_length_ * i];
   }
 
@@ -189,7 +189,7 @@ const std::array<unsigned char*, ROWS> jpegutil::RowIterator<ROWS>::LoadAt(
     return buf_ptrs;
   }
 
-  for (int i = 0; i < ROWS; i++) {
+  for (unsigned int i = 0; i < ROWS; i++) {
     int y = i + y_base;
     y = min(y, transform_.output_height() - 1);
 
index b2afd94..ad29b87 100644 (file)
@@ -67,7 +67,7 @@ using namespace jpegutil;
  */
 extern "C" JNIEXPORT jint JNICALL
 Java_com_android_camera_util_JpegUtilNative_compressJpegFromYUV420pNative(
-    JNIEnv* env, jclass clazz,
+    JNIEnv* env, jclass clazz __unused,
     /** Input image dimensions */
     jint width, jint height,
     /** Y Plane */
@@ -116,7 +116,7 @@ Java_com_android_camera_util_JpegUtilNative_compressJpegFromYUV420pNative(
  */
 extern "C" JNIEXPORT void JNICALL
 Java_com_android_camera_util_JpegUtilNative_copyImagePlaneToBitmap(
-    JNIEnv* env, jclass clazz, jint width, jint height, jobject planeBuf,
+    JNIEnv* env, jclass clazz __unused, jint width, jint height, jobject planeBuf,
     jint pStride, jint rStride, jobject outBitmap, jint rot90) {
   jbyte* src = (jbyte*)env->GetDirectBufferAddress(planeBuf);
 
index dfb31d7..de63ac9 100644 (file)
@@ -130,7 +130,9 @@ void StereographicProjection(float scale, float angle, unsigned char* input_imag
 }
 
 
-JNIEXPORT void JNICALL Java_com_android_camera_tinyplanet_TinyPlanetNative_process(JNIEnv* env, jobject obj, jobject bitmap_in, jint width, jint height, jobject bitmap_out, jint output_size, jfloat scale, jfloat angle)
+JNIEXPORT void JNICALL Java_com_android_camera_tinyplanet_TinyPlanetNative_process(JNIEnv* env,
+        jobject obj __unused, jobject bitmap_in, jint width, jint height, jobject bitmap_out,
+        jint output_size, jfloat scale, jfloat angle)
 {
     char* source = 0;
     char* destination = 0;