You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@apr.apache.org by jo...@apache.org on 2007/04/26 15:18:24 UTC

svn commit: r532736 - /apr/apr/branches/1.2.x/strings/apr_snprintf.c

Author: jorton
Date: Thu Apr 26 06:18:24 2007
New Revision: 532736

URL: http://svn.apache.org/viewvc?view=rev&rev=532736
Log:
Merge r380106 from trunk:

* strings/apr_snprintf.c (conv_os_thread_t, conv_os_thread_t_hex):
Avoid strict-aliasing warnings with gcc 4.1.

Modified:
    apr/apr/branches/1.2.x/strings/apr_snprintf.c

Modified: apr/apr/branches/1.2.x/strings/apr_snprintf.c
URL: http://svn.apache.org/viewvc/apr/apr/branches/1.2.x/strings/apr_snprintf.c?view=diff&rev=532736&r1=532735&r2=532736
==============================================================================
--- apr/apr/branches/1.2.x/strings/apr_snprintf.c (original)
+++ apr/apr/branches/1.2.x/strings/apr_snprintf.c Thu Apr 26 06:18:24 2007
@@ -501,16 +501,17 @@
 {
     union {
         apr_os_thread_t tid;
-        apr_uint64_t alignme;
+        apr_uint64_t u64;
+        apr_uint32_t u32;
     } u;
     int is_negative;
 
     u.tid = *tid;
     switch(sizeof(u.tid)) {
     case sizeof(apr_int32_t):
-        return conv_10(*(apr_uint32_t *)&u.tid, TRUE, &is_negative, buf_end, len);
+        return conv_10(u.u32, TRUE, &is_negative, buf_end, len);
     case sizeof(apr_int64_t):
-        return conv_10_quad(*(apr_uint64_t *)&u.tid, TRUE, &is_negative, buf_end, len);
+        return conv_10_quad(u.u64, TRUE, &is_negative, buf_end, len);
     default:
         /* not implemented; stick 0 in the buffer */
         return conv_10(0, TRUE, &is_negative, buf_end, len);
@@ -671,16 +672,17 @@
 {
     union {
         apr_os_thread_t tid;
-        apr_uint64_t alignme;
+        apr_uint64_t u64;
+        apr_uint32_t u32;
     } u;
     int is_negative;
 
     u.tid = *tid;
     switch(sizeof(u.tid)) {
     case sizeof(apr_int32_t):
-        return conv_p2(*(apr_uint32_t *)&u.tid, 4, 'x', buf_end, len);
+        return conv_p2(u.u32, 4, 'x', buf_end, len);
     case sizeof(apr_int64_t):
-        return conv_p2_quad(*(apr_uint64_t *)&u.tid, 4, 'x', buf_end, len);
+        return conv_p2_quad(u.u64, 4, 'x', buf_end, len);
     default:
         /* not implemented; stick 0 in the buffer */
         return conv_10(0, TRUE, &is_negative, buf_end, len);