diff main/database/src/command.cc @ 11646:b257244ad466 octave-forge

Hopefully fix strict aliasing issues.
author i7tiol
date Mon, 22 Apr 2013 18:41:18 +0000
parents bd5a8f1bdfb8
children 465192f682f0
line wrap: on
line diff
--- a/main/database/src/command.cc	Mon Apr 22 13:40:13 2013 +0000
+++ b/main/database/src/command.cc	Mon Apr 22 18:41:18 2013 +0000
@@ -668,10 +668,12 @@
       char header [COPY_HEADER_SIZE];
       memset (header, 0, COPY_HEADER_SIZE);
       strcpy (header, "PGCOPY\n\377\r\n\0");
-      *((uint32_t *) (&header[11])) = htobe32 (uint32_t (oids) << 16);
+      uint32_t tpu32 = htobe32 (uint32_t (oids) << 16);
+      memcpy (&header[11], &tpu32, 4);
 
       char trailer [2];
-      *((int16_t *) (&trailer)) = htobe16 (int16_t (-1));
+      int16_t tp16 = htobe16 (int16_t (-1));
+      memcpy (&trailer, &tp16, 2);
 
       if (PQputCopyData (cptr, header, COPY_HEADER_SIZE) == -1)
         {