Hi Gerd, Ticker

sorry for that. I waited for a comment from Steve and forgot about it.
I'd still prefer that Steve gives an OK because he wrote most of the code that 
the patch changes.


I read through the patch and done some very simple tests and it looks
OK to me.  Hope someone has tested some really big maps.

I think we should remove the commented out code and I noticed
a few unneeded casts remaining (some maybe not actually as a result
of the patch), and some javadoc errors.

I've attached an incremental patch of the things I did, which
you can take or leave as you wish.

Lets get it committed.

Its a big patch, thanks for going through all the cases and
completing it.

Steve
diff -r eebe2c5e70b3 src/uk/me/parabola/imgfmt/app/BufferedImgFileReader.java
--- a/src/uk/me/parabola/imgfmt/app/BufferedImgFileReader.java	Tue Apr 17 22:22:25 2018 +0100
+++ b/src/uk/me/parabola/imgfmt/app/BufferedImgFileReader.java	Tue Apr 17 22:26:11 2018 +0100
@@ -104,7 +104,7 @@
 	 * @return int sign-extended value that was read.
 	 */
 	public int get1s() throws ReadFailedException {
-		return (int)get();
+		return get();
 	}
 
 	/**
diff -r eebe2c5e70b3 src/uk/me/parabola/imgfmt/app/BufferedImgFileWriter.java
--- a/src/uk/me/parabola/imgfmt/app/BufferedImgFileWriter.java	Tue Apr 17 22:22:25 2018 +0100
+++ b/src/uk/me/parabola/imgfmt/app/BufferedImgFileWriter.java	Tue Apr 17 22:26:11 2018 +0100
@@ -107,7 +107,7 @@
 	/**
 	 * Write out a single byte.
  	 * Should not be used for writing numbers, use put1s/u instead.
-	 * %%% temporary
+	 *
 	 * @param b The byte to write.
 	 */
 	public void put(byte b) {
@@ -137,7 +137,7 @@
 
 	/**
 	 * Write out int in range -0x800000..0x7fffff in little endian byte order.
-	 * @param int The value to write.
+	 * @param val The value to write.
 	 */
 	public void put3s(int val) {
 		assert val >= -0x800000 && val <= 0x7fffff : val;
diff -r eebe2c5e70b3 src/uk/me/parabola/imgfmt/app/FileBackedImgFileWriter.java
--- a/src/uk/me/parabola/imgfmt/app/FileBackedImgFileWriter.java	Tue Apr 17 22:22:25 2018 +0100
+++ b/src/uk/me/parabola/imgfmt/app/FileBackedImgFileWriter.java	Tue Apr 17 22:26:11 2018 +0100
@@ -105,7 +105,7 @@
 
 	/**
 	 * Write out a single byte.
-	 * %%% temporary
+	 *
 	 * @param b The byte to write.
 	 */
 	public void put(byte b) {
@@ -145,7 +145,7 @@
 
 	/**
 	 * Write out int in range -0x800000..0x7fffff in little endian byte order.
-	 * @param int The value to write.
+	 * @param val The value to write.
 	 */
 	public void put3s(int val) {
 		assert val >= -0x800000 && val <= 0x7fffff : val;
diff -r eebe2c5e70b3 src/uk/me/parabola/imgfmt/app/ImgFileReader.java
--- a/src/uk/me/parabola/imgfmt/app/ImgFileReader.java	Tue Apr 17 22:22:25 2018 +0100
+++ b/src/uk/me/parabola/imgfmt/app/ImgFileReader.java	Tue Apr 17 22:26:11 2018 +0100
@@ -67,19 +67,12 @@
 	 */
 	public int get3s() throws ReadFailedException;
 
-// don't think needed:
-//	public int getNs(int nBytes) throws ReadFailedException;
-
 	public int get1u() throws ReadFailedException;
 
 	public int get2u() throws ReadFailedException;
 
 	public int get3u() throws ReadFailedException;
 
-//	public default long get4u() throws ReadFailedException {
-//		return get4() & 0xffff_ffffL;
-//	}
-
 	/**
 	 * Read a variable sized integer.  The size is given.
 	 * @param nBytes The size of the integer to read. Must be 1 to 4.
diff -r eebe2c5e70b3 src/uk/me/parabola/imgfmt/app/ImgFileWriter.java
--- a/src/uk/me/parabola/imgfmt/app/ImgFileWriter.java	Tue Apr 17 22:22:25 2018 +0100
+++ b/src/uk/me/parabola/imgfmt/app/ImgFileWriter.java	Tue Apr 17 22:26:11 2018 +0100
@@ -53,7 +53,7 @@
 
 	/**
 	 * Write out a single byte.
-	 * %%% temporary
+	 *
 	 * @param b The byte to write.
 	 */
 	public void put(byte b);
@@ -72,7 +72,7 @@
 
 	/**
 	 * Write out int in range -0x800000..0x7fffff in little endian byte order.
-	 * @param int The value to write.
+	 * @param val The value to write.
 	 */
 	public void put3s(int val);
 
@@ -112,10 +112,6 @@
 	 */
 	public void put4(int val);
 
-// 	public default void put4u(long val) {
-//		put4((int) val);
-//	}
-
 	/**
 	 * Write out an arbitrary length sequence of bytes.
 	 *
diff -r eebe2c5e70b3 src/uk/me/parabola/imgfmt/app/dem/DEMTile.java
--- a/src/uk/me/parabola/imgfmt/app/dem/DEMTile.java	Tue Apr 17 22:22:25 2018 +0100
+++ b/src/uk/me/parabola/imgfmt/app/dem/DEMTile.java	Tue Apr 17 22:26:11 2018 +0100
@@ -310,7 +310,7 @@
 	 * Write an unsigned binary value with the given number of bits, MSB first. 
 	 * @param val
 	 * @param hunit
-	 * @param type 
+	 * @param maxZeroBits
 	 * @return 
 	 */
 	private boolean writeValHybrid(int val, int hunit, int maxZeroBits) {
diff -r eebe2c5e70b3 src/uk/me/parabola/imgfmt/app/lbl/ExitFacility.java
--- a/src/uk/me/parabola/imgfmt/app/lbl/ExitFacility.java	Tue Apr 17 22:22:25 2018 +0100
+++ b/src/uk/me/parabola/imgfmt/app/lbl/ExitFacility.java	Tue Apr 17 22:26:11 2018 +0100
@@ -51,8 +51,6 @@
 		word |= type << 24;	 // 24:27 = 4 bit type
 		// 28 = unknown
 		word |= direction << 29; // 29:31 = 3 bit direction
-//		writer.put2u(word && 0xffff);
-//		writer.put2u(word >> 16);
 		writer.put4(word);
 		writer.put1u(facilities);
 	}
diff -r eebe2c5e70b3 src/uk/me/parabola/imgfmt/app/lbl/POIRecord.java
--- a/src/uk/me/parabola/imgfmt/app/lbl/POIRecord.java	Tue Apr 17 22:22:25 2018 +0100
+++ b/src/uk/me/parabola/imgfmt/app/lbl/POIRecord.java	Tue Apr 17 22:26:11 2018 +0100
@@ -337,8 +337,6 @@
 
 		public void write(ImgFileWriter writer)
 		{
-//			for(int i = 0; i < encodedSize; i++)
-//				writer.put1u(encodedNumber[i]);
 			writer.put(encodedNumber, 0, encodedSize);
 		}
 
diff -r eebe2c5e70b3 src/uk/me/parabola/imgfmt/app/mdr/Mdr7.java
--- a/src/uk/me/parabola/imgfmt/app/mdr/Mdr7.java	Tue Apr 17 22:22:25 2018 +0100
+++ b/src/uk/me/parabola/imgfmt/app/mdr/Mdr7.java	Tue Apr 17 22:26:11 2018 +0100
@@ -239,7 +239,6 @@
 	/**
 	 * Group a list of roads with the same partial name.
 	 * @param samePartial
-	 * @param minorSorter
 	 */
 	private void groupByNameAndMap(List<Mdr7Record> samePartial) {
 		if (samePartial.isEmpty())
diff -r eebe2c5e70b3 src/uk/me/parabola/imgfmt/app/net/RouteNode.java
--- a/src/uk/me/parabola/imgfmt/app/net/RouteNode.java	Tue Apr 17 22:22:25 2018 +0100
+++ b/src/uk/me/parabola/imgfmt/app/net/RouteNode.java	Tue Apr 17 22:26:11 2018 +0100
@@ -739,7 +739,6 @@
 	 * The initial bearing doesn't really matter as it is not written
 	 * for indirect arcs.  
 	 * @param road
-	 * @param maxRoadClass
 	 */
 	public void addArcsToMajorRoads(RoadDef road){
 		assert road.getNode() == this;
diff -r eebe2c5e70b3 src/uk/me/parabola/imgfmt/app/srt/SRTHeader.java
--- a/src/uk/me/parabola/imgfmt/app/srt/SRTHeader.java	Tue Apr 17 22:22:25 2018 +0100
+++ b/src/uk/me/parabola/imgfmt/app/srt/SRTHeader.java	Tue Apr 17 22:26:11 2018 +0100
@@ -39,10 +39,10 @@
 
 	private final Section desc = new Section(header2);
 	private final Section subheader = new Section(desc);
-	private final Section chartab = new Section((char) 3);
-	private final Section expansions = new Section(chartab, (char) 2);
-	private final Section srt8 = new Section(expansions, (char) 5);
-	private final Section srt7 = new Section(srt8, (char) 4);
+	private final Section chartab = new Section(3);
+	private final Section expansions = new Section(chartab, 2);
+	private final Section srt8 = new Section(expansions, 5);
+	private final Section srt7 = new Section(srt8, 4);
 	
 
 	private Sort sort;
@@ -163,8 +163,8 @@
 		this.sort = sort;
 		if (sort.isMulti()) {
 			chartab.setPosition(HEADER3_MULTI_LEN);
-			chartab.setItemSize((char) 5);
-			expansions.setItemSize((char) 4);
+			chartab.setItemSize(5);
+			expansions.setItemSize(4);
 		}
 	}
 
diff -r eebe2c5e70b3 src/uk/me/parabola/imgfmt/app/trergn/TREHeader.java
--- a/src/uk/me/parabola/imgfmt/app/trergn/TREHeader.java	Tue Apr 17 22:22:25 2018 +0100
+++ b/src/uk/me/parabola/imgfmt/app/trergn/TREHeader.java	Tue Apr 17 22:26:11 2018 +0100
@@ -203,7 +203,7 @@
 			// The record size must be zero if the section is empty for compatibility
 			// with cpreview.
 			if (extTypeOffsets.getSize() == 0)
-				extTypeOffsets.setItemSize((char) 0);
+				extTypeOffsets.setItemSize(0);
 			extTypeOffsets.writeSectionInfo(writer, true);
 
 			// the second byte value of 6 appears to mean "extended
diff -r eebe2c5e70b3 src/uk/me/parabola/imgfmt/app/typ/TYPFile.java
--- a/src/uk/me/parabola/imgfmt/app/typ/TYPFile.java	Tue Apr 17 22:22:25 2018 +0100
+++ b/src/uk/me/parabola/imgfmt/app/typ/TYPFile.java	Tue Apr 17 22:26:11 2018 +0100
@@ -104,7 +104,7 @@
 		Collections.sort(keys);
 
 		// Offset 0 is reserved to mean no label.
-		writer.put1u((byte) 0);
+		writer.put1u(0);
 
 		for (SortKey<TypIconSet> key : keys) {
 			int off = writer.position();
@@ -127,7 +127,7 @@
 					String name = encoder.charset().name();
 					throw new TypLabelException(name);
 				}
-				writer.put1u((byte) 0);
+				writer.put1u(0);
 			}
 		}
 		Utils.closeFile(writer);
@@ -190,7 +190,7 @@
 		for (Section s : sect) {
 			if (s.getSize() == 0) {
 				s.setPosition(0);
-				s.setItemSize((char) 0);
+				s.setItemSize(0);
 			}
 		}
 	}
_______________________________________________
mkgmap-dev mailing list
[email protected]
http://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev

Reply via email to