Bug 765116 - Part 2: mozglue/android: fix gcc -pedantic warnings. r=glandium
authorChris Peterson <cpeterson@mozilla.com>
Mon, 18 Jun 2012 09:06:59 -0700
changeset 96941 380fd6ee7ded3b84987ba049a1ac6ba45e7e9353
parent 96940 00f19e7b179b214cf29ae41a1ebde11bf67a01c3
child 96942 6cae61dfc9f440909f14dc0c1f853f894aa1bb02
push idunknown
push userunknown
push dateunknown
reviewersglandium
bugs765116
milestone16.0a1
Bug 765116 - Part 2: mozglue/android: fix gcc -pedantic warnings. r=glandium
mozglue/android/APKOpen.cpp
mozglue/android/NSSBridge.cpp
mozglue/android/SQLiteBridge.cpp
--- a/mozglue/android/APKOpen.cpp
+++ b/mozglue/android/APKOpen.cpp
@@ -62,16 +62,17 @@ extern "C" {
 }
 
 typedef int mozglueresult;
 
 enum StartupEvent {
 #define mozilla_StartupTimeline_Event(ev, z) ev,
 #include "StartupTimeline.h"
 #undef mozilla_StartupTimeline_Event
+  MAX_STARTUP_EVENT_ID
 };
 
 using namespace mozilla;
 
 static uint64_t *sStartupTimeline;
 
 void StartupTimeline_Record(StartupEvent ev, struct timeval *tm)
 {
@@ -699,17 +700,17 @@ loadGeckoLibs(const char *apkName)
   file_ids = NULL;
 #endif
 
   if (!xul_handle) {
     __android_log_print(ANDROID_LOG_ERROR, "GeckoLibLoad", "Couldn't get a handle to libxul!");
     return FAILURE;
   }
 
-#define GETFUNC(name) f_ ## name = (name ## _t) __wrap_dlsym(xul_handle, "Java_org_mozilla_gecko_GeckoAppShell_" #name)
+#define GETFUNC(name) f_ ## name = (name ## _t) (uintptr_t) __wrap_dlsym(xul_handle, "Java_org_mozilla_gecko_GeckoAppShell_" #name)
   GETFUNC(nativeInit);
   GETFUNC(notifyGeckoOfEvent);
   GETFUNC(processNextNativeEvent);
   GETFUNC(setSurfaceView);
   GETFUNC(setLayerClient);
   GETFUNC(onResume);
   GETFUNC(onLowMemory);
   GETFUNC(callObserver);
@@ -736,17 +737,17 @@ loadGeckoLibs(const char *apkName)
   GETFUNC(notifyListCreated);
   GETFUNC(notifyGotNextMessage);
   GETFUNC(notifyReadingMessageListFailed);
   GETFUNC(notifyFilePickerResult);
   GETFUNC(getSurfaceBits);
   GETFUNC(onFullScreenPluginHidden);
   GETFUNC(getNextMessageFromQueue);
 #undef GETFUNC
-  sStartupTimeline = (uint64_t *)__wrap_dlsym(xul_handle, "_ZN7mozilla15StartupTimeline16sStartupTimelineE");
+  sStartupTimeline = (uint64_t *) (uintptr_t) __wrap_dlsym(xul_handle, "_ZN7mozilla15StartupTimeline16sStartupTimelineE");
   gettimeofday(&t1, 0);
   struct rusage usage2;
   getrusage(RUSAGE_THREAD, &usage2);
   __android_log_print(ANDROID_LOG_ERROR, "GeckoLibLoad", "Loaded libs in %ldms total, %ldms user, %ldms system, %ld faults",
                       (t1.tv_sec - t0.tv_sec)*1000 + (t1.tv_usec - t0.tv_usec)/1000, 
                       (usage2.ru_utime.tv_sec - usage1.ru_utime.tv_sec)*1000 + (usage2.ru_utime.tv_usec - usage1.ru_utime.tv_usec)/1000,
                       (usage2.ru_stime.tv_sec - usage1.ru_stime.tv_sec)*1000 + (usage2.ru_stime.tv_usec - usage1.ru_stime.tv_usec)/1000,
                       usage2.ru_majflt-usage1.ru_majflt);
@@ -952,17 +953,17 @@ Java_org_mozilla_gecko_GeckoAppShell_loa
   jenv->ReleaseStringUTFChars(jApkName, str);
 }
 
 typedef void (*GeckoStart_t)(void *, const nsXREAppData *);
 
 extern "C" NS_EXPORT void JNICALL
 Java_org_mozilla_gecko_GeckoAppShell_nativeRun(JNIEnv *jenv, jclass jc, jstring jargs)
 {
-  GeckoStart_t GeckoStart = (GeckoStart_t) __wrap_dlsym(xul_handle, "GeckoStart");
+  GeckoStart_t GeckoStart = (GeckoStart_t) (uintptr_t) __wrap_dlsym(xul_handle, "GeckoStart");
   if (GeckoStart == NULL)
     return;
   // XXX: java doesn't give us true UTF8, we should figure out something
   // better to do here
   int len = jenv->GetStringUTFLength(jargs);
   // GeckoStart needs to write in the args buffer, so we need a copy.
   char *args = (char *) malloc(len + 1);
   jenv->GetStringUTFRegion(jargs, 0, len, args);
@@ -999,17 +1000,17 @@ ChildProcessInit(int argc, char* argv[])
   }
 
   // don't pass the last arg - it's only recognized by the lib cache
   argc--;
 
   typedef GeckoProcessType (*XRE_StringToChildProcessType_t)(char*);
   typedef mozglueresult (*XRE_InitChildProcess_t)(int, char**, GeckoProcessType);
   XRE_StringToChildProcessType_t fXRE_StringToChildProcessType =
