Fix and re-enable important compiler warnings

The disabled warnings have a high signal-to-noise ratio and would have
caught two bugs.

linux_set_iface_flags() had an error handling path that returned an
uninitalized ret to the caller.  This is fixed by setting ret
appropriately before returning it.

onSignificantWifiChange() made an implicit copy of an object, then tried
to read from a flexible array member in the copy.  This is fixed by
turning the implicit copy into a reference.

Change-Id: Ie1335b80a62c349ef766e3e31221ce87f72f6c0d
Signed-off-by: Greg Hackmann <ghackmann@google.com>
diff --git a/service/Android.mk b/service/Android.mk
index b20d099..af0dae7 100644
--- a/service/Android.mk
+++ b/service/Android.mk
@@ -23,9 +23,7 @@
 
 LOCAL_REQUIRED_MODULES :=
 
-LOCAL_CFLAGS += -Wno-unused-parameter -Wno-int-to-pointer-cast
-LOCAL_CFLAGS += -Wno-maybe-uninitialized -Wno-parentheses
-LOCAL_CPPFLAGS += -Wno-conversion-null
+LOCAL_CFLAGS += -Wno-unused-parameter
 
 LOCAL_C_INCLUDES += \
 	external/libnl-headers \
@@ -61,9 +59,7 @@
 
 LOCAL_REQUIRED_MODULES := libandroid_runtime libhardware_legacy
 
-LOCAL_CFLAGS += -Wno-unused-parameter -Wno-int-to-pointer-cast
-LOCAL_CFLAGS += -Wno-maybe-uninitialized -Wno-parentheses
-LOCAL_CPPFLAGS += -Wno-conversion-null
+LOCAL_CFLAGS += -Wno-unused-parameter
 
 LOCAL_C_INCLUDES += \
 	$(call include-path-for, libhardware)/hardware \
@@ -91,9 +87,7 @@
 
 LOCAL_REQUIRED_MODULES := libandroid_runtime libhardware_legacy
 
-LOCAL_CFLAGS += -Wno-unused-parameter -Wno-int-to-pointer-cast
-LOCAL_CFLAGS += -Wno-maybe-uninitialized -Wno-parentheses
-LOCAL_CPPFLAGS += -Wno-conversion-null
+LOCAL_CFLAGS += -Wno-unused-parameter
 
 LOCAL_C_INCLUDES += \
 	$(JNI_H_INCLUDE) \
diff --git a/service/jni/com_android_server_wifi_WifiNative.cpp b/service/jni/com_android_server_wifi_WifiNative.cpp
index 2bd4229..c14fa8d 100644
--- a/service/jni/com_android_server_wifi_WifiNative.cpp
+++ b/service/jni/com_android_server_wifi_WifiNative.cpp
@@ -684,7 +684,7 @@
 
     for (unsigned i = 0; i < num_results; i++) {
 
-        wifi_significant_change_result result = *(results[i]);
+        wifi_significant_change_result &result = *(results[i]);
 
         jobject scanResult = createObject(env, "android/net/wifi/ScanResult");
         if (scanResult == NULL) {
diff --git a/service/tools/halutil/halutil.cpp b/service/tools/halutil/halutil.cpp
index b9192c7..54c6e6b 100644
--- a/service/tools/halutil/halutil.cpp
+++ b/service/tools/halutil/halutil.cpp
@@ -109,6 +109,7 @@
     }
 
     if (ioctl(sock, SIOCSIFFLAGS, &ifr) != 0) {
+      ret = -errno;
       printMsg("Could not set interface %s flags \n", ifname);
       return ret;
     }else {