From 996eb5801107678496c184d1d5684fc7bee2e510 Mon Sep 17 00:00:00 2001 From: Howard Chu Date: Sat, 5 Jan 2002 10:33:38 +0000 Subject: [PATCH] Fix ASCII detection; can't use "< 0x80" on a signed char. --- include/ldap_pvt.h | 2 +- include/ldap_pvt_uc.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/include/ldap_pvt.h b/include/ldap_pvt.h index 71fd9d8f80..40f0f84e47 100644 --- a/include/ldap_pvt.h +++ b/include/ldap_pvt.h @@ -106,7 +106,7 @@ LDAP_F (void) ldap_pvt_hex_unescape LDAP_P(( char *s )); * these macros assume 'x' is an ASCII x * and assume the "C" locale */ -#define LDAP_ASCII(c) ((c) < 0x80) +#define LDAP_ASCII(c) (!((c) & 0x80)) #define LDAP_SPACE(c) ((c) == ' ' || (c) == '\t' || (c) == '\n') #define LDAP_DIGIT(c) ((c) >= '0' && (c) <= '9') #define LDAP_LOWER(c) ((c) >= 'a' && (c) <= 'z') diff --git a/include/ldap_pvt_uc.h b/include/ldap_pvt_uc.h index 5292207630..8417b4441b 100644 --- a/include/ldap_pvt_uc.h +++ b/include/ldap_pvt_uc.h @@ -77,7 +77,7 @@ LDAP_F (char*) ldap_utf8_strtok( char* sp, const char* sep, char **last); /* Optimizations */ LDAP_V (const char) ldap_utf8_lentab[128]; -#define LDAP_UTF8_ISASCII(p) ( *(unsigned char *)(p) ^ 0x80 ) +#define LDAP_UTF8_ISASCII(p) ( !(*(unsigned char *)(p) & 0x80 ) ) #define LDAP_UTF8_CHARLEN(p) ( LDAP_UTF8_ISASCII(p) \ ? 1 : ldap_utf8_lentab[*(unsigned char *)(p) ^ 0x80] ) #define LDAP_UTF8_OFFSET(p) ( LDAP_UTF8_ISASCII(p) \ -- 2.39.5