~mdw
/
sgt
/
puzzles
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Add grotty casts to prevent negative -> large positive conversion of cursor
[sgt/puzzles]
/
pattern.c
diff --git
a/pattern.c
b/pattern.c
index
d597127
..
e7b99b3
100644
(file)
--- a/
pattern.c
+++ b/
pattern.c
@@
-322,16
+322,16
@@
int compute_rowdata(int *ret, unsigned char *start, int len, int step)
n = 0;
for (i = 0; i < len; i++) {
n = 0;
for (i = 0; i < len; i++) {
- if (start[i*step] == GRID_UNKNOWN)
- return -1;
-
if (start[i*step] == GRID_FULL) {
int runlen = 1;
if (start[i*step] == GRID_FULL) {
int runlen = 1;
- while (i+runlen < len && start[(i+runlen)*step])
+ while (i+runlen < len && start[(i+runlen)*step]
== GRID_FULL
)
runlen++;
ret[n++] = runlen;
i += runlen;
}
runlen++;
ret[n++] = runlen;
i += runlen;
}
+
+ if (i < len && start[i*step] == GRID_UNKNOWN)
+ return -1;
}
return n;
}
return n;