-    (XRE_StringToChildProcessType_t)__wrap_dlsym(xul_handle, "XRE_StringToChildProcessType");
+    (XRE_StringToChildProcessType_t) (uintptr_t) __wrap_dlsym(xul_handle, "XRE_StringToChildProcessType");
   XRE_InitChildProcess_t fXRE_InitChildProcess =
-    (XRE_InitChildProcess_t)__wrap_dlsym(xul_handle, "XRE_InitChildProcess");
+    (XRE_InitChildProcess_t) (uintptr_t) __wrap_dlsym(xul_handle, "XRE_InitChildProcess");
 
   GeckoProcessType proctype = fXRE_StringToChildProcessType(argv[--argc]);
 
   return fXRE_InitChildProcess(argc, argv, proctype);
 }
 
--- a/mozglue/android/NSSBridge.cpp
+++ b/mozglue/android/NSSBridge.cpp
@@ -43,34 +43,34 @@ int
 setup_nss_functions(void *nss_handle,
                         void *nspr_handle,
                         void *plc_handle)
 {
   if (nss_handle == NULL || nspr_handle == NULL || plc_handle == NULL) {
     LOG("Missing handle\n");
     return FAILURE;
   }
-#define GETFUNC(name) f_ ## name = (name ## _t) __wrap_dlsym(nss_handle, #name); \
+#define GETFUNC(name) f_ ## name = (name ## _t) (uintptr_t) __wrap_dlsym(nss_handle, #name); \
                       if (!f_ ##name) return FAILURE;
   GETFUNC(NSS_Initialize);
   GETFUNC(NSS_Shutdown);
   GETFUNC(PK11SDR_Encrypt);
   GETFUNC(PK11SDR_Decrypt);
   GETFUNC(PK11_GetInternalKeySlot);
   GETFUNC(PK11_NeedUserInit);
   GETFUNC(PK11_InitPin);
   GETFUNC(SECITEM_ZfreeItem);
 #undef GETFUNC
-#define NSPRFUNC(name) f_ ## name = (name ## _t) __wrap_dlsym(nspr_handle, #name); \
+#define NSPRFUNC(name) f_ ## name = (name ## _t) (uintptr_t) __wrap_dlsym(nspr_handle, #name); \
                        if (!f_ ##name) return FAILURE;
   NSPRFUNC(PR_ErrorToString);
   NSPRFUNC(PR_GetError);
   NSPRFUNC(PR_Free);
 #undef NSPRFUNC
-#define PLCFUNC(name) f_ ## name = (name ## _t) __wrap_dlsym(plc_handle, #name); \
+#define PLCFUNC(name) f_ ## name = (name ## _t) (uintptr_t) __wrap_dlsym(plc_handle, #name); \
                       if (!f_ ##name) return FAILURE;
   PLCFUNC(PL_Base64Encode);
   PLCFUNC(PL_Base64Decode);
   PLCFUNC(PL_strfree);
 #undef PLCFUNC
 
   return SUCCESS;
 }
--- a/mozglue/android/SQLiteBridge.cpp
+++ b/mozglue/android/SQLiteBridge.cpp
@@ -35,17 +35,17 @@ SQLITE_WRAPPER_INT(sqlite3_column_type)
 SQLITE_WRAPPER_INT(sqlite3_column_blob)
 SQLITE_WRAPPER_INT(sqlite3_column_bytes)
 SQLITE_WRAPPER_INT(sqlite3_column_text)
 SQLITE_WRAPPER_INT(sqlite3_changes)
 SQLITE_WRAPPER_INT(sqlite3_last_insert_rowid)
 
 void setup_sqlite_functions(void *sqlite_handle)
 {
-#define GETFUNC(name) f_ ## name = (name ## _t) __wrap_dlsym(sqlite_handle, #name)
+#define GETFUNC(name) f_ ## name = (name ## _t) (uintptr_t) __wrap_dlsym(sqlite_handle, #name)
   GETFUNC(sqlite3_open);
   GETFUNC(sqlite3_errmsg);
   GETFUNC(sqlite3_prepare_v2);
   GETFUNC(sqlite3_bind_parameter_count);
   GETFUNC(sqlite3_bind_text);
   GETFUNC(sqlite3_step);
   GETFUNC(sqlite3_column_count);
   GETFUNC(sqlite3_finalize);