Skip to content
Draft
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
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -387,8 +387,8 @@ install(FILES ${CMAKE_BINARY_DIR}/etc/gitinfo.txt DESTINATION ${CMAKE_INSTALL_SY

#---Recurse into the given subdirectories. This does not actually cause another cmake executable
# to run. The same process will walk through the project's entire directory structure.
add_subdirectory (builtins/zip) # hard coded C builtin for core/zip
add_subdirectory (core)
add_subdirectory (builtins/zip) # hard coded builtin for core/zip
add_subdirectory (math)
add_subdirectory (hist)
add_subdirectory (tree)
Expand Down
1 change: 1 addition & 0 deletions README/ReleaseNotes/v642/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ Users are encouraged to export their models to ONNX and use the retained ONNX pa
* Support for the AIX operating system has been removed from the codebase. This support has not been tested since the late v5 releases and the LLVM JIT is not yet supporting AIX.
* The headers Htypes.h and Gtypes.h that were deprecated in ROOT 6.20 will now emit warnings and will be fully removed in ROOT 6.44.
* The header GLConstants.h is no longer part of ROOT installed headers.
* The headers `ZipLZMA.h` and `ZipLZ4.h` are no longer part of ROOT installed headers. Use instead `RZip.h` methods.

## Build System

Expand Down
18 changes: 17 additions & 1 deletion builtins/zip/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,28 @@
# For the licensing terms see $ROOTSYS/LICENSE.
# For the list of contributors see $ROOTSYS/README/CREDITS.

target_sources(Core PRIVATE
add_library(ROOTzip STATIC)
target_sources(ROOTzip PUBLIC
Bits.h # was renamed from Bits.c at https://github.com/root-project/root/commit/3b2f05c8ddf1001cc8eb05ad60b07b10af6ac293#diff-ff111e76990c56e7019ed0d837f1f615e280dc679ed393200c4f75b61094c5b7 and later split back to Bits.c in https://github.com/root-project/root/commit/25d5805abac4d408554e99aec6e49b8a671a2d96
Tailor.h # forked from 1993: zip 2.0 (https://github.com/root-project/root/blob/852600061bcacd9b255d44f6312c96b6b1e00a2d/zip/inc/Tailor.h vs https://github.com/pmqs/Info-ZIP-Family-Tree-for-Zip/blob/d25ed515bc56fae136b635d764ce8b363041aef5/tailor.h)
ZIP.h # forked from 1993: zip 2.0 (https://github.com/root-project/root/blob/852600061bcacd9b255d44f6312c96b6b1e00a2d/zip/inc/ZIP.h vs https://github.com/pmqs/Info-ZIP-Family-Tree-for-Zip/blob/d25ed515bc56fae136b635d764ce8b363041aef5/zip.h)
PRIVATE
Bits.c # forked from 1993: zip 2.0 (https://github.com/root-project/root/blob/852600061bcacd9b255d44f6312c96b6b1e00a2d/zip/src/Bits.c vs https://github.com/pmqs/Info-ZIP-Family-Tree-for-Zip/blob/d25ed515bc56fae136b635d764ce8b363041aef5/bits.c)
ZDeflate.c # forked from 1993: zip 2.0 (https://github.com/root-project/root/blob/852600061bcacd9b255d44f6312c96b6b1e00a2d/zip/src/Deflate.c vs https://github.com/pmqs/Info-ZIP-Family-Tree-for-Zip/blob/d25ed515bc56fae136b635d764ce8b363041aef5/deflate.c)
ZInflate.c # forked from 1994: version c14o / unzip-5.12 (https://github.com/root-project/root/blob/852600061bcacd9b255d44f6312c96b6b1e00a2d/zip/src/Inflate.c vs https://github.com/freebsd/freebsd-src/commit/37c32e9f3a0dc8ba9d0b7cd06742502dcba1b457 or https://stuff.mit.edu/afs/sipb.mit.edu/project/sipbsrc/i386_nbsd1/unzip-5.12/inflate.c)
ZTrees.c # forked from 1993: zip 2.0 (https://github.com/root-project/root/blob/852600061bcacd9b255d44f6312c96b6b1e00a2d/zip/src/Trees.c vs https://github.com/pmqs/Info-ZIP-Family-Tree-for-Zip/blob/d25ed515bc56fae136b635d764ce8b363041aef5/trees.c)
ZipLZMA.c # ROOT
ZipLZMA.h # ROOT, public
ZipLZ4.c # ROOT
ZipLZ4.h # ROOT, public
ZipZSTD.cxx # ROOT
ZipZSTD.h # ROOT, public
)
target_include_directories(ROOTzip PUBLIC .
PRIVATE
# for ThreadLocalStorage.h ZTrees.c we need
${CMAKE_SOURCE_DIR}/core/foundation/inc
)
target_link_libraries(ROOTzip PRIVATE LibLZMA::LibLZMA xxHash::xxHash LZ4::LZ4 ZSTD::ZSTD)
target_compile_definitions(ROOTzip PRIVATE R__LINUX) # TODO derive from cmake https://github.com/root-project/root/pull/23261 after isolating TLS header
set_target_properties(ROOTzip PROPERTIES POSITION_INDEPENDENT_CODE ON)
3 changes: 1 addition & 2 deletions builtins/zip/ZInflate.c
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
#include <stdlib.h>
#include <string.h>

#ifdef WIN32
#ifdef _WIN32
#define __STDC__ 1
#endif
#ifdef __MWERKS__
Expand All @@ -18,7 +18,6 @@
static const int qflag = 0;

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

Expand Down
29 changes: 13 additions & 16 deletions core/lz4/src/ZipLZ4.cxx → builtins/zip/ZipLZ4.c
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,10 @@

#include "ZipLZ4.h"

#include "ROOT/RConfig.hxx"

#include <cinttypes>
#include <cstdint>
#include <cstdio>
#include <cstring>
#include <inttypes.h>
#include <stdint.h>
#include <stdio.h>
#include <string.h>
#include <lz4.h>
#include <lz4hc.h>
#include <xxhash.h>
Expand All @@ -38,12 +36,12 @@ void R__zipLZ4(int cxlevel, int *srcsize, const char *src, int *tgtsize, char *t

*irep = 0;

if (R__unlikely(*tgtsize <= 0)) {
if ((*tgtsize <= 0)) {
return;
}

// Refuse to compress more than 16MB at a time -- we are only allowed 3 bytes for size info.
if (R__unlikely(*srcsize > 0xffffff || *srcsize < 0)) {
if ((*srcsize > 0xffffff || *srcsize < 0)) {
return;
}

Expand All @@ -57,7 +55,7 @@ void R__zipLZ4(int cxlevel, int *srcsize, const char *src, int *tgtsize, char *t
returnStatus = LZ4_compress_default(src, &tgt[kHeaderSize], *srcsize, *tgtsize - kHeaderSize);
}

if (R__unlikely(returnStatus == 0)) { /* LZ4 compression failed */
if ((returnStatus == 0)) { /* LZ4 compression failed */
return;
}
XXH64_hash_t checksumResult = XXH64(tgt + kHeaderSize, returnStatus, 0);
Expand All @@ -79,7 +77,7 @@ void R__zipLZ4(int cxlevel, int *srcsize, const char *src, int *tgtsize, char *t
tgt[8] = (char)((in_size >> 16) & 0xff);

// Write out checksum.
XXH64_canonicalFromHash(reinterpret_cast<XXH64_canonical_t *>(tgt + kChecksumOffset), checksumResult);
XXH64_canonicalFromHash((XXH64_canonical_t *)(tgt + kChecksumOffset), checksumResult);

*irep = (int)returnStatus + kHeaderSize;
}
Expand All @@ -91,12 +89,12 @@ void R__unzipLZ4(int *srcsize, const unsigned char *src, int *tgtsize, unsigned

int LZ4_version = LZ4_versionNumber() / (100 * 100);
*irep = 0;
if (R__unlikely(src[0] != 'L' || src[1] != '4')) {
if ((src[0] != 'L' || src[1] != '4')) {
fprintf(stderr, "R__unzipLZ4: algorithm run against buffer with incorrect header (got %d%d; expected %d%d).\n",
src[0], src[1], 'L', '4');
return;
}
if (R__unlikely(src[2] != LZ4_version)) {
if ((src[2] != LZ4_version)) {
fprintf(stderr,
"R__unzipLZ4: This version of LZ4 is incompatible with the on-disk version (got %d; expected %d).\n",
src[2], LZ4_version);
Expand All @@ -110,18 +108,17 @@ void R__unzipLZ4(int *srcsize, const unsigned char *src, int *tgtsize, unsigned
// what size of chunks does interleaving (avoiding two fetches from RAM) improve enough for the
// extra function call costs? NOTE that ROOT limits the buffer size to 16MB.
XXH64_hash_t checksumResult = XXH64(src + kHeaderSize, inputBufferSize, 0);
XXH64_hash_t checksumFromFile =
XXH64_hashFromCanonical(reinterpret_cast<const XXH64_canonical_t *>(src + kChecksumOffset));
XXH64_hash_t checksumFromFile = XXH64_hashFromCanonical((const XXH64_canonical_t *)(src + kChecksumOffset));

if (R__unlikely(checksumFromFile != checksumResult)) {
if ((checksumFromFile != checksumResult)) {
fprintf(
stderr,
"R__unzipLZ4: Buffer corruption error! Calculated checksum %llu; checksum calculated in the file was %llu.\n",
(unsigned long long) checksumResult, (unsigned long long) checksumFromFile);
return;
}
int returnStatus = LZ4_decompress_safe((char *)(&src[kHeaderSize]), (char *)(tgt), inputBufferSize, *tgtsize);
if (R__unlikely(returnStatus < 0)) {
if ((returnStatus < 0)) {
fprintf(stderr, "R__unzipLZ4: error in decompression around byte %d out of maximum %d.\n", -returnStatus,
*tgtsize);
return;
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 0 additions & 2 deletions core/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,6 @@ add_subdirectory(textinput)
add_subdirectory(thread)
add_subdirectory(utils)
add_subdirectory(zip)
add_subdirectory(lzma)
add_subdirectory(lz4)
add_subdirectory(zstd)

add_subdirectory(macosx)
Expand Down
20 changes: 6 additions & 14 deletions core/foundation/inc/ThreadLocalStorage.h
Original file line number Diff line number Diff line change
Expand Up @@ -57,14 +57,6 @@

#include <stddef.h>

#ifdef __cplusplus
#include "RtypesCore.h"
#endif

#include <ROOT/RConfig.hxx>

#include "RConfigure.h"

#if defined(R__MACOSX)
# if defined(__clang__) && defined(MAC_OS_X_VERSION_10_7) && (defined(__x86_64__) || defined(__i386__))
# define R__HAS___THREAD
Expand Down Expand Up @@ -130,32 +122,32 @@
template <int marker, typename T>
T &TTHREAD_TLS_INIT() {
TTHREAD_TLS(T*) ptr = NULL;
TTHREAD_TLS(Bool_t) isInit(kFALSE);
TTHREAD_TLS(bool) isInit(false);
if (!isInit) {
ptr = new T;
isInit = kTRUE;
isInit = true;
}
return *ptr;
}

template <int marker, typename Array, typename T>
Array &TTHREAD_TLS_INIT_ARRAY() {
TTHREAD_TLS(Array*) ptr = NULL;
TTHREAD_TLS(Bool_t) isInit(kFALSE);
TTHREAD_TLS(bool) isInit(false);
if (!isInit) {
ptr = new Array[sizeof(Array)/sizeof(T)];
isInit = kTRUE;
isInit = true;
}
return *ptr;
}

template <int marker, typename T, typename ArgType>
T &TTHREAD_TLS_INIT(ArgType arg) {
TTHREAD_TLS(T*) ptr = NULL;
TTHREAD_TLS(Bool_t) isInit(kFALSE);
TTHREAD_TLS(bool) isInit(false);
if (!isInit) {
ptr = new T(arg);
isInit = kTRUE;
isInit = true;
}
return *ptr;
}
Expand Down
13 changes: 0 additions & 13 deletions core/lz4/CMakeLists.txt

This file was deleted.

17 changes: 0 additions & 17 deletions core/lzma/CMakeLists.txt

This file was deleted.

3 changes: 1 addition & 2 deletions core/zip/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,7 @@ target_sources(Core PRIVATE
src/RZip.cxx
)

target_link_libraries(Core PRIVATE ZLIB::ZLIB)
target_include_directories(Core PRIVATE ../../builtins/zip)
target_link_libraries(Core PRIVATE ZLIB::ZLIB ROOTzip)

target_include_directories(Core PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/inc>
Expand Down
11 changes: 0 additions & 11 deletions core/zstd/CMakeLists.txt

This file was deleted.