Revert "Fix compiling warnings"
* We'll take the upstream fix
This reverts commit 2ba45029b40b4932fc112efb102dd6b59b757d8a.
Change-Id: I067db32fe72db2b177b55cf68562daf227931e7a
diff --git a/jni/filters/bwfilter.c b/jni/filters/bwfilter.c
index 415223a..f7fb31a 100644
--- a/jni/filters/bwfilter.c
+++ b/jni/filters/bwfilter.c
@@ -19,7 +19,6 @@
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 fbd9c76..b04e936 100644
--- a/jni/filters/contrast.c
+++ b/jni/filters/contrast.c
@@ -17,9 +17,27 @@
#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 6c40675..9f5d88f 100644
--- a/jni/filters/edge.c
+++ b/jni/filters/edge.c
@@ -19,7 +19,6 @@
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 a2df709..6b32798 100644
--- a/jni/filters/exposure.c
+++ b/jni/filters/exposure.c
@@ -18,7 +18,6 @@
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 a46b3ce..a63ef20 100644
--- a/jni/filters/filters.h
+++ b/jni/filters/filters.h
@@ -44,24 +44,8 @@
#define ALPHA (i+3)
#define CLAMP(c) (MAX(0, MIN(255, c)))
-__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;
-}
+__inline__ unsigned char clamp(int c);
+__inline__ int clampMax(int c,int max);
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 d577e61..c3c9cbd 100644
--- a/jni/filters/fx.c
+++ b/jni/filters/fx.c
@@ -33,9 +33,6 @@
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 8e5e741..a0e77ef 100644
--- a/jni/filters/geometry.c
+++ b/jni/filters/geometry.c
@@ -21,8 +21,6 @@
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;
@@ -37,8 +35,6 @@
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;
@@ -77,13 +73,12 @@
//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;
- unsigned int j = 0;
+ 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;
@@ -127,6 +122,7 @@
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 );
@@ -134,7 +130,6 @@
}
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) {
@@ -148,9 +143,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);
@@ -159,9 +154,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);
@@ -170,10 +165,6 @@
}
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;
@@ -182,7 +173,9 @@
// 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 1501d5e..1a85697 100644
--- a/jni/filters/gradient.c
+++ b/jni/filters/gradient.c
@@ -19,7 +19,6 @@
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 f9e4665..567a216 100644
--- a/jni/filters/highlight.c
+++ b/jni/filters/highlight.c
@@ -21,7 +21,6 @@
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 974e1e2..a4aef93 100644
--- a/jni/filters/hue.c
+++ b/jni/filters/hue.c
@@ -18,7 +18,6 @@
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 f0aa54b..97cead7 100644
--- a/jni/filters/kmeans.cc
+++ b/jni/filters/kmeans.cc
@@ -34,7 +34,6 @@
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 69c7670..735e583 100644
--- a/jni/filters/negative.c
+++ b/jni/filters/negative.c
@@ -18,7 +18,6 @@
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 1942d69..9a16d60 100644
--- a/jni/filters/redEyeMath.c
+++ b/jni/filters/redEyeMath.c
@@ -34,7 +34,6 @@
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;
@@ -56,7 +55,6 @@
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;
@@ -74,7 +72,6 @@
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;
@@ -116,6 +113,7 @@
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 a7d12a8..9a358dd 100644
--- a/jni/filters/redeye.c
+++ b/jni/filters/redeye.c
@@ -19,7 +19,6 @@
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 5ea361b..1bc0cc5 100644
--- a/jni/filters/saturated.c
+++ b/jni/filters/saturated.c
@@ -18,7 +18,6 @@
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;
@@ -37,6 +36,7 @@
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 ee4621c..5f802dd 100644
--- a/jni/filters/shadows.c
+++ b/jni/filters/shadows.c
@@ -20,7 +20,6 @@
#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 56d1253..beac086 100644
--- a/jni/filters/tinyplanet.cc
+++ b/jni/filters/tinyplanet.cc
@@ -131,7 +131,6 @@
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 43e73db..cb5c536 100644
--- a/jni/filters/vibrance.c
+++ b/jni/filters/vibrance.c
@@ -19,7 +19,6 @@
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;
@@ -46,6 +45,7 @@
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 78271cd..9a21561 100644
--- a/jni/filters/wbalance.c
+++ b/jni/filters/wbalance.c
@@ -101,10 +101,10 @@
}
void estmateWhiteBox(unsigned char *src, int iw, int ih, int x,int y, int *wr, int *wb, int *wg){
- int r = 0;
- int g = 0;
- int b = 0;
- int sum = 0;
+ int r;
+ int g;
+ int b;
+ int sum;
int xp,yp;
int bounds = 5;
if (x<0) x = bounds;
@@ -132,7 +132,6 @@
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 7e78892..cf15e2f 100644
--- a/jni/jni_egl_fence.cpp
+++ b/jni/jni_egl_fence.cpp
@@ -37,6 +37,7 @@
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");
@@ -55,8 +56,6 @@
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 c8491cc..f8f864f 100644
--- a/jni_jpegstream/src/jerr_hook.cpp
+++ b/jni_jpegstream/src/jerr_hook.cpp
@@ -34,6 +34,7 @@
* 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 b4d4dd3..cca54e4 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 >= (size_t)num_bytes) {
+ if (src->mgr.bytes_in_buffer >= num_bytes) {
src->mgr.bytes_in_buffer -= num_bytes;
src->mgr.next_input_byte += num_bytes;
} else {
@@ -151,7 +151,6 @@
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 9662152..4726b64 100644
--- a/jni_jpegstream/src/jpeg_reader.cpp
+++ b/jni_jpegstream/src/jpeg_reader.cpp
@@ -215,6 +215,7 @@
// 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;
@@ -223,6 +224,7 @@
}
} 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 4c239e8..3b9a683 100644
--- a/jni_jpegstream/src/jpegstream.cpp
+++ b/jni_jpegstream/src/jpegstream.cpp
@@ -324,7 +324,6 @@
}
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");