Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
Rudolf
/
huffman
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
fc7e2827
authored
Nov 17, 2016
by
Rudolf
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Do not redefine bit variable
parent
273b1678
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
5 deletions
tree.c
tree.c
View file @
fc7e2827
...
@@ -96,6 +96,7 @@ struct tree *create_tree(FILE *file)
...
@@ -96,6 +96,7 @@ struct tree *create_tree(FILE *file)
static
int
write_entry
(
struct
BIT_BUFFER
*
bitbuf
,
struct
tree
*
parent
,
static
int
write_entry
(
struct
BIT_BUFFER
*
bitbuf
,
struct
tree
*
parent
,
unsigned
char
c
)
unsigned
char
c
)
{
{
int
bit
=
0
;
while
(
parent
!=
NULL
)
{
while
(
parent
!=
NULL
)
{
struct
tree
*
left
,
*
right
;
struct
tree
*
left
,
*
right
;
...
@@ -104,27 +105,27 @@ static int write_entry(struct BIT_BUFFER *bitbuf, struct tree *parent,
...
@@ -104,27 +105,27 @@ static int write_entry(struct BIT_BUFFER *bitbuf, struct tree *parent,
if
(
c
!=
0
)
{
if
(
c
!=
0
)
{
if
(
left
->
ch
==
c
)
{
if
(
left
->
ch
==
c
)
{
int
bit
=
0
;
bit
=
0
;
bb_write
(
bitbuf
,
&
bit
,
1
);
bb_write
(
bitbuf
,
&
bit
,
1
);
break
;
break
;
}
else
if
(
right
->
ch
==
c
)
{
}
else
if
(
right
->
ch
==
c
)
{
int
bit
=
1
;
bit
=
1
;
bb_write
(
bitbuf
,
&
bit
,
1
);
bb_write
(
bitbuf
,
&
bit
,
1
);
break
;
break
;
}
}
}
else
{
}
else
{
if
(
left
->
left
==
NULL
)
{
if
(
left
->
left
==
NULL
)
{
int
bit
=
0
;
bit
=
0
;
bb_write
(
bitbuf
,
&
bit
,
1
);
bb_write
(
bitbuf
,
&
bit
,
1
);
break
;
break
;
}
else
if
(
right
->
ch
==
c
)
{
}
else
if
(
right
->
ch
==
c
)
{
int
bit
=
1
;
bit
=
1
;
bb_write
(
bitbuf
,
&
bit
,
1
);
bb_write
(
bitbuf
,
&
bit
,
1
);
break
;
break
;
}
}
}
}
int
bit
=
0
;
bit
=
0
;
bb_write
(
bitbuf
,
&
bit
,
1
);
bb_write
(
bitbuf
,
&
bit
,
1
);
parent
=
left
;
parent
=
left
;
...
...
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