Skip to content

Commit

Permalink
Avoid confusing/misleading code layout (were triggering misleading in…
Browse files Browse the repository at this point in the history
…dentation warning)
  • Loading branch information
pcanal committed Apr 9, 2016
1 parent ff6289e commit 3e3de3e
Show file tree
Hide file tree
Showing 6 changed files with 82 additions and 51 deletions.
6 changes: 4 additions & 2 deletions gui/gui/src/TGFSContainer.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -649,7 +649,8 @@ void TGFileContainer::GetFilePictures(const TGPicture **pic,
*pic = fClient->GetPicturePool()->GetPicture(lnk_name.Data(),
img1->GetPixmap(), img1->GetMask());
fCleanups->Add(((TObject *)*pic));
if (img2) delete img2; delete img1;
if (img2) delete img2;
delete img1;
}
img1 = TImage::Create();
if (img1) {
Expand All @@ -662,7 +663,8 @@ void TGFileContainer::GetFilePictures(const TGPicture **pic,
*lpic = fClient->GetPicturePool()->GetPicture(lnk_name.Data(),
img1->GetPixmap(), img1->GetMask());
fCleanups->Add(((TObject *)*lpic));
if (img2) delete img2; delete img1;
if (img2) delete img2;
delete img1;
}
}
else {
Expand Down
3 changes: 2 additions & 1 deletion gui/gui/src/TGFileBrowser.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -1194,7 +1194,8 @@ static const TGPicture *MakeLinkPic(const TGPicture *pic)
lnk_name.Prepend("lnk_");
merged = gClient->GetPicturePool()->GetPicture(lnk_name.Data(),
img1->GetPixmap(), img1->GetMask());
if (img2) delete img2; delete img1;
if (img2) delete img2;
delete img1;
return merged;
}
return pic;
Expand Down
79 changes: 50 additions & 29 deletions hist/hist/src/TFormula_v5.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -2731,14 +2731,15 @@ Double_t TFormula::EvalParOld(const Double_t *x, const Double_t *uparams)
case kcosh : tab[pos-1] = TMath::CosH(tab[pos-1]); continue;
case ksinh : tab[pos-1] = TMath::SinH(tab[pos-1]); continue;
case ktanh : if (TMath::CosH(tab[pos-1]) == 0) {tab[pos-1] = 0;} // { tangente indeterminee }
else tab[pos-1] = TMath::TanH(tab[pos-1]);
continue;
else tab[pos-1] = TMath::TanH(tab[pos-1]);
continue;
case kacosh: if (tab[pos-1] < 1) {tab[pos-1] = 0;} // indetermination
else tab[pos-1] = TMath::ACosH(tab[pos-1]);
continue;
else tab[pos-1] = TMath::ACosH(tab[pos-1]);
continue;
case kasinh: tab[pos-1] = TMath::ASinH(tab[pos-1]); continue;
case katanh: if (TMath::Abs(tab[pos-1]) > 1) {tab[pos-1] = 0;} // indetermination
else tab[pos-1] = TMath::ATanH(tab[pos-1]); continue;
else tab[pos-1] = TMath::ATanH(tab[pos-1]);
continue;
case katan2: pos--; tab[pos-1] = TMath::ATan2(tab[pos-1],tab[pos]); continue;

case kfmod : pos--; tab[pos-1] = fmod(tab[pos-1],tab[pos]); continue;
Expand All @@ -2748,21 +2749,22 @@ Double_t TFormula::EvalParOld(const Double_t *x, const Double_t *uparams)

case kstrstr : strpos -= 2; pos-=2; pos++;
if (strstr(stringStack[strpos],stringStack[strpos+1])) tab[pos-1]=1;
else tab[pos-1]=0; continue;
else tab[pos-1]=0;
continue;

case kmin : pos--; tab[pos-1] = TMath::Min(tab[pos-1],tab[pos]); continue;
case kmax : pos--; tab[pos-1] = TMath::Max(tab[pos-1],tab[pos]); continue;

