Loading liblog/logprint.c +29 −20 Original line number Original line Diff line number Diff line Loading @@ -20,9 +20,6 @@ #define HAVE_STRSEP #define HAVE_STRSEP #endif #endif //#ifndef __MINGW32__ //#include <arpa/inet.h> //#endif #include <assert.h> #include <assert.h> #include <ctype.h> #include <ctype.h> #include <errno.h> #include <errno.h> Loading Loading @@ -521,6 +518,9 @@ LIBLOG_ABI_PUBLIC int android_log_processLogBuffer( struct logger_entry *buf, struct logger_entry *buf, AndroidLogEntry *entry) AndroidLogEntry *entry) { { entry->message = NULL; entry->messageLen = 0; entry->tv_sec = buf->sec; entry->tv_sec = buf->sec; entry->tv_nsec = buf->nsec; entry->tv_nsec = buf->nsec; entry->uid = -1; entry->uid = -1; Loading Loading @@ -829,7 +829,10 @@ static int android_log_printBinaryEvent(const unsigned char** pEventData, eventData += 4; eventData += 4; eventDataLen -= 4; eventDataLen -= 4; if (eventDataLen < strLen) return -1; if (eventDataLen < strLen) { result = -1; /* mark truncated */ strLen = eventDataLen; } if (cp && (strLen == 0)) { if (cp && (strLen == 0)) { /* reset the format if no content */ /* reset the format if no content */ Loading @@ -840,15 +843,18 @@ static int android_log_printBinaryEvent(const unsigned char** pEventData, memcpy(outBuf, eventData, strLen); memcpy(outBuf, eventData, strLen); outBuf += strLen; outBuf += strLen; outBufLen -= strLen; outBufLen -= strLen; } else if (outBufLen > 0) { } else { if (outBufLen > 0) { /* copy what we can */ /* copy what we can */ memcpy(outBuf, eventData, outBufLen); memcpy(outBuf, eventData, outBufLen); outBuf += outBufLen; outBuf += outBufLen; outBufLen -= outBufLen; outBufLen -= outBufLen; goto no_room; } if (!result) result = 1; /* if not truncated, return no room */ } } eventData += strLen; eventData += strLen; eventDataLen -= strLen; eventDataLen -= strLen; if (result != 0) goto bail; break; break; } } case EVENT_TYPE_LIST: case EVENT_TYPE_LIST: Loading Loading @@ -991,13 +997,16 @@ no_room: LIBLOG_ABI_PUBLIC int android_log_processBinaryLogBuffer( LIBLOG_ABI_PUBLIC int android_log_processBinaryLogBuffer( struct logger_entry *buf, struct logger_entry *buf, AndroidLogEntry *entry, AndroidLogEntry *entry, const EventTagMap *map __unused, // only on !__ANDROID__ const EventTagMap *map __unused, /* only on !__ANDROID__ */ char *messageBuf, int messageBufLen) char *messageBuf, int messageBufLen) { { size_t inCount; size_t inCount; uint32_t tagIndex; uint32_t tagIndex; const unsigned char* eventData; const unsigned char* eventData; entry->message = NULL; entry->messageLen = 0; entry->tv_sec = buf->sec; entry->tv_sec = buf->sec; entry->tv_nsec = buf->nsec; entry->tv_nsec = buf->nsec; entry->priority = ANDROID_LOG_INFO; entry->priority = ANDROID_LOG_INFO; Loading Loading @@ -1217,7 +1226,7 @@ static size_t convertPrintable(char *p, const char *message, size_t messageLen) } else if (*message == '\b') { } else if (*message == '\b') { strcpy(buf, "\\b"); strcpy(buf, "\\b"); } else if (*message == '\t') { } else if (*message == '\t') { strcpy(buf, "\t"); // Do not escape tabs strcpy(buf, "\t"); /* Do not escape tabs */ } else if (*message == '\v') { } else if (*message == '\v') { strcpy(buf, "\\v"); strcpy(buf, "\\v"); } else if (*message == '\f') { } else if (*message == '\f') { Loading Loading @@ -1574,7 +1583,7 @@ LIBLOG_ABI_PUBLIC char *android_log_formatLogLine ( nsec = entry->tv_nsec; nsec = entry->tv_nsec; #if __ANDROID__ #if __ANDROID__ if (p_format->monotonic_output) { if (p_format->monotonic_output) { // prevent convertMonotonic from being called if logd is monotonic /* prevent convertMonotonic from being called if logd is monotonic */ if (android_log_clockid() != CLOCK_MONOTONIC) { if (android_log_clockid() != CLOCK_MONOTONIC) { struct timespec time; struct timespec time; convertMonotonic(&time, entry); convertMonotonic(&time, entry); Loading Loading @@ -1648,7 +1657,7 @@ LIBLOG_ABI_PUBLIC char *android_log_formatLogLine ( } else } else #endif #endif { { // Not worth parsing package list, names all longer than 5 /* Not worth parsing package list, names all longer than 5 */ snprintf(uid, sizeof(uid), "%5d:", entry->uid); snprintf(uid, sizeof(uid), "%5d:", entry->uid); } } } else { } else { Loading Loading
liblog/logprint.c +29 −20 Original line number Original line Diff line number Diff line Loading @@ -20,9 +20,6 @@ #define HAVE_STRSEP #define HAVE_STRSEP #endif #endif //#ifndef __MINGW32__ //#include <arpa/inet.h> //#endif #include <assert.h> #include <assert.h> #include <ctype.h> #include <ctype.h> #include <errno.h> #include <errno.h> Loading Loading @@ -521,6 +518,9 @@ LIBLOG_ABI_PUBLIC int android_log_processLogBuffer( struct logger_entry *buf, struct logger_entry *buf, AndroidLogEntry *entry) AndroidLogEntry *entry) { { entry->message = NULL; entry->messageLen = 0; entry->tv_sec = buf->sec; entry->tv_sec = buf->sec; entry->tv_nsec = buf->nsec; entry->tv_nsec = buf->nsec; entry->uid = -1; entry->uid = -1; Loading Loading @@ -829,7 +829,10 @@ static int android_log_printBinaryEvent(const unsigned char** pEventData, eventData += 4; eventData += 4; eventDataLen -= 4; eventDataLen -= 4; if (eventDataLen < strLen) return -1; if (eventDataLen < strLen) { result = -1; /* mark truncated */ strLen = eventDataLen; } if (cp && (strLen == 0)) { if (cp && (strLen == 0)) { /* reset the format if no content */ /* reset the format if no content */ Loading @@ -840,15 +843,18 @@ static int android_log_printBinaryEvent(const unsigned char** pEventData, memcpy(outBuf, eventData, strLen); memcpy(outBuf, eventData, strLen); outBuf += strLen; outBuf += strLen; outBufLen -= strLen; outBufLen -= strLen; } else if (outBufLen > 0) { } else { if (outBufLen > 0) { /* copy what we can */ /* copy what we can */ memcpy(outBuf, eventData, outBufLen); memcpy(outBuf, eventData, outBufLen); outBuf += outBufLen; outBuf += outBufLen; outBufLen -= outBufLen; outBufLen -= outBufLen; goto no_room; } if (!result) result = 1; /* if not truncated, return no room */ } } eventData += strLen; eventData += strLen; eventDataLen -= strLen; eventDataLen -= strLen; if (result != 0) goto bail; break; break; } } case EVENT_TYPE_LIST: case EVENT_TYPE_LIST: Loading Loading @@ -991,13 +997,16 @@ no_room: LIBLOG_ABI_PUBLIC int android_log_processBinaryLogBuffer( LIBLOG_ABI_PUBLIC int android_log_processBinaryLogBuffer( struct logger_entry *buf, struct logger_entry *buf, AndroidLogEntry *entry, AndroidLogEntry *entry, const EventTagMap *map __unused, // only on !__ANDROID__ const EventTagMap *map __unused, /* only on !__ANDROID__ */ char *messageBuf, int messageBufLen) char *messageBuf, int messageBufLen) { { size_t inCount; size_t inCount; uint32_t tagIndex; uint32_t tagIndex; const unsigned char* eventData; const unsigned char* eventData; entry->message = NULL; entry->messageLen = 0; entry->tv_sec = buf->sec; entry->tv_sec = buf->sec; entry->tv_nsec = buf->nsec; entry->tv_nsec = buf->nsec; entry->priority = ANDROID_LOG_INFO; entry->priority = ANDROID_LOG_INFO; Loading Loading @@ -1217,7 +1226,7 @@ static size_t convertPrintable(char *p, const char *message, size_t messageLen) } else if (*message == '\b') { } else if (*message == '\b') { strcpy(buf, "\\b"); strcpy(buf, "\\b"); } else if (*message == '\t') { } else if (*message == '\t') { strcpy(buf, "\t"); // Do not escape tabs strcpy(buf, "\t"); /* Do not escape tabs */ } else if (*message == '\v') { } else if (*message == '\v') { strcpy(buf, "\\v"); strcpy(buf, "\\v"); } else if (*message == '\f') { } else if (*message == '\f') { Loading Loading @@ -1574,7 +1583,7 @@ LIBLOG_ABI_PUBLIC char *android_log_formatLogLine ( nsec = entry->tv_nsec; nsec = entry->tv_nsec; #if __ANDROID__ #if __ANDROID__ if (p_format->monotonic_output) { if (p_format->monotonic_output) { // prevent convertMonotonic from being called if logd is monotonic /* prevent convertMonotonic from being called if logd is monotonic */ if (android_log_clockid() != CLOCK_MONOTONIC) { if (android_log_clockid() != CLOCK_MONOTONIC) { struct timespec time; struct timespec time; convertMonotonic(&time, entry); convertMonotonic(&time, entry); Loading Loading @@ -1648,7 +1657,7 @@ LIBLOG_ABI_PUBLIC char *android_log_formatLogLine ( } else } else #endif #endif { { // Not worth parsing package list, names all longer than 5 /* Not worth parsing package list, names all longer than 5 */ snprintf(uid, sizeof(uid), "%5d:", entry->uid); snprintf(uid, sizeof(uid), "%5d:", entry->uid); } } } else { } else { Loading