Mapsforge: remove MapDatabase.readZoomTable redundant checks, fixes #357

This commit is contained in:
Emux 2017-06-05 13:41:30 +03:00
parent 3afca64080
commit 903dbad9c6
2 changed files with 3 additions and 27 deletions

View File

@ -13,6 +13,7 @@
- vtm-ios-example module [#326](https://github.com/mapsforge/vtm/issues/326) - vtm-ios-example module [#326](https://github.com/mapsforge/vtm/issues/326)
- Handle layers enabled state [#342](https://github.com/mapsforge/vtm/issues/342) - Handle layers enabled state [#342](https://github.com/mapsforge/vtm/issues/342)
- Fix coord scale short overflow [#343](https://github.com/mapsforge/vtm/issues/343) - Fix coord scale short overflow [#343](https://github.com/mapsforge/vtm/issues/343)
- Mapsforge map read improvements [#357](https://github.com/mapsforge/vtm/issues/357)
- Improve canvas DPI setting [#349](https://github.com/mapsforge/vtm/issues/349) - Improve canvas DPI setting [#349](https://github.com/mapsforge/vtm/issues/349)
- Gretty plugin at web modules [#338](https://github.com/mapsforge/vtm/issues/338) - Gretty plugin at web modules [#338](https://github.com/mapsforge/vtm/issues/338)
- Many other minor improvements and bug fixes - Many other minor improvements and bug fixes

View File

@ -1,7 +1,7 @@
/* /*
* Copyright 2010, 2011, 2012 mapsforge.org * Copyright 2010, 2011, 2012 mapsforge.org
* Copyright 2013, 2014 Hannes Janetzek * Copyright 2013, 2014 Hannes Janetzek
* Copyright 2016 devemux86 * Copyright 2016-2017 devemux86
* Copyright 2016 Andrey Novikov * Copyright 2016 Andrey Novikov
* *
* This file is part of the OpenScienceMap project (http://www.opensciencemap.org). * This file is part of the OpenScienceMap project (http://www.opensciencemap.org).
@ -44,8 +44,7 @@ import static org.oscim.tiling.QueryResult.SUCCESS;
/** /**
* A class for reading binary map files. * A class for reading binary map files.
* *
* @see <a * @see <a href="http://code.google.com/p/mapsforge/wiki/SpecificationBinaryMapFile">Specification</a>
* href="http://code.google.com/p/mapsforge/wiki/SpecificationBinaryMapFile">Specification</a>
*/ */
public class MapDatabase implements ITileDataSource { public class MapDatabase implements ITileDataSource {
/** /**
@ -83,12 +82,6 @@ public class MapDatabase implements ITileDataSource {
*/ */
private static final int MAXIMUM_WAY_NODES_SEQUENCE_LENGTH = 8192; private static final int MAXIMUM_WAY_NODES_SEQUENCE_LENGTH = 8192;
/**
* Maximum number of map objects in the zoom table which is considered as
* valid.
*/
private static final int MAXIMUM_ZOOM_TABLE_OBJECTS = 65536 * 2;
/** /**
* Bitmask for the optional POI feature "elevation". * Bitmask for the optional POI feature "elevation".
*/ */
@ -924,24 +917,6 @@ public class MapDatabase implements ITileDataSource {
cumulatedNumberOfPois += mReadBuffer.readUnsignedInt(); cumulatedNumberOfPois += mReadBuffer.readUnsignedInt();
cumulatedNumberOfWays += mReadBuffer.readUnsignedInt(); cumulatedNumberOfWays += mReadBuffer.readUnsignedInt();
if (cumulatedNumberOfPois < 0
|| cumulatedNumberOfPois > MAXIMUM_ZOOM_TABLE_OBJECTS) {
log.warn("invalid cumulated number of POIs in row " + row + ' '
+ cumulatedNumberOfPois);
if (mDebugFile) {
log.warn(DEBUG_SIGNATURE_BLOCK + mSignatureBlock);
}
return null;
} else if (cumulatedNumberOfWays < 0
|| cumulatedNumberOfWays > MAXIMUM_ZOOM_TABLE_OBJECTS) {
log.warn("invalid cumulated number of ways in row " + row + ' '
+ cumulatedNumberOfWays);
if (mTileSource.fileInfo.debugFile) {
log.warn(DEBUG_SIGNATURE_BLOCK + mSignatureBlock);
}
return null;
}
zoomTable[row][0] = cumulatedNumberOfPois; zoomTable[row][0] = cumulatedNumberOfPois;
zoomTable[row][1] = cumulatedNumberOfWays; zoomTable[row][1] = cumulatedNumberOfWays;
} }