diff --git a/www/index.html b/www/index.html index 4d559967..640594b1 100644 --- a/www/index.html +++ b/www/index.html @@ -455,14 +455,16 @@

Main libraries and resources used:

diff --git a/www/js/lib/zimfile.js b/www/js/lib/zimfile.js index a92c4601..0551d659 100644 --- a/www/js/lib/zimfile.js +++ b/www/js/lib/zimfile.js @@ -191,10 +191,7 @@ define(['xzdec_wrapper', 'zstddec_wrapper', 'util', 'utf8', 'q', 'zimDirEntry'], return that._readSlice(clusterOffset, 1).then(function(compressionType) { var decompressor; var plainBlobReader = function(offset, size) { - // DEV: old algorithm merely returned requested data size - // but I believe we need to check that we are not reading beyond the end of the cluster - // Is this an oversight in original code or an unnecessary protection? - // return that._readSlice(clusterOffset + 1 + offset, size); + // Check that we are not reading beyond the end of the cluster var offsetStart = clusterOffset + 1 + offset; if ( offsetStart < nextCluster) { // Gratuitous parentheses added for legibility diff --git a/www/js/lib/zstddec_wrapper.js b/www/js/lib/zstddec_wrapper.js index 1fd90da3..ec40014c 100644 --- a/www/js/lib/zstddec_wrapper.js +++ b/www/js/lib/zstddec_wrapper.js @@ -48,9 +48,10 @@ define(['q', 'zstddec'], function(Q) { // Get a permanent decoder handle (pointer to control structure) // NB there is no need to change this handle even between ZIM loads: zstddeclib encourages re-using assigned structures zd._decHandle = zd._ZSTD_createDStream(); - // DEV set chunkSize according to memory environment; for systems with plenty of memory, - // zd can provide a max recommended size with + // In-built function below provides a max recommended chunk size zd._chunkSize = zd._ZSTD_DStreamInSize(); + // Change _chunkSize if you need a more conservative memory environment, but you may need to experiment with INITIAL_MEMORY + // in zstddec.js (see below) for this to make any difference // zd._chunkSize = 5 * 1024; // Initialize inBuffer @@ -259,4 +260,4 @@ define(['q', 'zstddec'], function(Q) { return { Decompressor: Decompressor }; -}); +}); \ No newline at end of file