summaryrefslogtreecommitdiff
path: root/huffman.c
diff options
context:
space:
mode:
Diffstat (limited to 'huffman.c')
-rw-r--r--huffman.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/huffman.c b/huffman.c
index a1141a8..596de6c 100644
--- a/huffman.c
+++ b/huffman.c
@@ -42,7 +42,6 @@ typedef struct {
} huff_node;
static huff_node *hufftree; /* The huffman tree */
-static long plaintextlen; /* Length of plaintext */
static void create_text_line(char *dt,long nchars);
static void create_text_block(char *tb, unsigned long tblen,
@@ -103,7 +102,6 @@ DoHuffman(void)
randnum((int32_t)13);
create_text_block(plaintext,ARRAY_SIZE-1,(unsigned short)500);
plaintext[ARRAY_SIZE-1L]='\0';
- plaintextlen=ARRAY_SIZE;
/*
** See if we need to perform self adjustment loop.
@@ -282,7 +280,7 @@ for(j=0;j<ARRAY_SIZE;j++)
hufftree[(int)plaintext[j]].freq+=(float)1.0;
for(i=0;i<256;i++)
- if(hufftree[i].freq != (float)0.0)
+ if(hufftree[i].freq != 0.0)
hufftree[i].freq/=(float)ARRAY_SIZE;
/* Reset the second half of the tree. Otherwise the loop below that
@@ -299,7 +297,7 @@ memset(&(hufftree[256]), 0, sizeof(huff_node) * 256);
** pointers and left/right pointers. Also, discard all
** nodes that have a frequency of true 0. */
for(i=0;i<512;i++)
-{ if(hufftree[i].freq==(float)0.0)
+{ if(hufftree[i].freq == 0.0)
hufftree[i].parent=EXCLUDED;
else {
hufftree[i].right = -1;