aboutsummaryrefslogtreecommitdiff
path: root/engines/agi/lzw.cpp
diff options
context:
space:
mode:
authorPaweł Kołodziejski2007-01-16 12:40:51 +0000
committerPaweł Kołodziejski2007-01-16 12:40:51 +0000
commitb47eb953160883221f02c7455cb55ca66f75198f (patch)
tree1060caa6495c20970d35dc3abb42ae7f9e513af3 /engines/agi/lzw.cpp
parent994604527b15dbe129b5c91f26da8840f3519199 (diff)
downloadscummvm-rg350-b47eb953160883221f02c7455cb55ca66f75198f.tar.gz
scummvm-rg350-b47eb953160883221f02c7455cb55ca66f75198f.tar.bz2
scummvm-rg350-b47eb953160883221f02c7455cb55ca66f75198f.zip
Formating names in source code
svn-id: r25101
Diffstat (limited to 'engines/agi/lzw.cpp')
-rw-r--r--engines/agi/lzw.cpp82
1 files changed, 41 insertions, 41 deletions
diff --git a/engines/agi/lzw.cpp b/engines/agi/lzw.cpp
index 29259a5bc9..52bbd6cc00 100644
--- a/engines/agi/lzw.cpp
+++ b/engines/agi/lzw.cpp
@@ -44,33 +44,33 @@ namespace Agi {
#define START_BITS 9
static int32 BITS, MAX_VALUE, MAX_CODE;
-static uint32 *prefix_code;
-static uint8 *append_character;
-static uint8 *decode_stack;
-static int32 input_bit_count = 0; /* Number of bits in input bit buffer */
-static uint32 input_bit_buffer = 0L;
+static uint32 *prefixCode;
+static uint8 *appendCharacter;
+static uint8 *decodeStack;
+static int32 inputBitCount = 0; /* Number of bits in input bit buffer */
+static uint32 inputBitBuffer = 0L;
static void initLZW() {
- decode_stack = (uint8 *)calloc(1, 8192);
- prefix_code = (uint32 *)malloc(TABLE_SIZE * sizeof(uint32));
- append_character = (uint8 *)malloc(TABLE_SIZE * sizeof(uint8));
- input_bit_count = 0; /* Number of bits in input bit buffer */
- input_bit_buffer = 0L;
+ decodeStack = (uint8 *)calloc(1, 8192);
+ prefixCode = (uint32 *)malloc(TABLE_SIZE * sizeof(uint32));
+ appendCharacter = (uint8 *)malloc(TABLE_SIZE * sizeof(uint8));
+ inputBitCount = 0; /* Number of bits in input bit buffer */
+ inputBitBuffer = 0L;
}
static void closeLZW() {
- free(decode_stack);
- free(prefix_code);
- free(append_character);
+ free(decodeStack);
+ free(prefixCode);
+ free(appendCharacter);
}
/***************************************************************************
-** setBITS
+** setBits
**
** Purpose: To adjust the number of bits used to store codes to the value
** passed in.
***************************************************************************/
-int setBITS(int32 value) {
+int setBits(int32 value) {
if (value == MAXBITS)
return true;
@@ -88,12 +88,12 @@ int setBITS(int32 value) {
** represents. The string is returned as a stack, i.e. the characters are
** in reverse order.
***************************************************************************/
-static uint8 *decode_string(uint8 *buffer, uint32 code) {
+static uint8 *decodeString(uint8 *buffer, uint32 code) {
uint32 i;
for (i = 0; code > 255;) {
- *buffer++ = append_character[code];
- code = prefix_code[code];
+ *buffer++ = appendCharacter[code];
+ code = prefixCode[code];
if (i++ >= 4000) {
fprintf(stderr, "lzw: error in code expansion.\n");
abort();
@@ -109,16 +109,16 @@ static uint8 *decode_string(uint8 *buffer, uint32 code) {
**
** Purpose: To return the next code from the input buffer.
***************************************************************************/
-static uint32 input_code(uint8 **input) {
+static uint32 inputCode(uint8 **input) {
uint32 r;
- while (input_bit_count <= 24) {
- input_bit_buffer |= (uint32) * (*input)++ << input_bit_count;
- input_bit_count += 8;
+ while (inputBitCount <= 24) {
+ inputBitBuffer |= (uint32) * (*input)++ << inputBitCount;
+ inputBitCount += 8;
}
- r = (input_bit_buffer & 0x7FFF) % (1 << BITS);
- input_bit_buffer >>= BITS;
- input_bit_count -= BITS;
+ r = (inputBitBuffer & 0x7FFF) % (1 << BITS);
+ inputBitBuffer >>= BITS;
+ inputBitCount -= BITS;
return r;
}
@@ -135,57 +135,57 @@ static uint32 input_code(uint8 **input) {
** code 256 = start over
** code 257 = end of data
***************************************************************************/
-void LZW_expand(uint8 *in, uint8 *out, int32 len) {
+void lzwExpand(uint8 *in, uint8 *out, int32 len) {
int32 c, lzwnext, lzwnew, lzwold;
uint8 *s, *end;
initLZW();
- setBITS(START_BITS); /* Starts at 9-bits */
+ setBits(START_BITS); /* Starts at 9-bits */
lzwnext = 257; /* Next available code to define */
end = (unsigned char *)((long)out + (long)len);
- lzwold = input_code(&in); /* Read in the first code */
+ lzwold = inputCode(&in); /* Read in the first code */
c = lzwold;
- lzwnew = input_code(&in);
+ lzwnew = inputCode(&in);
while ((out < end) && (lzwnew != 0x101)) {
if (lzwnew == 0x100) {
/* Code to "start over" */
lzwnext = 258;
- setBITS(START_BITS);
- lzwold = input_code(&in);
+ setBits(START_BITS);
+ lzwold = inputCode(&in);
c = lzwold;
*out++ = (char)c;
- lzwnew = input_code(&in);
+ lzwnew = inputCode(&in);
} else {
if (lzwnew >= lzwnext) {
/* Handles special LZW scenario */
- *decode_stack = c;
- s = decode_string(decode_stack + 1, lzwold);
+ *decodeStack = c;
+ s = decodeString(decodeStack + 1, lzwold);
} else
- s = decode_string(decode_stack, lzwnew);
+ s = decodeString(decodeStack, lzwnew);
/* Reverse order of decoded string and
* store in out buffer
*/
c = *s;
- while (s >= decode_stack)
+ while (s >= decodeStack)
*out++ = *s--;
if (lzwnext > MAX_CODE)
- setBITS(BITS + 1);
+ setBits(BITS + 1);
- prefix_code[lzwnext] = lzwold;
- append_character[lzwnext] = c;
+ prefixCode[lzwnext] = lzwold;
+ appendCharacter[lzwnext] = c;
lzwnext++;
lzwold = lzwnew;
- lzwnew = input_code(&in);
+ lzwnew = inputCode(&in);
}
}
closeLZW();
}
-} // End of namespace Agi
+} // End of namespace Agi