changeset 12474:26d3164fd58d

strchr.m: avoid implict string to number conversion
author John W. Eaton <jwe@octave.org>
date Thu, 24 Feb 2011 02:07:37 -0500
parents 95b1c64c287f
children 009068efc66d
files scripts/ChangeLog scripts/strings/strchr.m
diffstat 2 files changed, 6 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/scripts/ChangeLog
+++ b/scripts/ChangeLog
@@ -1,3 +1,8 @@
+2011-02-24  John W. Eaton  <jwe@octave.org>
+
+	* strings/strchr.m: Avoid implicit string to number conversion.
+	Bug #32546.  From Kim Hansen <kim@i9.dk>.
+
 2011-02-22  Ben Abbott  <bpabbott@mac.com>
 
 	* plot/subplot.m: Use new looseinset property introduced by changeset
--- a/scripts/strings/strchr.m
+++ b/scripts/strings/strchr.m
@@ -46,7 +46,7 @@
     ## Index the str into a mask of valid values.  This is slower than
     ## it could be because of the +1 issue.
     f = false (1, 256);
-    f(chars + 1) = true;
+    f(uint8(chars)+1) = true;
     ## Default goes via double -- unnecessarily long.
     si = uint32 (str);
     ## in-place