Skip to content

Commit

Permalink
Merge pull request root-project#46 from Dr15Jones/philippeFixEmptyArr…
Browse files Browse the repository at this point in the history
…ayIO

Philippe's fix for empty array I/O
  • Loading branch information
ktf committed Oct 23, 2014
2 parents 04ffc30 + 4a3f98d commit 07f1df4
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 0 deletions.
1 change: 1 addition & 0 deletions hist/hist/inc/TH1.h
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,7 @@ class TH1 : public TNamed, public TAttLine, public TAttFill, public TAttMarker {

virtual Double_t Chisquare(TF1 * f1, Option_t *option = "") const;
virtual Double_t ComputeIntegral(Bool_t onlyPositive = false);
TObject* Clone(const char* newname=0) const;
virtual void Copy(TObject &hnew) const;
virtual void DirectoryAutoAdd(TDirectory *);
virtual Int_t DistancetoPrimitive(Int_t px, Int_t py);
Expand Down
19 changes: 19 additions & 0 deletions hist/hist/src/TH1.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -2485,6 +2485,25 @@ void TH1::Copy(TObject &obj) const

}

//______________________________________________________________________________
TObject* TH1::Clone(const char* newname) const
{
TH1* obj = (TH1*)IsA()->GetNew()(0);
Copy(*obj);

//Now handle the parts that Copy doesn't do
if(fFunctions) {
if(not obj->fFunctions) {
obj->fFunctions = new TList;
}
fFunctions->Copy( *(obj->fFunctions) );
}
if(newname and strlen(newname) ) {
obj->SetName(newname);
}
return obj;
}

//______________________________________________________________________________
void TH1::DirectoryAutoAdd(TDirectory *dir)
{
Expand Down
4 changes: 4 additions & 0 deletions io/io/src/TStreamerInfoReadBuffer.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,10 @@
f[j] = new name[*l]; \
b.ReadFastArray(f[j],*l); \
} \
else for(j=0;j<fLength[i];j++) { \
delete [] f[j]; \
f[j] = 0; \
} \
}

#define ReadBasicPointer(name) \
Expand Down

0 comments on commit 07f1df4

Please sign in to comment.