cvsuser 02/09/09 00:04:41
Modified: . string.c
t/op string.t
Log:
string_index was using bufstart instead of strstart. Fix by Peter Gibbs.
Revision Changes Path
1.93 +3 -3 parrot/string.c
Index: string.c
===================================================================
RCS file: /cvs/public/parrot/string.c,v
retrieving revision 1.92
retrieving revision 1.93
diff -u -w -r1.92 -r1.93
--- string.c 6 Sep 2002 08:23:07 -0000 1.92
+++ string.c 9 Sep 2002 07:04:15 -0000 1.93
@@ -1,7 +1,7 @@
/* string.c
* Copyright: (When this is determined...it will go here)
* CVS Info
- * $Id: string.c,v 1.92 2002/09/06 08:23:07 mongo Exp $
+ * $Id: string.c,v 1.93 2002/09/09 07:04:15 sfink Exp $
* Overview:
* This is the api definitions for the string subsystem
* Data Structure and Algorithms:
@@ -256,10 +256,10 @@
* in a singlebyte encoding.
* This assumes that any singlebyte encoding uses is us-ascii, which is
wrong,
* but consistent withthe result of calling s->encoding->decode */
- return *((unsigned char*) s->bufstart + idx);
+ return *((unsigned char*) s->strstart + idx);
}
else {
- return s->encoding->decode(s->encoding->skip_forward(s->bufstart, idx));
+ return s->encoding->decode(s->encoding->skip_forward(s->strstart, idx));
}
}
1.33 +26 -1 parrot/t/op/string.t
Index: string.t
===================================================================
RCS file: /cvs/public/parrot/t/op/string.t,v
retrieving revision 1.32
retrieving revision 1.33
diff -u -w -r1.32 -r1.33
--- string.t 5 Sep 2002 15:04:27 -0000 1.32
+++ string.t 9 Sep 2002 07:04:41 -0000 1.33
@@ -1,6 +1,6 @@
#! perl -w
-use Parrot::Test tests => 94;
+use Parrot::Test tests => 95;
use Test::More;
output_is( <<'CODE', <<OUTPUT, "set_s_s|sc" );
@@ -1372,6 +1372,31 @@
end
CODE
[foo bar quux ]
+OUTPUT
+
+output_is( <<'CODE', <<OUTPUT, "ord and substring (see #17035)" );
+ set S0, "abcdef"
+ substr S1, S0, 2, 3
+ ord I0, S0, 2
+ ord I1, S1, 0
+ ne I0, I1, fail
+ ord I0, S0, 3
+ ord I1, S1, 1
+ ne I0, I1, fail
+ ord I0, S0, 4
+ ord I1, S1, 2
+ ne I0, I1, fail
+ print "It's all good\n"
+ end
+fail:
+ print "Not good: original string="
+ print I0
+ print ", substring="
+ print I1
+ print "\n"
+ end
+CODE
+It's all good
OUTPUT
# Set all string registers to values given by &$_[0](reg num)