case klog : if (tab[pos-1] > 0) tab[pos-1] = TMath::Log(tab[pos-1]);
else {tab[pos-1] = 0;} //{indetermination }
continue;
else {tab[pos-1] = 0;} //{indetermination }
continue;
case kexp : { Double_t dexp = tab[pos-1];
if (dexp < -700) {tab[pos-1] = 0; continue;}
if (dexp > 700) {tab[pos-1] = TMath::Exp(700); continue;}
tab[pos-1] = TMath::Exp(dexp); continue; }
case klog10: if (tab[pos-1] > 0) tab[pos-1] = TMath::Log10(tab[pos-1]);
else {tab[pos-1] = 0;} //{indetermination }
continue;
else {tab[pos-1] = 0;} //{indetermination }
continue;

case kpi : pos++; tab[pos-1] = TMath::ACos(-1); continue;

Expand All @@ -2775,30 +2777,41 @@ Double_t TFormula::EvalParOld(const Double_t *x, const Double_t *uparams)
case krndm : pos++; tab[pos-1] = gRandom->Rndm(1); continue;

case kAnd : pos--; if (tab[pos-1]!=0 && tab[pos]!=0) tab[pos-1]=1;
else tab[pos-1]=0; continue;
else tab[pos-1]=0;
continue;
case kOr : pos--; if (tab[pos-1]!=0 || tab[pos]!=0) tab[pos-1]=1;
else tab[pos-1]=0; continue;
else tab[pos-1]=0;
continue;
case kEqual: pos--; if (tab[pos-1] == tab[pos]) tab[pos-1]=1;
else tab[pos-1]=0; continue;
else tab[pos-1]=0;
continue;
case kNotEqual : pos--; if (tab[pos-1] != tab[pos]) tab[pos-1]=1;
else tab[pos-1]=0; continue;
else tab[pos-1]=0;
continue;
case kLess : pos--; if (tab[pos-1] < tab[pos]) tab[pos-1]=1;
else tab[pos-1]=0; continue;
else tab[pos-1]=0;
continue;
case kGreater : pos--; if (tab[pos-1] > tab[pos]) tab[pos-1]=1;
else tab[pos-1]=0; continue;
else tab[pos-1]=0;
continue;

case kLessThan: pos--; if (tab[pos-1]<=tab[pos]) tab[pos-1]=1;
else tab[pos-1]=0; continue;
else tab[pos-1]=0;
continue;
case kGreaterThan: pos--; if (tab[pos-1]>=tab[pos]) tab[pos-1]=1;
else tab[pos-1]=0; continue;
case kNot : if (tab[pos-1]!=0) tab[pos-1] = 0; else tab[pos-1] = 1; continue;
else tab[pos-1]=0;
continue;
case kNot : if (tab[pos-1]!=0) tab[pos-1] = 0; else tab[pos-1] = 1;
continue;

case kStringEqual : strpos -= 2; pos -=2 ; pos++;
if (!strcmp(stringStack[strpos+1],stringStack[strpos])) tab[pos-1]=1;
else tab[pos-1]=0; continue;
else tab[pos-1]=0;
continue;
case kStringNotEqual: strpos -= 2; pos -= 2; pos++;
if (strcmp(stringStack[strpos+1],stringStack[strpos])) tab[pos-1]=1;
else tab[pos-1]=0; continue;
else tab[pos-1]=0;
continue;

