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
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 @@
 */
 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 <stdlib.h>
 #include <fcntl.h>
 #include <unistd.h>
+#include <errno.h>
 
 #include "android/config.h"
 #include "android/utils/path.h"
@@ -193,7 +194,7 @@
             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 @@
 
         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 @@
 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 @@
 
 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 @@
 #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 <math.h>
 
 /***********************************************************************/
@@ -448,7 +449,7 @@
             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 @@
 }
 
 void
-iniFile_getPair( IniFile*   i, 
-                    int           index, 
+iniFile_getPair( IniFile*   i,
+                    int           index,
                     const char*  *pKey,
                     const char*  *pValue )
 {
@@ -251,6 +251,7 @@
     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 @@
 
     /* 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 @@
 {
 #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. */