OSDN Git Service

Fix misc-macro-parentheses warnings in aapt and androidfw.
authorChih-Hung Hsieh <chh@google.com>
Thu, 19 May 2016 22:19:22 +0000 (15:19 -0700)
committerChih-Hung Hsieh <chh@google.com>
Thu, 19 May 2016 22:19:22 +0000 (15:19 -0700)
Bug: 28705665
Change-Id: Iac353e66718aadad384183cf300330695df25909

libs/androidfw/ResourceTypes.cpp
tools/aapt/StringPool.cpp

index d6dd983..57a12f5 100644 (file)
@@ -6543,7 +6543,7 @@ bool ResTable::getIdmapInfo(const void* idmap, size_t sizeBytes,
 #define CHAR16_TO_CSTR(c16, len) (String8(String16(c16,len)).string())
 
 #define CHAR16_ARRAY_EQ(constant, var, len) \
-        ((len == (sizeof(constant)/sizeof(constant[0]))) && (0 == memcmp((var), (constant), (len))))
+        (((len) == (sizeof(constant)/sizeof((constant)[0]))) && (0 == memcmp((var), (constant), (len))))
 
 static void print_complex(uint32_t complex, bool isFraction)
 {
index 9908c44..37a4933 100644 (file)
@@ -390,12 +390,12 @@ sp<AaptFile> StringPool::createStringBlock()
 
 #define ENCODE_LENGTH(str, chrsz, strSize) \
 { \
-    size_t maxMask = 1 << ((chrsz*8)-1); \
+    size_t maxMask = 1 << (((chrsz)*8)-1); \
     size_t maxSize = maxMask-1; \
-    if (strSize > maxSize) { \
-        *str++ = maxMask | ((strSize>>(chrsz*8))&maxSize); \
+    if ((strSize) > maxSize) { \
+        *(str)++ = maxMask | (((strSize)>>((chrsz)*8))&maxSize); \
     } \
-    *str++ = strSize; \
+    *(str)++ = strSize; \
 }
 
 status_t StringPool::writeStringBlock(const sp<AaptFile>& pool)