From c1c94ec80c607cf73f599b0221235cdd442cbbbc Mon Sep 17 00:00:00 2001 From: Alexandre Julliard Date: Wed, 23 Aug 2000 19:15:02 +0000 Subject: [PATCH] Cleaned up major ugliness in __lfCheckSum. --- graphics/x11drv/xfont.c | 24 +++++++++++------------- 1 file changed, 11 insertions(+), 13 deletions(-) diff --git a/graphics/x11drv/xfont.c b/graphics/x11drv/xfont.c index 4decaee360f..fbc6a1bdbf3 100644 --- a/graphics/x11drv/xfont.c +++ b/graphics/x11drv/xfont.c @@ -292,19 +292,17 @@ static UINT16 __lfCheckSum( LPLOGFONT16 plf ) { CHAR font[LF_FACESIZE]; UINT16 checksum = 0; - UINT16 i; - -#define ptr ((UINT16*)plf) - for( i = 0; i < 9; i++ ) checksum ^= *ptr++; -#undef ptr - i = 0; -#define ptr ((CHAR*)plf) - do { font[i++] = tolower(*ptr++); } while (( i < LF_FACESIZE) && (*ptr) && (*ptr!=' ')); - for( ptr = font, i >>= 1; i > 0; i-- ) -#undef ptr -#define ptr ((UINT16*)plf) - checksum ^= *ptr++; -#undef ptr + UINT16 *ptr; + int i; + + ptr = (UINT16 *)plf; + for (i = 0; i < 9; i++) checksum ^= *ptr++; + for (i = 0; i < LF_FACESIZE; i++) + { + font[i] = tolower(plf->lfFaceName[i]); + if (!font[i] || font[i] == ' ') break; + } + for (ptr = (UINT16 *)font, i >>= 1; i > 0; i-- ) checksum ^= *ptr++; return checksum; } -- 2.11.4.GIT