cvsuser     02/01/01 09:09:52

  Modified:    encodings singlebyte.c utf16.c utf32.c utf8.c
               include/parrot encoding.h
  Log:
  Some signed things are now unsigned, as is proper.
  
  Courtesy of: "David & Lisa Jacobs" <[EMAIL PROTECTED]>
  Courtesy of: "Bryan C. Warnock" <[EMAIL PROTECTED]>
  
  Revision  Changes    Path
  1.7       +8 -8      parrot/encodings/singlebyte.c
  
  Index: singlebyte.c
  ===================================================================
  RCS file: /home/perlcvs/parrot/encodings/singlebyte.c,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -w -r1.6 -r1.7
  --- singlebyte.c      30 Dec 2001 12:04:56 -0000      1.6
  +++ singlebyte.c      1 Jan 2002 17:09:52 -0000       1.7
  @@ -1,7 +1,7 @@
   /* singlebyte.c
    *  Copyright: (When this is determined...it will go here)
    *  CVS Info
  - *     $Id: singlebyte.c,v 1.6 2001/12/30 12:04:56 simon Exp $
  + *     $Id: singlebyte.c,v 1.7 2002/01/01 17:09:52 dan Exp $
    *  Overview:
    *     This defines the single byte encoding routines.
    *  Data Structure and Algorithms:
  @@ -14,12 +14,12 @@
   
   typedef unsigned char byte_t;
   
  -static INTVAL
  -singlebyte_characters (const void *ptr, INTVAL bytes) {
  +static UINTVAL
  +singlebyte_characters (const void *ptr, UINTVAL bytes) {
       return bytes;
   }
   
  -static INTVAL
  +static UINTVAL
   singlebyte_decode (const void *ptr) {
       const byte_t *bptr = ptr;
   
  @@ -27,8 +27,8 @@
   }
   
   static void *
  -singlebyte_encode (void *ptr, INTVAL c) {
  -    byte_t *bptr = ptr;
  +singlebyte_encode (const void *ptr, UINTVAL c) {
  +    byte_t *bptr = (byte_t*)ptr;
   
       if (c < 0 || c > 255) {
           INTERNAL_EXCEPTION(INVALID_CHARACTER,
  @@ -41,14 +41,14 @@
   }
   
   static void *
  -singlebyte_skip_forward (const void *ptr, INTVAL n) {
  +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, INTVAL n) {
  +singlebyte_skip_backward (const void *ptr, UINTVAL n) {
       byte_t *bptr = (byte_t*)ptr;
   
       return bptr - n;
  
  
  
  1.6       +10 -10    parrot/encodings/utf16.c
  
  Index: utf16.c
  ===================================================================
  RCS file: /home/perlcvs/parrot/encodings/utf16.c,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -w -r1.5 -r1.6
  --- utf16.c   30 Dec 2001 12:04:56 -0000      1.5
  +++ utf16.c   1 Jan 2002 17:09:52 -0000       1.6
  @@ -1,7 +1,7 @@
   /* utf16.c
    *  Copyright: (When this is determined...it will go here)
    *  CVS Info
  - *     $Id: utf16.c,v 1.5 2001/12/30 12:04:56 simon Exp $
  + *     $Id: utf16.c,v 1.6 2002/01/01 17:09:52 dan Exp $
    *  Overview:
    *     This defines the UTF-16 encoding routines.
    *  Data Structure and Algorithms:
  @@ -17,11 +17,11 @@
   typedef unsigned short utf16_t;
   #endif
   
  -static INTVAL
  -utf16_characters (const void *ptr, INTVAL bytes) {
  +static UINTVAL
  +utf16_characters (const void *ptr, UINTVAL bytes) {
       const utf16_t *u16ptr = ptr;
       const utf16_t *u16end = u16ptr + bytes / sizeof(utf16_t);
  -    INTVAL characters = 0;
  +    UINTVAL characters = 0;
   
       while (u16ptr < u16end) {
           u16ptr += UTF16SKIP(u16ptr);
  @@ -35,10 +35,10 @@
       return characters;
   }
   
  -static INTVAL
  +static UINTVAL
   utf16_decode (const void *ptr) {
       const utf16_t *u16ptr = ptr;
  -    INTVAL c = *u16ptr++;
  +    UINTVAL c = *u16ptr++;
   
       if (UNICODE_IS_HIGH_SURROGATE(c)) {
           utf16_t low = *u16ptr++;
  @@ -57,8 +57,8 @@
   }
   
   static void *
  -utf16_encode (void *ptr, INTVAL c) {
  -    utf16_t *u16ptr = ptr;
  +utf16_encode (const void *ptr, UINTVAL c) {
  +    utf16_t *u16ptr = (utf16_t*)ptr;
   
       if (c < 0 || c > 0x10FFFF || UNICODE_IS_SURROGATE(c)) {
           INTERNAL_EXCEPTION(INVALID_CHARACTER,
  @@ -77,7 +77,7 @@
   }
   
   static void *
  -utf16_skip_forward (const void *ptr, INTVAL n) {
  +utf16_skip_forward (const void *ptr, UINTVAL n) {
       utf16_t *u16ptr = (utf16_t*)ptr;
   
       while (n-- > 0) {
  @@ -100,7 +100,7 @@
   }
   
   static void *
  -utf16_skip_backward (const void *ptr, INTVAL n) {
  +utf16_skip_backward (const void *ptr, UINTVAL n) {
       utf16_t *u16ptr = (utf16_t*)ptr;
   
       while (n--> 0) {
  
  
  
  1.3       +8 -8      parrot/encodings/utf32.c
  
  Index: utf32.c
  ===================================================================
  RCS file: /home/perlcvs/parrot/encodings/utf32.c,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -w -r1.2 -r1.3
  --- utf32.c   30 Dec 2001 12:04:56 -0000      1.2
  +++ utf32.c   1 Jan 2002 17:09:52 -0000       1.3
  @@ -1,7 +1,7 @@
   /* utf32.c
    *  Copyright: (When this is determined...it will go here)
    *  CVS Info
  - *     $Id: utf32.c,v 1.2 2001/12/30 12:04:56 simon Exp $
  + *     $Id: utf32.c,v 1.3 2002/01/01 17:09:52 dan Exp $
    *  Overview:
    *     This defines the UTF-32 encoding routines.
    *  Data Structure and Algorithms:
  @@ -17,12 +17,12 @@
   typedef unsigned long utf32_t;
   #endif
   
  -static INTVAL
  -utf32_characters (const void *ptr, INTVAL bytes) {
  +static UINTVAL
  +utf32_characters (const void *ptr, UINTVAL bytes) {
       return bytes / 4;
   }
   
  -static INTVAL
  +static UINTVAL
   utf32_decode (const void *ptr) {
       const utf32_t *u32ptr = ptr;
   
  @@ -30,8 +30,8 @@
   }
   
   static void *
  -utf32_encode (void *ptr, INTVAL c) {
  -    utf32_t *u32ptr = ptr;
  +utf32_encode (const void *ptr, UINTVAL c) {
  +    utf32_t *u32ptr = (utf32_t*)ptr;
   
       if (c < 0 || c > 0x10FFFF || UNICODE_IS_SURROGATE(c)) {
           INTERNAL_EXCEPTION(INVALID_CHARACTER,
  @@ -44,14 +44,14 @@
   }
   
   static void *
  -utf32_skip_forward (const void *ptr, INTVAL n) {
  +utf32_skip_forward (const void *ptr, UINTVAL n) {
       utf32_t *u32ptr = (utf32_t*)ptr;
   
       return u32ptr + n;
   }
   
   static void *
  -utf32_skip_backward (const void *ptr, INTVAL n) {
  +utf32_skip_backward (const void *ptr, UINTVAL n) {
       utf32_t *u32ptr = (utf32_t*)ptr;
   
       return u32ptr - n;
  
  
  
  1.7       +13 -13    parrot/encodings/utf8.c
  
  Index: utf8.c
  ===================================================================
  RCS file: /home/perlcvs/parrot/encodings/utf8.c,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -w -r1.6 -r1.7
  --- utf8.c    31 Dec 2001 16:00:59 -0000      1.6
  +++ utf8.c    1 Jan 2002 17:09:52 -0000       1.7
  @@ -1,7 +1,7 @@
   /* utf8.c
    *  Copyright: (When this is determined...it will go here)
    *  CVS Info
  - *     $Id: utf8.c,v 1.6 2001/12/31 16:00:59 simon Exp $
  + *     $Id: utf8.c,v 1.7 2002/01/01 17:09:52 dan Exp $
    *  Overview:
    *     This defines the UTF-8 encoding routines.
    *  Data Structure and Algorithms:
  @@ -28,11 +28,11 @@
   typedef unsigned char utf8_t;
   #endif
   
  -static INTVAL
  -utf8_characters (const void *ptr, INTVAL bytes) {
  +static UINTVAL
  +utf8_characters (const void *ptr, UINTVAL bytes) {
       const utf8_t *u8ptr = ptr;
       const utf8_t *u8end = u8ptr + bytes;
  -    INTVAL characters = 0;
  +    UINTVAL characters = 0;
   
       while (u8ptr < u8end) {
           u8ptr += UTF8SKIP(u8ptr);
  @@ -46,14 +46,14 @@
       return characters;
   }
   
  -static INTVAL
  +static UINTVAL
   utf8_decode (const void *ptr) {
       const utf8_t *u8ptr = ptr;
  -    INTVAL c = *u8ptr;
  +    UINTVAL c = *u8ptr;
   
       if (UTF8_IS_START(c)) {
  -        INTVAL len = UTF8SKIP(u8ptr);
  -        INTVAL count;
  +        UINTVAL len = UTF8SKIP(u8ptr);
  +        UINTVAL count;
   
           c &= UTF8_START_MASK(len);
           for (count = 1; count < len; count++) {
  @@ -77,9 +77,9 @@
   }
   
   static void *
  -utf8_encode (void *ptr, INTVAL c) {
  -    utf8_t *u8ptr = ptr;
  -    INTVAL len = UNISKIP(c);
  +utf8_encode (const void *ptr, UINTVAL c) {
  +    utf8_t *u8ptr = (utf8_t*)ptr;
  +    UINTVAL len = UNISKIP(c);
       utf8_t *u8end = u8ptr + len - 1;
   
       if (c < 0 || c > 0x10FFFF || UNICODE_IS_SURROGATE(c)) {
  @@ -97,7 +97,7 @@
   }
   
   static void *
  -utf8_skip_forward (void *ptr, INTVAL n) {
  +utf8_skip_forward (const void *ptr, UINTVAL n) {
       utf8_t *u8ptr = (utf8_t*)ptr;
   
       while (n-- > 0) {
  @@ -108,7 +108,7 @@
   }
   
   static void *
  -utf8_skip_backward (void *ptr, INTVAL n) {
  +utf8_skip_backward (const void *ptr, UINTVAL n) {
       utf8_t *u8ptr = (utf8_t*)ptr;
   
       while (n-- > 0) {
  
  
  
  1.7       +7 -7      parrot/include/parrot/encoding.h
  
  Index: encoding.h
  ===================================================================
  RCS file: /home/perlcvs/parrot/include/parrot/encoding.h,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -w -r1.6 -r1.7
  --- encoding.h        31 Dec 2001 16:00:59 -0000      1.6
  +++ encoding.h        1 Jan 2002 17:09:52 -0000       1.7
  @@ -1,7 +1,7 @@
   /* encoding.h
    *  Copyright: (When this is determined...it will go here)
    *  CVS Info
  - *     $Id: encoding.h,v 1.6 2001/12/31 16:00:59 simon Exp $
  + *     $Id: encoding.h,v 1.7 2002/01/01 17:09:52 dan Exp $
    *  Overview:
    *     This is the api header for the string encoding subsystem
    *  Data Structure and Algorithms:
  @@ -15,12 +15,12 @@
   
   typedef struct {
       const char *name;
  -    INTVAL max_bytes;
  -    INTVAL (*characters)(const void *ptr, INTVAL bytes);
  -    INTVAL (*decode)(const void *ptr);
  -    void *(*encode)(void *ptr, INTVAL c);
  -    void *(*skip_forward)(void *ptr, INTVAL n);
  -    void *(*skip_backward)(void *ptr, INTVAL n);
  +    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;
   
   const ENCODING *
  
  
  


Reply via email to