Fix compiling warnings

Change-Id: Ifa32c703e9919277be98c258ced56ef67150dd13
diff --git a/jni/filters/bwfilter.c b/jni/filters/bwfilter.c
index f7fb31a..415223a 100644
--- a/jni/filters/bwfilter.c
+++ b/jni/filters/bwfilter.c
@@ -19,6 +19,7 @@
 
 void JNIFUNCF(ImageFilterBwFilter, nativeApplyFilter, jobject bitmap, jint width, jint height, jint rw, jint gw, jint bw)
 {
+    (void)obj;
     char* destination = 0;
     AndroidBitmap_lockPixels(env, bitmap, (void**) &destination);
     unsigned char * rgb = (unsigned char * )destination;
diff --git a/jni/filters/contrast.c b/jni/filters/contrast.c
index b04e936..fbd9c76 100644
--- a/jni/filters/contrast.c
+++ b/jni/filters/contrast.c
@@ -17,27 +17,9 @@
 #include <math.h>
 #include "filters.h"
 
-unsigned char clamp(int c)
-{
-    int N = 255;
-    c &= ~(c >> 31);
-    c -= N;
-    c &= (c >> 31);
-    c += N;
-    return  (unsigned char) c;
-}
-
-int clampMax(int c,int max)
-{
-    c &= ~(c >> 31);
-    c -= max;
-    c &= (c >> 31);
-    c += max;
-    return  c;
-}
-
 void JNIFUNCF(ImageFilterContrast, nativeApplyFilter, jobject bitmap, jint width, jint height, jfloat bright)
 {
+    (void)obj;
     char* destination = 0;
     AndroidBitmap_lockPixels(env, bitmap, (void**) &destination);
     unsigned char * rgb = (unsigned char * )destination;
diff --git a/jni/filters/edge.c b/jni/filters/edge.c
index 9f5d88f..6c40675 100644
--- a/jni/filters/edge.c
+++ b/jni/filters/edge.c
@@ -19,6 +19,7 @@
 
 void JNIFUNCF(ImageFilterEdge, nativeApplyFilter, jobject bitmap, jint width, jint height, jfloat p)
 {
+    (void)obj;
     char* destination = 0;
     AndroidBitmap_lockPixels(env, bitmap, (void**) &destination);
 
diff --git a/jni/filters/exposure.c b/jni/filters/exposure.c
index 6b32798..a2df709 100644
--- a/jni/filters/exposure.c
+++ b/jni/filters/exposure.c
@@ -18,6 +18,7 @@
 
 void JNIFUNCF(ImageFilterExposure, nativeApplyFilter, jobject bitmap, jint width, jint height, jfloat bright)
 {
+    (void)obj;
     char* destination = 0;
     AndroidBitmap_lockPixels(env, bitmap, (void**) &destination);
     unsigned char * rgb = (unsigned char * )destination;
diff --git a/jni/filters/filters.h b/jni/filters/filters.h
index 3f8c3a0..55c260f 100644
--- a/jni/filters/filters.h
+++ b/jni/filters/filters.h
@@ -44,8 +44,24 @@
 #define ALPHA i+3
 #define CLAMP(c) (MAX(0, MIN(255, c)))
 
-__inline__ unsigned char  clamp(int c);
-__inline__ int clampMax(int c,int max);
+__inline__ unsigned char  clamp(int c)
+{
+    int N = 255;
+    c &= ~(c >> 31);
+    c -= N;
+    c &= (c >> 31);
+    c += N;
+    return  (unsigned char) c;
+}
+
+__inline__ int clampMax(int c,int max)
+{
+    c &= ~(c >> 31);
+    c -= max;
+    c &= (c >> 31);
+    c += max;
+    return  c;
+}
 
 extern void rgb2hsv( unsigned char *rgb,int rgbOff,unsigned short *hsv,int hsvOff);
 extern void hsv2rgb(unsigned short *hsv,int hsvOff,unsigned char  *rgb,int rgbOff);
diff --git a/jni/filters/fx.c b/jni/filters/fx.c
index c3c9cbd..d577e61 100644
--- a/jni/filters/fx.c
+++ b/jni/filters/fx.c
@@ -33,6 +33,9 @@
         jobject lutbitmap, jint lutwidth, jint lutheight,
         jint start, jint end)
 {
+    (void)obj;
+    (void)width;
+    (void)height;
     char* destination = 0;
     char* lut = 0;
     AndroidBitmap_lockPixels(env, bitmap, (void**) &destination);
diff --git a/jni/filters/geometry.c b/jni/filters/geometry.c
index b308213..9fbf733 100644
--- a/jni/filters/geometry.c
+++ b/jni/filters/geometry.c
@@ -19,6 +19,8 @@
 
 static __inline__ void flipVertical(char * source, int srcWidth, int srcHeight, char * destination, int dstWidth, int dstHeight){
     //Vertical
+    (void)dstWidth;
+    (void)dstHeight;
     size_t cpy_bytes = sizeof(char) * 4;
     int width = cpy_bytes * srcWidth;
     int length = srcHeight;
@@ -33,6 +35,8 @@
 
 static __inline__ void flipHorizontal(char * source, int srcWidth, int srcHeight, char * destination, int dstWidth, int dstHeight){
     //Horizontal
+    (void)dstWidth;
+    (void)dstHeight;
     size_t cpy_bytes = sizeof(char) * 4;
     int width = cpy_bytes * srcWidth;
     int length = srcHeight;
@@ -71,12 +75,13 @@
 
 //90 CCW (opposite of what's used in UI?)
 static __inline__ void rotate90(char * source, int srcWidth, int srcHeight, char * destination, int dstWidth, int dstHeight){
+    (void)dstWidth;
+    (void)dstHeight;
     size_t cpy_bytes = sizeof(char) * 4;
     int width = cpy_bytes * srcWidth;
     int length = srcHeight;
-    int total = length * width;
     int i = 0;
-    int j = 0;
+    unsigned int j = 0;
     for (j = 0; j < length * cpy_bytes; j+= cpy_bytes){
         for (i = 0; i < width; i+=cpy_bytes){
             int column_disp = (width - cpy_bytes - i) * length;
@@ -120,7 +125,6 @@
     if ((srcWidth > dstWidth + offsetWidth) || (srcHeight > dstHeight + offsetHeight)){
         return;
     }
-    int i = 0;
     int j = 0;
     for (j = offsetHeight; j < offsetHeight + dstHeight; j++){
         memcpy(destination + (j - offsetHeight) * new_row_width, source + j * row_width + offsetWidth * cpy_bytes, cpy_bytes * dstWidth );
@@ -128,6 +132,7 @@
 }
 
 void JNIFUNCF(ImageFilterGeometry, nativeApplyFilterFlip, jobject src, jint srcWidth, jint srcHeight, jobject dst, jint dstWidth, jint dstHeight, jint flip) {
+    (void)obj;
     char* destination = 0;
     char* source = 0;
     if (srcWidth != dstWidth || srcHeight != dstHeight) {
@@ -141,9 +146,9 @@
 }
 
 void JNIFUNCF(ImageFilterGeometry, nativeApplyFilterRotate, jobject src, jint srcWidth, jint srcHeight, jobject dst, jint dstWidth, jint dstHeight, jint rotate) {
+    (void)obj;
     char* destination = 0;
     char* source = 0;
-    int len = dstWidth * dstHeight * 4;
     AndroidBitmap_lockPixels(env, src, (void**) &source);
     AndroidBitmap_lockPixels(env, dst, (void**) &destination);
     rotate_fun(rotate, source, srcWidth, srcHeight, destination, dstWidth, dstHeight);
@@ -152,9 +157,9 @@
 }
 
 void JNIFUNCF(ImageFilterGeometry, nativeApplyFilterCrop, jobject src, jint srcWidth, jint srcHeight, jobject dst, jint dstWidth, jint dstHeight, jint offsetWidth, jint offsetHeight) {
+    (void)obj;
     char* destination = 0;
     char* source = 0;
-    int len = dstWidth * dstHeight * 4;
     AndroidBitmap_lockPixels(env, src, (void**) &source);
     AndroidBitmap_lockPixels(env, dst, (void**) &destination);
     crop(source, srcWidth, srcHeight, destination, dstWidth, dstHeight, offsetWidth, offsetHeight);
@@ -163,6 +168,10 @@
 }
 
 void JNIFUNCF(ImageFilterGeometry, nativeApplyFilterStraighten, jobject src, jint srcWidth, jint srcHeight, jobject dst, jint dstWidth, jint dstHeight, jfloat straightenAngle) {
+    (void)obj;
+    (void)srcWidth;
+    (void)srcHeight;
+    (void)straightenAngle;
     char* destination = 0;
     char* source = 0;
     int len = dstWidth * dstHeight * 4;
@@ -171,9 +180,7 @@
     // TODO: implement straighten
     int i = 0;
     for (; i < len; i += 4) {
-        int r = source[RED];
         int g = source[GREEN];
-        int b = source[BLUE];
         destination[RED] = 128;
         destination[GREEN] = g;
         destination[BLUE] = 128;
diff --git a/jni/filters/gradient.c b/jni/filters/gradient.c
index 1a85697..1501d5e 100644
--- a/jni/filters/gradient.c
+++ b/jni/filters/gradient.c
@@ -19,6 +19,7 @@
 void JNIFUNCF(ImageFilter, nativeApplyGradientFilter, jobject bitmap, jint width, jint height,
         jintArray redGradient, jintArray greenGradient, jintArray blueGradient)
 {
+    (void)obj;
     char* destination = 0;
     jint* redGradientArray = 0;
     jint* greenGradientArray = 0;
diff --git a/jni/filters/highlight.c b/jni/filters/highlight.c
index fe9b88f..2d49e6b 100644
--- a/jni/filters/highlight.c
+++ b/jni/filters/highlight.c
@@ -19,6 +19,7 @@
 
 void JNIFUNCF(ImageFilterHighlights, nativeApplyFilter, jobject bitmap,
               jint width, jint height, jfloatArray luminanceMap){
+    (void)obj;
     char* destination = 0;
     AndroidBitmap_lockPixels(env, bitmap, (void**) &destination);
     unsigned char * rgb = (unsigned char * )destination;
diff --git a/jni/filters/hue.c b/jni/filters/hue.c
index a4aef93..974e1e2 100644
--- a/jni/filters/hue.c
+++ b/jni/filters/hue.c
@@ -18,6 +18,7 @@
 
 void JNIFUNCF(ImageFilterHue, nativeApplyFilter, jobject bitmap, jint width, jint height, jfloatArray matrix)
 {
+    (void)obj;
     char* destination = 0;
     AndroidBitmap_lockPixels(env, bitmap, (void**) &destination);
     unsigned char * rgb = (unsigned char * )destination;
diff --git a/jni/filters/kmeans.cc b/jni/filters/kmeans.cc
index 97cead7..f0aa54b 100644
--- a/jni/filters/kmeans.cc
+++ b/jni/filters/kmeans.cc
@@ -34,6 +34,7 @@
         jobject large_ds_bitmap, jint lwidth, jint lheight, jobject small_ds_bitmap,
         jint swidth, jint sheight, jint p, jint seed)
 {
+    (void)obj;
     char* destination = 0;
     char* larger_ds_dst = 0;
     char* smaller_ds_dst = 0;
diff --git a/jni/filters/negative.c b/jni/filters/negative.c
index 735e583..69c7670 100644
--- a/jni/filters/negative.c
+++ b/jni/filters/negative.c
@@ -18,6 +18,7 @@
 
 void JNIFUNCF(ImageFilterNegative, nativeApplyFilter, jobject bitmap, jint width, jint height)
 {
+    (void)obj;
     char* destination = 0;
     AndroidBitmap_lockPixels(env, bitmap, (void**) &destination);
 
diff --git a/jni/filters/redEyeMath.c b/jni/filters/redEyeMath.c
index 26f3f76..d088563 100644
--- a/jni/filters/redEyeMath.c
+++ b/jni/filters/redEyeMath.c
@@ -32,6 +32,7 @@
 
 void findPossible(unsigned char *src, unsigned char *mask, int iw, int ih,
         short *rect) {
+    (void)ih;
     int recX = rect[0], recY = rect[1], recW = rect[2], recH = rect[3];
     int y, x;
 
@@ -53,6 +54,7 @@
 
 void findReds(unsigned char *src, unsigned char *mask, int iw, int ih,
         short *rect) {
+    (void)ih;
     int recX = rect[0], recY = rect[1], recW = rect[2], recH = rect[3];
     int y, x;
 
@@ -70,6 +72,7 @@
 
 void dialateMaskIfRed(unsigned char *src, int iw, int ih, unsigned char *mask,
         unsigned char *out, short *rect) {
+    (void)ih;
     int recX = rect[0], recY = rect[1], recW = rect[2], recH = rect[3];
     int y, x;
 
@@ -111,7 +114,6 @@
     int recX = rect[0], recY = rect[1], recW = rect[2], recH = rect[3];
     unsigned char *mask1 = (unsigned char *) malloc(recW * recH);
     unsigned char *mask2 = (unsigned char *)malloc(recW*recH);
-    int QUE_LEN = 100;
     int y, x, i;
 
     rect[0] = MAX(rect[0],0);
diff --git a/jni/filters/redeye.c b/jni/filters/redeye.c
index 9a358dd..a7d12a8 100644
--- a/jni/filters/redeye.c
+++ b/jni/filters/redeye.c
@@ -19,6 +19,7 @@
 
  void JNIFUNCF(ImageFilterRedEye, nativeApplyFilter, jobject bitmap, jint width, jint height, jshortArray vrect)
  {
+     (void)obj;
      char* destination = 0;
      AndroidBitmap_lockPixels(env, bitmap, (void**) &destination);
      unsigned char * rgb = (unsigned char * )destination;
diff --git a/jni/filters/saturated.c b/jni/filters/saturated.c
index 1bc0cc5..5ea361b 100644
--- a/jni/filters/saturated.c
+++ b/jni/filters/saturated.c
@@ -18,6 +18,7 @@
 
 void JNIFUNCF(ImageFilterSaturated, nativeApplyFilter, jobject bitmap, jint width, jint height, jfloat saturation)
 {
+    (void)obj;
     char* destination = 0;
     AndroidBitmap_lockPixels(env, bitmap, (void**) &destination);
     int i;
@@ -36,7 +37,6 @@
         int r = destination[RED];
         int g = destination[GREEN];
         int b = destination[BLUE];
-        int t = (r + g) / 2;
         R = r;
         G = g;
         B = b;
diff --git a/jni/filters/shadows.c b/jni/filters/shadows.c
index 38d64c8..af3dba4 100644
--- a/jni/filters/shadows.c
+++ b/jni/filters/shadows.c
@@ -18,6 +18,7 @@
 #include "filters.h"
 
 void JNIFUNCF(ImageFilterShadows, nativeApplyFilter, jobject bitmap, jint width, jint height, float scale){
+    (void)obj;
     double shadowFilterMap[] = {
             -0.00591,  0.0001,
              1.16488,  0.01668,
diff --git a/jni/filters/tinyplanet.cc b/jni/filters/tinyplanet.cc
index beac086..56d1253 100644
--- a/jni/filters/tinyplanet.cc
+++ b/jni/filters/tinyplanet.cc
@@ -131,6 +131,7 @@
 
 void JNIFUNCF(ImageFilterTinyPlanet, nativeApplyFilter, jobject bitmap_in, jint width, jint height, jobject bitmap_out, jint output_size, jfloat scale,jfloat angle)
 {
+    (void)obj;
     char* source = 0;
     char* destination = 0;
     AndroidBitmap_lockPixels(env, bitmap_in, (void**) &source);
diff --git a/jni/filters/vibrance.c b/jni/filters/vibrance.c
index cb5c536..43e73db 100644
--- a/jni/filters/vibrance.c
+++ b/jni/filters/vibrance.c
@@ -19,6 +19,7 @@
 
 void JNIFUNCF(ImageFilterVibrance, nativeApplyFilter, jobject bitmap, jint width, jint height,  jfloat vibrance)
 {
+    (void)obj;
     char* destination = 0;
     AndroidBitmap_lockPixels(env, bitmap, (void**) &destination);
     int i;
@@ -45,7 +46,6 @@
         Rt = Rf * MS;
         Gt = Gf * MS;
         Bt = Bf * MS;
-        int t = (r + g) / 2;
         R = r;
         G = g;
         B = b;
diff --git a/jni/filters/wbalance.c b/jni/filters/wbalance.c
index 2b92b99..3e1eac6 100644
--- a/jni/filters/wbalance.c
+++ b/jni/filters/wbalance.c
@@ -99,10 +99,10 @@
 }
 
 void estmateWhiteBox(unsigned char *src, int iw, int ih, int x,int y, int *wr, int *wb, int *wg){
-    int r;
-    int g;
-    int b;
-    int sum;
+    int r = 0;
+    int g = 0;
+    int b = 0;
+    int sum = 0;
     int xp,yp;
     int bounds = 5;
     if (x<0) x = bounds;
@@ -130,6 +130,7 @@
 
 void JNIFUNCF(ImageFilterWBalance, nativeApplyFilter, jobject bitmap, jint width, jint height, int locX,int locY)
 {
+    (void)obj;
     char* destination = 0;
     AndroidBitmap_lockPixels(env, bitmap, (void**) &destination);
     int i;
diff --git a/jni/jni_egl_fence.cpp b/jni/jni_egl_fence.cpp
index cf15e2f..7e78892 100644
--- a/jni/jni_egl_fence.cpp
+++ b/jni/jni_egl_fence.cpp
@@ -37,7 +37,6 @@
 
 bool IsEglKHRFenceSyncSupported() {
   if (!initialized) {
-    EGLDisplay display = eglGetCurrentDisplay();
     const char* eglExtensions = eglQueryString(eglGetCurrentDisplay(), EGL_EXTENSIONS);
     if (eglExtensions && strstr(eglExtensions, "EGL_KHR_fence_sync")) {
       FuncEglCreateSyncKHR = (TypeEglCreateSyncKHR) eglGetProcAddress("eglCreateSyncKHR");
@@ -56,6 +55,8 @@
 void
 Java_com_android_gallery3d_photoeditor_FilterStack_nativeEglSetFenceAndWait(JNIEnv* env,
                                                                           jobject thiz) {
+  (void)env;
+  (void)thiz;
   if (!IsEglKHRFenceSyncSupported()) return;
   EGLDisplay display = eglGetCurrentDisplay();
 
diff --git a/jni_jpegstream/src/jerr_hook.cpp b/jni_jpegstream/src/jerr_hook.cpp
index f8f864f..c8491cc 100644
--- a/jni_jpegstream/src/jerr_hook.cpp
+++ b/jni_jpegstream/src/jerr_hook.cpp
@@ -34,7 +34,6 @@
  * to logcat's error log.
  */
 void ErrOutput(j_common_ptr cinfo) {
-    ErrManager* mgr = reinterpret_cast<ErrManager*>(cinfo->err);
     char buf[JMSG_LENGTH_MAX];
     (*cinfo->err->format_message) (cinfo, buf);
     buf[JMSG_LENGTH_MAX - 1] = '\0';  // Force null terminator
diff --git a/jni_jpegstream/src/jpeg_hook.cpp b/jni_jpegstream/src/jpeg_hook.cpp
index cca54e4..b4d4dd3 100644
--- a/jni_jpegstream/src/jpeg_hook.cpp
+++ b/jni_jpegstream/src/jpeg_hook.cpp
@@ -121,7 +121,7 @@
         return;
     }
     SourceManager *src = reinterpret_cast<SourceManager*>(cinfo->src);
-    if (src->mgr.bytes_in_buffer >= num_bytes) {
+    if (src->mgr.bytes_in_buffer >= (size_t)num_bytes) {
         src->mgr.bytes_in_buffer -= num_bytes;
         src->mgr.next_input_byte += num_bytes;
     } else {
@@ -151,6 +151,7 @@
 
 void Mgr_term_source_fcn(j_decompress_ptr cinfo) {
     //noop
+    (void)cinfo;
 }
 
 int32_t MakeSrc(j_decompress_ptr cinfo, JNIEnv *env, jobject inStream){
diff --git a/jni_jpegstream/src/jpeg_reader.cpp b/jni_jpegstream/src/jpeg_reader.cpp
index 4726b64..9662152 100644
--- a/jni_jpegstream/src/jpeg_reader.cpp
+++ b/jni_jpegstream/src/jpeg_reader.cpp
@@ -215,7 +215,6 @@
     // Do endianness and alpha for output format
     if (mFormat == Jpeg_Config::FORMAT_RGBA) {
         // Set alphas to 255
-        uint8_t* end = buf + len - 1;
         for (int i = len - 1; i >= 0; i -= 4) {
             buf[i] = 255;
             buf[i - 1] = *--iter;
@@ -224,7 +223,6 @@
         }
     } else if (mFormat == Jpeg_Config::FORMAT_ABGR) {
         // Reverse endianness and set alphas to 255
-        uint8_t* end = buf + len - 1;
         int r, g, b;
         for (int i = len - 1; i >= 0; i -= 4) {
             b = *--iter;
diff --git a/jni_jpegstream/src/jpegstream.cpp b/jni_jpegstream/src/jpegstream.cpp
index 3b9a683..4c239e8 100644
--- a/jni_jpegstream/src/jpegstream.cpp
+++ b/jni_jpegstream/src/jpegstream.cpp
@@ -324,6 +324,7 @@
 }
 
 jint JNI_OnLoad(JavaVM* vm, void* reserved) {
+    (void)reserved;
     JNIEnv* env;
     if (vm->GetEnv(reinterpret_cast<void**>(&env), JNI_VERSION_1_6) != JNI_OK) {
         LOGE("Error: GetEnv failed in JNI_OnLoad");