-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
15 changed files
with
243 additions
and
65 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
lib_LTLIBRARIES = libral.la | ||
libral_la_SOURCES = main.c ral.c ral_stdc.c ral_gz.c ral_lzo.c ral_snappy.c | ||
libral_la_SOURCES = main.c ral.c ral_stdc.c ral_gz.c ral_lzo.c ral_snappy.c ral_bzip.c | ||
libral_la_CPPFLAGS = $(DEPS_CFLAGS) | ||
libral_la_LIBADD = $(DEPS_LIBS) | ||
include_HEADERS = ral.h |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
#include "ral_bzip.h" | ||
#include <bzlib.h> | ||
|
||
enum ral_status f_bzip_compress(char *dest, size_t *destLen, | ||
const char *source, size_t sourceLen, void *param){ | ||
enum ral_status ret; | ||
static const int default_blockSize100k = 5; | ||
static const int default_verbosity = 0; | ||
static const int default_workFactor = 0; | ||
int res = BZ2_bzBuffToBuffCompress(dest, (unsigned int *)destLen, (char *)source, sourceLen, | ||
default_blockSize100k, default_verbosity, default_workFactor); | ||
switch (res){ | ||
case BZ_OK: | ||
ret = RAL_OK; | ||
break; | ||
case BZ_OUTBUFF_FULL: | ||
ret = RAL_EBUFFER_TOO_SMALL; | ||
break; | ||
case BZ_MEM_ERROR: | ||
ret = RAL_ENOT_ENOUGH_MEM; | ||
break; | ||
case BZ_CONFIG_ERROR: | ||
case BZ_PARAM_ERROR: | ||
default: | ||
ret = RAL_EUNKNOWN; | ||
break; | ||
}; | ||
return ret; | ||
} | ||
|
||
enum ral_status f_bzip_uncompress(char *dest, size_t *destLen, | ||
const char *source, size_t sourceLen, void *param) | ||
{ | ||
enum ral_status ret; | ||
static const int default_verbosity = 0; | ||
static const int default_small = 0; | ||
int res = BZ2_bzBuffToBuffDecompress(dest, (unsigned int *)destLen, (char *)source, sourceLen, | ||
default_small, default_verbosity); | ||
switch (res){ | ||
case BZ_OK: | ||
ret = RAL_OK; | ||
break; | ||
case BZ_OUTBUFF_FULL: | ||
ret = RAL_EBUFFER_TOO_SMALL; | ||
break; | ||
case BZ_MEM_ERROR: | ||
ret = RAL_ENOT_ENOUGH_MEM; | ||
break; | ||
case BZ_DATA_ERROR: | ||
case BZ_DATA_ERROR_MAGIC: | ||
case BZ_UNEXPECTED_EOF: | ||
ret = RAL_EINVALID_INPUT; | ||
break; | ||
case BZ_CONFIG_ERROR: | ||
case BZ_PARAM_ERROR: | ||
default: | ||
ret = RAL_EUNKNOWN; | ||
break; | ||
}; | ||
return ret; | ||
} | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
#ifndef RAL_BZIP_H | ||
#define RAL_BZIP_H | ||
|
||
#include "ral.h" | ||
enum ral_status f_bzip_compress(char *dest, size_t *destLen, const char *source, size_t sourceLen, void *param); | ||
enum ral_status f_bzip_uncompress(char *dest, size_t *destLen, const char *source, size_t sourceLen, void *param); | ||
|
||
#endif | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.