25 #ifndef SRC_XRDZIP_XRDZIPEOCD_HH_
26 #define SRC_XRDZIP_XRDZIPEOCD_HH_
41 inline static const char*
Find(
const char *buffer, uint64_t size )
43 for( ssize_t offset = size -
eocdBaseSize; offset >= 0; --offset )
45 uint32_t signature = to<uint32_t>( buffer + offset );
46 if( signature ==
eocdSign )
return buffer + offset;
54 EOCD(
const char *buffer, uint32_t maxSize = 0 )
56 nbDisk = to<uint16_t>(buffer + 4);
59 nbCdRec = to<uint16_t>(buffer + 10);
60 cdSize = to<uint32_t>(buffer + 12);
61 cdOffset = to<uint32_t>(buffer + 16);
74 EOCD( uint64_t cdoff, uint32_t cdcnt, uint32_t cdsize ):
118 std::copy(
comment.begin(),
comment.end(), std::back_inserter( buffer ) );
126 std::stringstream ss;
127 ss <<
"{nbDisk=" <<
nbDisk;
131 ss <<
";cdSize" <<
cdSize;
134 ss <<
";comment=" <<
comment <<
'}';
std::vector< char > buffer_t
static void copy_bytes(const INT value, buffer_t &buffer)
static const uint16_t eocdBaseSize
static const uint16_t maxCommentLength
std::string ToString()
Convert the EOCD into a string for logging purposes.
EOCD(const char *buffer, uint32_t maxSize=0)
Constructor from buffer.
EOCD(uint64_t cdoff, uint32_t cdcnt, uint32_t cdsize)
Constructor from last LFH + CDFH.
static const uint32_t eocdSign
static const char * Find(const char *buffer, uint64_t size)
void Serialize(buffer_t &buffer)
Serialize the object into a buffer.