summaryrefslogtreecommitdiffstats
path: root/rbutil/rbutilqt/mspack/cab.h
diff options
context:
space:
mode:
authorDominik Riebeling <Dominik.Riebeling@gmail.com>2020-06-08 21:44:02 +0200
committerDominik Riebeling <Dominik.Riebeling@gmail.com>2020-08-07 22:18:41 +0200
commit729b6e4f33419489415a6111bb98e5d95221a338 (patch)
tree87e83604959f7d848e80287aa799900cd0a9f989 /rbutil/rbutilqt/mspack/cab.h
parentb0f22620a2dbfb991b10a8e1e8b0c8db5e3ee117 (diff)
downloadrockbox-729b6e4f33.tar.gz
rockbox-729b6e4f33.zip
rbutil: Update libmspack to 0.10.1alpha.
Update to the most recent release. Fix name / include clashes, as has been done before. Change-Id: Ia712bb2b5f4b9018b65a46b8bdd04ba42363be8b
Diffstat (limited to 'rbutil/rbutilqt/mspack/cab.h')
-rw-r--r--rbutil/rbutilqt/mspack/cab.h27
1 files changed, 20 insertions, 7 deletions
diff --git a/rbutil/rbutilqt/mspack/cab.h b/rbutil/rbutilqt/mspack/cab.h
index 78ec8e60db..79d9951252 100644
--- a/rbutil/rbutilqt/mspack/cab.h
+++ b/rbutil/rbutilqt/mspack/cab.h
@@ -1,5 +1,5 @@
/* This file is part of libmspack.
- * (C) 2003-2004 Stuart Caie.
+ * (C) 2003-2018 Stuart Caie.
*
* libmspack is free software; you can redistribute it and/or modify it under
* the terms of the GNU Lesser General Public License (LGPL) version 2.1
@@ -10,10 +10,6 @@
#ifndef MSPACK_CAB_H
#define MSPACK_CAB_H 1
-#include "mszip.h"
-#include "qtm.h"
-#include "lzx.h"
-
/* generic CAB definitions */
/* structure offsets */
@@ -70,6 +66,22 @@
#define CAB_BLOCKMAX (32768)
#define CAB_INPUTMAX (CAB_BLOCKMAX+6144)
+/* input buffer needs to be CAB_INPUTMAX + 1 byte to allow for max-sized block
+ * plus 1 trailer byte added by cabd_sys_read_block() for Quantum alignment.
+ *
+ * When MSCABD_PARAM_SALVAGE is set, block size is not checked so can be
+ * up to 65535 bytes, so max input buffer size needed is 65535 + 1
+ */
+#define CAB_INPUTMAX_SALVAGE (65535)
+#define CAB_INPUTBUF (CAB_INPUTMAX_SALVAGE + 1)
+
+/* There are no more than 65535 data blocks per folder, so a folder cannot
+ * be more than 32768*65535 bytes in length. As files cannot span more than
+ * one folder, this is also their max offset, length and offset+length limit.
+ */
+#define CAB_FOLDERMAX (65535)
+#define CAB_LENGTHMAX (CAB_BLOCKMAX * CAB_FOLDERMAX)
+
/* CAB compression definitions */
struct mscab_compressor_p {
@@ -85,6 +97,7 @@ struct mscabd_decompress_state {
struct mscabd_folder_data *data; /* current folder split we're in */
unsigned int offset; /* uncompressed offset within folder */
unsigned int block; /* which block are we decompressing? */
+ off_t outlen; /* cumulative sum of block output sizes */
struct mspack_system sys; /* special I/O code for decompressor */
int comp_type; /* type of compression used by folder */
int (*decompress)(void *, off_t); /* decompressor code */
@@ -93,14 +106,14 @@ struct mscabd_decompress_state {
struct mspack_file *infh; /* input file handle */
struct mspack_file *outfh; /* output file handle */
unsigned char *i_ptr, *i_end; /* input data consumed, end */
- unsigned char input[CAB_INPUTMAX]; /* one input block of data */
+ unsigned char input[CAB_INPUTBUF]; /* one input block of data */
};
struct mscab_decompressor_p {
struct mscab_decompressor base;
struct mscabd_decompress_state *d;
struct mspack_system *system;
- int param[3]; /* !!! MATCH THIS TO NUM OF PARAMS IN MSPACK.H !!! */
+ int buf_size, searchbuf_size, fix_mszip, salvage; /* params */
int error, read_error;
};