diff --git a/ports/gilbert.c b/ports/gilbert.c index 10fa13f..6e300d3 100644 --- a/ports/gilbert.c +++ b/ports/gilbert.c @@ -175,8 +175,6 @@ int gilbert_d2xy_r(int dst_idx, int cur_idx, int *xres, int *yres, int ax,int ay, int bx,int by ) { - static int max_iter = 0; - int nxt_idx; int w, h, x, y, dax, day, @@ -184,9 +182,6 @@ int gilbert_d2xy_r(int dst_idx, int cur_idx, di; int ax2, ay2, bx2, by2, w2, h2; - if (max_iter > 100000) { return -1; } - max_iter++; - w = abs(ax + ay); h = abs(bx + by); @@ -891,7 +886,7 @@ int main(int argc, char **argv) { } strncpy(buf, argv[1], 1023); - buf[1024]='\0'; + buf[1023]='\0'; w = atoi(argv[2]); h = atoi(argv[3]); diff --git a/tests/runtests.sh b/tests/runtests.sh index c3001aa..5cdab09 100755 --- a/tests/runtests.sh +++ b/tests/runtests.sh @@ -159,3 +159,6 @@ gilbert_cmp2 $x $y x=7 ; y=6 ; z=4 gilbert_cmp3 $x $y $z +x=490 ; y=490 +gilbert_cmp2 $x $y +