logo separator

[mkgmap-dev] Commit: r888: Add zero to the bit array when the road does not end in a node

From Steve Ratcliffe steve at parabola.demon.co.uk on Sun Feb 15 11:32:59 GMT 2009

>
>> Also fix the loop that writes the array out.

> To fix the bug, I'd prefer this change (assuming I didn't mess it up):

Oh I should have read all these messages before replying to the previous one ;)

I can confirm that your patch works and gives the same results as
BitWriter would.

> --- RoadDef.java	(revision 887)
> +++ RoadDef.java	(working copy)
> @@ -351,8 +351,8 @@
>  			bits[0] = false;
>  		for (int i = 0; i < bits.length; i += 8) {
>  			int b = 0;
> -			for (int j = 0; j < bits.length - i; j++)
> -				if (bits[j])
> +			for (int j = 0; j < 8 && j < bits.length - i; j++)
> +				if (bits[i+j])
>  					b |= 1 << j;
>  			writer.put((byte) b);

I will add this in, and remove the end node code for now, as it was not
being run anyway.

..Steve



More information about the mkgmap-dev mailing list