You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@apr.apache.org by tr...@apache.org on 2003/04/22 15:48:00 UTC
cvs commit: apr-util/crypto uuid.c
trawick 2003/04/22 06:47:58
Modified: . CHANGES
crypto uuid.c
Log:
Fix apr_uuid_parse() on EBCDIC machines by providing a
more generic version of parse_hexpair() (which is probably
slower).
Revision Changes Path
1.109 +2 -0 apr-util/CHANGES
Index: CHANGES
===================================================================
RCS file: /home/cvs/apr-util/CHANGES,v
retrieving revision 1.108
retrieving revision 1.109
diff -u -r1.108 -r1.109
--- CHANGES 21 Apr 2003 18:48:15 -0000 1.108
+++ CHANGES 22 Apr 2003 13:47:57 -0000 1.109
@@ -1,5 +1,7 @@
Changes with APR-util 0.9.4
+ *) Fix apr_uuid_parse() on EBCDIC machines. [Jeff Trawick]
+
*) Fix alignment problem when allocating memory using apr_rmm. The problem
showed up while trying to write a double in the memory allocated.
[Madhusudan Mathihalli]
1.3 +34 -0 apr-util/crypto/uuid.c
Index: uuid.c
===================================================================
RCS file: /home/cvs/apr-util/crypto/uuid.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- uuid.c 1 Jan 2003 00:02:18 -0000 1.2
+++ uuid.c 22 Apr 2003 13:47:58 -0000 1.3
@@ -71,6 +71,7 @@
}
/* convert a pair of hex digits to an integer value [0,255] */
+#if 'A' == 65
static unsigned char parse_hexpair(const char *s)
{
int result;
@@ -94,6 +95,39 @@
return (unsigned char)result;
}
+#else
+static unsigned char parse_hexpair(const char *s)
+{
+ int result;
+
+ if (isdigit(*s)) {
+ result = (*s - '0') << 4;
+ }
+ else {
+ if (isupper(*s)) {
+ result = (*s - 'A' + 10) << 4;
+ }
+ else {
+ result = (*s - 'a' + 10) << 4;
+ }
+ }
+
+ ++s;
+ if (isdigit(*s)) {
+ result |= (*s - '0');
+ }
+ else {
+ if (isupper(*s)) {
+ result |= (*s - 'A' + 10);
+ }
+ else {
+ result |= (*s - 'a' + 10);
+ }
+ }
+
+ return (unsigned char)result;
+}
+#endif
APU_DECLARE(apr_status_t) apr_uuid_parse(apr_uuid_t *uuid,
const char *uuid_str)