Skip to content

Compression namespace #178

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions core/zip/inc/Compression.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,9 @@
#ifndef ROOT_Compression
#define ROOT_Compression

#if defined(__cplusplus)
namespace ROOT {
#endif

// The global settings depend on a global variable named
// R__ZipMode which can be modified by a global function
Expand All @@ -39,8 +41,10 @@ namespace ROOT {
kUndefinedCompressionAlgorithm
};

#if defined(__cplusplus)
int CompressionSettings(ECompressionAlgorithm algorithm,
int compressionLevel);
}
#endif

#endif
11 changes: 6 additions & 5 deletions core/zip/src/Bits.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
*/

#include "zlib.h"
#include "Compression.h"
#include "RConfigure.h"
#include "ZipLZMA.h"

Expand Down Expand Up @@ -293,7 +294,7 @@ struct bits_internal_state {
is done. LZMA typically has significantly higher compression factors, but takes
more CPU time and memory resources while compressing.
*/
int R__ZipMode = 1;
enum ECompressionAlgorithm R__ZipMode = 1;

/* ===========================================================================
* Prototypes for local functions
Expand All @@ -304,7 +305,7 @@ local void R__flush_outbuf OF((bits_internal_state *state, unsigned w, unsigned
/* ===========================================================================
Function to set the ZipMode
*/
void R__SetZipMode(int mode)
void R__SetZipMode(enum ECompressionAlgorithm mode)
{
R__ZipMode = mode;
}
Expand Down Expand Up @@ -575,20 +576,20 @@ void R__zipMultipleAlgorithm(int cxlevel, int *srcsize, char *src, int *tgtsize,
return;
}

if (compressionAlgorithm == 0) {
if (compressionAlgorithm == kUseGlobalSetting) {
compressionAlgorithm = R__ZipMode;
}

// The LZMA compression algorithm from the XZ package
if (compressionAlgorithm == 2) {
if (compressionAlgorithm == kLZMA) {
R__zipLZMA(cxlevel, srcsize, src, tgtsize, tgt, irep);
return;
}

// The very old algorithm for backward compatibility
// 0 for selecting with R__ZipMode in a backward compatible way
// 3 for selecting in other cases
if (compressionAlgorithm == 3 || compressionAlgorithm == 0) {
if (compressionAlgorithm == kOldCompressionAlgo || compressionAlgorithm == kUseGlobalSetting) {
bits_internal_state state;
ush att = (ush)UNKNOWN;
ush flags = 0;
Expand Down