From: miker Date: Wed, 22 Nov 2006 21:41:54 +0000 (+0000) Subject: ugly, but it does not warn X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=2054ea5743fcb5750fe8cd7981e3348ec161473a;p=opensrf%2Fbjwebb.git ugly, but it does not warn git-svn-id: svn://svn.open-ils.org/OpenSRF/trunk@801 9efc2488-bf62-4759-914b-345cdb29e865 --- diff --git a/src/utils/utils.c b/src/utils/utils.c index 58644a0..004e027 100644 --- a/src/utils/utils.c +++ b/src/utils/utils.c @@ -255,17 +255,17 @@ char* uescape( const char* string, int size, int full_escape ) { growing_buffer* buf = buffer_init(size + 64); int idx = 0; - long unsigned int c = 0; + int c = 0; while (string[idx]) { c ^= c; - if (!(string[idx] < 0x80)) { // not ASCII - if (string[idx]>= 0xc0 && string[idx] <= 0xfd) { // starts a UTF8 string + if (!((unsigned char)string[idx] < 0x80)) { // not ASCII + if ((unsigned char)string[idx] >= 0xc0 && (unsigned char)string[idx] <= 0xfd) { // starts a UTF8 string do { - c = (c << 6) | (string[idx] & 0x3f); // add this byte worth - } while ((string[idx + 1] >= 0x80 && string[idx + 1] <= 0xbf) && idx++); // and continue if there's more + c = (c << 6) | ((unsigned char)string[idx] & 0x3f); // add this byte worth + } while (((unsigned char)string[idx + 1] >= 0x80 && (unsigned char)string[idx + 1] <= 0xbf) && idx++); // and continue if there's more buffer_fadd(buf, "\\u%0.4x", c); } else return NULL; } else {