Fix warning

This commit is contained in:
Alexander S. Aganichev 2004-01-20 14:58:37 +00:00
parent 49adbfab72
commit 86705f4181
6 changed files with 36 additions and 36 deletions

View File

@ -421,7 +421,7 @@ void Rot13(GMsg* msg) {
if(not (line->type & (GLINE_KLUDGE|GLINE_TEAR|GLINE_ORIG))) { if(not (line->type & (GLINE_KLUDGE|GLINE_TEAR|GLINE_ORIG))) {
for(ptr = 0; ptr != line->txt.length(); ptr++) { for(ptr = 0; ptr != line->txt.length(); ptr++) {
c = line->txt[ptr]; c = line->txt[ptr];
line->txt[ptr] = ROT13_DECODE(c); line->txt[ptr] = ROT13_DECODE(c & 0xff);
} }
} }
line = line->next; line = line->next;

View File

@ -72,14 +72,14 @@ void gbmh::init(const char* pattern, bool ignorecase) {
for(i=0; i<256; i++) for(i=0; i<256; i++)
skip[i] = patlen; skip[i] = patlen;
for(i=0; i<patlen; i++) { for(i=0; i<patlen; i++) {
skip[pat[i]] = patlen - i - 1; skip[pat[i] & 0xff] = patlen - i - 1;
if(ignore_case) if(ignore_case)
skip[tolower(pat[i])] = patlen - i - 1; skip[tolower((unsigned char)pat[i])] = patlen - i - 1;
} }
char lastpatchar = pat[patlen - 1]; char lastpatchar = pat[patlen - 1];
skip[lastpatchar] = INT_MAX; skip[lastpatchar & 0xff] = INT_MAX;
if(ignore_case) if(ignore_case)
skip[tolower(lastpatchar)] = INT_MAX; skip[tolower((unsigned char)lastpatchar)] = INT_MAX;
// Horspool's fixed second shift // Horspool's fixed second shift
skip2 = patlen; skip2 = patlen;
@ -103,7 +103,7 @@ bool gbmh::find(const char* buffer) {
while(1) { while(1) {
while((i += skip[buffer[i]]) < 0) while((i += skip[buffer[i] & 0xff]) < 0)
; ;
if(i < (INT_MAX - buflen)) if(i < (INT_MAX - buflen))
@ -114,7 +114,7 @@ bool gbmh::find(const char* buffer) {
const char* s = buffer + (i - j); const char* s = buffer + (i - j);
if(ignore_case) { if(ignore_case) {
while(--j >= 0 and toupper(s[j]) == pat[j]) while(--j >= 0 and toupper((unsigned char)s[j]) == pat[j])
; ;
} }
else { else {

View File

@ -42,26 +42,26 @@ mail_ctype::mail_ctype() {
memset(table+'A', mail_char|mail_alpha, ('Z'-'A'+1)*sizeof(uint)); memset(table+'A', mail_char|mail_alpha, ('Z'-'A'+1)*sizeof(uint));
memset(table+'a', mail_char|mail_alpha, ('z'-'a'+1)*sizeof(uint)); memset(table+'a', mail_char|mail_alpha, ('z'-'a'+1)*sizeof(uint));
memset(table+128, 0, 128*sizeof(uint)); memset(table+128, 0, 128*sizeof(uint));
table[127] |= mail_ctl; table[127 & 0xff] |= mail_ctl;
table[0] |= mail_delimiters; table[0 & 0xff] |= mail_delimiters;
table[' '] |= mail_delimiters | mail_lwsp; table[' ' & 0xff] |= mail_delimiters | mail_lwsp;
table[HT] |= mail_delimiters | mail_lwsp; table[HT & 0xff] |= mail_delimiters | mail_lwsp;
table['('] |= mail_delimiters | mail_special | mime_tspecial | mime_especial; table['(' & 0xff] |= mail_delimiters | mail_special | mime_tspecial | mime_especial;
table[')'] |= mail_delimiters | mail_special | mime_tspecial | mime_especial; table[')' & 0xff] |= mail_delimiters | mail_special | mime_tspecial | mime_especial;
table['<'] |= mail_delimiters | mail_special | mime_tspecial | mime_especial; table['<' & 0xff] |= mail_delimiters | mail_special | mime_tspecial | mime_especial;
table['>'] |= mail_delimiters | mail_special | mime_tspecial | mime_especial; table['>' & 0xff] |= mail_delimiters | mail_special | mime_tspecial | mime_especial;
table['@'] |= mail_delimiters | mail_special | mime_tspecial | mime_especial; table['@' & 0xff] |= mail_delimiters | mail_special | mime_tspecial | mime_especial;
table[','] |= mail_delimiters | mail_special | mime_tspecial | mime_especial; table[',' & 0xff] |= mail_delimiters | mail_special | mime_tspecial | mime_especial;
table[';'] |= mail_delimiters | mail_special | mime_tspecial | mime_especial; table[';' & 0xff] |= mail_delimiters | mail_special | mime_tspecial | mime_especial;
table[':'] |= mail_delimiters | mail_special | mime_tspecial | mime_especial; table[':' & 0xff] |= mail_delimiters | mail_special | mime_tspecial | mime_especial;
table['\\'] |= mail_delimiters | mail_special | mime_tspecial | mime_especial; table['\\' & 0xff] |= mail_delimiters | mail_special | mime_tspecial | mime_especial;
table['\"'] |= mail_delimiters | mail_special | mime_tspecial | mime_especial; table['\"' & 0xff] |= mail_delimiters | mail_special | mime_tspecial | mime_especial;
table['['] |= mail_delimiters | mail_special | mime_tspecial | mime_especial; table['[' & 0xff] |= mail_delimiters | mail_special | mime_tspecial | mime_especial;
table[']'] |= mail_delimiters | mail_special | mime_tspecial | mime_especial; table[']' & 0xff] |= mail_delimiters | mail_special | mime_tspecial | mime_especial;
table['.'] |= mail_delimiters | mail_special | mime_especial; table['.' & 0xff] |= mail_delimiters | mail_special | mime_especial;
table['/'] |= mime_tspecial | mime_especial; table['/' & 0xff] |= mime_tspecial | mime_especial;
table['?'] |= mime_tspecial | mime_especial; table['?' & 0xff] |= mime_tspecial | mime_especial;
table['='] |= mime_tspecial | mime_especial; table['=' & 0xff] |= mime_tspecial | mime_especial;
} }

View File

@ -57,8 +57,8 @@ void uucode_engine::initialize() {
table.ch[i] = j; table.ch[i] = j;
for(i=' '+64; i<256; i++) for(i=' '+64; i<256; i++)
table.ch[i] = -1; table.ch[i] = -1;
table.ch['`'] = table.ch[' ']; // A common mutation table.ch['`' & 0xff] = table.ch[' ' & 0xff]; // A common mutation
table.ch['~'] = table.ch['^']; // Another common mutation table.ch['~' & 0xff] = table.ch['^' & 0xff]; // Another common mutation
table.blank = ' '; table.blank = ' ';
// Set up the line length table, to avoid computing lotsa * and / ... // Set up the line length table, to avoid computing lotsa * and / ...
@ -108,7 +108,7 @@ char* uucode_engine::decode(char* outputbuffer, const char* inputbuffer) {
while((c = *p) != 0) { while((c = *p) != 0) {
if(table_index == 0) if(table_index == 0)
table.blank = c; table.blank = c;
table.ch[c] = table_index++; table.ch[c & 0xff] = table_index++;
if(table_index >= 64) { if(table_index >= 64) {
defining_table = false; defining_table = false;
break; break;
@ -119,7 +119,7 @@ char* uucode_engine::decode(char* outputbuffer, const char* inputbuffer) {
} }
// Get the binary line length. // Get the binary line length.
int n = table.ch[*buf]; int n = table.ch[*buf & 0xff];
if(n > 0) { if(n > 0) {
// Pad with blanks. // Pad with blanks.
@ -134,14 +134,14 @@ char* uucode_engine::decode(char* outputbuffer, const char* inputbuffer) {
// Output a group of 3 bytes (4 input characters). // Output a group of 3 bytes (4 input characters).
i = buf + 1; i = buf + 1;
while(n > 0) { while(n > 0) {
*(o++) = (char)((table.ch[*i] << 2) | (table.ch[i[1]] >> 4)); *(o++) = (char)((table.ch[*i & 0xff] << 2) | (table.ch[i[1] & 0xff] >> 4));
n--; n--;
if(n) { if(n) {
*(o++) = (char)((table.ch[i[1]] << 4) | (table.ch[i[2]] >> 2)); *(o++) = (char)((table.ch[i[1] & 0xff] << 4) | (table.ch[i[2] & 0xff] >> 2));
n--; n--;
} }
if(n) { if(n) {
*(o++) = (char)((table.ch[i[2]] << 6) | table.ch[i[3]]); *(o++) = (char)((table.ch[i[2] & 0xff] << 6) | table.ch[i[3] & 0xff]);
n--; n--;
} }
i += 4; i += 4;

View File

@ -314,7 +314,7 @@ int g_put_clip_text(const char *Data) {
if((*Data == '\r') or (*Data == '\n') or (*Data == '\t')) if((*Data == '\r') or (*Data == '\n') or (*Data == '\t'))
*UData++ = *Data++; // no translation for real control chars *UData++ = *Data++; // no translation for real control chars
else else
*UData++ = oem2unicode[*Data++]; *UData++ = oem2unicode[*Data++ & 0xff];
} }
*UData = 0; *UData = 0;
GlobalUnlock(hData); GlobalUnlock(hData);

View File

@ -98,7 +98,7 @@ extern WCHAR oem2unicode[]; // defined in gutlwin.cpp
inline WCHAR gvid_tcpr(vchar chr) { inline WCHAR gvid_tcpr(vchar chr) {
return oem2unicode[chr]; return oem2unicode[chr & 0xff];
} }
#endif #endif