[gegl] fix strict aliasing of type-punned pointers



commit 97f7a2dae4ddc3c52faf6da2988ecf9e3dfd12f1
Author: Nils Philippsen <nils redhat com>
Date:   Fri Feb 19 15:08:09 2010 +0100

    fix strict aliasing of type-punned pointers

 gegl/gegl-cpuaccel.c            |    7 ++++---
 gegl/property-types/gegl-path.c |    3 ++-
 2 files changed, 6 insertions(+), 4 deletions(-)
---
diff --git a/gegl/gegl-cpuaccel.c b/gegl/gegl-cpuaccel.c
index 54e930a..0e5df8b 100644
--- a/gegl/gegl-cpuaccel.c
+++ b/gegl/gegl-cpuaccel.c
@@ -144,6 +144,7 @@ arch_get_vendor (void)
 {
   guint32 eax, ebx, ecx, edx;
   gchar   id[16];
+  guint32 *id32 = (void*) id;
 
 #ifndef ARCH_X86_64
   /* Only need to check this on ia32 */
@@ -171,9 +172,9 @@ arch_get_vendor (void)
   if (eax == 0)
     return ARCH_X86_VENDOR_NONE;
 
-  *(int *)&id[0] = ebx;
-  *(int *)&id[4] = edx;
-  *(int *)&id[8] = ecx;
+  id32[0] = ebx;
+  id32[1] = edx;
+  id32[2] = ecx;
 
   id[12] = '\0';
 
diff --git a/gegl/property-types/gegl-path.c b/gegl/property-types/gegl-path.c
index 8df13c9..bf514ca 100644
--- a/gegl/property-types/gegl-path.c
+++ b/gegl/property-types/gegl-path.c
@@ -296,6 +296,7 @@ static GeglPathList *flatten_curve (GeglMatrix3   matrix,
   gfloat f;
   Point res;
   gchar buf[64]="C";
+  GeglPathItem *item=(void*)buf;
 
   copy_data (&self->d, (void*)buf);
   transform_data (matrix, (void*)buf);
@@ -306,7 +307,7 @@ static GeglPathList *flatten_curve (GeglMatrix3   matrix,
       head = gegl_path_list_append (head, 'L', res.x, res.y);
     }
 
-  res = ((GeglPathItem*)buf)->point[2];
+  res = item->point[2];
   head = gegl_path_list_append (head, 'L', res.x, res.y);
 
   return head;



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]