From: Tom Hughes Date: Sun, 4 Feb 2018 17:22:06 +0000 (+0000) Subject: Fix C version of QuadTile#tiles_for_area to return correct tiles X-Git-Tag: live~3690 X-Git-Url: https://git.openstreetmap.org./rails.git/commitdiff_plain/413bf78e5496f87cfa30dbc6b4cb61f8f86c6773 Fix C version of QuadTile#tiles_for_area to return correct tiles --- diff --git a/lib/quad_tile/quad_tile.c b/lib/quad_tile/quad_tile.c index cd45e6e76..304776982 100644 --- a/lib/quad_tile/quad_tile.c +++ b/lib/quad_tile/quad_tile.c @@ -14,10 +14,10 @@ static tilelist_t tilelist_for_area(unsigned int minx, unsigned int miny, unsign unsigned int maxtilec; maxtilec = 256; - + tl.tilev = malloc(maxtilec * sizeof(unsigned int)); tl.tilec = 0; - + for (x = minx; x <= maxx; x++) { for (y = miny; y <= maxy; y++) @@ -75,7 +75,7 @@ static VALUE tiles_for_area(VALUE self, VALUE bbox) for (t = 0; t < tl.tilec; t++) { - rb_ary_push(tiles, UINT2NUM(tl.tilev[tl.tilec])); + rb_ary_push(tiles, UINT2NUM(tl.tilev[t])); } free(tl.tilev);