From c7af5118e1e55f4f19357eb7ecf44bc7cfbe8ae2 Mon Sep 17 00:00:00 2001
From: Bertrand Bellenot <bertrand.bellenot@cern.ch>
Date: Mon, 2 Oct 2017 14:06:49 +0200
Subject: [PATCH] Fix compilation errors on Windows

- Use TMath::Pi() instead of M_PI (undefined on Windows)
- Replace 'uint' with 'unsigned int'
- Fix error C2057: expected constant expression with newX and newY arrays
---
 hist/hist/src/AnalyticalIntegrals.cxx  | 2 +-
 hist/hist/src/TF1.cxx                  | 2 +-
 hist/histpainter/src/TGraphPainter.cxx | 6 ++++--
 3 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/hist/hist/src/AnalyticalIntegrals.cxx b/hist/hist/src/AnalyticalIntegrals.cxx
index ab0f45f5e6c..aae4061078f 100644
--- a/hist/hist/src/AnalyticalIntegrals.cxx
+++ b/hist/hist/src/AnalyticalIntegrals.cxx
@@ -54,7 +54,7 @@ Double_t AnalyticalIntegral(TF1 *f, Double_t a, Double_t b)
       if (formula->TestBit(TFormula::kNormalized) ) 
          result =  amp*( ROOT::Math::gaussian_cdf(xmax, sigma, mean)- ROOT::Math::gaussian_cdf(xmin, sigma, mean) );
       else
-         result =  amp*sqrt(2*M_PI)*sigma*(ROOT::Math::gaussian_cdf(xmax, sigma, mean)- ROOT::Math::gaussian_cdf(xmin, sigma, mean));//
+         result =  amp*sqrt(2*TMath::Pi())*sigma*(ROOT::Math::gaussian_cdf(xmax, sigma, mean)- ROOT::Math::gaussian_cdf(xmin, sigma, mean));//
    }
    else if (num == 400)//landau: root::math::landau(x,mpv=0,sigma=1,bool norm=false)
    {
diff --git a/hist/hist/src/TF1.cxx b/hist/hist/src/TF1.cxx
index 1442d91aae1..010704ae40b 100644
--- a/hist/hist/src/TF1.cxx
+++ b/hist/hist/src/TF1.cxx
@@ -439,7 +439,7 @@ TF1::TF1(const char *name, const char *formula, Double_t xmin, Double_t xmax, EA
       // Look for single ',' delimiter
       int delimPosition = -1;
       int parenCount = 0;
-      for (uint i = 5; i < strlen(formula) - 1; i++) {
+      for (unsigned int i = 5; i < strlen(formula) - 1; i++) {
          if (formula[i] == '(')
             parenCount++;
          else if (formula[i] == ')')
diff --git a/hist/histpainter/src/TGraphPainter.cxx b/hist/histpainter/src/TGraphPainter.cxx
index 35dc80e2ddb..540eb69647b 100644
--- a/hist/histpainter/src/TGraphPainter.cxx
+++ b/hist/histpainter/src/TGraphPainter.cxx
@@ -3320,8 +3320,8 @@ void TGraphPainter::PaintGraphReverse(TGraph *theGraph, Option_t *option)
    Double_t YA2 = theGraph->GetYaxis()->GetXmax();
    Double_t dX  = XA1+XA2;
    Double_t dY  = YA1+YA2;
-   Double_t newX[N];
-   Double_t newY[N];
+   Double_t *newX = new Double_t[N];
+   Double_t *newY = new Double_t[N];
 
    if (lrx) {
       opt.ReplaceAll("rx", "");
@@ -3407,6 +3407,8 @@ void TGraphPainter::PaintGraphReverse(TGraph *theGraph, Option_t *option)
    theHist->GetYaxis()->SetTickLength(TLY);
    theHist->GetXaxis()->SetAxisColor(XACOL);
    theHist->GetYaxis()->SetAxisColor(YACOL);
+   delete [] newX;
+   delete [] newY;
 }
 
 
-- 
GitLab