Hi,

here is attached temporary fix for block-size. List of changes:
* Default block size for img set to 1k. This allows for img up to 64MB. User can change this value with option --block-size.
* Block size for overview map fixed at 1k. Not changeable by user.
* Block size for MDR fixed at 16k. Not changeable by user.
* Corrected number of reserved directory blocks for MDR, reduces size of MDR by 3MB.

I have added a comment about calculation of reserved directory blocks, I'm not sure if code is wrong, but it does not exactly what comments describe.

--
Best regards,
Andrzej
Index: src/uk/me/parabola/imgfmt/app/map/Map.java
===================================================================
--- src/uk/me/parabola/imgfmt/app/map/Map.java  (revision 4048)
+++ src/uk/me/parabola/imgfmt/app/map/Map.java  (working copy)
@@ -312,7 +312,7 @@
 
                // A header slot is always 512 bytes, so we need to calculate 
the
                // number of blocks if the block-size is different.
-               // There are 2 slots for the header itself.
+               // There are 2 slots for the header itself. (slots or blocks? 
code adds blocks)
                int blocksRequired = 2 + headerSlotsRequired * 512 / blockSize;
 
                param.setReservedDirectoryBlocks(blocksRequired);
Index: src/uk/me/parabola/mkgmap/combiners/MdrBuilder.java
===================================================================
--- src/uk/me/parabola/mkgmap/combiners/MdrBuilder.java (revision 4048)
+++ src/uk/me/parabola/mkgmap/combiners/MdrBuilder.java (working copy)
@@ -87,7 +87,10 @@
                try {
                        // Create the .img file system/archive
                        FileSystemParam params = new FileSystemParam();
-                       params.setBlockSize(args.get("block-size", 16384));
+                       // prepare for index size up to 1GB
+                       params.setBlockSize(16384);
+                       // reduce maximum blocks number reserved for directory, 
exact value should be calculated instead
+                       params.setReservedDirectoryBlocks(1 + 
280*512/params.getBlockSize());
 
                        tmpName = File.createTempFile("mdr", null, new 
File(outputDir));
                        tmpName.deleteOnExit();
Index: src/uk/me/parabola/mkgmap/combiners/OverviewBuilder.java
===================================================================
--- src/uk/me/parabola/mkgmap/combiners/OverviewBuilder.java    (revision 4048)
+++ src/uk/me/parabola/mkgmap/combiners/OverviewBuilder.java    (working copy)
@@ -168,7 +168,7 @@
                mb.setEnableLineCleanFilters(false);
 
                FileSystemParam params = new FileSystemParam();
-               params.setBlockSize(512);
+               params.setBlockSize(1024);
                params.setMapDescription(areaName);
                mb.setCopyrights(creMsgList(copyrightMsgs));
                mb.setMapInfo(creMsgList(licenseInfos));
Index: src/uk/me/parabola/mkgmap/CommandArgs.java
===================================================================
--- src/uk/me/parabola/mkgmap/CommandArgs.java  (revision 4048)
+++ src/uk/me/parabola/mkgmap/CommandArgs.java  (working copy)
@@ -43,7 +43,7 @@
        // ////
 
        public int getBlockSize() {
-               return get("block-size", 512);
+               return get("block-size", 1024);
        }
 
        public String getMapname() {
_______________________________________________
mkgmap-dev mailing list
[email protected]
http://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev

Reply via email to