diff options
author | Tomasz Wasilczyk <twasilczyk@google.com> | 2017-04-07 15:53:44 -0700 |
---|---|---|
committer | Tomasz Wasilczyk <twasilczyk@google.com> | 2017-04-07 15:53:44 -0700 |
commit | a836402ee66cc1d723fa752ff5cff9930c1249c6 (patch) | |
tree | 0ac9fd64bc35e9af6e9f5fca883c5c4819629fa5 /jni | |
parent | 326dcc80b53182747ee8b74f055d0971b34b35a8 (diff) | |
download | android_packages_apps_Gallery2-a836402ee66cc1d723fa752ff5cff9930c1249c6.tar.gz android_packages_apps_Gallery2-a836402ee66cc1d723fa752ff5cff9930c1249c6.tar.bz2 android_packages_apps_Gallery2-a836402ee66cc1d723fa752ff5cff9930c1249c6.zip |
Fix warnings and set Werror flag to not let them happen again.
Test: it builds.
Bug: b/37159108
Change-Id: I898f5de0f8e992404977d4958b8dd44af4aea9fe
Diffstat (limited to 'jni')
-rw-r--r-- | jni/Android.mk | 2 | ||||
-rw-r--r-- | jni/filters/filters.h | 2 | ||||
-rw-r--r-- | jni/filters/fx.c | 4 | ||||
-rw-r--r-- | jni/filters/geometry.c | 22 | ||||
-rw-r--r-- | jni/filters/redEyeMath.c | 11 | ||||
-rw-r--r-- | jni/filters/saturated.c | 1 | ||||
-rw-r--r-- | jni/filters/vibrance.c | 1 | ||||
-rw-r--r-- | jni/jni_egl_fence.cpp | 6 |
8 files changed, 23 insertions, 26 deletions
diff --git a/jni/Android.mk b/jni/Android.mk index 857fca243..6e0552a67 100644 --- a/jni/Android.mk +++ b/jni/Android.mk @@ -3,6 +3,7 @@ LOCAL_PATH:= $(call my-dir) include $(CLEAR_VARS) LOCAL_CFLAGS += -DEGL_EGLEXT_PROTOTYPES -Wno-unused-parameter +LOCAL_CFLAGS += -Wall -Wextra -Werror LOCAL_SRC_FILES := jni_egl_fence.cpp @@ -45,6 +46,7 @@ LOCAL_SRC_FILES := filters/gradient.c \ filters/kmeans.cc LOCAL_CFLAGS += -ffast-math -O3 -funroll-loops -Wno-unused-parameter +LOCAL_CFLAGS += -Wall -Wextra -Werror LOCAL_LDLIBS := -llog -ljnigraphics LOCAL_ARM_MODE := arm diff --git a/jni/filters/filters.h b/jni/filters/filters.h index 6856a2616..e20396384 100644 --- a/jni/filters/filters.h +++ b/jni/filters/filters.h @@ -35,7 +35,7 @@ typedef unsigned int Color; #define LOG(msg...) __android_log_print(ANDROID_LOG_VERBOSE, "NativeFilters", msg) -#define JNIFUNCF(cls, name, vars...) Java_com_android_gallery3d_filtershow_filters_ ## cls ## _ ## name(JNIEnv* env, jobject obj, vars) +#define JNIFUNCF(cls, name, vars...) Java_com_android_gallery3d_filtershow_filters_ ## cls ## _ ## name(JNIEnv* env, jobject obj_unused __unused, vars) #define RED i #define GREEN (i+1) diff --git a/jni/filters/fx.c b/jni/filters/fx.c index c3c9cbdc6..4d4cda123 100644 --- a/jni/filters/fx.c +++ b/jni/filters/fx.c @@ -29,8 +29,8 @@ __inline__ int interp(unsigned char *src, int p , int *off ,float dr,float dg, return (int)frbg ; } -void JNIFUNCF(ImageFilterFx, nativeApplyFilter, jobject bitmap, jint width, jint height, - jobject lutbitmap, jint lutwidth, jint lutheight, +void JNIFUNCF(ImageFilterFx, nativeApplyFilter, jobject bitmap, jint width __unused, + jint height __unused, jobject lutbitmap, jint lutwidth, jint lutheight, jint start, jint end) { char* destination = 0; diff --git a/jni/filters/geometry.c b/jni/filters/geometry.c index b01e5e05f..8537549d0 100644 --- a/jni/filters/geometry.c +++ b/jni/filters/geometry.c @@ -19,7 +19,8 @@ #include "filters.h" -static __inline__ void flipVertical(char * source, int srcWidth, int srcHeight, char * destination, int dstWidth, int dstHeight){ +static __inline__ void flipVertical(char * source, int srcWidth, int srcHeight, char * destination, + int dstWidth __unused, int dstHeight __unused) { //Vertical size_t cpy_bytes = sizeof(char) * 4; int width = cpy_bytes * srcWidth; @@ -33,7 +34,8 @@ static __inline__ void flipVertical(char * source, int srcWidth, int srcHeight, } } -static __inline__ void flipHorizontal(char * source, int srcWidth, int srcHeight, char * destination, int dstWidth, int dstHeight){ +static __inline__ void flipHorizontal(char * source, int srcWidth, int srcHeight, + char * destination, int dstWidth __unused, int dstHeight __unused) { //Horizontal size_t cpy_bytes = sizeof(char) * 4; int width = cpy_bytes * srcWidth; @@ -72,11 +74,11 @@ static __inline__ void flip_fun(int flip, char * source, int srcWidth, int srcHe } //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){ +static __inline__ void rotate90(char * source, int srcWidth, int srcHeight, char * destination, + int dstWidth __unused, int dstHeight __unused) { size_t cpy_bytes = sizeof(char) * 4; int width = cpy_bytes * srcWidth; int length = srcHeight; - int total = length * width; for (size_t j = 0; j < length * cpy_bytes; j+= cpy_bytes){ for (int i = 0; i < width; i+=cpy_bytes){ int column_disp = (width - cpy_bytes - i) * length; @@ -120,7 +122,6 @@ static __inline__ void crop(char * source, int srcWidth, int srcHeight, char * d 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 ); @@ -143,7 +144,6 @@ void JNIFUNCF(ImageFilterGeometry, nativeApplyFilterFlip, jobject src, jint srcW void JNIFUNCF(ImageFilterGeometry, nativeApplyFilterRotate, jobject src, jint srcWidth, jint srcHeight, jobject dst, jint dstWidth, jint dstHeight, jint rotate) { 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); @@ -154,7 +154,6 @@ void JNIFUNCF(ImageFilterGeometry, nativeApplyFilterRotate, jobject src, jint sr void JNIFUNCF(ImageFilterGeometry, nativeApplyFilterCrop, jobject src, jint srcWidth, jint srcHeight, jobject dst, jint dstWidth, jint dstHeight, jint offsetWidth, jint offsetHeight) { 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); @@ -162,7 +161,9 @@ void JNIFUNCF(ImageFilterGeometry, nativeApplyFilterCrop, jobject src, jint srcW AndroidBitmap_unlockPixels(env, src); } -void JNIFUNCF(ImageFilterGeometry, nativeApplyFilterStraighten, jobject src, jint srcWidth, jint srcHeight, jobject dst, jint dstWidth, jint dstHeight, jfloat straightenAngle) { +void JNIFUNCF(ImageFilterGeometry, nativeApplyFilterStraighten, jobject src, jint srcWidth __unused, + jint srcHeight __unused, jobject dst, jint dstWidth, jint dstHeight, + jfloat straightenAngle __unused) { char* destination = 0; char* source = 0; int len = dstWidth * dstHeight * 4; @@ -171,11 +172,8 @@ void JNIFUNCF(ImageFilterGeometry, nativeApplyFilterStraighten, jobject src, jin // 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[GREEN] = source[GREEN]; destination[BLUE] = 128; } AndroidBitmap_unlockPixels(env, dst); diff --git a/jni/filters/redEyeMath.c b/jni/filters/redEyeMath.c index 9a16d6004..7bc558c78 100644 --- a/jni/filters/redEyeMath.c +++ b/jni/filters/redEyeMath.c @@ -32,8 +32,8 @@ int isRed(unsigned char *src, int p) { return ((r * 100 / (max + 2) > 160) & (max < 80)); } -void findPossible(unsigned char *src, unsigned char *mask, int iw, int ih, - short *rect) { +void findPossible(unsigned char *src, unsigned char *mask, int iw, + int ih __unused, short *rect) { int recX = rect[0], recY = rect[1], recW = rect[2], recH = rect[3]; int y, x; @@ -53,7 +53,7 @@ void findPossible(unsigned char *src, unsigned char *mask, int iw, int ih, } } -void findReds(unsigned char *src, unsigned char *mask, int iw, int ih, +void findReds(unsigned char *src, unsigned char *mask, int iw, int ih __unused, short *rect) { int recX = rect[0], recY = rect[1], recW = rect[2], recH = rect[3]; int y, x; @@ -70,8 +70,8 @@ void findReds(unsigned char *src, unsigned char *mask, int iw, int ih, } } -void dialateMaskIfRed(unsigned char *src, int iw, int ih, unsigned char *mask, - unsigned char *out, short *rect) { +void dialateMaskIfRed(unsigned char *src, int iw, int ih __unused, + unsigned char *mask, unsigned char *out, short *rect) { int recX = rect[0], recY = rect[1], recW = rect[2], recH = rect[3]; int y, x; @@ -113,7 +113,6 @@ void filterRedEye(unsigned char *src, unsigned char *dest, int iw, int ih, short 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/saturated.c b/jni/filters/saturated.c index 1bc0cc56b..f5cf7677a 100644 --- a/jni/filters/saturated.c +++ b/jni/filters/saturated.c @@ -36,7 +36,6 @@ void JNIFUNCF(ImageFilterSaturated, nativeApplyFilter, jobject bitmap, jint widt 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/vibrance.c b/jni/filters/vibrance.c index cb5c536e5..feef7bc97 100644 --- a/jni/filters/vibrance.c +++ b/jni/filters/vibrance.c @@ -45,7 +45,6 @@ void JNIFUNCF(ImageFilterVibrance, nativeApplyFilter, jobject bitmap, jint width Rt = Rf * MS; Gt = Gf * MS; Bt = Bf * MS; - int t = (r + g) / 2; R = r; G = g; B = b; diff --git a/jni/jni_egl_fence.cpp b/jni/jni_egl_fence.cpp index cf15e2f5d..0f696fc1e 100644 --- a/jni/jni_egl_fence.cpp +++ b/jni/jni_egl_fence.cpp @@ -38,7 +38,7 @@ static bool egl_khr_fence_sync_supported = false; bool IsEglKHRFenceSyncSupported() { if (!initialized) { EGLDisplay display = eglGetCurrentDisplay(); - const char* eglExtensions = eglQueryString(eglGetCurrentDisplay(), EGL_EXTENSIONS); + const char* eglExtensions = eglQueryString(display, EGL_EXTENSIONS); if (eglExtensions && strstr(eglExtensions, "EGL_KHR_fence_sync")) { FuncEglCreateSyncKHR = (TypeEglCreateSyncKHR) eglGetProcAddress("eglCreateSyncKHR"); FuncEglClientWaitSyncKHR = (TypeEglClientWaitSyncKHR) eglGetProcAddress("eglClientWaitSyncKHR"); @@ -54,8 +54,8 @@ bool IsEglKHRFenceSyncSupported() { } void -Java_com_android_gallery3d_photoeditor_FilterStack_nativeEglSetFenceAndWait(JNIEnv* env, - jobject thiz) { +Java_com_android_gallery3d_photoeditor_FilterStack_nativeEglSetFenceAndWait( + JNIEnv* env __unused, jobject thiz __unused) { if (!IsEglKHRFenceSyncSupported()) return; EGLDisplay display = eglGetCurrentDisplay(); |