summaryrefslogtreecommitdiffstats
path: root/unix/tkUnixFont.c
diff options
context:
space:
mode:
authornijtmans <nijtmans>2010-05-26 15:28:09 (GMT)
committernijtmans <nijtmans>2010-05-26 15:28:09 (GMT)
commit44956ea2ae237e8111e50cfde47883f81e24fb7b (patch)
treeb40da66d41c9fb7b65513e77544b1afb6c20b36f /unix/tkUnixFont.c
parentd59e4da7e1c57fe1962f24cafedbc04cf2cc5b2b (diff)
downloadtk-44956ea2ae237e8111e50cfde47883f81e24fb7b.zip
tk-44956ea2ae237e8111e50cfde47883f81e24fb7b.tar.gz
tk-44956ea2ae237e8111e50cfde47883f81e24fb7b.tar.bz2
Fix some gcc strict-aliasing warnings (discovered with "-Wstrict-aliasing=2"
Diffstat (limited to 'unix/tkUnixFont.c')
-rw-r--r--unix/tkUnixFont.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/unix/tkUnixFont.c b/unix/tkUnixFont.c
index 3b9beae..cbfcdc9 100644
--- a/unix/tkUnixFont.c
+++ b/unix/tkUnixFont.c
@@ -9,7 +9,7 @@
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tkUnixFont.c,v 1.41 2010/01/05 08:49:49 dkf Exp $
+ * RCS: @(#) $Id: tkUnixFont.c,v 1.42 2010/05/26 15:28:10 nijtmans Exp $
*/
#include "tkUnixInt.h"
@@ -1086,7 +1086,7 @@ Tk_MeasureChars(
int newX, termX, sawNonSpace, dstWrote;
Tcl_UniChar ch;
FontFamily *familyPtr;
- char buf[16];
+ XChar2b buf[8];
/*
* How many chars will fit in the space allotted? This first version
@@ -1108,14 +1108,14 @@ Tk_MeasureChars(
} else {
lastSubFontPtr = FindSubFontForChar(fontPtr, ch, NULL);
familyPtr = lastSubFontPtr->familyPtr;
- Tcl_UtfToExternal(NULL, familyPtr->encoding, p, next - p,
- 0, NULL, buf, sizeof(buf), NULL, &dstWrote, NULL);
+ Tcl_UtfToExternal(NULL, familyPtr->encoding, p, next - p, 0, NULL,
+ (char *)&buf[0].byte1, sizeof(buf), NULL, &dstWrote, NULL);
if (familyPtr->isTwoByteFont) {
newX += XTextWidth16(lastSubFontPtr->fontStructPtr,
- (XChar2b *) buf, dstWrote >> 1);
+ buf, dstWrote >> 1);
} else {
- newX += XTextWidth(lastSubFontPtr->fontStructPtr, buf,
- dstWrote);
+ newX += XTextWidth(lastSubFontPtr->fontStructPtr,
+ (char *)&buf[0].byte1, dstWrote);
}
}
if (newX > maxLength) {