Bug 989303 - Use Android's PROPERTY_VALUE_MAX instead of #defining our own. r=fabrice
authorChris Peterson <cpeterson@mozilla.com>
Wed, 10 Dec 2014 22:19:39 -0800
changeset 235221 ba352db713862b84a6be32e75b5221416e5666d0
parent 235220 6a3870adc1deeaf1d6960eca551e6d629524e1bb
child 235222 2074c8fd1f10ba540fe80902ebd2d07af3af088e
push id355
push usermleibovic@mozilla.com
push dateWed, 07 Jan 2015 02:29:19 +0000
reviewersfabrice
bugs989303
milestone37.0a1
Bug 989303 - Use Android's PROPERTY_VALUE_MAX instead of #defining our own. r=fabrice
dom/wifi/WifiUtils.cpp
--- a/dom/wifi/WifiUtils.cpp
+++ b/dom/wifi/WifiUtils.cpp
@@ -8,17 +8,16 @@
 #include <cutils/properties.h>
 #include "prinit.h"
 #include "js/CharacterEncoding.h"
 
 using namespace mozilla::dom;
 
 #define BUFFER_SIZE        4096
 #define COMMAND_SIZE       256
-#define PROPERTY_VALUE_MAX 80
 
 // Intentionally not trying to dlclose() this handle. That's playing
 // Russian roulette with security bugs.
 static void* sWifiLib;
 static PRCallOnceType sInitWifiLib;
 
 static PRStatus
 InitWifiLib()
@@ -38,45 +37,45 @@ GetSharedLibrary()
 static bool
 GetWifiP2pSupported()
 {
   char propP2pSupported[PROPERTY_VALUE_MAX];
   property_get("ro.moz.wifi.p2p_supported", propP2pSupported, "0");
   return (0 == strcmp(propP2pSupported, "1"));
 }
 
-int
+static int
 hex2num(char c)
 {
   if (c >= '0' && c <= '9')
     return c - '0';
   if (c >= 'a' && c <= 'f')
     return c - 'a' + 10;
   if (c >= 'A' && c <= 'F')
     return c - 'A' + 10;
   return -1;
 }
 
-int
+static int
 hex2byte(const char* hex)
 {
   int a, b;
   a = hex2num(*hex++);
   if (a < 0)
     return -1;
   b = hex2num(*hex++);
   if (b < 0)
     return -1;
   return (a << 4) | b;
 }
 
 // This function is equivalent to printf_decode() at src/utils/common.c in
 // the supplicant.
 
-uint32_t
+static uint32_t
 convertToBytes(char* buf, uint32_t maxlen, const char* str)
 {
   const char *pos = str;
   uint32_t len = 0;
   int val;
 
   while (*pos) {
     if (len == maxlen)
@@ -151,17 +150,18 @@ convertToBytes(char* buf, uint32_t maxle
 }
 
 // This is the same algorithm as in InflateUTF8StringToBuffer with Copy and
 // while ignoring invalids.
 // https://mxr.mozilla.org/mozilla-central/source/js/src/vm/CharacterEncoding.cpp#231
 
 static const uint32_t REPLACE_UTF8 = 0xFFFD;
 
-void LossyConvertUTF8toUTF16(const char* aInput, uint32_t aLength, nsAString& aOut)
+static void
+LossyConvertUTF8toUTF16(const char* aInput, uint32_t aLength, nsAString& aOut)
 {
   JS::UTF8Chars src(aInput, aLength);
 
   char16_t dst[aLength]; // Allocating for worst case.
 
   // Count how many char16_t characters are needed in the inflated string.
   // |i| is the index into |src|, and |j| is the the index into |dst|.
   size_t srclen = src.length();