Import Geant4 11.3.0 source tree
This commit is contained in:
+1
-10
@@ -183,6 +183,7 @@ public:
|
||||
uint32 last() const {return m_last;}
|
||||
|
||||
void set_nev(uint32 a_last,uint32 a_nev_buf_size,uint32 a_nev,const int* a_entry_offset,const int* a_displacement) {
|
||||
//used in mpi_create_basket.
|
||||
m_last = a_last;
|
||||
m_nev_buf_size = a_nev_buf_size;
|
||||
m_nev = a_nev;
|
||||
@@ -306,16 +307,6 @@ public:
|
||||
bool kdelete = false;
|
||||
a_file.compress_buffer(m_data,kbuf,klen,kdelete);
|
||||
|
||||
if(klen>m_object_size) {
|
||||
m_out << "tools::wroot::basket::write_on_file :"
|
||||
<< " compression anomaly "
|
||||
<< " m_object_size " << m_object_size
|
||||
<< " klen " << klen
|
||||
<< std::endl;
|
||||
if(kdelete) delete [] kbuf;
|
||||
return false;
|
||||
}
|
||||
|
||||
if(!initialize(a_file,klen)) { //it will do a m_seek_key = a_file.END() and then a_file.set_END(...)
|
||||
m_out << "tools::wroot::basket::write_on_file :"
|
||||
<< " initialize() failed."
|
||||
|
||||
+2
-2
@@ -151,13 +151,13 @@ public:
|
||||
}
|
||||
|
||||
template <class T>
|
||||
bool write_array(const std::vector<T> a_v) {
|
||||
bool write_array(const std::vector<T>& a_v) {
|
||||
if(!write((uint32)a_v.size())) return false;
|
||||
return write_fast_array(a_v);
|
||||
}
|
||||
|
||||
template <class T>
|
||||
bool write_array2(const std::vector< std::vector<T> > a_v) {
|
||||
bool write_array2(const std::vector< std::vector<T> >& a_v) {
|
||||
if(!write((uint32)a_v.size())) return false;
|
||||
for(unsigned int index=0;index<a_v.size();index++) {
|
||||
if(!write_array(a_v[index])) return false;
|
||||
|
||||
@@ -399,7 +399,7 @@
|
||||
protected:
|
||||
std_vector_column_ref(const std_vector_column_ref& a_from)
|
||||
:icol(a_from)
|
||||
,m_branch(a_from.m_barnch)
|
||||
,m_branch(a_from.m_branch)
|
||||
,m_ref(a_from.m_ref)
|
||||
,m_leaf(0)
|
||||
,m_leaf_count(0)
|
||||
|
||||
+23
-10
@@ -167,7 +167,7 @@ public: //ifile
|
||||
}
|
||||
virtual uint32 compression() const {return m_compress;}
|
||||
virtual void compress_buffer(const buffer& a_buffer,char*& a_kbuf,uint32& a_klen,bool& a_kdel) {
|
||||
//NOTE : if(kdelete) delete [] kbuf;
|
||||
//NOTE: if(kdelete) delete [] kbuf;
|
||||
|
||||
a_kbuf = 0;
|
||||
a_klen = 0;
|
||||
@@ -178,7 +178,7 @@ public: //ifile
|
||||
if(cxlevel && (nbytes>256)) {
|
||||
compress_func func;
|
||||
if(!ziper('Z',func)) {
|
||||
//m_out << "tools::wroot::directory::write_object :"
|
||||
//m_out << "tools::wroot::file::compress_buffer :"
|
||||
// << " zlib ziper not found."
|
||||
// << std::endl;
|
||||
a_kbuf = (char*)a_buffer.buf();
|
||||
@@ -188,7 +188,8 @@ public: //ifile
|
||||
const uint32 kMAXBUF = 0xffffff;
|
||||
const uint32 HDRSIZE = 9;
|
||||
uint32 nbuffers = nbytes/kMAXBUF;
|
||||
uint32 buflen = nbytes+HDRSIZE*(nbuffers+1);
|
||||
uint32 buf_out_size = kMAXBUF+HDRSIZE+kMAXBUF/2;
|
||||
uint32 buflen = (nbuffers+1)*buf_out_size;
|
||||
a_kbuf = new char[buflen];
|
||||
a_kdel = true;
|
||||
char* src = (char*)a_buffer.buf();
|
||||
@@ -197,19 +198,30 @@ public: //ifile
|
||||
for(uint32 i=0;i<=nbuffers;i++) {
|
||||
uint32 bufmax = ((i == nbuffers) ? nbytes - nzip : kMAXBUF);
|
||||
uint32 nout;
|
||||
if(!zip(m_out,func,cxlevel,bufmax,src,bufmax,tgt,nout)) {
|
||||
if(!zip(m_out,func,cxlevel,bufmax,src,buf_out_size,tgt,nout)) {
|
||||
delete [] a_kbuf;
|
||||
a_kbuf = (char*)a_buffer.buf();
|
||||
a_klen = a_buffer.length();
|
||||
a_kdel = false;
|
||||
break;
|
||||
return;
|
||||
}
|
||||
tgt += nout; //nout includes HDRSIZE
|
||||
a_klen += nout;
|
||||
src += kMAXBUF;
|
||||
nzip += kMAXBUF;
|
||||
}
|
||||
//::printf("debug : compress : end : %u %u\n",nbytes,klen);
|
||||
if(a_klen>=a_buffer.length()) {
|
||||
//NOTE: It is in the ROOT/IO specification (see ROOT/TKey.cxx/TKey::ReadObj() code) that some data compressions
|
||||
// are detected at read time by checking that "fObjlen > fNbytes-fKeylen", that is to say that
|
||||
// the overall output size (fNbytes-fKeylen) is stricly lower than the input size (fObjlen).
|
||||
// By using the zlib-ng compression library, we saw that we may fall on cases where the overall
|
||||
// output size (a_klen here at this point) may be equal to the input size (a_buffer.lengt()) which
|
||||
// induces problem when reading back the data with ROOT. Then the upper test checks and protects against that.
|
||||
delete [] a_kbuf;
|
||||
a_kbuf = (char*)a_buffer.buf();
|
||||
a_klen = a_buffer.length();
|
||||
a_kdel = false;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
a_kbuf = (char*)a_buffer.buf();
|
||||
@@ -714,14 +726,14 @@ protected:
|
||||
const uint32 HDRSIZE = 9;
|
||||
|
||||
if(a_tgtsize<HDRSIZE) {
|
||||
a_out << "tools::wroot::directory::zip :"
|
||||
a_out << "tools::wroot::file::zip :"
|
||||
<< " target buffer too small."
|
||||
<< std::endl;
|
||||
a_irep = 0;
|
||||
return false;
|
||||
}
|
||||
if(a_srcsize>0xffffff) {
|
||||
a_out << "tools::wroot::directory::zip :"
|
||||
a_out << "tools::wroot::file::zip :"
|
||||
<< " source buffer too big."
|
||||
<< std::endl;
|
||||
a_irep = 0;
|
||||
@@ -733,14 +745,15 @@ protected:
|
||||
a_srcsize,a_src,
|
||||
a_tgtsize,a_tgt+HDRSIZE,
|
||||
out_size)) {
|
||||
a_out << "tools::wroot::directory::zip :"
|
||||
a_out << "tools::wroot::file::zip :"
|
||||
<< " zipper failed."
|
||||
<< std::endl;
|
||||
a_irep = 0;
|
||||
return false;
|
||||
}
|
||||
|
||||
if((HDRSIZE+out_size)>a_tgtsize) {
|
||||
a_out << "tools::wroot::directory::zip :"
|
||||
a_out << "tools::wroot::file::zip :"
|
||||
<< " target buffer overflow."
|
||||
<< std::endl;
|
||||
a_irep = 0;
|
||||
|
||||
Reference in New Issue
Block a user