Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Michael A. (Mike) Iovine
p1
Commits
470866d7
Commit
470866d7
authored
5 years ago
by
Mike Iovine
Browse files
Options
Download
Email Patches
Plain Diff
Remove unused import
parent
593d7870
master
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
Makefile
+1
-1
Makefile
inflate.c
+2
-23
inflate.c
with
3 additions
and
24 deletions
+3
-24
Makefile
View file @
470866d7
...
...
@@ -10,7 +10,7 @@ huffman : huffman.c
cc huffman.c
-o
huffman
inflate
:
inflate.c
cc inflate.c
-o
inflate
-lm
cc inflate.c
-o
inflate
clean
:
rm
myzip0 myunzip0 huffman inflate
This diff is collapsed.
Click to expand it.
inflate.c
View file @
470866d7
...
...
@@ -4,36 +4,16 @@
#include <stdint.h>
#include <stdlib.h>
#include <stdbool.h>
#include <math.h>
#include "inflate.h"
/* Types of huffman codes */
#define FIXED 1
#define DYNAMIC 2
/* Maximum length for any Huffman code */
#define MAX_LENGTH 15
/* Dummy value for min_codes in huffman_t structs */
#define NO_CODE -1
typedef
struct
huffman
{
/* bl_counts[i] = number of codes of length i */
int
bl_counts
[
MAX_LENGTH
+
1
];
/* This stores the alphabet.
* alphabet[i] returns an array of alphabet symbols of length bl_counts[i].
*/
int
*
alphabet
[
MAX_LENGTH
+
1
];
/* Suppose we are reading a code and we want an index into the alphabet array.
* These are basically the numerical offsets for such an index.
* So if the code we are reading has value c and is of length i,
* its alphabet character is indexed by (c - min_codes[i]).
*/
int
min_codes
[
MAX_LENGTH
+
1
];
}
huffman_t
;
/*
* Constants for FIXED code type
*/
...
...
@@ -323,7 +303,6 @@ int *read_lens(char *buf, huffman_t *hf_codes, int num_symbols, int num_codes) {
return
lens
;
}
/* Read the block starting at the n-th bit */
void
read_block
(
char
*
buf
,
FILE
*
out
)
{
/* First bit is the BFINAL flag */
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment
Menu
Projects
Groups
Snippets
Help