From: Gurusamy Sarathy Date: Sun, 2 Aug 1998 22:49:53 +0000 (+0000) Subject: fix unpack('u',...) problem with spaces in input X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=ba1ac97691f605d2aaa9008a954c1aa8ac884815;p=p5sagit%2Fp5-mst-13.2.git fix unpack('u',...) problem with spaces in input p4raw-id: //depot/maint-5.005/perl@1715 --- diff --git a/pp.c b/pp.c index 60cb417..9df4c97 100644 --- a/pp.c +++ b/pp.c @@ -2913,13 +2913,13 @@ static const char uuemap[] = static char uudmap[256]; /* Initialised on first use */ #if 'I' == 73 && 'J' == 74 /* On an ASCII/ISO kind of system */ -#define ISUUCHAR(ch) ((ch) > ' ' && (ch) < 'a') +#define ISUUCHAR(ch) ((ch) >= ' ' && (ch) < 'a') #else /* Some other sort of character set - use memchr() so we don't match the null byte. */ -#define ISUUCHAR(ch) (memchr(uuemap, (ch), sizeof(uuemap)-1)) +#define ISUUCHAR(ch) (memchr(uuemap, (ch), sizeof(uuemap)-1) || (ch) == ' ') #endif PP(pp_unpack) diff --git a/t/op/pack.t b/t/op/pack.t index 02efb66..c821ed6 100755 --- a/t/op/pack.t +++ b/t/op/pack.t @@ -161,16 +161,20 @@ foreach my $t (@templates) { # 57..58: uuencode/decode $in = join "", map { chr } 0..255; + +# just to be anal, we do some random tr/`/ / $uu = <<'EOUU'; -M``$"`P0%!@<("0H+#`T.#Q`1$A,4%187&!D:&QP='A\@(2(C)"4F)R@I*BLL +M` $"`P0%!@<("0H+# T.#Q`1$A,4%187&!D:&QP='A\@(2(C)"4F)R@I*BLL M+2XO,#$R,S0U-C'EZ>WQ]?G^`@8*#A(6& MAXB)BHN,C8Z/D)&2DY25EI>8F9J;G)V>GZ"AHJ.DI::GJ*FJJZRMKJ^PL;*S MM+6VM[BYNKN\O;Z_P,'"P\3%QL?(R+CY.7FY^CIZNOL[>[O\/'R\_3U]O?X^?K[_/W^_P`` +?X>+CY.7FY^CIZNOL[>[O\/'R\_3U]O?X^?K[_/W^_P ` EOUU -print "not " unless pack('u', $in) eq $uu; +$_ = $uu; +tr/ /`/; +print "not " unless pack('u', $in) eq $_; print "ok ", $test++, "\n"; print "not " unless unpack('u', $uu) eq $in;