case kBitAnd : pos--; tab[pos-1]= ((Int_t) tab[pos-1]) & ((Int_t) tab[pos]); continue;
case kBitOr : pos--; tab[pos-1]= ((Int_t) tab[pos-1]) | ((Int_t) tab[pos]); continue;
Expand Down Expand Up @@ -4247,10 +4260,12 @@ Double_t TFormula::EvalParFast(const Double_t *x, const Double_t *uparams)
//
switch(opcode) {
case kBoolOptimizeAnd: {
if (!tab[pos-1]) i=fOperOffset[i].fToJump; continue;
if (!tab[pos-1]) i=fOperOffset[i].fToJump;
continue;
}
case kBoolOptimizeOr: {
if (tab[pos-1]) i=fOperOffset[i].fToJump; continue;
if (tab[pos-1]) i=fOperOffset[i].fToJump;
continue;
}
case kAnd : pos--; tab[pos-1] = (bool)tab[pos]; continue; // use the fact that other were check before - see bool optimize
case kOr : pos--; tab[pos-1] = (bool)tab[pos]; continue;
Expand All @@ -4274,7 +4289,8 @@ Double_t TFormula::EvalParFast(const Double_t *x, const Double_t *uparams)

case kstrstr : strpos -= 2; pos-=2; pos++;
if (strstr(stringStack[strpos],stringStack[strpos+1])) tab[pos-1]=1;
else tab[pos-1]=0; continue;
else tab[pos-1]=0;
continue;
case kpi : pos++; tab[pos-1] = TMath::ACos(-1); continue;


Expand All @@ -4284,17 +4300,22 @@ Double_t TFormula::EvalParFast(const Double_t *x, const Double_t *uparams)


case kEqual: pos--; if (tab[pos-1] == tab[pos]) tab[pos-1]=1;
else tab[pos-1]=0; continue;
else tab[pos-1]=0;
continue;
case kNotEqual : pos--; if (tab[pos-1] != tab[pos]) tab[pos-1]=1;
else tab[pos-1]=0; continue;
case kNot : if (tab[pos-1]!=0) tab[pos-1] = 0; else tab[pos-1] = 1; continue;
else tab[pos-1]=0;
continue;
case kNot : if (tab[pos-1]!=0) tab[pos-1] = 0; else tab[pos-1] = 1;
continue;

case kStringEqual : strpos -= 2; pos -=2 ; pos++;
if (!strcmp(stringStack[strpos+1],stringStack[strpos])) tab[pos-1]=1;
else tab[pos-1]=0; continue;
else tab[pos-1]=0;
continue;
case kStringNotEqual: strpos -= 2; pos -= 2; pos++;
if (strcmp(stringStack[strpos+1],stringStack[strpos])) tab[pos-1]=1;
else tab[pos-1]=0; continue;
else tab[pos-1]=0;
continue;

case kBitAnd : pos--; tab[pos-1]= ((Int_t) tab[pos-1]) & ((Int_t) tab[pos]); continue;
case kBitOr : pos--; tab[pos-1]= ((Int_t) tab[pos-1]) | ((Int_t) tab[pos]); continue;
Expand Down
3 changes: 2 additions & 1 deletion math/mlp/src/TMLPAnalyzer.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,8 @@ void TMLPAnalyzer::GatherInformations()
delete[] outVal;
delete[] trueVal;
delete[] index;
for(i=0; i<GetNeurons(1); i++) delete formulas[i]; delete [] formulas;
for(i=0; i<GetNeurons(1); i++) delete formulas[i];
delete [] formulas;
fAnalysisTree->ResetBranchAddresses();
fIOTree->ResetBranchAddresses();
}
Expand Down
21 changes: 10 additions & 11 deletions tree/tree/src/TTreeCacheUnzip.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -1130,18 +1130,17 @@ Int_t TTreeCacheUnzip::UnzipCache(Int_t &startindex, Int_t &locbuffsz, char *&lo
locbuffsz = rdlen;
locbuff = new char[locbuffsz];
//memset(locbuff, 0, locbuffsz);
} else
if(locbuffsz > rdlen*3) {
if (locbuff) delete [] locbuff;
locbuffsz = rdlen*2;
locbuff = new char[locbuffsz];
//memset(locbuff, 0, locbuffsz);
}

if (gDebug > 0)
Info("UnzipCache", "Going to unzip block %d", idxtounzip);
} else if(locbuffsz > rdlen*3) {
if (locbuff) delete [] locbuff;
locbuffsz = rdlen*2;
locbuff = new char[locbuffsz];
//memset(locbuff, 0, locbuffsz);
}

if (gDebug > 0)
Info("UnzipCache", "Going to unzip block %d", idxtounzip);

readbuf = ReadBufferExt(locbuff, rdoffs, rdlen, loc);
readbuf = ReadBufferExt(locbuff, rdoffs, rdlen, loc);

