src/share/back/log_messages.c

Print this page
rev 9508 : 8037825: Fix warnings and enable "warnings as errors" in serviceability native libraries
Reviewed-by:

@@ -54,21 +54,25 @@
 
 /* Ascii id of current native thread. */
 static void
 get_time_stamp(char *tbuf, size_t ltbuf)
 {
-    char format[MAXLEN_TIMESTAMP+1];
+    char timestamp_prefix[MAXLEN_TIMESTAMP+1];
+    char timestamp_postfix[MAXLEN_TIMESTAMP+1];
     unsigned millisecs = 0;
     time_t t = 0;
 
     GETMILLSECS(millisecs);
     if ( time(&t) == (time_t)(-1) )
         t = 0;
-    (void)strftime(format, sizeof(format),
+    (void)strftime(timestamp_prefix, sizeof(timestamp_prefix),
                 /* Break this string up for SCCS's sake */
-                "%" "d.%" "m.%" "Y %" "T.%%.3d %" "Z", localtime(&t));
-    (void)snprintf(tbuf, ltbuf, format, (int)(millisecs));
+                "%" "d.%" "m.%" "Y %" "T", localtime(&t));
+    (void)strftime(timestamp_postfix, sizeof(timestamp_postfix),
+                /* Break this string up for SCCS's sake */
+                "%" "Z", localtime(&t));
+    (void)snprintf(tbuf, ltbuf, "%s.%.3d %s", timestamp_prefix, (int)(millisecs), timestamp_postfix);
 }
 
 /* Get basename of filename */
 static const char *
 file_basename(const char *file)

@@ -173,11 +177,11 @@
             messageID = ""; /* FIXUP: Unique message string ID? */
             (void)snprintf(optional, sizeof(optional),
                         "LOC=%s;PID=%d;THR=t@%d",
                         location_stamp,
                         (int)processPid,
-                        (int)tid);
+                        (int)(intptr_t)tid);
 
             /* Construct message string. */
             va_start(ap, format);
             (void)vsnprintf(message, sizeof(message), format, ap);
             va_end(ap);