summaryrefslogtreecommitdiff
path: root/libs
diff options
context:
space:
mode:
author Chih-Hung Hsieh <chh@google.com> 2016-05-19 15:21:42 -0700
committer Chih-Hung Hsieh <chh@google.com> 2016-05-19 15:21:42 -0700
commit2bd7a3efc408e9102f586428ce9ec6e4186e05e2 (patch)
tree0f047113e8e556cac40e896377ea7b949710332a /libs
parent4bc3d32b15cdcae7685722e7a20007c7aa9ae949 (diff)
Fix misc-macro-parentheses warnings in common_time.
Bug: 28705665 Change-Id: Ibdab4631f0e692b8a291faecdeb4a6062f906ea5
Diffstat (limited to 'libs')
-rw-r--r--libs/common_time/common_time_server_api.cpp2
-rw-r--r--libs/common_time/common_time_server_packets.cpp12
2 files changed, 7 insertions, 7 deletions
diff --git a/libs/common_time/common_time_server_api.cpp b/libs/common_time/common_time_server_api.cpp
index e0f35a9def8b..60e65677b2f9 100644
--- a/libs/common_time/common_time_server_api.cpp
+++ b/libs/common_time/common_time_server_api.cpp
@@ -285,7 +285,7 @@ void CommonTimeServer::reevaluateAutoDisableState(bool commonClockHasClients) {
if (res > 0) \
write(fd, buffer, res); \
} while (0)
-#define checked_percentage(a, b) ((0 == b) ? 0.0f : ((100.0f * a) / b))
+#define checked_percentage(a, b) ((0 == (b)) ? 0.0f : ((100.0f * (a)) / (b)))
status_t CommonTimeServer::dumpClockInterface(int fd,
const Vector<String16>& /* args */,
diff --git a/libs/common_time/common_time_server_packets.cpp b/libs/common_time/common_time_server_packets.cpp
index 9833c37f2519..c7c893d34499 100644
--- a/libs/common_time/common_time_server_packets.cpp
+++ b/libs/common_time/common_time_server_packets.cpp
@@ -48,12 +48,12 @@ const uint16_t TimeServicePacketHeader::kCurVersion = 1;
#define SERIALIZE_INT32(field_name) SERIALIZE_FIELD(field_name, int32_t, htonl)
#define SERIALIZE_INT64(field_name) SERIALIZE_FIELD(field_name, int64_t, htonq)
-#define DESERIALIZE_FIELD(field_name, type, converter) \
- do { \
- if ((offset + sizeof(field_name)) > length) \
- return -1; \
- field_name = converter(*((type*)(data + offset))); \
- offset += sizeof(field_name); \
+#define DESERIALIZE_FIELD(field_name, type, converter) \
+ do { \
+ if ((offset + sizeof(field_name)) > length) \
+ return -1; \
+ (field_name) = converter(*((type*)(data + offset))); \
+ offset += sizeof(field_name); \
} while (0)
#define DESERIALIZE_INT16(field_name) DESERIALIZE_FIELD(field_name, int16_t, ntohs)
#define DESERIALIZE_INT32(field_name) DESERIALIZE_FIELD(field_name, int32_t, ntohl)