Cleaned up major ugliness in __lfCheckSum.

This commit is contained in:
Alexandre Julliard 2000-08-23 19:15:02 +00:00
parent 53d40899b1
commit c1c94ec80c
1 changed files with 10 additions and 12 deletions

View File

@ -292,19 +292,17 @@ static UINT16 __lfCheckSum( LPLOGFONT16 plf )
{ {
CHAR font[LF_FACESIZE]; CHAR font[LF_FACESIZE];
UINT16 checksum = 0; UINT16 checksum = 0;
UINT16 i; UINT16 *ptr;
int i;
#define ptr ((UINT16*)plf) ptr = (UINT16 *)plf;
for( i = 0; i < 9; i++ ) checksum ^= *ptr++; for (i = 0; i < 9; i++) checksum ^= *ptr++;
#undef ptr for (i = 0; i < LF_FACESIZE; i++)
i = 0; {
#define ptr ((CHAR*)plf) font[i] = tolower(plf->lfFaceName[i]);
do { font[i++] = tolower(*ptr++); } while (( i < LF_FACESIZE) && (*ptr) && (*ptr!=' ')); if (!font[i] || font[i] == ' ') break;
for( ptr = font, i >>= 1; i > 0; i-- ) }
#undef ptr for (ptr = (UINT16 *)font, i >>= 1; i > 0; i-- ) checksum ^= *ptr++;
#define ptr ((UINT16*)plf)
checksum ^= *ptr++;
#undef ptr
return checksum; return checksum;
} }