File quesoglc-typepun.diff of Package libGLC

From: Jan Engelhardt <jengelh@medozas.de>
Date: 2012-02-19 10:56:25.973701757 +0100

build: resolve compiler warnings

../src/unicode.c: In function '__glcConvertUcs4ToGLint':
../src/unicode.c:492:7: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]

---
 src/unicode.c |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

Index: quesoglc-0.7.2/src/unicode.c
===================================================================
--- quesoglc-0.7.2.orig/src/unicode.c
+++ quesoglc-0.7.2/src/unicode.c
@@ -482,6 +482,7 @@ GLint __glcConvertUcs4ToGLint(__GLCconte
        * UTF-8 format
        */
       GLCchar8 buffer[FC_UTF8_MAX_LEN > 8 ? FC_UTF8_MAX_LEN : 8];
+      GLint res;
 #ifndef NDEBUG
       int len = FcUcs4ToUtf8((GLCchar32)inCode, buffer);
       assert((size_t)len <= sizeof(GLint));
@@ -489,7 +490,8 @@ GLint __glcConvertUcs4ToGLint(__GLCconte
       FcUcs4ToUtf8((GLCchar32)inCode, buffer);
 #endif
 
-      return *((GLint*)buffer);
+      memcpy(&res, buffer, sizeof(res));
+      return res;
     }
   }
openSUSE Build Service is sponsored by