Subject: | use iswxdigit instead of ishexnumber |
I found that this module failed tests except FreeBSD on CPAN Testers.
Just changing ishexnumber() to iswxdigit() works quite well on those
platforms below.
FreeBSD 6.2 (uname -srm = FreeBSD 6.2-RELEASE-p6 i386)
Ubuntu Linux 7.04 (uname -srm = Linux 2.6.20-16-generic i686)
I guess that this will solve most of test problems on platforms a part
from FreeBSD and cause no problem on FreeBSD.
I attached the patch of XS.xs. I hope you will check it.
Subject: | XS.xs.patch |
*** XS.xs.org Sat Apr 28 02:17:49 2007
--- XS.xs Tue Jul 31 14:39:19 2007
***************
*** 12,18 ****
# include <stdio.h>
# include <stdlib.h>
# include <string.h>
! # include <ctype.h>
static char escapes[256] =
/* 0 1 2 3 4 5 6 7 8 9 a b c d e f */
--- 12,18 ----
# include <stdio.h>
# include <stdlib.h>
# include <string.h>
! # include <wctype.h>
static char escapes[256] =
/* 0 1 2 3 4 5 6 7 8 9 a b c d e f */
***************
*** 73,87 ****
for (i = 0; i < slen; i++){
if (src[i] == '%'){
! if (ishexnumber(src[i+1]) && ishexnumber(src[i+2])){
strncpy((char *)buf, (char *)(src + i + 1), 2);
hi = strtol((char *)buf, NULL, 16);
dst[dlen++] = hi;
i += 2;
}
else if(src[i+1] == 'u'
! && ishexnumber(src[i+2]) && ishexnumber(src[i+3])
! && ishexnumber(src[i+4]) && ishexnumber(src[i+5])){
strncpy((char *)buf, (char *)(src + i + 2), 4);
hi = strtol((char *)buf, NULL, 16);
i += 5;
--- 73,87 ----
for (i = 0; i < slen; i++){
if (src[i] == '%'){
! if (iswxdigit(src[i+1]) && iswxdigit(src[i+2])){
strncpy((char *)buf, (char *)(src + i + 1), 2);
hi = strtol((char *)buf, NULL, 16);
dst[dlen++] = hi;
i += 2;
}
else if(src[i+1] == 'u'
! && iswxdigit(src[i+2]) && iswxdigit(src[i+3])
! && iswxdigit(src[i+4]) && iswxdigit(src[i+5])){
strncpy((char *)buf, (char *)(src + i + 2), 4);
hi = strtol((char *)buf, NULL, 16);
i += 5;
***************
*** 95,102 ****
}else{
i++;
if(src[i] == '%' && src[i+1] == 'u'
! && ishexnumber(src[i+2]) && ishexnumber(src[i+3])
! && ishexnumber(src[i+4]) && ishexnumber(src[i+5])){
strncpy((char *)buf, (char *)(src + i + 2), 4);
lo = strtol((char *)buf, NULL, 16);
i += 5;
--- 95,102 ----
}else{
i++;
if(src[i] == '%' && src[i+1] == 'u'
! && iswxdigit(src[i+2]) && iswxdigit(src[i+3])
! && iswxdigit(src[i+4]) && iswxdigit(src[i+5])){
strncpy((char *)buf, (char *)(src + i + 2), 4);
lo = strtol((char *)buf, NULL, 16);
i += 5;