Return-Path: Delivered-To: apmail-stdcxx-dev-archive@www.apache.org Received: (qmail 91212 invoked from network); 1 Apr 2008 19:55:45 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 1 Apr 2008 19:55:45 -0000 Received: (qmail 38231 invoked by uid 500); 1 Apr 2008 19:55:45 -0000 Delivered-To: apmail-stdcxx-dev-archive@stdcxx.apache.org Received: (qmail 38218 invoked by uid 500); 1 Apr 2008 19:55:45 -0000 Mailing-List: contact dev-help@stdcxx.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@stdcxx.apache.org Delivered-To: mailing list dev@stdcxx.apache.org Received: (qmail 38209 invoked by uid 99); 1 Apr 2008 19:55:45 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 01 Apr 2008 12:55:45 -0700 X-ASF-Spam-Status: No, hits=0.2 required=10.0 tests=SPF_PASS,WHOIS_MYPRIVREG X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: local policy) Received: from [208.30.140.160] (HELO moroha.roguewave.com) (208.30.140.160) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 01 Apr 2008 19:55:03 +0000 Received: from exchmail01.Blue.Roguewave.Com (exchmail01.blue.roguewave.com [10.22.129.22]) by moroha.roguewave.com (8.13.6/8.13.6) with ESMTP id m31JtDuw009046 for ; Tue, 1 Apr 2008 19:55:13 GMT X-MimeOLE: Produced By Microsoft Exchange V6.5 Content-class: urn:content-classes:message MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Subject: RE: svn commit: r642397 - in /stdcxx/trunk/tests/src: braceexp.cpp locale.cpp Date: Tue, 1 Apr 2008 13:55:29 -0600 Message-ID: X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: svn commit: r642397 - in /stdcxx/trunk/tests/src: braceexp.cpp locale.cpp Thread-Index: AciULJX7ZI/5oAUaS56e0etu+4gjvgABXZKw References: <47EEBF00.5030701@roguewave.com> <16421931.post@talk.nabble.com> From: "Travis Vitek" To: X-Virus-Checked: Checked by ClamAV on apache.org =20 >Martin Sebor wrote: > >PING? > >The sign extension issue is still there. I don't want it to=20 >get forgotten. > > It was not forgotten. I decided to re-add the inline functions to avoid having to cast to unsigned char all over the place. http://svn.apache.org/viewvc?view=3Drev&revision=3D643214 Travis >Martin Sebor wrote: >>=20 >> vitek@apache.org wrote: >>> Author: vitek >>> Date: Fri Mar 28 14:28:41 2008 >>> New Revision: 642397 >>>=20 >>> URL: http://svn.apache.org/viewvc?rev=3D642397&view=3Drev >>> Log: >>>=20 >>> 2008-03-28 Travis Vitek >>>=20 >>> STDCXX-714 >>> * tests/src/braceexp.cpp: Remove _rw_isspace(),=20 >_rw_isupper() and >>> _rw_islower(). Use appropriate C library calls instead. >>>=20 >>> STDCXX-716 >>> * tests/src/locale.cpp: Remove _rw_isspace(), _rw_toupper() and >>> _rw_tolower(). Use appropriate C library calls instead. >>=20 >>=20 >> Travis, the isxxx() functions take an int argument and that their >> domain is the values between 0 and UCHAR_MAX plus EOF (and their >> behavior is undefined otherwise -- IIRC, the Microsoft functions >> abort in the undefined case). When passed a plain char, the >> argument is subject to sign extension where the type signed and >> values between CHAR_MIN and -1 are invalid. To make sure the >> functions always behave correctly it's best to cast the argument >> to unsigned char. >>=20 >> Martin >>=20 >>> =09 >>>=20 >>> Modified: >>> stdcxx/trunk/tests/src/braceexp.cpp >>> stdcxx/trunk/tests/src/locale.cpp >>>=20 >>> Modified: stdcxx/trunk/tests/src/braceexp.cpp >>> URL: >>>=20 >http://svn.apache.org/viewvc/stdcxx/trunk/tests/src/braceexp.cp >p?rev=3D642397&r1=3D642396&r2=3D642397&view=3Ddiff >>>=20 >=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D >=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D >>> --- stdcxx/trunk/tests/src/braceexp.cpp (original) >>> +++ stdcxx/trunk/tests/src/braceexp.cpp Fri Mar 28 14:28:41 2008 >>> @@ -3,55 +3,14 @@ >>> =20 >>> #include // for malloc(), free() >>> #include // for memcpy() >>> +#include // for isspace() >>> #include // for assert() >>> =20 >>> #include >>> =20 >>> -inline int _rw_is_lower (int ch) >>> -{ >>> - switch (ch) { >>> - case 'a': case 'b': case 'c': case 'd': case 'e': case 'f': >>> - case 'g': case 'h': case 'i': case 'j': case 'k': case 'l': >>> - case 'm': case 'n': case 'o': case 'p': case 'q': case 'r': >>> - case 's': case 't': case 'u': case 'v': case 'w': case 'x': >>> - case 'y': case 'z': >>> - return 1; >>> - } >>> - >>> - return 0; >>> -} >>> - >>> -inline int _rw_is_upper (int ch) >>> -{ >>> - switch (ch) { >>> - case 'A': case 'B': case 'C': case 'D': case 'E': case 'F': >>> - case 'G': case 'H': case 'I': case 'J': case 'K': case 'L': >>> - case 'M': case 'N': case 'O': case 'P': case 'Q': case 'R': >>> - case 'S': case 'T': case 'U': case 'V': case 'W': case 'X': >>> - case 'Y': case 'Z': >>> - return 1; >>> - } >>> - >>> - return 0; >>> -} >>> - >>> -inline int _rw_is_space (int ch) >>> -{ >>> - switch (ch) >>> - { >>> - case '\n': >>> - case '\r': >>> - case '\t': >>> - case ' ': >>> - return 1; >>> - } >>> - >>> - return 0; >>> -} >>> - >>> inline int _rw_is_not_space (int ch) >>> { >>> - return !_rw_is_space (ch); >>> + return !isspace (ch); >>> } >>> =20 >>> // search `beg' to `end' for a character that `fn' >>> @@ -696,8 +655,8 @@ >>> char cend =3D beg [4]; >>> =20 >>> // only works if sequence characters are both lowercase or >>> uppercase. >>> - const int both_are_lower =3D _rw_is_lower (cbeg) && = _rw_is_lower >>> (cend); >>> - const int both_are_upper =3D _rw_is_upper (cbeg) && = _rw_is_upper >>> (cend); >>> + const int both_are_lower =3D islower (cbeg) && islower (cend); >>> + const int both_are_upper =3D isupper (cbeg) && isupper (cend); >>> =20 >>> if (! (both_are_lower || both_are_upper)) >>> return 0; >>> @@ -1050,7 +1009,7 @@ >>> =20 >>> while (tok_beg) >>> { >>> - const char* tok_end =3D _rw_find_match (tok_beg, end, >>> _rw_is_space); >>> + const char* tok_end =3D _rw_find_match (tok_beg,=20 >end, isspace); >>> if (!tok_end) >>> tok_end =3D end; >>> =20 >>>=20 >>> Modified: stdcxx/trunk/tests/src/locale.cpp >>> URL: >>>=20 >http://svn.apache.org/viewvc/stdcxx/trunk/tests/src/locale.cpp? >rev=3D642397&r1=3D642396&r2=3D642397&view=3Ddiff >>>=20 >=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D >=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D >>> --- stdcxx/trunk/tests/src/locale.cpp (original) >>> +++ stdcxx/trunk/tests/src/locale.cpp Fri Mar 28 14:28:41 2008 >>> @@ -951,59 +951,6 @@ >>> struct _rw_locale_entry* next; >>> }; >>> =20 >>> -static int >>> -_rw_toupper (int chr) >>> -{ >>> - //if (chr < 'a' || 'z' < chr) >>> - // return chr; >>> - //return chr - 'a' + 'A'; >>> - switch (chr) >>> - { >>> - case 'a': case 'b': case 'c': case 'd': case 'e': case 'f': >>> - case 'g': case 'h': case 'i': case 'j': case 'k': case 'l': >>> - case 'm': case 'n': case 'o': case 'p': case 'q': case 'r': >>> - case 's': case 't': case 'u': case 'v': case 'w': case 'x': >>> - case 'y': case 'z': >>> - return chr - 'a' + 'A'; >>> - } >>> - >>> - return chr; >>> -} >>> - >>> -static int >>> -_rw_tolower (int chr) >>> -{ >>> - //if (chr < 'A' || 'Z' < chr) >>> - // return chr; >>> - //return chr - 'A' + 'a'; >>> - switch (chr) >>> - { >>> - case 'A': case 'B': case 'C': case 'D': case 'E': case 'F': >>> - case 'G': case 'H': case 'I': case 'J': case 'K': case 'L': >>> - case 'M': case 'N': case 'O': case 'P': case 'Q': case 'R': >>> - case 'S': case 'T': case 'U': case 'V': case 'W': case 'X': >>> - case 'Y': case 'Z': >>> - return chr - 'A' + 'a'; >>> - } >>> - >>> - return chr; >>> -} >>> - >>> -static int >>> -_rw_isspace (int chr) >>> -{ >>> - switch (chr) >>> - { >>> - case '\r': >>> - case '\n': >>> - case '\t': >>> - case ' ': >>> - return 1; >>> - } >>> - >>> - return 0; >>> -} >>> - >>> struct _rw_locale_array { >>> _rw_locale_entry* entries; >>> _RWSTD_SIZE_T count; >>> @@ -1205,7 +1152,7 @@ >>> for (const char* charset =3D nl_langinfo (CODESET); >>> *charset; >>> ++charset) { >>> - codeset [i++] =3D _rw_toupper (*charset); >>> + codeset [i++] =3D toupper (*charset); >>> } >>> =20 >>> codeset [i] =3D '\0'; >>> @@ -1225,7 +1172,7 @@ >>> *encoding++ =3D '\0'; >>> =20 >>> for (int n =3D 0; encoding [n]; ++n) >>> - encoding [n] =3D _rw_toupper (encoding [n]); >>> + encoding [n] =3D toupper (encoding [n]); >>> } >>> =20 >>> char* country =3D strrchr (locale, '_'); >>> @@ -1233,13 +1180,13 @@ >>> *country++ =3D '\0'; >>> =20 >>> for (int n =3D 0; country [n]; ++n) >>> - country [n] =3D _rw_toupper (country [n]); >>> + country [n] =3D toupper (country [n]); >>> } >>> =20 >>> char* language =3D locale; >>> =20 >>> for (int n =3D 0; language [n]; ++n) >>> - language [n] =3D _rw_tolower (language [n]); >>> + language [n] =3D tolower (language [n]); >>> =20 >>> // use mapping databases to find the canonical >>> // names for each part of the locale name >>> @@ -1296,7 +1243,7 @@ >>> =20 >>> // the canonical name for lookup >>> sprintf (entry->canonical_name, "%s-%s-%d-%s", >>> - planguage, pcountry, MB_CUR_MAX, pencoding); >>> + planguage, pcountry, int=20 >(MB_CUR_MAX), pencoding); >>> =20 >>> size +=3D 1; >>> } >>> @@ -1527,7 +1474,7 @@ >>> =20 >>> char* key =3D table_data + offset; >>> =20 >>> - const int len =3D strcspn (key, "\r\n"); >>> + const size_t len =3D strcspn (key, "\r\n"); >>> key [len] =3D '\0'; >>> =20 >>> // skip the newline if it is there >>> @@ -1541,27 +1488,27 @@ >>> // make upper or lower case as requested >>> if (upper_or_lower < 0) { >>> for (char* s =3D key; *s; ++s) >>> - *s =3D _rw_tolower (*s); >>> + *s =3D tolower (*s); >>> } >>> else if (0 < upper_or_lower) { >>> for (char* s =3D key; *s; ++s) >>> - *s =3D _rw_toupper (*s); >>> + *s =3D toupper (*s); >>> } >>> =20 >>> // if first character of new line is not=20 >whitespace, then we >>> have a new >>> // canonical name token >>> - if (!_rw_isspace (*key)) { >>> + if (!isspace (*key)) { >>> =20 >>> canonical_name =3D key; >>> =20 >>> // increment key past cannonical name >>> for (/**/; *key; ++key) >>> - if (_rw_isspace (*key)) >>> + if (isspace (*key)) >>> break; >>> } >>> =20 >>> // kill whitespace >>> - while (_rw_isspace (*key)) >>> + while (isspace (*key)) >>> *key++ =3D '\0'; >>> =20 >>> // key points to first non-whitespace after=20 >canonical name >>> @@ -1582,11 +1529,11 @@ >>> *key++ =3D '\0'; >>> =20 >>> // kill any whitespace before comma >>> - for (char* bey =3D key - 1; _rw_isspace=20 >(*bey); --bey) >>> + for (char* bey =3D key - 1; isspace (*bey); --bey) >>> *bey =3D '\0'; >>> =20 >>> // kill whitespace after comma >>> - while (_rw_isspace (*key)) >>> + while (isspace (*key)) >>> *key++ =3D '\0'; >>> =20 >>> // ensure we have enough entries >>>=20 >>>=20 >>>=20 >>=20 >>=20 >>=20 > >--=20 >View this message in context:=20 >http://www.nabble.com/Re%3A-svn-commit%3A-r642397---in--stdcxx- >trunk-tests-src%3A-braceexp.cpp-locale.cpp-tp16375460p16421931.html >Sent from the stdcxx-dev mailing list archive at Nabble.com. > >