File tree 2 files changed +11
-2
lines changed
2 files changed +11
-2
lines changed Original file line number Diff line number Diff line change @@ -63,7 +63,11 @@ PROCEDURE Length* (stringVal: ARRAY OF CHAR): INTEGER;
63
63
i: INTEGER ;
64
64
BEGIN
65
65
i := 0 ;
66
- WHILE ( stringVal[i] # 0X ) DO
66
+ (* note from noch:
67
+ original ooc code below, commented out, leads to
68
+ index out of range runtime error
69
+ WHILE (stringVal[i] # 0X) DO *)
70
+ WHILE (( i < LEN( stringVal)) & ( stringVal[i] # 0X )) DO
67
71
INC ( i)
68
72
END ;
69
73
RETURN i
Original file line number Diff line number Diff line change @@ -59,7 +59,12 @@ PROCEDURE Length* (stringVal: ARRAY OF CHAR): INTEGER;
59
59
i: INTEGER ;
60
60
BEGIN
61
61
i := 0 ;
62
- WHILE ( stringVal[i] # 0X ) DO
62
+ (* note from noch:
63
+ this original ooc code crashes with index out of range
64
+ because it doesn't expect a string which has no 0X character
65
+ so i had to change it
66
+ WHILE (stringVal[i] # 0X) DO *)
67
+ WHILE (( i < LEN( stringVal)) & ( stringVal[i] # 0X )) DO
63
68
INC ( i)
64
69
END ;
65
70
RETURN i
You can’t perform that action at this time.
0 commit comments