{
R__LOCKGUARD(fMutexList);
Expand Down
21 changes: 14 additions & 7 deletions tree/treeplayer/src/TTreeFormula.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -4026,7 +4026,8 @@ T TTreeFormula::EvalInstance(Int_t instance, const char *stringStackArg[])
continue;
case kasinh: tab[pos-1] = TMath::ASinH(tab[pos-1]); continue;
case katanh: if (TMath::Abs(tab[pos-1]) > 1) {tab[pos-1] = 0;} // indetermination
else tab[pos-1] = TMath::ATanH(tab[pos-1]); continue;
else tab[pos-1] = TMath::ATanH(tab[pos-1]);
continue;
case katan2: pos--; tab[pos-1] = TMath::ATan2(tab[pos-1],tab[pos]); continue;

case kfmod : pos--; tab[pos-1] = fmod_local(tab[pos-1],tab[pos]); continue;
Expand All @@ -4035,7 +4036,8 @@ T TTreeFormula::EvalInstance(Int_t instance, const char *stringStackArg[])
case ksqrt : tab[pos-1] = TMath::Sqrt(TMath::Abs(tab[pos-1])); continue;

case kstrstr : pos2 -= 2; pos++;if (strstr(stringStack[pos2],stringStack[pos2+1])) tab[pos-1]=1;
else tab[pos-1]=0; continue;
else tab[pos-1]=0;
continue;

case kmin : pos--; tab[pos-1] = std::min(tab[pos-1],tab[pos]); continue;
case kmax : pos--; tab[pos-1] = std::max(tab[pos-1],tab[pos]); continue;
Expand All @@ -4055,15 +4057,18 @@ T TTreeFormula::EvalInstance(Int_t instance, const char *stringStackArg[])
case kpi : pos++; tab[pos-1] = TMath::ACos(-1); continue;

case kabs : tab[pos-1] = TMath::Abs(tab[pos-1]); continue;
case ksign : if (tab[pos-1] < 0) tab[pos-1] = -1; else tab[pos-1] = 1; continue;
case ksign : if (tab[pos-1] < 0) tab[pos-1] = -1; else tab[pos-1] = 1;
continue;
case kint : tab[pos-1] = T(Long64_t(tab[pos-1])); continue;
case kSignInv: tab[pos-1] = -1 * tab[pos-1]; continue;
case krndm : pos++; tab[pos-1] = gRandom->Rndm(1); continue;

case kAnd : pos--; if (tab[pos-1]!=0 && tab[pos]!=0) tab[pos-1]=1;
else tab[pos-1]=0; continue;
else tab[pos-1]=0;
continue;
case kOr : pos--; if (tab[pos-1]!=0 || tab[pos]!=0) tab[pos-1]=1;
else tab[pos-1]=0; continue;
else tab[pos-1]=0;
continue;

case kEqual : pos--; tab[pos-1] = (tab[pos-1] == tab[pos]) ? 1 : 0; continue;
case kNotEqual : pos--; tab[pos-1] = (tab[pos-1] != tab[pos]) ? 1 : 0; continue;
Expand All @@ -4074,9 +4079,11 @@ T TTreeFormula::EvalInstance(Int_t instance, const char *stringStackArg[])
case kNot : tab[pos-1] = (tab[pos-1] != 0) ? 0 : 1; continue;

case kStringEqual : pos2 -= 2; pos++; if (!strcmp(stringStack[pos2+1],stringStack[pos2])) tab[pos-1]=1;
else tab[pos-1]=0; continue;
else tab[pos-1]=0;
continue;
case kStringNotEqual: pos2 -= 2; pos++;if (strcmp(stringStack[pos2+1],stringStack[pos2])) tab[pos-1]=1;
else tab[pos-1]=0; continue;
else tab[pos-1]=0;
continue;

case kBitAnd : pos--; tab[pos-1]= ((ULong64_t) tab[pos-1]) & ((ULong64_t) tab[pos]); continue;
case kBitOr : pos--; tab[pos-1]= ((ULong64_t) tab[pos-1]) | ((ULong64_t) tab[pos]); continue;
Expand Down

0 comments on commit 3e3de3e

Please sign in to comment.