Fixed two 64-bit porting issues; Make pid/tid type consistent
1. In printf, use "%zu" for variable of type size_t
2. Print tid in %5d
3. Make type of pid/tid in AndroidLogEntry and logger_entry consistent
Change-Id: I3e3d9536ee58823f349a4734ae093d30eabe1bfe
diff --git a/include/cutils/logprint.h b/include/cutils/logprint.h
index 769c8a7..2b1e1c5 100644
--- a/include/cutils/logprint.h
+++ b/include/cutils/logprint.h
@@ -44,8 +44,8 @@
time_t tv_sec;
long tv_nsec;
android_LogPriority priority;
- pid_t pid;
- pthread_t tid;
+ int32_t pid;
+ int32_t tid;
const char * tag;
size_t messageLen;
const char * message;
diff --git a/liblog/fake_log_device.c b/liblog/fake_log_device.c
index f8b7254..df43299 100644
--- a/liblog/fake_log_device.c
+++ b/liblog/fake_log_device.c
@@ -398,7 +398,7 @@
break;
case FORMAT_THREAD:
prefixLen = snprintf(prefixBuf, sizeof(prefixBuf),
- "%c(%5d:%p) ", priChar, pid, (void*)tid);
+ "%c(%5d:%5d) ", priChar, pid, tid);
strcpy(suffixBuf, "\n"); suffixLen = 1;
break;
case FORMAT_RAW:
@@ -417,8 +417,8 @@
break;
case FORMAT_LONG:
prefixLen = snprintf(prefixBuf, sizeof(prefixBuf),
- "[ %s %5d:%p %c/%-8s ]\n",
- timeBuf, pid, (void*)tid, priChar, tag);
+ "[ %s %5d:%5d %c/%-8s ]\n",
+ timeBuf, pid, tid, priChar, tag);
strcpy(suffixBuf, "\n\n"); suffixLen = 2;
break;
default:
diff --git a/liblog/logprint.c b/liblog/logprint.c
index 8366c94..6fac84b 100644
--- a/liblog/logprint.c
+++ b/liblog/logprint.c
@@ -673,7 +673,7 @@
if (inCount != 0) {
fprintf(stderr,
- "Warning: leftover binary log data (%d bytes)\n", inCount);
+ "Warning: leftover binary log data (%zu bytes)\n", inCount);
}
/*
@@ -753,7 +753,7 @@
break;
case FORMAT_THREAD:
prefixLen = snprintf(prefixBuf, sizeof(prefixBuf),
- "%c(%5d:%p) ", priChar, entry->pid, (void*)entry->tid);
+ "%c(%5d:%5d) ", priChar, entry->pid, entry->tid);
strcpy(suffixBuf, "\n");
suffixLen = 1;
break;
@@ -773,15 +773,15 @@
case FORMAT_THREADTIME:
prefixLen = snprintf(prefixBuf, sizeof(prefixBuf),
"%s.%03ld %5d %5d %c %-8s: ", timeBuf, entry->tv_nsec / 1000000,
- (int)entry->pid, (int)entry->tid, priChar, entry->tag);
+ entry->pid, entry->tid, priChar, entry->tag);
strcpy(suffixBuf, "\n");
suffixLen = 1;
break;
case FORMAT_LONG:
prefixLen = snprintf(prefixBuf, sizeof(prefixBuf),
- "[ %s.%03ld %5d:%p %c/%-8s ]\n",
+ "[ %s.%03ld %5d:%5d %c/%-8s ]\n",
timeBuf, entry->tv_nsec / 1000000, entry->pid,
- (void*)entry->tid, priChar, entry->tag);
+ entry->tid, priChar, entry->tag);
strcpy(suffixBuf, "\n\n");
suffixLen = 2;
prefixSuffixIsHeaderFooter = 1;