Changeset 2302


Ignore:
Timestamp:
Sep 21, 2008 9:11:49 PM (12 years ago)
Author:
bennylp
Message:

Ticket #639: Assertion in <ctype.h> functions with Visual Studio 2005 when handling non-ASCII characters

File:
1 edited

Legend:

Unmodified
Added
Removed
  • pjproject/trunk/pjlib/include/pj/ctype.h

    r2039 r2302  
    4545 * @return      Non-zero value if either isalpha or isdigit is true for c. 
    4646 */ 
    47 PJ_INLINE(int) pj_isalnum(int c) { return isalnum(c); } 
     47PJ_INLINE(int) pj_isalnum(unsigned char c) { return isalnum(c); } 
    4848 
    4949/**  
     
    5454 *              alphabetic character. 
    5555 */ 
    56 PJ_INLINE(int) pj_isalpha(int c) { return isalpha(c); } 
     56PJ_INLINE(int) pj_isalpha(unsigned char c) { return isalpha(c); } 
    5757 
    5858/**  
     
    6363 *              an ASCII character. 
    6464 */ 
    65 PJ_INLINE(int) pj_isascii(int c) { return c<128 && c>=0; } 
     65PJ_INLINE(int) pj_isascii(unsigned char c) { return c<128 && c>=0; } 
    6666 
    6767/**  
     
    7272 *              a decimal-digit character. 
    7373 */ 
    74 PJ_INLINE(int) pj_isdigit(int c) { return isdigit(c); } 
     74PJ_INLINE(int) pj_isdigit(unsigned char c) { return isdigit(c); } 
    7575 
    7676/**  
     
    8181 *              a space character (0x09 - 0x0D or 0x20). 
    8282 */ 
    83 PJ_INLINE(int) pj_isspace(int c) { return isspace(c); } 
     83PJ_INLINE(int) pj_isspace(unsigned char c) { return isspace(c); } 
    8484 
    8585/**  
     
    9090 *              a lowercase character. 
    9191 */ 
    92 PJ_INLINE(int) pj_islower(int c) { return islower(c); } 
     92PJ_INLINE(int) pj_islower(unsigned char c) { return islower(c); } 
    9393 
    9494 
     
    100100 *              a uppercase character. 
    101101 */ 
    102 PJ_INLINE(int) pj_isupper(int c) { return isupper(c); } 
     102PJ_INLINE(int) pj_isupper(unsigned char c) { return isupper(c); } 
    103103 
    104104/** 
     
    109109 *              tab ('\\t') character. 
    110110 */ 
    111 PJ_INLINE(int) pj_isblank(int c) { return isblank(c); } 
     111PJ_INLINE(int) pj_isblank(unsigned char c) { return isblank(c); } 
    112112 
    113113/** 
     
    116116 * @return      Lowercase character of c. 
    117117 */ 
    118 PJ_INLINE(int) pj_tolower(int c) { return tolower(c); } 
     118PJ_INLINE(int) pj_tolower(unsigned char c) { return tolower(c); } 
    119119 
    120120/** 
     
    123123 * @return      Uppercase character of c. 
    124124 */ 
    125 PJ_INLINE(int) pj_toupper(int c) { return toupper(c); } 
     125PJ_INLINE(int) pj_toupper(unsigned char c) { return toupper(c); } 
    126126 
    127127/** 
     
    132132 *              an hexadecimal digit character. 
    133133 */ 
    134 PJ_INLINE(int) pj_isxdigit(int c){ return isxdigit(c); } 
     134PJ_INLINE(int) pj_isxdigit(unsigned char c){ return isxdigit(c); } 
    135135 
    136136/** 
     
    157157 * @return      The integral value between 0 and 15. 
    158158 */ 
    159 PJ_INLINE(unsigned) pj_hex_digit_to_val(unsigned c) 
     159PJ_INLINE(unsigned) pj_hex_digit_to_val(unsigned char c) 
    160160{ 
    161161    if (c <= '9') 
Note: See TracChangeset for help on using the changeset viewer.