Hi

once again I stumbled over a really weird problem:

I have a patch for this problem.  A size calculation was wrong
leading to the first file entry being overridden.

Patch attached and pre-built jar file at:
    http://files.mkgmap.org.uk/download/234/mkgmap.jar

Thanks,
..Steve
Index: src/uk/me/parabola/mkgmap/combiners/GmapsuppBuilder.java
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
--- src/uk/me/parabola/mkgmap/combiners/GmapsuppBuilder.java	(revision 3352)
+++ src/uk/me/parabola/mkgmap/combiners/GmapsuppBuilder.java	(revision )
@@ -536,15 +536,14 @@
 				totHeaderEntries += mdrSlots;
 			}
 
-			// There are 2 entries for the header itself.
-			totHeaderEntries += 2;
+			// Add for header itself, plus the first directory block.
+			totHeaderEntries += DIRECTORY_OFFSET_ENTRY + 1;
 			int totHeaderBlocks = totHeaderEntries * 512 / bs;
 
 			log.info("total blocks for", bs, "is", totHeaderBlocks, "based on slots=", totHeaderEntries);
 
-			int reserveEntries = DIRECTORY_OFFSET_ENTRY + 1 + totHeaderEntries;
-			if (totBlocks + reserveEntries < 0xfffe && totHeaderBlocks <= ENTRY_SIZE) {
-				return new BlockInfo(bs, reserveEntries);
+			if (totBlocks + totHeaderEntries < 0xfffe && totHeaderBlocks <= ENTRY_SIZE) {
+				return new BlockInfo(bs, totHeaderEntries);
 			}
 		}
 
_______________________________________________
mkgmap-dev mailing list
[email protected]
http://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev

Reply via email to