Return-Path: Delivered-To: apmail-apr-cvs-archive@apr.apache.org Received: (qmail 41600 invoked by uid 500); 28 May 2003 14:03:29 -0000 Mailing-List: contact cvs-help@apr.apache.org; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: Reply-To: dev@apr.apache.org Delivered-To: mailing list cvs@apr.apache.org Received: (qmail 41589 invoked by uid 500); 28 May 2003 14:03:28 -0000 Delivered-To: apmail-apr-iconv-cvs@apache.org Date: 28 May 2003 14:03:28 -0000 Message-ID: <20030528140328.83426.qmail@icarus.apache.org> From: martin@apache.org To: apr-iconv-cvs@apache.org Subject: cvs commit: apr-iconv/lib charset_alias.h X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N martin 2003/05/28 07:03:28 Modified: lib charset_alias.h Log: [Porting] Collation order is different for EBCDIC machines Revision Changes Path 1.2 +14 -0 apr-iconv/lib/charset_alias.h Index: charset_alias.h =================================================================== RCS file: /home/cvs/apr-iconv/lib/charset_alias.h,v retrieving revision 1.1 retrieving revision 1.2 diff -u -u -r1.1 -r1.2 --- charset_alias.h 12 Jan 2003 23:46:28 -0000 1.1 +++ charset_alias.h 28 May 2003 14:03:28 -0000 1.2 @@ -394,6 +394,20 @@ { struct charset_alias key; struct charset_alias *alias; +#if 'A' == '\xC1' /* if EBCDIC host */ + /* The table is sorted in ASCII collation order, not in EBCDIC order. + * At the first access, we sort it automatically + * Criterion for the 1st time initialization is the fact that the + * 1st name in the list starts with a digit (in ASCII, numbers + * have a lower ordinal value than alphabetic characters; while + * in EBCDIC, their ordinal value is higher) + */ + if (isdigit(charset_alias_list[0].name[0])) { + qsort((void *)charset_alias_list, charset_alias_count, + sizeof(charset_alias_list[0]), + charset_alias_compare); + } +#endif key.name = name; alias = bsearch(&key, charset_alias_list, charset_alias_count, sizeof(charset_alias_list[0]),