Got rid of unneeded tmp var and eliminated const from encode prototype since it does make changes to the string.
David Index: encodings/singlebyte.c =================================================================== RCS file: /cvs/public/parrot/encodings/singlebyte.c,v retrieving revision 1.9 diff -c -r1.9 singlebyte.c *** encodings/singlebyte.c 1 Jan 2002 18:43:54 -0000 1.9 --- encodings/singlebyte.c 1 Jan 2002 20:15:01 -0000 *************** *** 21,33 **** static UINTVAL singlebyte_decode (const void *ptr) { ! const byte_t *bptr = ptr; ! ! return *bptr; } static void * ! singlebyte_encode (const void *ptr, UINTVAL c) { byte_t *bptr = (byte_t*)ptr; if (c > 255) { --- 21,31 ---- static UINTVAL singlebyte_decode (const void *ptr) { ! return *(const byte_t *)ptr; } static void * ! singlebyte_encode (void *ptr, UINTVAL c) { byte_t *bptr = (byte_t*)ptr; if (c > 255) { *************** *** 41,54 **** } static void * ! singlebyte_skip_forward (void *ptr, UINTVAL n) { byte_t *bptr = (byte_t*)ptr; return bptr + n; } static void * ! singlebyte_skip_backward (void *ptr, UINTVAL n) { byte_t *bptr = (byte_t*)ptr; return bptr - n; --- 39,52 ---- } static void * ! singlebyte_skip_forward (const void *ptr, UINTVAL n) { byte_t *bptr = (byte_t*)ptr; return bptr + n; } static void * ! singlebyte_skip_backward (const void *ptr, UINTVAL n) { byte_t *bptr = (byte_t*)ptr; return bptr - n; Index: encodings/utf16.c =================================================================== RCS file: /cvs/public/parrot/encodings/utf16.c,v retrieving revision 1.7 diff -c -r1.7 utf16.c *** encodings/utf16.c 1 Jan 2002 18:43:54 -0000 1.7 --- encodings/utf16.c 1 Jan 2002 20:15:01 -0000 *************** *** 57,63 **** } static void * ! utf16_encode (const void *ptr, UINTVAL c) { utf16_t *u16ptr = (utf16_t*)ptr; if (c > 0x10FFFF || UNICODE_IS_SURROGATE(c)) { --- 57,63 ---- } static void * ! utf16_encode (void *ptr, UINTVAL c) { utf16_t *u16ptr = (utf16_t*)ptr; if (c > 0x10FFFF || UNICODE_IS_SURROGATE(c)) { Index: encodings/utf32.c =================================================================== RCS file: /cvs/public/parrot/encodings/utf32.c,v retrieving revision 1.4 diff -c -r1.4 utf32.c *** encodings/utf32.c 1 Jan 2002 18:43:54 -0000 1.4 --- encodings/utf32.c 1 Jan 2002 20:15:01 -0000 *************** *** 30,36 **** } static void * ! utf32_encode (const void *ptr, UINTVAL c) { utf32_t *u32ptr = (utf32_t*)ptr; if (c > 0x10FFFF || UNICODE_IS_SURROGATE(c)) { --- 30,36 ---- } static void * ! utf32_encode (void *ptr, UINTVAL c) { utf32_t *u32ptr = (utf32_t*)ptr; if (c > 0x10FFFF || UNICODE_IS_SURROGATE(c)) { Index: encodings/utf8.c =================================================================== RCS file: /cvs/public/parrot/encodings/utf8.c,v retrieving revision 1.8 diff -c -r1.8 utf8.c *** encodings/utf8.c 1 Jan 2002 18:43:54 -0000 1.8 --- encodings/utf8.c 1 Jan 2002 20:15:01 -0000 *************** *** 77,83 **** } static void * ! utf8_encode (const void *ptr, UINTVAL c) { utf8_t *u8ptr = (utf8_t*)ptr; UINTVAL len = UNISKIP(c); utf8_t *u8end = u8ptr + len - 1; --- 77,83 ---- } static void * ! utf8_encode (void *ptr, UINTVAL c) { utf8_t *u8ptr = (utf8_t*)ptr; UINTVAL len = UNISKIP(c); utf8_t *u8end = u8ptr + len - 1; Index: include/parrot/encoding.h =================================================================== RCS file: /cvs/public/parrot/include/parrot/encoding.h,v retrieving revision 1.7 diff -c -r1.7 encoding.h *** include/parrot/encoding.h 1 Jan 2002 17:09:52 -0000 1.7 --- include/parrot/encoding.h 1 Jan 2002 20:15:02 -0000 *************** *** 18,24 **** UINTVAL max_bytes; UINTVAL (*characters)(const void *ptr, UINTVAL bytes); UINTVAL (*decode)(const void *ptr); ! void *(*encode)(const void *ptr, UINTVAL c); void *(*skip_forward)(const void *ptr, UINTVAL n); void *(*skip_backward)(const void *ptr, UINTVAL n); } ENCODING; --- 18,24 ---- UINTVAL max_bytes; UINTVAL (*characters)(const void *ptr, UINTVAL bytes); UINTVAL (*decode)(const void *ptr); ! void *(*encode)(void *ptr, UINTVAL c); void *(*skip_forward)(const void *ptr, UINTVAL n); void *(*skip_backward)(const void *ptr, UINTVAL n); } ENCODING;