aboutsummaryrefslogtreecommitdiff
path: root/src/pklib
diff options
context:
space:
mode:
authorLadislav Zezula <zezula@volny.cz>2020-11-23 12:56:00 +0100
committerLadislav Zezula <zezula@volny.cz>2020-11-23 12:56:00 +0100
commitb6102b2600f792f159320439686a872a72d20c70 (patch)
treea9cfacadc0c28b3cfde908d2a4511b6605a648a0 /src/pklib
parent809005c7f025bcc55bfa4ede78cb4cc45d3c0e6c (diff)
Removed trailing whitespace
Diffstat (limited to 'src/pklib')
-rw-r--r--src/pklib/explode.c22
-rw-r--r--src/pklib/implode.c24
-rw-r--r--src/pklib/pklib.h20
3 files changed, 33 insertions, 33 deletions
diff --git a/src/pklib/explode.c b/src/pklib/explode.c
index 7d63687..0f551d8 100644
--- a/src/pklib/explode.c
+++ b/src/pklib/explode.c
@@ -16,7 +16,7 @@
#include "pklib.h"
-#define PKDCL_OK 0
+#define PKDCL_OK 0
#define PKDCL_STREAM_END 1 // All data from the input stream is read
#define PKDCL_NEED_DICT 2 // Need more data (dictionary)
#define PKDCL_CONTINUE 10 // Internal flag, not returned to user
@@ -31,7 +31,7 @@ char CopyrightPkware[] = "PKWARE Data Compression Library for Win32\r\n"
//-----------------------------------------------------------------------------
// Tables
-unsigned char DistBits[0x40] =
+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] =
+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,
@@ -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] =
+unsigned short ChCodeAsc[0x100] =
{
0x0490, 0x0FE0, 0x07E0, 0x0BE0, 0x03E0, 0x0DE0, 0x05E0, 0x09E0,
0x01E0, 0x00B8, 0x0062, 0x0EE0, 0x06E0, 0x0022, 0x0AE0, 0x02E0,
@@ -121,7 +121,7 @@ unsigned short ChCodeAsc[0x100] =
0x0300, 0x0D40, 0x1D00, 0x0D00, 0x1500, 0x0540, 0x0500, 0x1900,
0x0900, 0x0940, 0x1100, 0x0100, 0x1E00, 0x0E00, 0x0140, 0x1600,
0x0600, 0x1A00, 0x0E40, 0x0640, 0x0A40, 0x0A00, 0x1200, 0x0200,
- 0x1C00, 0x0C00, 0x1400, 0x0400, 0x1800, 0x0800, 0x1000, 0x0000
+ 0x1C00, 0x0C00, 0x1400, 0x0400, 0x1800, 0x0800, 0x1000, 0x0000
};
//-----------------------------------------------------------------------------
@@ -278,11 +278,11 @@ static unsigned int DecodeLit(TDcmpStruct * pWork)
{
// Remove one bit from the input data
if(WasteBits(pWork, 1))
- return 0x306;
-
+ return 0x306;
+
// The next 8 bits hold the index to the length code table
length_code = pWork->LengthCodes[pWork->bit_buff & 0xFF];
-
+
// Remove the apropriate number of bits
if(WasteBits(pWork, pWork->LenBits[length_code]))
return 0x306;
@@ -442,7 +442,7 @@ static unsigned int Expand(TDcmpStruct * pWork)
{
pWork->out_buff[pWork->outputPos++] = (unsigned char)next_literal;
}
-
+
// Flush the output buffer, if number of extracted bytes has reached the end
if(pWork->outputPos >= 0x2000)
{
@@ -495,7 +495,7 @@ unsigned int PKEXPORT explode(
pWork->in_pos = 3; // Position in input buffer
// Test for the valid dictionary size
- if(4 > pWork->dsize_bits || pWork->dsize_bits > 6)
+ if(4 > pWork->dsize_bits || pWork->dsize_bits > 6)
return CMP_INVALID_DICTSIZE;
pWork->dsize_mask = 0xFFFF >> (0x10 - pWork->dsize_bits); // Shifted by 'sar' instruction
@@ -517,6 +517,6 @@ unsigned int PKEXPORT explode(
GenDecodeTabs(pWork->DistPosCodes, DistCode, pWork->DistBits, sizeof(pWork->DistBits));
if(Expand(pWork) != 0x306)
return CMP_NO_ERROR;
-
+
return CMP_ABORT;
}
diff --git a/src/pklib/implode.c b/src/pklib/implode.c
index f34eb22..90cb482 100644
--- a/src/pklib/implode.c
+++ b/src/pklib/implode.c
@@ -50,7 +50,7 @@ static void SortBuffer(TCmpStruct * pWork, unsigned char * buffer_begin, unsigne
// Zero the entire "phash_to_index" table
memset(pWork->phash_to_index, 0, sizeof(pWork->phash_to_index));
-
+
// Step 1: Count amount of each PAIR_HASH in the input buffer
// The table will look like this:
// offs 0x000: Number of occurences of PAIR_HASH 0
@@ -60,7 +60,7 @@ static void SortBuffer(TCmpStruct * pWork, unsigned char * buffer_begin, unsigne
for(buffer_ptr = buffer_begin; buffer_ptr < buffer_end; buffer_ptr++)
pWork->phash_to_index[BYTE_PAIR_HASH(buffer_ptr)]++;
- // Step 2: Convert the table to the array of PAIR_HASH amounts.
+ // Step 2: Convert the table to the array of PAIR_HASH amounts.
// Each element contains count of PAIR_HASHes that is less or equal
// to element index
// The table will look like this:
@@ -128,7 +128,7 @@ static void OutputBits(TCmpStruct * pWork, unsigned int nbits, unsigned long bit
{
pWork->out_bytes++;
bit_buff >>= (8 - out_bits);
-
+
pWork->out_buff[pWork->out_bytes] = (unsigned char)bit_buff;
pWork->out_bits &= 7;
}
@@ -146,7 +146,7 @@ static void OutputBits(TCmpStruct * pWork, unsigned int nbits, unsigned long bit
// This function searches for a repetition
// (a previous occurence of the current byte sequence)
-// Returns length of the repetition, and stores the backward distance
+// Returns length of the repetition, and stores the backward distance
// to pWork structure.
static unsigned int FindRep(TCmpStruct * pWork, unsigned char * input_data)
{
@@ -187,7 +187,7 @@ static unsigned int FindRep(TCmpStruct * pWork, unsigned char * input_data)
phash_offs = pWork->phash_offs + phash_offs_index;
prev_repetition = pWork->work_buff + phash_offs[0];
repetition_limit = input_data - 1;
-
+
// If the current PAIR_HASH was not encountered before,
// we haven't found a repetition.
if(prev_repetition >= repetition_limit)
@@ -213,7 +213,7 @@ static unsigned int FindRep(TCmpStruct * pWork, unsigned char * input_data)
{
prev_repetition++;
input_data_ptr++;
-
+
// Are the bytes different ?
if(*prev_repetition != *input_data_ptr)
break;
@@ -309,7 +309,7 @@ static unsigned int FindRep(TCmpStruct * pWork, unsigned char * input_data)
pWork->offs09BC[++offs_in_rep] = ++di_val;
}
- //
+ //
// Now go through all the repetitions from the first found one
// to the current input data, and check if any of them migh be
// a start of a greater sequence match.
@@ -318,7 +318,7 @@ static unsigned int FindRep(TCmpStruct * pWork, unsigned char * input_data)
prev_repetition = pWork->work_buff + phash_offs[0];
prev_rep_end = prev_repetition + rep_length;
rep_length2 = rep_length;
-
+
for(;;)
{
rep_length2 = pWork->offs09BC[rep_length2];
@@ -412,7 +412,7 @@ static void WriteCmpData(TCmpStruct * pWork)
unsigned int save_rep_length; // Saved length of current repetition
unsigned int save_distance = 0; // Saved distance of current repetition
unsigned int rep_length; // Length of the found repetition
- unsigned int phase = 0; //
+ unsigned int phase = 0; //
// Store the compression type and dictionary size
pWork->out_buff[0] = (char)pWork->ctype;
@@ -452,12 +452,12 @@ static void WriteCmpData(TCmpStruct * pWork)
input_data_end = pWork->work_buff + pWork->dsize_bytes + total_loaded;
if(input_data_ended)
input_data_end += 0x204;
-
+
//
// Warning: The end of the buffer passed to "SortBuffer" is actually 2 bytes beyond
// valid data. It is questionable if this is actually a bug or not,
// but it might cause the compressed data output to be dependent on random bytes
- // that are in the buffer.
+ // that are in the buffer.
// To prevent that, the calling application must always zero the compression
// buffer before passing it to "implode"
//
@@ -466,7 +466,7 @@ static void WriteCmpData(TCmpStruct * pWork)
// previously compressed data, if any.
switch(phase)
{
- case 0:
+ case 0:
SortBuffer(pWork, input_data, input_data_end + 1);
phase++;
if(pWork->dsize_bytes != 0x1000)
diff --git a/src/pklib/pklib.h b/src/pklib/pklib.h
index 6f7e933..d9b2a70 100644
--- a/src/pklib/pklib.h
+++ b/src/pklib/pklib.h
@@ -32,7 +32,7 @@
#ifndef PKEXPORT
#ifdef WIN32
-#define PKEXPORT __cdecl // Use for normal __cdecl calling
+#define PKEXPORT __cdecl // Use for normal __cdecl calling
#else
#define PKEXPORT
#endif
@@ -45,7 +45,7 @@
typedef struct
{
unsigned int distance; // 0000: Backward distance of the currently found repetition, decreased by 1
- unsigned int out_bytes; // 0004: # bytes available in out_buff
+ unsigned int out_bytes; // 0004: # bytes available in out_buff
unsigned int out_bits; // 0008: # of bits available in the last out byte
unsigned int dsize_bits; // 000C: Number of bits needed for dictionary size. 4 = 0x400, 5 = 0x800, 6 = 0x1000
unsigned int dsize_mask; // 0010: Bit mask for dictionary. 0x0F = 0x400, 0x1F = 0x800, 0x3F = 0x1000
@@ -55,14 +55,14 @@ typedef struct
unsigned char dist_codes[0x40]; // 005C: Distance codes
unsigned char nChBits[0x306]; // 009C: Table of literal bit lengths to be put to the output stream
unsigned short nChCodes[0x306]; // 03A2: Table of literal codes to be put to the output stream
- unsigned short offs09AE; // 09AE:
+ unsigned short offs09AE; // 09AE:
void * param; // 09B0: User parameter
unsigned int (*read_buf)(char *buf, unsigned int *size, void *param); // 9B4
void (*write_buf)(char *buf, unsigned int *size, void *param); // 9B8
unsigned short offs09BC[0x204]; // 09BC:
- unsigned long offs0DC4; // 0DC4:
+ unsigned long offs0DC4; // 0DC4:
unsigned short phash_to_index[0x900]; // 0DC8: Array of indexes (one for each PAIR_HASH) to the "pair_hash_offsets" table
unsigned short phash_to_index_end; // 1FC8: End marker for "phash_to_index" table
char out_buff[0x802]; // 1FCA: Compressed data
@@ -99,15 +99,15 @@ typedef struct
unsigned char in_buff[0x800]; // 2234: Buffer for data to be decompressed
unsigned char DistPosCodes[0x100]; // 2A34: Table of distance position codes
unsigned char LengthCodes[0x100]; // 2B34: Table of length codes
- unsigned char offs2C34[0x100]; // 2C34: Buffer for
- unsigned char offs2D34[0x100]; // 2D34: Buffer for
- unsigned char offs2E34[0x80]; // 2E34: Buffer for
- unsigned char offs2EB4[0x100]; // 2EB4: Buffer for
- unsigned char ChBitsAsc[0x100]; // 2FB4: Buffer for
+ unsigned char offs2C34[0x100]; // 2C34: Buffer for
+ unsigned char offs2D34[0x100]; // 2D34: Buffer for
+ unsigned char offs2E34[0x80]; // 2E34: Buffer for
+ unsigned char offs2EB4[0x100]; // 2EB4: Buffer for
+ unsigned char ChBitsAsc[0x100]; // 2FB4: Buffer for
unsigned char DistBits[0x40]; // 30B4: Numbers of bytes to skip copied block length
unsigned char LenBits[0x10]; // 30F4: Numbers of bits for skip copied block length
unsigned char ExLenBits[0x10]; // 3104: Number of valid bits for copied block
- unsigned short LenBase[0x10]; // 3114: Buffer for
+ unsigned short LenBase[0x10]; // 3114: Buffer for
} TDcmpStruct;
#define EXP_BUFFER_SIZE sizeof(TDcmpStruct) // Size of decompression structure