aboutsummaryrefslogtreecommitdiff
path: root/src/pklib/implode.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/pklib/implode.c')
-rw-r--r--src/pklib/implode.c24
1 files changed, 12 insertions, 12 deletions
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)