apr-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jor...@apache.org
Subject svn commit: r380106 - /apr/apr/trunk/strings/apr_snprintf.c
Date Thu, 23 Feb 2006 12:37:05 GMT
Author: jorton
Date: Thu Feb 23 04:36:59 2006
New Revision: 380106

URL: http://svn.apache.org/viewcvs?rev=380106&view=rev
Log:
* strings/apr_snprintf.c (conv_os_thread_t, conv_os_thread_t_hex):
Avoid strict-aliasing warnings with gcc 4.1.

Modified:
    apr/apr/trunk/strings/apr_snprintf.c

Modified: apr/apr/trunk/strings/apr_snprintf.c
URL: http://svn.apache.org/viewcvs/apr/apr/trunk/strings/apr_snprintf.c?rev=380106&r1=380105&r2=380106&view=diff
==============================================================================
--- apr/apr/trunk/strings/apr_snprintf.c (original)
+++ apr/apr/trunk/strings/apr_snprintf.c Thu Feb 23 04:36:59 2006
@@ -510,16 +510,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);
@@ -680,16 +681,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);



Mime
View raw message