* Do not set buffer length in BufferedInputStream constructor, default lenght will do ok.
* Fix bug that potentially set compression level to NaN in Zip.add().
This commit is contained in:
parent
620ce4c305
commit
c82daee623
1 changed files with 5 additions and 5 deletions
10
helma/Zip.js
10
helma/Zip.js
|
@ -8,10 +8,10 @@
|
||||||
*
|
*
|
||||||
* Copyright 1998-2006 Helma Software. All Rights Reserved.
|
* Copyright 1998-2006 Helma Software. All Rights Reserved.
|
||||||
*
|
*
|
||||||
* $RCSfile: helma.Zip.js,v $
|
* $RCSfile: Zip.js,v $
|
||||||
* $Author: czv $
|
* $Author: czv $
|
||||||
* $Revision: 1.6 $
|
* $Revision: 1.2 $
|
||||||
* $Date: 2006/04/18 13:06:58 $
|
* $Date: 2006/04/24 07:02:17 $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// take care of any dependencies
|
// take care of any dependencies
|
||||||
|
@ -84,7 +84,7 @@ helma.Zip = function (file) {
|
||||||
* file should be added (optional)
|
* file should be added (optional)
|
||||||
*/
|
*/
|
||||||
var addFile = function(zOutStream, f, level, pathPrefix) {
|
var addFile = function(zOutStream, f, level, pathPrefix) {
|
||||||
var fInStream = new java.io.BufferedInputStream(new java.io.FileInputStream(f), f.length());
|
var fInStream = new java.io.BufferedInputStream(new java.io.FileInputStream(f));
|
||||||
buf = new java.lang.reflect.Array.newInstance(java.lang.Byte.TYPE, f.length());
|
buf = new java.lang.reflect.Array.newInstance(java.lang.Byte.TYPE, f.length());
|
||||||
fInStream.read(buf, 0, f.length());
|
fInStream.read(buf, 0, f.length());
|
||||||
|
|
||||||
|
@ -214,7 +214,7 @@ helma.Zip = function (file) {
|
||||||
level = 9;
|
level = 9;
|
||||||
}
|
}
|
||||||
// only levels between 0 and 9 are allowed
|
// only levels between 0 and 9 are allowed
|
||||||
level = Math.max(0, Math.min(9, arguments[1]));
|
level = Math.max(0, Math.min(9, level));
|
||||||
|
|
||||||
if (f.isDirectory()) {
|
if (f.isDirectory()) {
|
||||||
// add a whole directory to the zip file (recursive!)
|
// add a whole directory to the zip file (recursive!)
|
||||||
|
|
Loading…
Add table
Reference in a new issue