Skip Menu |

This queue is for tickets about the URI-Escape-XS CPAN distribution.

Report information
The Basics
Id: 28583
Status: resolved
Priority: 0/
Queue: URI-Escape-XS

People
Owner: Nobody in particular
Requestors: massa.hara [...] gmail.com
Cc:
AdminCc:

Bug Information
Severity: Normal
Broken in: 0.01
Fixed in: (no value)



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;
Fixed in Version 0.02. s/ishexdigit/isxdigit/g so it should be compatible with virtually all platforms w/ decent ctype.h Dan the Maintainer Thereof On Tue Jul 31 08:46:52 2007, MASANORIH wrote: Show quoted text
> 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.