summaryrefslogtreecommitdiff
path: root/var/spack/repos/builtin/packages/heasoft/heasoft-6.29_xspec-12.12.0f.patch
blob: fbd8d3582f9b7b7d78a548e720b37f2bc278e51a (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
--- a/Xspec/src/XSModel/Model/Component/OGIPTable/OGIPTable.cxx	2021-07-13 14:18:31.000000000 -0500
+++ b/Xspec/src/XSModel/Model/Component/OGIPTable/OGIPTable.cxx	2022-02-16 10:51:55.954573553 -0600
@@ -174,6 +174,14 @@
 
     int numbVals = thisParam.getNumberTabulatedValues();
 
+    // If the table parameter has no unit string, heasp may return
+    //  a blank but non-empty string.  Remove leading/trailing blanks here.
+    string unitStr;
+    string::size_type startPos = thisParam.getUnits().find_first_not_of(' ');
+    string::size_type endPos = thisParam.getUnits().find_last_not_of(' ');
+    if (startPos != string::npos && endPos != string::npos)
+       unitStr = thisParam.getUnits().substr(startPos,endPos-startPos+1);
+           
     if (thisParam.getInterpolationMethod() >= 0 && 
 	m_interParam.size() < (size_t)nInterpParams && numbVals > 0) {
       // case of an interpolated parameter
@@ -182,7 +190,7 @@
 			   thisParam.getInitialValue(), thisParam.getDelta(), 
 			   thisParam.getMaximum(), thisParam.getMinimum(), 
 			   thisParam.getTop(), thisParam.getBottom(), 
-			   thisParam.getUnits()));
+			   unitStr));
 
       modParam->numVals(numbVals);
       modParam->setTabValue(thisParam.getTabulatedValues());
@@ -196,7 +204,7 @@
 		      thisParam.getInitialValue(), thisParam.getDelta(), 
 		      thisParam.getMaximum(), thisParam.getMinimum(), 
 		      thisParam.getTop(), thisParam.getBottom(), 
-		      thisParam.getUnits()));
+		      unitStr));
       params().push_back(modPar.release());
       m_addParam.push_back(static_cast<ModParam*>(params().back()));
     }