100 const Int_t kBUFSIZE = 1024;
103 char buf[kBUFSIZE+4];
116 Error(
"FindEndHeader",
"error reading %d bytes at %lld",
n, pos);
120 for (
Int_t i =
n - 4; i > 0; i--)
121 if (buf[i] == 0x50 && buf[i+1] == 0x4b &&
122 buf[i+2] == 0x05 && buf[i+3] == 0x06) {
153 Error(
"ReadEndHeader",
"error reading %d end header bytes from %s",
166 if (disk != 0 || dirdisk != 0) {
167 Error(
"ReadHeader",
"only single disk archives are supported in %s",
171 if (dhdrs != thdrs) {
172 Error(
"ReadEndHeader",
"inconsistency in end header data in %s",
177 char *comment =
new char[commlen+1];
179 Error(
"ReadEndHeader",
"error reading %d end header comment bytes from %s",
184 comment[commlen] =
'\0';
224 Error(
"ReadZip64EndLocator",
"error reading %d Zip64 end locator header bytes from %s",
233 if (dirdisk != 0 || totdisk != 1) {
234 Error(
"ReadZip64EndLocator",
"only single disk archives are supported in %s",
254 Error(
"ReadZip64EndRecord",
"no Zip64 end of directory record\n");
260 Error(
"ReadZip64EndRecord",
"error reading %d Zip64 end record header bytes from %s",
287 Error(
"ReadDirectory",
"wrong directory header magic in %s",
296 Error(
"ReadDirectory",
"error reading %d directory bytes from %s",
326 Error(
"ReadDirectory",
"inconsistency in directory data in %s",
331 char *
name =
new char[namelen+1];
332 char *extra =
new char[extlen];
333 char *comment =
new char[commlen+1];
337 Error(
"ReadDirectory",
"error reading additional directory data from %s",
344 name[namelen] =
'\0';
345 comment[commlen] =
'\0';
353 : (flags & 6)/2 == 0 ? 3
354 : (flags & 6)/2 == 1 ? 9
355 : (flags & 6)/2 == 2 ? 2
356 : (flags & 6)/2 == 3 ? 1
361 m->fModTime.Set(time,
kTRUE);
362 m->fGlobalLen = extlen;
364 m->fComment = comment;
377 Info(
"ReadDirectory",
"%lld %lld %s %s",
378 m->GetDecompressedSize(),
m->GetCompressedSize(),
379 m->GetModTime().AsSQLString(),
m->
GetName());
383 Error(
"ReadDirectory",
"error reading %d directory bytes from %s",
414 Error(
"ReadMemberHeader",
"wrong entry header magic in %s",
421 Error(
"ReadMemberHeader",
"error reading %d member header bytes from %s",
448 buf = (
char *)
m->fGlobal;
451 buf = (
char *)
m->fLocal;
519 Error(
"Get",
"can not read > 4 byte integers, use Get64");
525 const UChar_t *buf =
static_cast<const unsigned char *
>(buffer);
527 value += *buf << shift;
540 Error(
"Get64",
"bytes must be 8 (asked for %d)",
bytes);
547 const UChar_t *buf =
static_cast<const unsigned char *
>(buffer);
549 value += *buf << shift;
672 printf(
"%-20lld",
fDsize);
size_t size(const MatrixT &matrix)
retrieve the size of a square matrix
constexpr UInt_t kMaxUInt
unsigned long long ULong64_t
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 offset
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void value
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 Atom_t Time_t UChar_t len
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 bytes
Class describing an archive file containing multiple sub-files, like a ZIP or TAR archive.
TArchiveMember * fCurMember
Current archive member.
TString fMemberName
Sub-file name.
TString fArchiveName
Archive file name.
Int_t fMemberIndex
Index of sub-file in archive.
TObjArray * fMembers
Members in this archive.
TFile * fFile
File stream used to access the archive.
TDatime fModTime
Modification time.
Long64_t fPosition
Byte position in archive.
Long64_t fFilePosition
Byte position in archive where member data starts.
TArchiveMember & operator=(const TArchiveMember &rhs)
Assignment operator.
TString fName
Name of member.
const char * GetName() const override
Returns name of object.
Long64_t fDsize
Decompressed size.
void Print(Option_t *option="") const override
Default print for collections, calls Print(option, 1).
const char * AsSQLString() const
Return the date & time in SQL compatible string format, like: 1997-01-15 20:16:28.
A ROOT file is a suite of consecutive data records (TKey instances) with a well defined format.
virtual void Seek(Long64_t offset, ERelativeTo pos=kBeg)
Seek to a specific position in the file. Pos it either kBeg, kCur or kEnd.
virtual Long64_t GetSize() const
Returns the current file size.
virtual Bool_t ReadBuffer(char *buf, Int_t len)
Read a buffer from the file.
Int_t GetEntriesFast() const
TObject * At(Int_t idx) const override
void Add(TObject *obj) override
virtual const char * GetName() const
Returns name of object.
virtual void Error(const char *method, const char *msgfmt,...) const
Issue error message.
virtual void Info(const char *method, const char *msgfmt,...) const
Issue info message.
const char * Data() const
Describes a ZIP archive file containing multiple sub-files.
Long64_t fDirPos
Central directory position.
Int_t ReadMemberHeader(TZIPMember *member)
Read the member header of the ZIP archive.
void Print(Option_t *option="") const override
Pretty print ZIP archive members.
Int_t DecodeZip64ExtendedExtraField(TZIPMember *m, Bool_t global=kTRUE)
Decode the Zip64 extended extra field.
Long64_t ReadZip64EndLocator(Long64_t pos)
Read Zip64 end of central directory locator.
Long64_t fDirSize
Central directory size.
Int_t ReadZip64EndRecord(Long64_t pos)
Read Zip64 end of central directory record.
UInt_t Get(const void *buffer, Int_t bytes)
Read a "bytes" long little-endian integer value from "buffer".
Int_t ReadDirectory()
Read the directory of the ZIP archive.
Int_t ReadEndHeader(Long64_t pos)
Read the end header of the ZIP archive including the archive comment at the current file position.
Int_t SetCurrentMember() override
Find the desired member in the member array and make it the current member.
ULong64_t Get64(const void *buffer, Int_t bytes)
Read a 8 byte long little-endian integer value from "buffer".
Long64_t FindEndHeader()
Find the end header of the ZIP archive. Returns 0 in case of error.
Long64_t fDirOffset
Central directory offset (from the beginning of the archive)
TString fComment
Archive comment.
Int_t OpenArchive() override
Open archive and read end-header and directory.
@ kZIP64_EXTENDED_MAGIC_OFF
@ kZIP64_EDR_DIR_SIZE_LEN
@ kZIP64_EXTENDED_USIZE_OFF
@ kZIP64_EXTENDED_CSIZE_LEN
@ kZIP64_EXTENTED_CSIZE_OFF
@ kZIP64_EDR_DIR_SIZE_OFF
@ kZIP64_EXTENDED_USIZE_LEN
@ kZIP64_EDL_TOTAL_DISK_OFF
@ kZIP64_EDL_REC_OFFSET_OFF
@ kDEFLATED
Stored using deflate.
@ kZIP64_EXTENDED_HDR_OFFSET_LEN
@ kZIP64_EXTENDED_SIZE_LEN
@ kZIP64_EXTENDED_MAGIC
Zip64 Extended Information Extra Field.
@ kZIP64_EDL_REC_OFFSET_LEN
@ kZIP64_EDL_TOTAL_DISK_LEN
@ kZIP64_EDR_DIR_OFFSET_OFF
@ kZIP64_EDR_HEADER_MAGIC
@ kZIP64_EDR_DIR_OFFSET_LEN
@ kMAX_VAR_LEN
Max variable-width field length.
@ kZIP64_EDL_HEADER_MAGIC
@ kZIP64_EXTENDED_SIZE_OFF
@ kZIP_MAGIC_LEN
Length of magic's.
@ kZIP64_EXTENDED_MAGIC_LEN
@ kZIP64_EXTENDED_HDR_OFFSET_OFF
A ZIP archive consists of files compressed with the popular ZLIB compression algorithm; this class re...
UInt_t fLevel
Compression level.
UInt_t fGlobalLen
Length of extra directory data.
UInt_t fCRC32
CRC-32 for all decompressed data.
UInt_t fAttrInt
Internal file attributes.
UInt_t fLocalLen
Length of extra file header data.
virtual ~TZIPMember()
Cleanup.
TZIPMember()
Default ctor.
UInt_t fMethod
Compression type.
void Print(Option_t *option="") const override
Pretty print basic ZIP member info.
UInt_t fAttrExt
External file attributes.
TZIPMember & operator=(const TZIPMember &rhs)
Assignment operator.
void * fGlobal
Extra directory data.
void * fLocal
Extra file header data.
Short_t Min(Short_t a, Short_t b)
Returns the smallest of a and b.