summaryrefslogtreecommitdiffstats
path: root/liblog
diff options
context:
space:
mode:
authorMark Salyzyn <salyzyn@google.com>2015-03-03 15:23:24 -0800
committerMark Salyzyn <salyzyn@google.com>2015-03-04 12:48:04 -0800
commit66bfc5ccbda1c36923230b8dea36e86e8ac62d67 (patch)
tree43eae354b5c268486a3d763f7ab8d08a203fe797 /liblog
parentfa1c063febb8726f7b629ba04c083edf33b87789 (diff)
downloadsystem_core-66bfc5ccbda1c36923230b8dea36e86e8ac62d67.zip
system_core-66bfc5ccbda1c36923230b8dea36e86e8ac62d67.tar.gz
system_core-66bfc5ccbda1c36923230b8dea36e86e8ac62d67.tar.bz2
liblog: logprint use <endian.h>
Change-Id: I0ec0fe3e954f6f04964d58e57c817d28057b630b
Diffstat (limited to 'liblog')
-rw-r--r--liblog/logprint.c29
1 files changed, 4 insertions, 25 deletions
diff --git a/liblog/logprint.c b/liblog/logprint.c
index 7ba4c8e..8093a4c 100644
--- a/liblog/logprint.c
+++ b/liblog/logprint.c
@@ -416,27 +416,6 @@ int android_log_processLogBuffer(struct logger_entry *buf,
}
/*
- * Extract a 4-byte value from a byte stream.
- */
-static inline uint32_t get4LE(const uint8_t* src)
-{
- return src[0] | (src[1] << 8) | (src[2] << 16) | (src[3] << 24);
-}
-
-/*
- * Extract an 8-byte value from a byte stream.
- */
-static inline uint64_t get8LE(const uint8_t* src)
-{
- uint32_t low, high;
-
- low = src[0] | (src[1] << 8) | (src[2] << 16) | (src[3] << 24);
- high = src[4] | (src[5] << 8) | (src[6] << 16) | (src[7] << 24);
- return ((long long) high << 32) | (long long) low;
-}
-
-
-/*
* Recursively convert binary log data to printable form.
*
* This needs to be recursive because you can have lists of lists.
@@ -473,7 +452,7 @@ static int android_log_printBinaryEvent(const unsigned char** pEventData,
if (eventDataLen < 4)
return -1;
- ival = get4LE(eventData);
+ ival = le32toh(*((int32_t *)eventData));
eventData += 4;
eventDataLen -= 4;
@@ -494,7 +473,7 @@ static int android_log_printBinaryEvent(const unsigned char** pEventData,
if (eventDataLen < 8)
return -1;
- lval = get8LE(eventData);
+ lval = le64toh(*((int64_t *)eventData));
eventData += 8;
eventDataLen -= 8;
@@ -515,7 +494,7 @@ static int android_log_printBinaryEvent(const unsigned char** pEventData,
if (eventDataLen < 4)
return -1;
- strLen = get4LE(eventData);
+ strLen = le32toh(*((int32_t *)eventData));
eventData += 4;
eventDataLen -= 4;
@@ -630,7 +609,7 @@ int android_log_processBinaryLogBuffer(struct logger_entry *buf,
inCount = buf->len;
if (inCount < 4)
return -1;
- tagIndex = get4LE(eventData);
+ tagIndex = le32toh(*((int32_t *)eventData));
eventData += 4;
inCount -= 4;