14#ifndef ROOT_RNTupleZip
15#define ROOT_RNTupleZip
48 static std::size_t
Zip(
const void *from, std::size_t nbytes,
int compression,
void *to)
52 auto cxLevel = compression % 100;
54 memcpy(to, from, nbytes);
59 unsigned int nZipBlocks = 1 + (nbytes - 1) / kMAXZIPBUF;
60 const char *source =
static_cast<const char *
>(from);
61 int szTarget = nbytes;
62 char *
target =
reinterpret_cast<char *
>(to);
64 int szRemaining = nbytes;
66 for (
unsigned int i = 0; i < nZipBlocks; ++i) {
67 int szSource = std::min(
static_cast<int>(kMAXZIPBUF), szRemaining);
68 R__zipMultipleAlgorithm(cxLevel, &szSource, source, &szTarget,
target, &szOutBlock, cxAlgorithm);
70 if ((szOutBlock == 0) || (szOutBlock >= szSource)) {
72 memcpy(to, from, nbytes);
76 szZipData += szOutBlock;
79 szRemaining -= szSource;
106 static void Unzip(
const void *from,
size_t nbytes,
size_t dataLen,
void *to)
108 if (dataLen == nbytes) {
109 memcpy(to, from, nbytes);
114 const unsigned char *source =
static_cast<const unsigned char *
>(from);
115 unsigned char *
target =
static_cast<unsigned char *
>(to);
116 size_t szRemainingLen = dataLen;
117 size_t szRemainingNbytes = nbytes;
119 if (
R__unlikely(szRemainingNbytes < ROOT::Internal::kZipHeaderSize)) {
124 int retval = R__unzip_header(&szSource, source, &szTarget);
125 if (
R__unlikely(!((retval == 0) && (szSource > 0) && (szTarget > szSource) &&
126 (
static_cast<unsigned int>(szSource) <= szRemainingNbytes) &&
127 (
static_cast<unsigned int>(szTarget) <= szRemainingLen)))) {
132 R__unzip(&szSource, source, &szTarget,
target, &unzipBytes);
135 std::to_string(szTarget) +
", got: " + std::to_string(unzipBytes) +
")"));
140 szRemainingNbytes -= szSource;
141 szRemainingLen -= unzipBytes;
142 }
while (szRemainingLen > 0);
144 if (szRemainingNbytes > 0) {
#define R__unlikely(expr)
#define R__FAIL(msg)
Short-hand to return an RResult<T> in an error state; the RError is implicitly converted into RResult...
#define R__ASSERT(e)
Checks condition e and reports a fatal error if it's false.
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t winding char text const char depth char const char Int_t count const char ColorStruct_t color const char Pixmap_t Pixmap_t PictureAttributes_t attr const char char ret_data h unsigned char height h Atom_t Int_t ULong_t ULong_t unsigned char prop_list Atom_t Atom_t target
RNTupleCompressor()=delete
RNTupleDecompressor()=delete
RNTupleCompressor & operator=(const RNTupleCompressor &other)=delete
RNTupleCompressor()=delete
static std::size_t Zip(const void *from, std::size_t nbytes, int compression, void *to)
Returns the size of the compressed data, written into the provided output buffer.
RNTupleCompressor(RNTupleCompressor &&other)=delete
RNTupleCompressor(const RNTupleCompressor &other)=delete
RNTupleCompressor & operator=(RNTupleCompressor &&other)=delete
RNTupleDecompressor(RNTupleDecompressor &&other)=delete
RNTupleDecompressor()=delete
static void Unzip(const void *from, size_t nbytes, size_t dataLen, void *to)
The nbytes parameter provides the size ls of the from buffer.
RNTupleDecompressor(const RNTupleDecompressor &other)=delete
RNTupleDecompressor & operator=(const RNTupleDecompressor &other)=delete
RNTupleDecompressor & operator=(RNTupleDecompressor &&other)=delete
Base class for all ROOT issued exceptions.
EValues
Note: this is only temporarily a struct and will become a enum class hence the name convention used.