From f75d8d2bd146dd8cfe16207377264218b148d197 Mon Sep 17 00:00:00 2001 From: Peter Baumann Date: Tue, 27 Jul 2010 09:09:46 +0200 Subject: PB: more benchmark improvement + correct log output handling --- raslib/error.cc | 25 +++++++++++-------------- raslib/error.hh | 7 ++----- raslib/rmdebug.cc | 2 +- raslib/rminit.cc | 2 +- 4 files changed, 15 insertions(+), 21 deletions(-) (limited to 'raslib') diff --git a/raslib/error.cc b/raslib/error.cc index 6647847..5e5bdbf 100644 --- a/raslib/error.cc +++ b/raslib/error.cc @@ -205,20 +205,17 @@ initTextTable() unsigned int numOfEntries = 0; int result; // sscanf() result - // determine file name; use path if env var is set - strcpy( errorFileName, "" ); - const char* rmanHome = getenv( RASDAMAN_PATH_VARNAME ); - if (rmanHome) - { - strcat(errorFileName, rmanHome); - strcat(errorFileName, ERRORTEXXT_PATH ); - strcat(errorFileName, "/" ); - } else { - strcat(errorFileName, SHARE_DATA_DIR); - strcat(errorFileName, "/"); - } - strcat(errorFileName, ERRORTEXT_FILE ); - // RMInit::logOut << "using error text file: " << errorFileName << endl; + // determine file path + name + int filenameLength = snprintf( errorFileName, FILENAME_MAX, "%s/%s", SHARE_DATA_DIR, ERRORTEXT_FILE ); + if (filenameLength < FILENAME_MAX ) + { + RMInit::logOut << "Using error text file: " << errorFileName << endl; + } + else + { + errorFileName[FILENAME_MAX-1] = '\0'; // force-terminate string before printing + cerr << "Warning: error text file path longer than allowed by OS, likely file will not be found: " << errorFileName << endl; + } // errortexts.open(errorFileName, ios::nocreate | ios::in); errortexts.open(errorFileName, ios::in); diff --git a/raslib/error.hh b/raslib/error.hh index 0042596..35c4e44 100644 --- a/raslib/error.hh +++ b/raslib/error.hh @@ -76,11 +76,8 @@ rasdaman GmbH. * error text file ------------------ */ -/// name of variable which should contain path to rasdaman home dir -#define RASDAMAN_PATH_VARNAME "RMANHOME" - -/// relative path to error text file, starting from $RMANHOME -#define ERRORTEXXT_PATH "/bin" +/// relative path to error text file, starting from rasdaman installation root +#define ERRORTEXT_PATH "/bin" /// error text file name #define ERRORTEXT_FILE "errtxts" diff --git a/raslib/rmdebug.cc b/raslib/rmdebug.cc index d047812..c0409c5 100644 --- a/raslib/rmdebug.cc +++ b/raslib/rmdebug.cc @@ -46,7 +46,7 @@ using namespace std; #include "raslib/odmgtypes.hh" int RManDebug = 0; // debug level (0-4), 0 means no debug info at all -int RManBenchmark = 0; // benchmark level (0-4) +int RManBenchmark = 4; // benchmark level (0-4) // initialization of static variables for RMDebug int RMDebug::level = 0; diff --git a/raslib/rminit.cc b/raslib/rminit.cc index 78c68cf..89802de 100644 --- a/raslib/rminit.cc +++ b/raslib/rminit.cc @@ -189,7 +189,7 @@ RMInit::RMInit( char initApplicationType ) else noTimeOut = 0; } - else + else // applicationType != 'C' (i.e.: =='S') { // default logOut.rdbuf(cout.rdbuf()); -- cgit