From 4e024bb4f5c8aa8b07459f7fbd65c35122127fd1 Mon Sep 17 00:00:00 2001 From: David 'Digit' Turner Date: Wed, 22 Sep 2010 14:19:28 +0200 Subject: Remove compiler warnings when building the emulator. This forces -Wall during the build. Note that this patch doesn't remove all warnings, but most of the remaining ones are from upstream anyway. Change-Id: I8808d8495e99866e156ce5780d2e3c305eab491f --- android/charmap.c | 2 +- android/config.c | 18 ++++++++++++++---- android/skin/argb.h | 2 +- android/skin/scaler.c | 2 +- android/skin/trackball.c | 3 ++- android/utils/ini.c | 9 +++++---- android/utils/mapfile.c | 4 ++-- 7 files changed, 26 insertions(+), 14 deletions(-) (limited to 'android') diff --git a/android/charmap.c b/android/charmap.c index 553ad67..1d200e6 100644 --- a/android/charmap.c +++ b/android/charmap.c @@ -394,7 +394,7 @@ kcm_get_key_code(const char* key_name, unsigned short* key_code) { */ static int kcm_get_ushort_hex_val(const char* token, unsigned short* val) { - int hex_val = hex2int(token, strlen(token)); + int hex_val = hex2int((const uint8_t*)token, strlen(token)); // Make sure token format was ok and value doesn't exceed unsigned short. if (-1 == hex_val || 0 != (hex_val & ~0xFFFF)) { return -1; diff --git a/android/config.c b/android/config.c index 36fab11..2c37b03 100644 --- a/android/config.c +++ b/android/config.c @@ -14,6 +14,7 @@ #include #include #include +#include #include "android/config.h" #include "android/utils/path.h" @@ -193,7 +194,7 @@ restart: s = data - 1; if(value) { - /* if we're looking for a value, then take anything + /* if we're looking for a value, then take anything * until the end of line. note that sharp signs do * not start comments then. the result will be stripped * from trailing whitespace. @@ -385,7 +386,12 @@ writer_write( Writer* w, const char* src, int len ) w->p += avail; if (w->p == w->end) { - write( w->fd, w->buff, w->p - w->buff ); + int ret; + do { + ret = write( w->fd, w->buff, w->p - w->buff ); + } while (ret < 0 && errno == EINTR); + if (ret < 0) + break; w->p = w->buff; } } @@ -394,8 +400,12 @@ writer_write( Writer* w, const char* src, int len ) static void writer_done( Writer* w ) { - if (w->p > w->buff) - write( w->fd, w->buff, w->p - w->buff ); + if (w->p > w->buff) { + int ret; + do { + ret = write( w->fd, w->buff, w->p - w->buff ); + } while (ret < 0 && errno == EINTR); + } close( w->fd ); } diff --git a/android/skin/argb.h b/android/skin/argb.h index b3f0a6d..436a9c8 100644 --- a/android/skin/argb.h +++ b/android/skin/argb.h @@ -134,7 +134,7 @@ mmx_interp255( mmx_t m1, mmx_t m2, mmx_t zero, int alpha ) typedef uint32_t argb_t; -#define ARGB_DECL_ZERO() argb_t _zero = 0 +#define ARGB_DECL_ZERO() /* nothing */ #define ARGB_DECL(x) argb_t x##_ag, x##_rb #define ARGB_DECL2(x1,x2) argb_t x1##_ag, x1##_rb, x2##_ag, x2##_rb #define ARGB_ZERO(x) (x##_ag = x##_rb = 0) diff --git a/android/skin/scaler.c b/android/skin/scaler.c index 59e212f..907c5ca 100644 --- a/android/skin/scaler.c +++ b/android/skin/scaler.c @@ -75,7 +75,7 @@ typedef struct { #define ARGB_SCALE_GENERIC scale_generic #define ARGB_SCALE_05_TO_10 scale_05_to_10 #define ARGB_SCALE_UP_BILINEAR scale_up_bilinear -#define ARGB_SCALE_UP_QUICK_4x4 scale_up_quick_4x4 +/* #define ARGB_SCALE_UP_QUICK_4x4 scale_up_quick_4x4 UNUSED */ #include "android/skin/argb.h" diff --git a/android/skin/trackball.c b/android/skin/trackball.c index b18923a..6fac1cb 100644 --- a/android/skin/trackball.c +++ b/android/skin/trackball.c @@ -12,6 +12,7 @@ #include "android/skin/trackball.h" #include "android/skin/image.h" #include "android/utils/system.h" +#include "user-events.h" #include /***********************************************************************/ @@ -448,7 +449,7 @@ trackball_move( TrackBall ball, int dx, int dy ) break; } - kbd_mouse_event(ddx, ddy, 1, 0); + user_event_mouse(ddx, ddy, 1, 0); } rotator_reset( rot, dx, dy ); diff --git a/android/utils/ini.c b/android/utils/ini.c index 95bb4e3..317d233 100644 --- a/android/utils/ini.c +++ b/android/utils/ini.c @@ -109,8 +109,8 @@ iniFile_getPairCount( IniFile* i ) } void -iniFile_getPair( IniFile* i, - int index, +iniFile_getPair( IniFile* i, + int index, const char* *pKey, const char* *pValue ) { @@ -251,6 +251,7 @@ iniFile_newFromFile( const char* filepath ) char* text; long size; IniFile* ini = NULL; + size_t len; if (fp == NULL) { D("could not open .ini file: %s: %s", @@ -275,8 +276,8 @@ iniFile_newFromFile( const char* filepath ) /* read the file, add a sentinel at the end of it */ AARRAY_NEW(text, size+1); - fread(text, 1, size, fp); - text[size] = 0; + len = fread(text, 1, size, fp); + text[len] = 0; ini = iniFile_newFromMemory(text, filepath); AFREE(text); diff --git a/android/utils/mapfile.c b/android/utils/mapfile.c index c8ba8e5..102dfd8 100644 --- a/android/utils/mapfile.c +++ b/android/utils/mapfile.c @@ -34,8 +34,8 @@ mapfile_open(const char* path, int oflag, int share_mode) { #ifdef WIN32 DWORD win32_share; - DWORD win32_desired_access; - DWORD win32_disposition; + DWORD win32_desired_access = GENERIC_READ; + DWORD win32_disposition = OPEN_EXISTING; DWORD win32_flags; /* Convert to Win32 desired access. */ -- cgit v1.1