Files
libGLC/quesoglc-typepun.diff
Pavol Rusnak 5415fd67a3 Accepting request 105904 from home:jengelh:branches:games
- Remove redundant tags/sections from specfile
- Parallel build with %_smp_mflags
- Fix deref-of-typepun-ptr error in source code

OBS-URL: https://build.opensuse.org/request/show/105904
OBS-URL: https://build.opensuse.org/package/show/games/libGLC?expand=0&rev=20
2012-02-20 11:40:13 +00:00

35 lines
1.1 KiB
Diff

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;
}
}