Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
libaec
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
1
Issues
1
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
Operations
Operations
Incidents
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Mathis Rosenhauer
libaec
Commits
32237e59
Commit
32237e59
authored
Aug 10, 2012
by
Mathis Rosenhauer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fixed some leaks and mem errors
parent
8fd6570e
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
45 additions
and
15 deletions
+45
-15
src/Makefile
src/Makefile
+2
-2
src/aed.c
src/aed.c
+15
-4
src/aee.c
src/aee.c
+14
-9
src/libae.h
src/libae.h
+2
-0
src/sz_compat.c
src/sz_compat.c
+6
-0
src/test_decode.c
src/test_decode.c
+3
-0
src/test_encode.c
src/test_encode.c
+3
-0
No files found.
src/Makefile
View file @
32237e59
CC
=
gcc
#CFLAGS = -g -pg -lc -O2 -Wall -fprofile-arcs -ftest-coverage -DPROFILE
CFLAGS
=
-g
-pg
-lc
-O2
-Wall
-fprofile-arcs
-ftest-coverage
-DUNROLL_BLOCK_8
#
CFLAGS = -g -O3 -Wall -DUNROLL_BLOCK_8
#
CFLAGS = -g -pg -lc -O2 -Wall -fprofile-arcs -ftest-coverage -DUNROLL_BLOCK_8
CFLAGS
=
-g
-O3
-Wall
-DUNROLL_BLOCK_8
OBJS
=
aee.o aed.o sz_compat.o
...
...
src/aed.c
View file @
32237e59
...
...
@@ -326,6 +326,17 @@ int ae_decode_init(ae_streamp strm)
return
AE_OK
;
}
int
ae_decode_end
(
ae_streamp
strm
)
{
decode_state
*
state
;
state
=
strm
->
state
;
free
(
state
->
block
);
free
(
state
->
id_table
);
free
(
state
);
return
AE_OK
;
}
#define ASK(n) \
do { \
while (state->bitp < (unsigned)(n)) \
...
...
@@ -426,7 +437,7 @@ int ae_decode(ae_streamp strm, int flush)
state
->
n
=
strm
->
block_size
;
}
state
->
i
=
state
->
n
;
state
->
i
=
state
->
n
-
1
;
state
->
mode
=
M_SPLIT_FS
;
case
M_SPLIT_FS
:
...
...
@@ -436,9 +447,9 @@ int ae_decode(ae_streamp strm, int flush)
state
->
block
[
state
->
i
]
=
GETFS
();
DROPFS
();
}
while
(
--
state
->
i
);
while
(
state
->
i
--
);
state
->
i
=
state
->
n
;
state
->
i
=
state
->
n
-
1
;
state
->
mode
=
M_SPLIT_OUTPUT
;
case
M_SPLIT_OUTPUT
:
...
...
@@ -449,7 +460,7 @@ int ae_decode(ae_streamp strm, int flush)
PUT
((
state
->
block
[
state
->
i
]
<<
k
)
+
GET
(
k
));
DROP
(
k
);
}
while
(
--
state
->
i
);
while
(
state
->
i
--
);
state
->
mode
=
M_ID
;
break
;
...
...
src/aee.c
View file @
32237e59
...
...
@@ -206,6 +206,20 @@ int ae_encode_init(ae_streamp strm)
return
AE_OK
;
}
int
ae_encode_end
(
ae_streamp
strm
)
{
encode_state
*
state
;
state
=
strm
->
state
;
#ifdef PROFILE
free
(
state
->
prof
);
#endif
free
(
state
->
block_in
);
free
(
state
->
block_out
);
free
(
state
);
return
AE_OK
;
}
static
inline
void
emit
(
encode_state
*
state
,
int64_t
data
,
int
bits
)
{
while
(
bits
)
...
...
@@ -595,14 +609,5 @@ int ae_encode(ae_streamp strm, int flush)
req_buffer:
strm
->
total_out
=
total_out
;
strm
->
avail_out
=
avail_out
;
if
(
strm
->
avail_in
==
0
&&
avail_out
&&
flush
==
AE_FLUSH
)
{
#ifdef PROFILE
free
(
state
->
prof
);
#endif
free
(
state
->
block_in
);
free
(
state
->
block_out
);
free
(
strm
->
state
);
}
return
AE_OK
;
}
src/libae.h
View file @
32237e59
...
...
@@ -59,8 +59,10 @@ typedef ae_stream *ae_streamp;
int
ae_decode_init
(
ae_streamp
strm
);
int
ae_decode
(
ae_streamp
strm
,
int
flush
);
int
ae_decode_end
(
ae_streamp
strm
);
int
ae_encode_init
(
ae_streamp
strm
);
int
ae_encode
(
ae_streamp
strm
,
int
flush
);
int
ae_encode_end
(
ae_streamp
strm
);
#endif
/* LIBAE_H */
src/sz_compat.c
View file @
32237e59
...
...
@@ -21,6 +21,9 @@ int SZ_BufftoBuffCompress(void *dest, size_t *destLen, const void *source, size_
if
((
status
=
ae_encode
(
&
strm
,
AE_FLUSH
))
!=
AE_OK
)
return
status
;
if
((
status
=
ae_encode_end
(
&
strm
))
!=
AE_OK
)
return
status
;
*
destLen
=
strm
.
total_out
;
return
SZ_OK
;
}
...
...
@@ -45,6 +48,9 @@ int SZ_BufftoBuffDecompress(void *dest, size_t *destLen, const void *source, siz
if
((
status
=
ae_decode
(
&
strm
,
AE_FLUSH
))
!=
AE_OK
)
return
status
;
if
((
status
=
ae_decode_end
(
&
strm
))
!=
AE_OK
)
return
status
;
*
destLen
=
strm
.
total_out
;
return
SZ_OK
;
}
src/test_decode.c
View file @
32237e59
...
...
@@ -88,5 +88,8 @@ int main(int argc, char *argv[])
}
ae_decode_end
(
&
strm
);
free
(
in
);
free
(
out
);
return
0
;
}
src/test_encode.c
View file @
32237e59
...
...
@@ -105,5 +105,8 @@ int main(int argc, char *argv[])
putc
(
out
[
i
],
stdout
);
}
}
ae_encode_end
(
&
strm
);
free
(
in
);
free
(
out
);
return
0
;
}
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