diff --git a/src/any2many.cpp b/src/any2many.cpp
index 7aedf3ea..852c2253 100644
--- a/src/any2many.cpp
+++ b/src/any2many.cpp
@@ -418,9 +418,6 @@ int main(int argc, char *argv[])
}
// read startup file
- fstream xmlFile;
- unsigned int xmlSize = 0;
- char *xmlBuffer = 0;
char startup_path_name[128];
TSAXParser *saxParser = new TSAXParser();
PStartupHandler *startupHandler = new PStartupHandler();
@@ -440,22 +437,9 @@ int main(int argc, char *argv[])
strcpy(startup_path_name, startupHandler->GetStartupFilePath().Data());
saxParser->ConnectToHandler("PStartupHandler", startupHandler);
//status = saxParser->ParseFile(startup_path_name);
- // parsing the file as above seems to lead to problems in certain environments; try working around through a buffer as follows
- xmlFile.open(startup_path_name, ios::in | ios::ate); // open file for reading and go to the end of the file
- if (xmlFile.is_open()) { // check if file has been opened successfully
- xmlSize = xmlFile.tellg(); // get the position within the stream == size of the file (since we are at the end)
- xmlFile.seekg(0, ios::beg); // go back to the beginning of the stream
- xmlBuffer = new char[xmlSize]; // allocate buffer memory for the whole XML file
- xmlFile.read(xmlBuffer, xmlSize); // read in the whole XML file into the buffer
- xmlFile.close(); // close the XML file
- }
- if (!xmlBuffer) { // file has not been read into the buffer
- status = 1;
- } else {
- status = saxParser->ParseBuffer(xmlBuffer, xmlSize); // parse buffer
- delete[] xmlBuffer; // free the buffer memory
- xmlBuffer = 0;
- }
+ // parsing the file as above seems to lead to problems in certain environments;
+ // use the parseXmlFile function instead (see PStartupHandler.cpp for the definition)
+ status = parseXmlFile(saxParser, startup_path_name);
// check for parse errors
if (status) { // error
cerr << endl << ">> any2many **WARNING** Reading/parsing musrfit_startup.xml failed.";
diff --git a/src/classes/PMsr2Data.cpp b/src/classes/PMsr2Data.cpp
index 0afae35e..24a8fd8e 100644
--- a/src/classes/PMsr2Data.cpp
+++ b/src/classes/PMsr2Data.cpp
@@ -415,35 +415,19 @@ int PMsr2Data::SetRunNumbers(const string &runListFile)
*
*
return:
* - 0 if everything went fine
- * - return value of the ParseFile-method otherwise
+ * - return value of the parseXmlFile function otherwise
*/
int PMsr2Data::ParseXmlStartupFile()
{
- fstream xmlFile;
- unsigned int xmlSize = 0;
- char *xmlBuffer = 0;
int status;
fSaxParser = new TSAXParser();
fStartupHandler = new PStartupHandler();
string startup_path_name(fStartupHandler->GetStartupFilePath().Data());
fSaxParser->ConnectToHandler("PStartupHandler", fStartupHandler);
//status = fSaxParser->ParseFile(startup_path_name.c_str());
- // parsing the file as above seems to lead to problems in certain environments; try working around through a buffer as follows
- xmlFile.open(startup_path_name.c_str(), ios::in | ios::ate); // open file for reading and go to the end of the file
- if (xmlFile.is_open()) { // check if file has been opened successfully
- xmlSize = xmlFile.tellg(); // get the position within the stream == size of the file (since we are at the end)
- xmlFile.seekg(0, ios::beg); // go back to the beginning of the stream
- xmlBuffer = new char[xmlSize]; // allocate buffer memory for the whole XML file
- xmlFile.read(xmlBuffer, xmlSize); // read in the whole XML file into the buffer
- xmlFile.close(); // close the XML file
- }
- if (!xmlBuffer) { // file has not been read into the buffer
- status = 1;
- } else {
- status = fSaxParser->ParseBuffer(xmlBuffer, xmlSize); // parse buffer
- delete[] xmlBuffer; // free the buffer memory
- xmlBuffer = 0;
- }
+ // parsing the file as above seems to lead to problems in certain environments;
+ // use the parseXmlFile function instead (see PStartupHandler.cpp for the definition)
+ status = parseXmlFile(fSaxParser, startup_path_name.c_str());
// check for parse errors
if (status) { // error
cerr << endl << ">> msr2data: **WARNING** Reading/parsing musrfit_startup.xml failed." << endl;
diff --git a/src/classes/PStartupHandler.cpp b/src/classes/PStartupHandler.cpp
index 76b49ae6..160facd7 100644
--- a/src/classes/PStartupHandler.cpp
+++ b/src/classes/PStartupHandler.cpp
@@ -42,6 +42,47 @@ using namespace std;
ClassImpQ(PStartupHandler)
+//--------------------------------------------------------------------------
+// This function is a replacement for the ParseFile method of TSAXParser.
+// It is needed because in certain environments ParseFile does not work but ParseBuffer does.
+//--------------------------------------------------------------------------
+/**
+ *
Replacement for the ParseFile method of TSAXParser.
+ *
+ *
return:
+ * - 1 if file cannot be read
+ * - 0 if the file has been parsed successfully
+ * - parse error code otherwise
+ *
+ * \param saxParser pointer to a TSAXParser object
+ * \param startup_path_name full path to the XML file to be read
+ */
+int parseXmlFile(TSAXParser *saxParser, const char *startup_path_name)
+{
+ int status;
+ fstream xmlFile;
+ unsigned int xmlSize = 0;
+ char *xmlBuffer = 0;
+
+ xmlFile.open(startup_path_name, ios::in | ios::ate); // open file for reading and go to the end of the file
+ if (xmlFile.is_open()) { // check if file has been opened successfully
+ xmlSize = xmlFile.tellg(); // get the position within the stream == size of the file (since we are at the end)
+ xmlFile.seekg(0, ios::beg); // go back to the beginning of the stream
+ xmlBuffer = new char[xmlSize]; // allocate buffer memory for the whole XML file
+ xmlFile.read(xmlBuffer, xmlSize); // read in the whole XML file into the buffer
+ xmlFile.close(); // close the XML file
+ }
+ if (!xmlBuffer) { // file has not been read into the buffer
+ status = 1;
+ } else {
+ status = saxParser->ParseBuffer(xmlBuffer, xmlSize); // parse buffer
+ delete[] xmlBuffer; // free the buffer memory
+ xmlBuffer = 0;
+ }
+
+ return status;
+}
+
//--------------------------------------------------------------------------
// Constructor
//--------------------------------------------------------------------------
diff --git a/src/classes/PUserFcnBase.cpp b/src/classes/PUserFcnBase.cpp
index 3f40af50..34817cb9 100644
--- a/src/classes/PUserFcnBase.cpp
+++ b/src/classes/PUserFcnBase.cpp
@@ -30,6 +30,7 @@
***************************************************************************/
#include
+#include
using namespace std;
#include "PUserFcnBase.h"
@@ -56,5 +57,47 @@ PUserFcnBase::~PUserFcnBase()
{
}
+//--------------------------------------------------------------------------
+// This function is a replacement for the ParseFile method of TSAXParser.
+// It is needed because in certain environments ParseFile does not work but ParseBuffer does.
+//--------------------------------------------------------------------------
+/**
+ * Replacement for the ParseFile method of TSAXParser
+ * that can be used in user functions.
+ *
+ *
return:
+ * - 1 if file cannot be read
+ * - 0 if the file has been parsed successfully
+ * - parse error code otherwise
+ *
+ * \param saxParser pointer to a TSAXParser object
+ * \param startup_path_name full path to the XML file to be read
+ */
+Int_t parseXmlFile(TSAXParser *saxParser, const char *startup_path_name)
+{
+ Int_t status;
+ fstream xmlFile;
+ UInt_t xmlSize = 0;
+ Char_t *xmlBuffer = 0;
+
+ xmlFile.open(startup_path_name, ios::in | ios::ate); // open file for reading and go to the end of the file
+ if (xmlFile.is_open()) { // check if file has been opened successfully
+ xmlSize = xmlFile.tellg(); // get the position within the stream == size of the file (since we are at the end)
+ xmlFile.seekg(0, ios::beg); // go back to the beginning of the stream
+ xmlBuffer = new Char_t[xmlSize]; // allocate buffer memory for the whole XML file
+ xmlFile.read(xmlBuffer, xmlSize); // read in the whole XML file into the buffer
+ xmlFile.close(); // close the XML file
+ }
+ if (!xmlBuffer) { // file has not been read into the buffer
+ status = 1;
+ } else {
+ status = saxParser->ParseBuffer(xmlBuffer, xmlSize); // parse buffer
+ delete[] xmlBuffer; // free the buffer memory
+ xmlBuffer = 0;
+ }
+
+ return status;
+}
+
// place a void pointer vector for global user function objects which might be needed
vector gGlobalUserFcn;
diff --git a/src/external/MagProximity/PMagProximityFitter.cpp b/src/external/MagProximity/PMagProximityFitter.cpp
index bc64b1c0..b720101c 100644
--- a/src/external/MagProximity/PMagProximityFitter.cpp
+++ b/src/external/MagProximity/PMagProximityFitter.cpp
@@ -33,7 +33,6 @@
#include
#include
-#include
using namespace std;
#include
@@ -66,26 +65,9 @@ PMagProximityFitterGlobal::PMagProximityFitterGlobal()
strcpy(startup_path_name, fStartupHandler->GetStartupFilePath().Data());
saxParser->ConnectToHandler("PMPStartupHandler", fStartupHandler);
//Int_t status = saxParser->ParseFile(startup_path_name);
- // parsing the file as above seems to lead to problems in certain environments; try working around through a buffer as follows
- fstream xmlFile;
- unsigned int xmlSize = 0;
- char *xmlBuffer = 0;
- xmlFile.open(startup_path_name, ios::in | ios::ate); // open file for reading and go to the end of the file
- if (xmlFile.is_open()) { // check if file has been opened successfully
- xmlSize = xmlFile.tellg(); // get the position within the stream == size of the file (since we are at the end)
- xmlFile.seekg(0, ios::beg); // go back to the beginning of the stream
- xmlBuffer = new char[xmlSize]; // allocate buffer memory for the whole XML file
- xmlFile.read(xmlBuffer, xmlSize); // read in the whole XML file into the buffer
- xmlFile.close(); // close the XML file
- }
- Int_t status;
- if (!xmlBuffer) { // file has not been read into the buffer
- status = 1;
- } else {
- status = saxParser->ParseBuffer(xmlBuffer, xmlSize); // parse buffer
- delete[] xmlBuffer; // free the buffer memory
- xmlBuffer = 0;
- }
+ // parsing the file as above seems to lead to problems in certain environments;
+ // use the parseXmlFile function instead (see PUserFcnBase.cpp for the definition)
+ Int_t status = parseXmlFile(saxParser, startup_path_name);
// check for parse errors
if (status) { // error
cout << endl << ">> PMagProximityFitterGlobal::PMagProximityFitterGlobal: **WARNING** Reading/parsing mag_proximity_startup.xml failed.";
diff --git a/src/external/Nonlocal/PNL_PippardFitter.cpp b/src/external/Nonlocal/PNL_PippardFitter.cpp
index 335a631b..317934c5 100644
--- a/src/external/Nonlocal/PNL_PippardFitter.cpp
+++ b/src/external/Nonlocal/PNL_PippardFitter.cpp
@@ -33,7 +33,6 @@
#include
#include
-#include
using namespace std;
#include
@@ -65,26 +64,9 @@ PNL_PippardFitterGlobal::PNL_PippardFitterGlobal()
strcpy(startup_path_name, fStartupHandler->GetStartupFilePath().Data());
saxParser->ConnectToHandler("PNL_StartupHandler", fStartupHandler);
//Int_t status = saxParser->ParseFile(startup_path_name);
- // parsing the file as above seems to lead to problems in certain environments; try working around through a buffer as follows
- fstream xmlFile;
- unsigned int xmlSize = 0;
- char *xmlBuffer = 0;
- xmlFile.open(startup_path_name, ios::in | ios::ate); // open file for reading and go to the end of the file
- if (xmlFile.is_open()) { // check if file has been opened successfully
- xmlSize = xmlFile.tellg(); // get the position within the stream == size of the file (since we are at the end)
- xmlFile.seekg(0, ios::beg); // go back to the beginning of the stream
- xmlBuffer = new char[xmlSize]; // allocate buffer memory for the whole XML file
- xmlFile.read(xmlBuffer, xmlSize); // read in the whole XML file into the buffer
- xmlFile.close(); // close the XML file
- }
- Int_t status;
- if (!xmlBuffer) { // file has not been read into the buffer
- status = 1;
- } else {
- status = saxParser->ParseBuffer(xmlBuffer, xmlSize); // parse buffer
- delete[] xmlBuffer; // free the buffer memory
- xmlBuffer = 0;
- }
+ // parsing the file as above seems to lead to problems in certain environments;
+ // use the parseXmlFile function instead (see PUserFcnBase.cpp for the definition)
+ Int_t status = parseXmlFile(saxParser, startup_path_name);
// check for parse errors
if (status) { // error
cout << endl << ">> PNL_PippardFitterGlobal::PNL_PippardFitterGlobal: **WARNING** Reading/parsing nonlocal_startup.xml failed.";
diff --git a/src/external/libFitPofB/classes/TLondon1D.cpp b/src/external/libFitPofB/classes/TLondon1D.cpp
index 46c6d05c..e569e318 100644
--- a/src/external/libFitPofB/classes/TLondon1D.cpp
+++ b/src/external/libFitPofB/classes/TLondon1D.cpp
@@ -30,7 +30,6 @@
#include "TLondon1D.h"
#include
-#include
#include
#include
using namespace std;
@@ -155,26 +154,9 @@ TLondon1DHS::TLondon1DHS() : fCalcNeeded(true), fFirstCall(true) {
BMWStartupHandler *startupHandler = new BMWStartupHandler();
saxParser->ConnectToHandler("BMWStartupHandler", startupHandler);
//int status (saxParser->ParseFile(startup_path_name.c_str()));
- // parsing the file as above seems to lead to problems in certain environments; try working around through a buffer as follows
- fstream xmlFile;
- unsigned int xmlSize = 0;
- char *xmlBuffer = 0;
- xmlFile.open(startup_path_name.c_str(), ios::in | ios::ate); // open file for reading and go to the end of the file
- if (xmlFile.is_open()) { // check if file has been opened successfully
- xmlSize = xmlFile.tellg(); // get the position within the stream == size of the file (since we are at the end)
- xmlFile.seekg(0, ios::beg); // go back to the beginning of the stream
- xmlBuffer = new char[xmlSize]; // allocate buffer memory for the whole XML file
- xmlFile.read(xmlBuffer, xmlSize); // read in the whole XML file into the buffer
- xmlFile.close(); // close the XML file
- }
- int status;
- if (!xmlBuffer) { // file has not been read into the buffer
- status = 1;
- } else {
- status = saxParser->ParseBuffer(xmlBuffer, xmlSize); // parse buffer
- delete[] xmlBuffer; // free the buffer memory
- xmlBuffer = 0;
- }
+ // parsing the file as above seems to lead to problems in certain environments;
+ // use the parseXmlFile function instead (see PUserFcnBase.cpp for the definition)
+ int status = parseXmlFile(saxParser, startup_path_name.c_str());
// check for parse errors
if (status) { // error
cerr << endl << "**ERROR** Reading/parsing " << startup_path_name << " failed." \
@@ -323,26 +305,9 @@ TLondon1D1L::TLondon1D1L() : fCalcNeeded(true), fFirstCall(true) {
BMWStartupHandler *startupHandler = new BMWStartupHandler();
saxParser->ConnectToHandler("BMWStartupHandler", startupHandler);
//int status (saxParser->ParseFile(startup_path_name.c_str()));
- // parsing the file as above seems to lead to problems in certain environments; try working around through a buffer as follows
- fstream xmlFile;
- unsigned int xmlSize = 0;
- char *xmlBuffer = 0;
- xmlFile.open(startup_path_name.c_str(), ios::in | ios::ate); // open file for reading and go to the end of the file
- if (xmlFile.is_open()) { // check if file has been opened successfully
- xmlSize = xmlFile.tellg(); // get the position within the stream == size of the file (since we are at the end)
- xmlFile.seekg(0, ios::beg); // go back to the beginning of the stream
- xmlBuffer = new char[xmlSize]; // allocate buffer memory for the whole XML file
- xmlFile.read(xmlBuffer, xmlSize); // read in the whole XML file into the buffer
- xmlFile.close(); // close the XML file
- }
- int status;
- if (!xmlBuffer) { // file has not been read into the buffer
- status = 1;
- } else {
- status = saxParser->ParseBuffer(xmlBuffer, xmlSize); // parse buffer
- delete[] xmlBuffer; // free the buffer memory
- xmlBuffer = 0;
- }
+ // parsing the file as above seems to lead to problems in certain environments;
+ // use the parseXmlFile function instead (see PUserFcnBase.cpp for the definition)
+ int status = parseXmlFile(saxParser, startup_path_name.c_str());
// check for parse errors
if (status) { // error
cerr << endl << "**ERROR** Reading/parsing " << startup_path_name << " failed." \
@@ -526,26 +491,9 @@ TLondon1D2L::TLondon1D2L() : fCalcNeeded(true), fFirstCall(true) {
BMWStartupHandler *startupHandler = new BMWStartupHandler();
saxParser->ConnectToHandler("BMWStartupHandler", startupHandler);
//int status (saxParser->ParseFile(startup_path_name.c_str()));
- // parsing the file as above seems to lead to problems in certain environments; try working around through a buffer as follows
- fstream xmlFile;
- unsigned int xmlSize = 0;
- char *xmlBuffer = 0;
- xmlFile.open(startup_path_name.c_str(), ios::in | ios::ate); // open file for reading and go to the end of the file
- if (xmlFile.is_open()) { // check if file has been opened successfully
- xmlSize = xmlFile.tellg(); // get the position within the stream == size of the file (since we are at the end)
- xmlFile.seekg(0, ios::beg); // go back to the beginning of the stream
- xmlBuffer = new char[xmlSize]; // allocate buffer memory for the whole XML file
- xmlFile.read(xmlBuffer, xmlSize); // read in the whole XML file into the buffer
- xmlFile.close(); // close the XML file
- }
- int status;
- if (!xmlBuffer) { // file has not been read into the buffer
- status = 1;
- } else {
- status = saxParser->ParseBuffer(xmlBuffer, xmlSize); // parse buffer
- delete[] xmlBuffer; // free the buffer memory
- xmlBuffer = 0;
- }
+ // parsing the file as above seems to lead to problems in certain environments;
+ // use the parseXmlFile function instead (see PUserFcnBase.cpp for the definition)
+ int status = parseXmlFile(saxParser, startup_path_name.c_str());
// check for parse errors
if (status) { // error
cerr << endl << "**ERROR** Reading/parsing " << startup_path_name << " failed." \
@@ -716,26 +664,9 @@ TProximity1D1LHS::TProximity1D1LHS() : fCalcNeeded(true), fFirstCall(true) {
BMWStartupHandler *startupHandler = new BMWStartupHandler();
saxParser->ConnectToHandler("BMWStartupHandler", startupHandler);
//int status (saxParser->ParseFile(startup_path_name.c_str()));
- // parsing the file as above seems to lead to problems in certain environments; try working around through a buffer as follows
- fstream xmlFile;
- unsigned int xmlSize = 0;
- char *xmlBuffer = 0;
- xmlFile.open(startup_path_name.c_str(), ios::in | ios::ate); // open file for reading and go to the end of the file
- if (xmlFile.is_open()) { // check if file has been opened successfully
- xmlSize = xmlFile.tellg(); // get the position within the stream == size of the file (since we are at the end)
- xmlFile.seekg(0, ios::beg); // go back to the beginning of the stream
- xmlBuffer = new char[xmlSize]; // allocate buffer memory for the whole XML file
- xmlFile.read(xmlBuffer, xmlSize); // read in the whole XML file into the buffer
- xmlFile.close(); // close the XML file
- }
- int status;
- if (!xmlBuffer) { // file has not been read into the buffer
- status = 1;
- } else {
- status = saxParser->ParseBuffer(xmlBuffer, xmlSize); // parse buffer
- delete[] xmlBuffer; // free the buffer memory
- xmlBuffer = 0;
- }
+ // parsing the file as above seems to lead to problems in certain environments;
+ // use the parseXmlFile function instead (see PUserFcnBase.cpp for the definition)
+ int status = parseXmlFile(saxParser, startup_path_name.c_str());
// check for parse errors
if (status) { // error
cerr << endl << "**ERROR** Reading/parsing " << startup_path_name << " failed." \
@@ -883,26 +814,9 @@ TLondon1D3L::TLondon1D3L() : fCalcNeeded(true), fFirstCall(true) {
BMWStartupHandler *startupHandler = new BMWStartupHandler();
saxParser->ConnectToHandler("BMWStartupHandler", startupHandler);
//int status (saxParser->ParseFile(startup_path_name.c_str()));
- // parsing the file as above seems to lead to problems in certain environments; try working around through a buffer as follows
- fstream xmlFile;
- unsigned int xmlSize = 0;
- char *xmlBuffer = 0;
- xmlFile.open(startup_path_name.c_str(), ios::in | ios::ate); // open file for reading and go to the end of the file
- if (xmlFile.is_open()) { // check if file has been opened successfully
- xmlSize = xmlFile.tellg(); // get the position within the stream == size of the file (since we are at the end)
- xmlFile.seekg(0, ios::beg); // go back to the beginning of the stream
- xmlBuffer = new char[xmlSize]; // allocate buffer memory for the whole XML file
- xmlFile.read(xmlBuffer, xmlSize); // read in the whole XML file into the buffer
- xmlFile.close(); // close the XML file
- }
- int status;
- if (!xmlBuffer) { // file has not been read into the buffer
- status = 1;
- } else {
- status = saxParser->ParseBuffer(xmlBuffer, xmlSize); // parse buffer
- delete[] xmlBuffer; // free the buffer memory
- xmlBuffer = 0;
- }
+ // parsing the file as above seems to lead to problems in certain environments;
+ // use the parseXmlFile function instead (see PUserFcnBase.cpp for the definition)
+ int status = parseXmlFile(saxParser, startup_path_name.c_str());
// check for parse errors
if (status) { // error
cerr << endl << "**ERROR** Reading/parsing " << startup_path_name << " failed." \
@@ -1072,26 +986,9 @@ TLondon1D3LS::TLondon1D3LS() : fCalcNeeded(true), fFirstCall(true) {
BMWStartupHandler *startupHandler = new BMWStartupHandler();
saxParser->ConnectToHandler("BMWStartupHandler", startupHandler);
//int status (saxParser->ParseFile(startup_path_name.c_str()));
- // parsing the file as above seems to lead to problems in certain environments; try working around through a buffer as follows
- fstream xmlFile;
- unsigned int xmlSize = 0;
- char *xmlBuffer = 0;
- xmlFile.open(startup_path_name.c_str(), ios::in | ios::ate); // open file for reading and go to the end of the file
- if (xmlFile.is_open()) { // check if file has been opened successfully
- xmlSize = xmlFile.tellg(); // get the position within the stream == size of the file (since we are at the end)
- xmlFile.seekg(0, ios::beg); // go back to the beginning of the stream
- xmlBuffer = new char[xmlSize]; // allocate buffer memory for the whole XML file
- xmlFile.read(xmlBuffer, xmlSize); // read in the whole XML file into the buffer
- xmlFile.close(); // close the XML file
- }
- int status;
- if (!xmlBuffer) { // file has not been read into the buffer
- status = 1;
- } else {
- status = saxParser->ParseBuffer(xmlBuffer, xmlSize); // parse buffer
- delete[] xmlBuffer; // free the buffer memory
- xmlBuffer = 0;
- }
+ // parsing the file as above seems to lead to problems in certain environments;
+ // use the parseXmlFile function instead (see PUserFcnBase.cpp for the definition)
+ int status = parseXmlFile(saxParser, startup_path_name.c_str());
// check for parse errors
if (status) { // error
cerr << endl << "**ERROR** Reading/parsing " << startup_path_name << " failed." \
@@ -1261,26 +1158,9 @@ double TLondon1D3LS::operator()(double t, const vector &par) const {
// BMWStartupHandler *startupHandler = new BMWStartupHandler();
// saxParser->ConnectToHandler("BMWStartupHandler", startupHandler);
// //int status (saxParser->ParseFile(startup_path_name.c_str()));
-// // parsing the file as above seems to lead to problems in certain environments; try working around through a buffer as follows
-// fstream xmlFile;
-// unsigned int xmlSize = 0;
-// char *xmlBuffer = 0;
-// xmlFile.open(startup_path_name.c_str(), ios::in | ios::ate); // open file for reading and go to the end of the file
-// if (xmlFile.is_open()) { // check if file has been opened successfully
-// xmlSize = xmlFile.tellg(); // get the position within the stream == size of the file (since we are at the end)
-// xmlFile.seekg(0, ios::beg); // go back to the beginning of the stream
-// xmlBuffer = new char[xmlSize]; // allocate buffer memory for the whole XML file
-// xmlFile.read(xmlBuffer, xmlSize); // read in the whole XML file into the buffer
-// xmlFile.close(); // close the XML file
-// }
-// int status;
-// if (!xmlBuffer) { // file has not been read into the buffer
-// status = 1;
-// } else {
-// status = saxParser->ParseBuffer(xmlBuffer, xmlSize); // parse buffer
-// delete[] xmlBuffer; // free the buffer memory
-// xmlBuffer = 0;
-// }
+// // parsing the file as above seems to lead to problems in certain environments;
+// // use the parseXmlFile function instead (see PUserFcnBase.cpp for the definition)
+// int status = parseXmlFile(saxParser, startup_path_name.c_str());
// // check for parse errors
// if (status) { // error
// cout << endl << "**WARNING** Reading/parsing " << startup_path_name << " failed." << endl;
diff --git a/src/external/libFitPofB/classes/TVortex.cpp b/src/external/libFitPofB/classes/TVortex.cpp
index 494df3a4..6ba5f572 100644
--- a/src/external/libFitPofB/classes/TVortex.cpp
+++ b/src/external/libFitPofB/classes/TVortex.cpp
@@ -30,7 +30,6 @@
#include "TVortex.h"
#include
-#include
#include
#include
using namespace std;
@@ -167,26 +166,9 @@ TBulkTriVortexLondon::TBulkTriVortexLondon() : fCalcNeeded(true), fFirstCall(tru
BMWStartupHandler *startupHandler = new BMWStartupHandler();
saxParser->ConnectToHandler("BMWStartupHandler", startupHandler);
//int status (saxParser->ParseFile(startup_path_name.c_str()));
- // parsing the file as above seems to lead to problems in certain environments; try working around through a buffer as follows
- fstream xmlFile;
- unsigned int xmlSize = 0;
- char *xmlBuffer = 0;
- xmlFile.open(startup_path_name.c_str(), ios::in | ios::ate); // open file for reading and go to the end of the file
- if (xmlFile.is_open()) { // check if file has been opened successfully
- xmlSize = xmlFile.tellg(); // get the position within the stream == size of the file (since we are at the end)
- xmlFile.seekg(0, ios::beg); // go back to the beginning of the stream
- xmlBuffer = new char[xmlSize]; // allocate buffer memory for the whole XML file
- xmlFile.read(xmlBuffer, xmlSize); // read in the whole XML file into the buffer
- xmlFile.close(); // close the XML file
- }
- int status;
- if (!xmlBuffer) { // file has not been read into the buffer
- status = 1;
- } else {
- status = saxParser->ParseBuffer(xmlBuffer, xmlSize); // parse buffer
- delete[] xmlBuffer; // free the buffer memory
- xmlBuffer = 0;
- }
+ // parsing the file as above seems to lead to problems in certain environments;
+ // use the parseXmlFile function instead (see PUserFcnBase.cpp for the definition)
+ int status = parseXmlFile(saxParser, startup_path_name.c_str());
// check for parse errors
if (status) { // error
cerr << endl << "**ERROR** Reading/parsing " << startup_path_name << " failed." \
@@ -244,26 +226,9 @@ TBulkSqVortexLondon::TBulkSqVortexLondon() : fCalcNeeded(true), fFirstCall(true)
BMWStartupHandler *startupHandler = new BMWStartupHandler();
saxParser->ConnectToHandler("BMWStartupHandler", startupHandler);
//int status (saxParser->ParseFile(startup_path_name.c_str()));
- // parsing the file as above seems to lead to problems in certain environments; try working around through a buffer as follows
- fstream xmlFile;
- unsigned int xmlSize = 0;
- char *xmlBuffer = 0;
- xmlFile.open(startup_path_name.c_str(), ios::in | ios::ate); // open file for reading and go to the end of the file
- if (xmlFile.is_open()) { // check if file has been opened successfully
- xmlSize = xmlFile.tellg(); // get the position within the stream == size of the file (since we are at the end)
- xmlFile.seekg(0, ios::beg); // go back to the beginning of the stream
- xmlBuffer = new char[xmlSize]; // allocate buffer memory for the whole XML file
- xmlFile.read(xmlBuffer, xmlSize); // read in the whole XML file into the buffer
- xmlFile.close(); // close the XML file
- }
- int status;
- if (!xmlBuffer) { // file has not been read into the buffer
- status = 1;
- } else {
- status = saxParser->ParseBuffer(xmlBuffer, xmlSize); // parse buffer
- delete[] xmlBuffer; // free the buffer memory
- xmlBuffer = 0;
- }
+ // parsing the file as above seems to lead to problems in certain environments;
+ // use the parseXmlFile function instead (see PUserFcnBase.cpp for the definition)
+ int status = parseXmlFile(saxParser, startup_path_name.c_str());
// check for parse errors
if (status) { // error
cerr << endl << "**ERROR** Reading/parsing " << startup_path_name << " failed." \
@@ -491,26 +456,9 @@ TBulkTriVortexML::TBulkTriVortexML() : fCalcNeeded(true), fFirstCall(true) {
BMWStartupHandler *startupHandler = new BMWStartupHandler();
saxParser->ConnectToHandler("BMWStartupHandler", startupHandler);
//int status (saxParser->ParseFile(startup_path_name.c_str()));
- // parsing the file as above seems to lead to problems in certain environments; try working around through a buffer as follows
- fstream xmlFile;
- unsigned int xmlSize = 0;
- char *xmlBuffer = 0;
- xmlFile.open(startup_path_name.c_str(), ios::in | ios::ate); // open file for reading and go to the end of the file
- if (xmlFile.is_open()) { // check if file has been opened successfully
- xmlSize = xmlFile.tellg(); // get the position within the stream == size of the file (since we are at the end)
- xmlFile.seekg(0, ios::beg); // go back to the beginning of the stream
- xmlBuffer = new char[xmlSize]; // allocate buffer memory for the whole XML file
- xmlFile.read(xmlBuffer, xmlSize); // read in the whole XML file into the buffer
- xmlFile.close(); // close the XML file
- }
- int status;
- if (!xmlBuffer) { // file has not been read into the buffer
- status = 1;
- } else {
- status = saxParser->ParseBuffer(xmlBuffer, xmlSize); // parse buffer
- delete[] xmlBuffer; // free the buffer memory
- xmlBuffer = 0;
- }
+ // parsing the file as above seems to lead to problems in certain environments;
+ // use the parseXmlFile function instead (see PUserFcnBase.cpp for the definition)
+ int status = parseXmlFile(saxParser, startup_path_name.c_str());
// check for parse errors
if (status) { // error
cerr << endl << "**ERROR** Reading/parsing " << startup_path_name << " failed." \
@@ -647,26 +595,9 @@ TBulkTriVortexAGL::TBulkTriVortexAGL() : fCalcNeeded(true), fFirstCall(true) {
BMWStartupHandler *startupHandler = new BMWStartupHandler();
saxParser->ConnectToHandler("BMWStartupHandler", startupHandler);
//int status (saxParser->ParseFile(startup_path_name.c_str()));
- // parsing the file as above seems to lead to problems in certain environments; try working around through a buffer as follows
- fstream xmlFile;
- unsigned int xmlSize = 0;
- char *xmlBuffer = 0;
- xmlFile.open(startup_path_name.c_str(), ios::in | ios::ate); // open file for reading and go to the end of the file
- if (xmlFile.is_open()) { // check if file has been opened successfully
- xmlSize = xmlFile.tellg(); // get the position within the stream == size of the file (since we are at the end)
- xmlFile.seekg(0, ios::beg); // go back to the beginning of the stream
- xmlBuffer = new char[xmlSize]; // allocate buffer memory for the whole XML file
- xmlFile.read(xmlBuffer, xmlSize); // read in the whole XML file into the buffer
- xmlFile.close(); // close the XML file
- }
- int status;
- if (!xmlBuffer) { // file has not been read into the buffer
- status = 1;
- } else {
- status = saxParser->ParseBuffer(xmlBuffer, xmlSize); // parse buffer
- delete[] xmlBuffer; // free the buffer memory
- xmlBuffer = 0;
- }
+ // parsing the file as above seems to lead to problems in certain environments;
+ // use the parseXmlFile function instead (see PUserFcnBase.cpp for the definition)
+ int status = parseXmlFile(saxParser, startup_path_name.c_str());
// check for parse errors
if (status) { // error
cerr << endl << "**ERROR** Reading/parsing " << startup_path_name << " failed." \
@@ -802,26 +733,9 @@ TBulkTriVortexAGLII::TBulkTriVortexAGLII() : fCalcNeeded(true), fFirstCall(true)
BMWStartupHandler *startupHandler = new BMWStartupHandler();
saxParser->ConnectToHandler("BMWStartupHandler", startupHandler);
//int status (saxParser->ParseFile(startup_path_name.c_str()));
- // parsing the file as above seems to lead to problems in certain environments; try working around through a buffer as follows
- fstream xmlFile;
- unsigned int xmlSize = 0;
- char *xmlBuffer = 0;
- xmlFile.open(startup_path_name.c_str(), ios::in | ios::ate); // open file for reading and go to the end of the file
- if (xmlFile.is_open()) { // check if file has been opened successfully
- xmlSize = xmlFile.tellg(); // get the position within the stream == size of the file (since we are at the end)
- xmlFile.seekg(0, ios::beg); // go back to the beginning of the stream
- xmlBuffer = new char[xmlSize]; // allocate buffer memory for the whole XML file
- xmlFile.read(xmlBuffer, xmlSize); // read in the whole XML file into the buffer
- xmlFile.close(); // close the XML file
- }
- int status;
- if (!xmlBuffer) { // file has not been read into the buffer
- status = 1;
- } else {
- status = saxParser->ParseBuffer(xmlBuffer, xmlSize); // parse buffer
- delete[] xmlBuffer; // free the buffer memory
- xmlBuffer = 0;
- }
+ // parsing the file as above seems to lead to problems in certain environments;
+ // use the parseXmlFile function instead (see PUserFcnBase.cpp for the definition)
+ int status = parseXmlFile(saxParser, startup_path_name.c_str());
// check for parse errors
if (status) { // error
cerr << endl << "**ERROR** Reading/parsing " << startup_path_name << " failed." \
@@ -970,26 +884,9 @@ TBulkTriVortexNGL::TBulkTriVortexNGL() : fCalcNeeded(true), fFirstCall(true) {
BMWStartupHandler *startupHandler = new BMWStartupHandler();
saxParser->ConnectToHandler("BMWStartupHandler", startupHandler);
//int status (saxParser->ParseFile(startup_path_name.c_str()));
- // parsing the file as above seems to lead to problems in certain environments; try working around through a buffer as follows
- fstream xmlFile;
- unsigned int xmlSize = 0;
- char *xmlBuffer = 0;
- xmlFile.open(startup_path_name.c_str(), ios::in | ios::ate); // open file for reading and go to the end of the file
- if (xmlFile.is_open()) { // check if file has been opened successfully
- xmlSize = xmlFile.tellg(); // get the position within the stream == size of the file (since we are at the end)
- xmlFile.seekg(0, ios::beg); // go back to the beginning of the stream
- xmlBuffer = new char[xmlSize]; // allocate buffer memory for the whole XML file
- xmlFile.read(xmlBuffer, xmlSize); // read in the whole XML file into the buffer
- xmlFile.close(); // close the XML file
- }
- int status;
- if (!xmlBuffer) { // file has not been read into the buffer
- status = 1;
- } else {
- status = saxParser->ParseBuffer(xmlBuffer, xmlSize); // parse buffer
- delete[] xmlBuffer; // free the buffer memory
- xmlBuffer = 0;
- }
+ // parsing the file as above seems to lead to problems in certain environments;
+ // use the parseXmlFile function instead (see PUserFcnBase.cpp for the definition)
+ int status = parseXmlFile(saxParser, startup_path_name.c_str());
// check for parse errors
if (status) { // error
cerr << endl << "**ERROR** Reading/parsing " << startup_path_name << " failed." \
@@ -1142,26 +1039,9 @@ TBulkAnisotropicTriVortexLondonGlobal::TBulkAnisotropicTriVortexLondonGlobal() :
BMWStartupHandler *startupHandler = new BMWStartupHandler();
saxParser->ConnectToHandler("BMWStartupHandler", startupHandler);
//int status (saxParser->ParseFile(startup_path_name.c_str()));
- // parsing the file as above seems to lead to problems in certain environments; try working around through a buffer as follows
- fstream xmlFile;
- unsigned int xmlSize = 0;
- char *xmlBuffer = 0;
- xmlFile.open(startup_path_name.c_str(), ios::in | ios::ate); // open file for reading and go to the end of the file
- if (xmlFile.is_open()) { // check if file has been opened successfully
- xmlSize = xmlFile.tellg(); // get the position within the stream == size of the file (since we are at the end)
- xmlFile.seekg(0, ios::beg); // go back to the beginning of the stream
- xmlBuffer = new char[xmlSize]; // allocate buffer memory for the whole XML file
- xmlFile.read(xmlBuffer, xmlSize); // read in the whole XML file into the buffer
- xmlFile.close(); // close the XML file
- }
- int status;
- if (!xmlBuffer) { // file has not been read into the buffer
- status = 1;
- } else {
- status = saxParser->ParseBuffer(xmlBuffer, xmlSize); // parse buffer
- delete[] xmlBuffer; // free the buffer memory
- xmlBuffer = 0;
- }
+ // parsing the file as above seems to lead to problems in certain environments;
+ // use the parseXmlFile function instead (see PUserFcnBase.cpp for the definition)
+ int status = parseXmlFile(saxParser, startup_path_name.c_str());
// check for parse errors
if (status) { // error
cerr << endl << "**ERROR** Reading/parsing " << startup_path_name << " failed." \
@@ -1401,26 +1281,9 @@ TBulkAnisotropicTriVortexMLGlobal::TBulkAnisotropicTriVortexMLGlobal() : fCalcNe
BMWStartupHandler *startupHandler = new BMWStartupHandler();
saxParser->ConnectToHandler("BMWStartupHandler", startupHandler);
//int status (saxParser->ParseFile(startup_path_name.c_str()));
- // parsing the file as above seems to lead to problems in certain environments; try working around through a buffer as follows
- fstream xmlFile;
- unsigned int xmlSize = 0;
- char *xmlBuffer = 0;
- xmlFile.open(startup_path_name.c_str(), ios::in | ios::ate); // open file for reading and go to the end of the file
- if (xmlFile.is_open()) { // check if file has been opened successfully
- xmlSize = xmlFile.tellg(); // get the position within the stream == size of the file (since we are at the end)
- xmlFile.seekg(0, ios::beg); // go back to the beginning of the stream
- xmlBuffer = new char[xmlSize]; // allocate buffer memory for the whole XML file
- xmlFile.read(xmlBuffer, xmlSize); // read in the whole XML file into the buffer
- xmlFile.close(); // close the XML file
- }
- int status;
- if (!xmlBuffer) { // file has not been read into the buffer
- status = 1;
- } else {
- status = saxParser->ParseBuffer(xmlBuffer, xmlSize); // parse buffer
- delete[] xmlBuffer; // free the buffer memory
- xmlBuffer = 0;
- }
+ // parsing the file as above seems to lead to problems in certain environments;
+ // use the parseXmlFile function instead (see PUserFcnBase.cpp for the definition)
+ int status = parseXmlFile(saxParser, startup_path_name.c_str());
// check for parse errors
if (status) { // error
cerr << endl << "**ERROR** Reading/parsing " << startup_path_name << " failed." \
@@ -1660,26 +1523,9 @@ TBulkAnisotropicTriVortexAGLGlobal::TBulkAnisotropicTriVortexAGLGlobal() : fCalc
BMWStartupHandler *startupHandler = new BMWStartupHandler();
saxParser->ConnectToHandler("BMWStartupHandler", startupHandler);
//int status (saxParser->ParseFile(startup_path_name.c_str()));
- // parsing the file as above seems to lead to problems in certain environments; try working around through a buffer as follows
- fstream xmlFile;
- unsigned int xmlSize = 0;
- char *xmlBuffer = 0;
- xmlFile.open(startup_path_name.c_str(), ios::in | ios::ate); // open file for reading and go to the end of the file
- if (xmlFile.is_open()) { // check if file has been opened successfully
- xmlSize = xmlFile.tellg(); // get the position within the stream == size of the file (since we are at the end)
- xmlFile.seekg(0, ios::beg); // go back to the beginning of the stream
- xmlBuffer = new char[xmlSize]; // allocate buffer memory for the whole XML file
- xmlFile.read(xmlBuffer, xmlSize); // read in the whole XML file into the buffer
- xmlFile.close(); // close the XML file
- }
- int status;
- if (!xmlBuffer) { // file has not been read into the buffer
- status = 1;
- } else {
- status = saxParser->ParseBuffer(xmlBuffer, xmlSize); // parse buffer
- delete[] xmlBuffer; // free the buffer memory
- xmlBuffer = 0;
- }
+ // parsing the file as above seems to lead to problems in certain environments;
+ // use the parseXmlFile function instead (see PUserFcnBase.cpp for the definition)
+ int status = parseXmlFile(saxParser, startup_path_name.c_str());
// check for parse errors
if (status) { // error
cerr << endl << "**ERROR** Reading/parsing " << startup_path_name << " failed." \
diff --git a/src/external/libLFRelaxation/TLFRelaxation.cpp b/src/external/libLFRelaxation/TLFRelaxation.cpp
index df13d06d..c4f1fbad 100644
--- a/src/external/libLFRelaxation/TLFRelaxation.cpp
+++ b/src/external/libLFRelaxation/TLFRelaxation.cpp
@@ -35,7 +35,6 @@
#include
#include
#include
-#include
#include
#ifdef HAVE_GOMP
@@ -203,26 +202,9 @@ TLFDynGssKT::TLFDynGssKT() : fCalcNeeded(true), fFirstCall(true), fCounter(0) {
BMWStartupHandler *startupHandler = new BMWStartupHandler();
saxParser->ConnectToHandler("BMWStartupHandler", startupHandler);
//int status (saxParser->ParseFile(startup_path_name.c_str()));
- // parsing the file as above seems to lead to problems in certain environments; try working around through a buffer as follows
- fstream xmlFile;
- unsigned int xmlSize = 0;
- char *xmlBuffer = 0;
- xmlFile.open(startup_path_name.c_str(), ios::in | ios::ate); // open file for reading and go to the end of the file
- if (xmlFile.is_open()) { // check if file has been opened successfully
- xmlSize = xmlFile.tellg(); // get the position within the stream == size of the file (since we are at the end)
- xmlFile.seekg(0, ios::beg); // go back to the beginning of the stream
- xmlBuffer = new char[xmlSize]; // allocate buffer memory for the whole XML file
- xmlFile.read(xmlBuffer, xmlSize); // read in the whole XML file into the buffer
- xmlFile.close(); // close the XML file
- }
- int status;
- if (!xmlBuffer) { // file has not been read into the buffer
- status = 1;
- } else {
- status = saxParser->ParseBuffer(xmlBuffer, xmlSize); // parse buffer
- delete[] xmlBuffer; // free the buffer memory
- xmlBuffer = 0;
- }
+ // parsing the file as above seems to lead to problems in certain environments;
+ // use the parseXmlFile function instead (see PUserFcnBase.cpp for the definition)
+ int status = parseXmlFile(saxParser, startup_path_name.c_str());
// check for parse errors
if (status) { // error
cerr << endl << "**ERROR** Reading/parsing " << startup_path_name << " failed." \
@@ -545,26 +527,9 @@ TLFDynExpKT::TLFDynExpKT() : fCalcNeeded(true), fFirstCall(true), fCounter(0), f
BMWStartupHandler *startupHandler = new BMWStartupHandler();
saxParser->ConnectToHandler("BMWStartupHandler", startupHandler);
//int status (saxParser->ParseFile(startup_path_name.c_str()));
- // parsing the file as above seems to lead to problems in certain environments; try working around through a buffer as follows
- fstream xmlFile;
- unsigned int xmlSize = 0;
- char *xmlBuffer = 0;
- xmlFile.open(startup_path_name.c_str(), ios::in | ios::ate); // open file for reading and go to the end of the file
- if (xmlFile.is_open()) { // check if file has been opened successfully
- xmlSize = xmlFile.tellg(); // get the position within the stream == size of the file (since we are at the end)
- xmlFile.seekg(0, ios::beg); // go back to the beginning of the stream
- xmlBuffer = new char[xmlSize]; // allocate buffer memory for the whole XML file
- xmlFile.read(xmlBuffer, xmlSize); // read in the whole XML file into the buffer
- xmlFile.close(); // close the XML file
- }
- int status;
- if (!xmlBuffer) { // file has not been read into the buffer
- status = 1;
- } else {
- status = saxParser->ParseBuffer(xmlBuffer, xmlSize); // parse buffer
- delete[] xmlBuffer; // free the buffer memory
- xmlBuffer = 0;
- }
+ // parsing the file as above seems to lead to problems in certain environments;
+ // use the parseXmlFile function instead (see PUserFcnBase.cpp for the definition)
+ int status = parseXmlFile(saxParser, startup_path_name.c_str());
// check for parse errors
if (status) { // error
cerr << endl << "**ERROR** Reading/parsing " << startup_path_name << " failed." \
diff --git a/src/include/PStartupHandler.h b/src/include/PStartupHandler.h
index f49b82ad..3854c303 100644
--- a/src/include/PStartupHandler.h
+++ b/src/include/PStartupHandler.h
@@ -36,9 +36,15 @@
#include
#include
#include
+#include
#include "PMusr.h"
+//--------------------------------------------------------------------------
+// This function is a replacement for the ParseFile method of TSAXParser.
+//--------------------------------------------------------------------------
+int parseXmlFile(TSAXParser*, const char*);
+
/**
* Handles the XML musrfit startup file (musrfit_startup.xml) in which default settings
* are stored:
diff --git a/src/include/PUserFcnBase.h b/src/include/PUserFcnBase.h
index cd10cd8b..20afc39e 100644
--- a/src/include/PUserFcnBase.h
+++ b/src/include/PUserFcnBase.h
@@ -36,6 +36,7 @@
using namespace std;
#include "TObject.h"
+#include "TSAXParser.h"
//--------------------------------------------------------------------------------------------
/**
@@ -56,4 +57,9 @@ class PUserFcnBase : public TObject
ClassDef(PUserFcnBase, 1)
};
+//--------------------------------------------------------------------------
+// This function is a replacement for the ParseFile method of TSAXParser.
+//--------------------------------------------------------------------------
+Int_t parseXmlFile(TSAXParser*, const Char_t*);
+
#endif // _PUSERFCNBASE_H_
diff --git a/src/musredit/musredit_startup.xml b/src/musredit/musredit_startup.xml
index 847a1c41..a33ec36f 100644
--- a/src/musredit/musredit_startup.xml
+++ b/src/musredit/musredit_startup.xml
@@ -9,7 +9,7 @@
./
$HOME/analysis/musrfit/src/musredit
y
- n
+ y
http://lmu.web.psi.ch/facilities/software/musrfit/user/MUSR/MusrFit.html
diff --git a/src/musrfit.cpp b/src/musrfit.cpp
index 71025a6f..9e9a58ef 100644
--- a/src/musrfit.cpp
+++ b/src/musrfit.cpp
@@ -424,9 +424,6 @@ int main(int argc, char *argv[])
}
// read startup file
- fstream xmlFile;
- unsigned int xmlSize = 0;
- char *xmlBuffer = 0;
char startup_path_name[128];
TSAXParser *saxParser = new TSAXParser();
PStartupHandler *startupHandler = new PStartupHandler();
@@ -446,22 +443,9 @@ int main(int argc, char *argv[])
strcpy(startup_path_name, startupHandler->GetStartupFilePath().Data());
saxParser->ConnectToHandler("PStartupHandler", startupHandler);
//status = saxParser->ParseFile(startup_path_name);
- // parsing the file as above seems to lead to problems in certain environments; try working around through a buffer as follows
- xmlFile.open(startup_path_name, ios::in | ios::ate); // open file for reading and go to the end of the file
- if (xmlFile.is_open()) { // check if file has been opened successfully
- xmlSize = xmlFile.tellg(); // get the position within the stream == size of the file (since we are at the end)
- xmlFile.seekg(0, ios::beg); // go back to the beginning of the stream
- xmlBuffer = new char[xmlSize]; // allocate buffer memory for the whole XML file
- xmlFile.read(xmlBuffer, xmlSize); // read in the whole XML file into the buffer
- xmlFile.close(); // close the XML file
- }
- if (!xmlBuffer) { // file has not been read into the buffer
- status = 1;
- } else {
- status = saxParser->ParseBuffer(xmlBuffer, xmlSize); // parse buffer
- delete[] xmlBuffer; // free the buffer memory
- xmlBuffer = 0;
- }
+ // parsing the file as above seems to lead to problems in certain environments;
+ // use the parseXmlFile function instead (see PStartupHandler.cpp for the definition)
+ status = parseXmlFile(saxParser, startup_path_name);
// check for parse errors
if (status) { // error
cerr << endl << ">> musrfit **WARNING** Reading/parsing musrfit_startup.xml failed.";
diff --git a/src/musrgui/musrgui_startup.xml b/src/musrgui/musrgui_startup.xml
index 7ecd6010..300a833c 100644
--- a/src/musrgui/musrgui_startup.xml
+++ b/src/musrgui/musrgui_startup.xml
@@ -9,7 +9,7 @@
./
$HOME/analysis/musrfit/src/musrgui
n
- n
+ y
Courier
diff --git a/src/musrt0.cpp b/src/musrt0.cpp
index 49474da9..3d0f85b5 100644
--- a/src/musrt0.cpp
+++ b/src/musrt0.cpp
@@ -34,7 +34,6 @@
#include
#include
-#include
using namespace std;
#include
@@ -276,9 +275,6 @@ Int_t main(Int_t argc, Char_t *argv[])
}
// read startup file
- fstream xmlFile;
- unsigned int xmlSize = 0;
- char *xmlBuffer = 0;
Char_t startup_path_name[128];
TSAXParser *saxParser = new TSAXParser();
PStartupHandler *startupHandler = new PStartupHandler();
@@ -298,22 +294,9 @@ Int_t main(Int_t argc, Char_t *argv[])
strcpy(startup_path_name, startupHandler->GetStartupFilePath().Data());
saxParser->ConnectToHandler("PStartupHandler", startupHandler);
//status = saxParser->ParseFile(startup_path_name);
- // parsing the file as above seems to lead to problems in certain environments; try working around through a buffer as follows
- xmlFile.open(startup_path_name, ios::in | ios::ate); // open file for reading and go to the end of the file
- if (xmlFile.is_open()) { // check if file has been opened successfully
- xmlSize = xmlFile.tellg(); // get the position within the stream == size of the file (since we are at the end)
- xmlFile.seekg(0, ios::beg); // go back to the beginning of the stream
- xmlBuffer = new char[xmlSize]; // allocate buffer memory for the whole XML file
- xmlFile.read(xmlBuffer, xmlSize); // read in the whole XML file into the buffer
- xmlFile.close(); // close the XML file
- }
- if (!xmlBuffer) { // file has not been read into the buffer
- status = 1;
- } else {
- status = saxParser->ParseBuffer(xmlBuffer, xmlSize); // parse buffer
- delete[] xmlBuffer; // free the buffer memory
- xmlBuffer = 0;
- }
+ // parsing the file as above seems to lead to problems in certain environments;
+ // use the parseXmlFile function instead (see PStartupHandler.cpp for the definition)
+ status = parseXmlFile(saxParser, startup_path_name);
// check for parse errors
if (status) { // error
cerr << endl << ">> musrt0 **WARNING** Reading/parsing musrfit_startup.xml failed.";
diff --git a/src/musrview.cpp b/src/musrview.cpp
index 40f61ee9..0541168a 100644
--- a/src/musrview.cpp
+++ b/src/musrview.cpp
@@ -34,7 +34,6 @@
#include
#include
-#include
using namespace std;
#include
@@ -159,9 +158,6 @@ int main(int argc, char *argv[])
}
// read startup file
- fstream xmlFile;
- unsigned int xmlSize = 0;
- char *xmlBuffer = 0;
char startup_path_name[128];
TSAXParser *saxParser = new TSAXParser();
PStartupHandler *startupHandler = new PStartupHandler();
@@ -181,22 +177,9 @@ int main(int argc, char *argv[])
strcpy(startup_path_name, startupHandler->GetStartupFilePath().Data());
saxParser->ConnectToHandler("PStartupHandler", startupHandler);
//status = saxParser->ParseFile(startup_path_name);
- // parsing the file as above seems to lead to problems in certain environments; try working around through a buffer as follows
- xmlFile.open(startup_path_name, ios::in | ios::ate); // open file for reading and go to the end of the file
- if (xmlFile.is_open()) { // check if file has been opened successfully
- xmlSize = xmlFile.tellg(); // get the position within the stream == size of the file (since we are at the end)
- xmlFile.seekg(0, ios::beg); // go back to the beginning of the stream
- xmlBuffer = new char[xmlSize]; // allocate buffer memory for the whole XML file
- xmlFile.read(xmlBuffer, xmlSize); // read in the whole XML file into the buffer
- xmlFile.close(); // close the XML file
- }
- if (!xmlBuffer) { // file has not been read into the buffer
- status = 1;
- } else {
- status = saxParser->ParseBuffer(xmlBuffer, xmlSize); // parse buffer
- delete[] xmlBuffer; // free the buffer memory
- xmlBuffer = 0;
- }
+ // parsing the file as above seems to lead to problems in certain environments;
+ // use the parseXmlFile function instead (see PStartupHandler.cpp for the definition)
+ status = parseXmlFile(saxParser, startup_path_name);
// check for parse errors
if (status) { // error
cerr << endl << ">> musrview **WARNING** Reading/parsing musrfit_startup.xml failed.";