aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorpionere <pionere@freemail.hu>2022-04-18 10:54:00 +0200
committerpionere <pionere@freemail.hu>2022-04-18 10:54:00 +0200
commit540d5dada1970bb1a4d01834a843c28634c21a49 (patch)
tree78162225628aaca2d08407dccb2b9708ee2f69b2 /src
parent1032227122413d68dfb1f8c1351033946a36bee3 (diff)
make tables constant (in explode.c)
Diffstat (limited to 'src')
-rw-r--r--src/pklib/explode.c24
-rw-r--r--src/pklib/pklib.h16
2 files changed, 20 insertions, 20 deletions
diff --git a/src/pklib/explode.c b/src/pklib/explode.c
index 190ee08..31480df 100644
--- a/src/pklib/explode.c
+++ b/src/pklib/explode.c
@@ -31,7 +31,7 @@ char CopyrightPkware[] = "PKWARE Data Compression Library for Win32\r\n"
//-----------------------------------------------------------------------------
// Tables
-unsigned char DistBits[0x40] =
+const unsigned char DistBits[0x40] =
{
0x02, 0x04, 0x04, 0x05, 0x05, 0x05, 0x05, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06,
0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07,
@@ -39,7 +39,7 @@ unsigned char DistBits[0x40] =
0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08
};
-unsigned char DistCode[0x40] =
+const unsigned char DistCode[0x40] =
{
0x03, 0x0D, 0x05, 0x19, 0x09, 0x11, 0x01, 0x3E, 0x1E, 0x2E, 0x0E, 0x36, 0x16, 0x26, 0x06, 0x3A,
0x1A, 0x2A, 0x0A, 0x32, 0x12, 0x22, 0x42, 0x02, 0x7C, 0x3C, 0x5C, 0x1C, 0x6C, 0x2C, 0x4C, 0x0C,
@@ -47,28 +47,28 @@ unsigned char DistCode[0x40] =
0xF0, 0x70, 0xB0, 0x30, 0xD0, 0x50, 0x90, 0x10, 0xE0, 0x60, 0xA0, 0x20, 0xC0, 0x40, 0x80, 0x00
};
-unsigned char ExLenBits[0x10] =
+const unsigned char ExLenBits[0x10] =
{
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08
};
-unsigned short LenBase[0x10] =
+const unsigned short LenBase[0x10] =
{
0x0000, 0x0001, 0x0002, 0x0003, 0x0004, 0x0005, 0x0006, 0x0007,
0x0008, 0x000A, 0x000E, 0x0016, 0x0026, 0x0046, 0x0086, 0x0106
};
-unsigned char LenBits[0x10] =
+const unsigned char LenBits[0x10] =
{
0x03, 0x02, 0x03, 0x03, 0x04, 0x04, 0x04, 0x05, 0x05, 0x05, 0x05, 0x06, 0x06, 0x06, 0x07, 0x07
};
-unsigned char LenCode[0x10] =
+const unsigned char LenCode[0x10] =
{
0x05, 0x03, 0x01, 0x06, 0x0A, 0x02, 0x0C, 0x14, 0x04, 0x18, 0x08, 0x30, 0x10, 0x20, 0x40, 0x00
};
-unsigned char ChBitsAsc[0x100] =
+const unsigned char ChBitsAsc[0x100] =
{
0x0B, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x08, 0x07, 0x0C, 0x0C, 0x07, 0x0C, 0x0C,
0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0D, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C,
@@ -88,7 +88,7 @@ unsigned char ChBitsAsc[0x100] =
0x0D, 0x0D, 0x0C, 0x0C, 0x0C, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D
};
-unsigned short ChCodeAsc[0x100] =
+const unsigned short ChCodeAsc[0x100] =
{
0x0490, 0x0FE0, 0x07E0, 0x0BE0, 0x03E0, 0x0DE0, 0x05E0, 0x09E0,
0x01E0, 0x00B8, 0x0062, 0x0EE0, 0x06E0, 0x0022, 0x0AE0, 0x02E0,
@@ -128,10 +128,10 @@ unsigned short ChCodeAsc[0x100] =
// Local functions
static void GenDecodeTabs(
- unsigned char * positions, // [out] Table of positions
- unsigned char * start_indexes, // [in] Table of start indexes
- unsigned char * length_bits, // [in] Table of lengths. Each length is stored as number of bits
- size_t elements) // [in] Number of elements in start_indexes and length_bits
+ unsigned char * positions, // [out] Table of positions
+ const unsigned char * start_indexes, // [in] Table of start indexes
+ const unsigned char * length_bits, // [in] Table of lengths. Each length is stored as number of bits
+ size_t elements) // [in] Number of elements in start_indexes and length_bits
{
unsigned int index;
unsigned int length;
diff --git a/src/pklib/pklib.h b/src/pklib/pklib.h
index d9b2a70..c1e328d 100644
--- a/src/pklib/pklib.h
+++ b/src/pklib/pklib.h
@@ -116,14 +116,14 @@ typedef struct
//-----------------------------------------------------------------------------
// Tables (in explode.c)
-extern unsigned char DistBits[0x40];
-extern unsigned char DistCode[0x40];
-extern unsigned char ExLenBits[0x10];
-extern unsigned short LenBase[0x10];
-extern unsigned char LenBits[0x10];
-extern unsigned char LenCode[0x10];
-extern unsigned char ChBitsAsc[0x100];
-extern unsigned short ChCodeAsc[0x100];
+extern const unsigned char DistBits[0x40];
+extern const unsigned char DistCode[0x40];
+extern const unsigned char ExLenBits[0x10];
+extern const unsigned short LenBase[0x10];
+extern const unsigned char LenBits[0x10];
+extern const unsigned char LenCode[0x10];
+extern const unsigned char ChBitsAsc[0x100];
+extern const unsigned short ChCodeAsc[0x100];
//-----------------------------------------------------------------------------
// Public functions