1
0
mirror of https://github.com/mariadb-corporation/mariadb-columnstore-engine.git synced 2025-07-30 19:23:07 +03:00

MCOL-537 There are no CS-specific warnings building with gcc 8.2.

This commit is contained in:
Roman Nozdrin
2019-04-29 12:26:12 +03:00
parent 9dc33c4e82
commit 7e2cb05624
23 changed files with 94 additions and 334 deletions

View File

@ -40,22 +40,6 @@ struct to_lower
} }
}; };
//Trim any leading/trailing ws
const string lrtrim(const string& in)
{
string::size_type p1;
p1 = in.find_first_not_of(" \t\n");
if (p1 == string::npos) p1 = 0;
string::size_type p2;
p2 = in.find_last_not_of(" \t\n");
if (p2 == string::npos) p2 = in.size() - 1;
return string(in, p1, (p2 - p1 + 1));
}
} }
namespace execplan namespace execplan

View File

@ -40,22 +40,6 @@ struct to_lower
} }
}; };
//Trim any leading/trailing ws
const string lrtrim(const string& in)
{
string::size_type p1;
p1 = in.find_first_not_of(" \t\n");
if (p1 == string::npos) p1 = 0;
string::size_type p2;
p2 = in.find_last_not_of(" \t\n");
if (p2 == string::npos) p2 = in.size() - 1;
return string(in, p1, (p2 - p1 + 1));
}
} }
namespace execplan namespace execplan

View File

@ -94,36 +94,6 @@ namespace
using namespace joblist; using namespace joblist;
bool checkCombinable(JobStep* jobStepPtr)
{
if (typeid(*(jobStepPtr)) == typeid(pColScanStep))
{
return true;
}
else if (typeid(*(jobStepPtr)) == typeid(PseudoColStep))
{
return true;
}
else if (typeid(*(jobStepPtr)) == typeid(pColStep))
{
return true;
}
else if (typeid(*(jobStepPtr)) == typeid(pDictionaryStep))
{
return true;
}
else if (typeid(*(jobStepPtr)) == typeid(PassThruStep))
{
return true;
}
else if (typeid(*(jobStepPtr)) == typeid(FilterStep))
{
return true;
}
return false;
}
void projectSimpleColumn(const SimpleColumn* sc, JobStepVector& jsv, JobInfo& jobInfo) void projectSimpleColumn(const SimpleColumn* sc, JobStepVector& jsv, JobInfo& jobInfo)
{ {
if (sc == NULL) if (sc == NULL)

View File

@ -88,103 +88,6 @@ inline uint32_t tid2sid(const uint32_t tid)
} }
//StopWatch timer; //StopWatch timer;
int buildBuffer(uchar* buf, string& buffer, int& columns, TABLE* table)
{
char attribute_buffer[1024];
String attribute(attribute_buffer, sizeof(attribute_buffer),
&my_charset_bin);
std::string cols = " (";
std::string vals = " values (";
columns = 0;
for (Field** field = table->field; *field; field++)
{
const char* ptr;
const char* end_ptr;
if ((*field)->is_null())
ptr = end_ptr = 0;
else
{
bitmap_set_bit(table->read_set, (*field)->field_index);
(*field)->val_str(&attribute, &attribute);
ptr = attribute.ptr();
end_ptr = attribute.length() + ptr;
}
if (columns > 0)
{
cols.append(",");
vals.append(",");
}
columns++;
cols.append((*field)->field_name.str);
if (ptr == end_ptr)
{
vals.append ("NULL");
}
else
{
if ( (*field)->type() == MYSQL_TYPE_VARCHAR ||
/*FIXME: (*field)->type() == MYSQL_TYPE_VARBINARY || */
(*field)->type() == MYSQL_TYPE_VAR_STRING ||
(*field)->type() == MYSQL_TYPE_STRING ||
(*field)->type() == MYSQL_TYPE_DATE ||
(*field)->type() == MYSQL_TYPE_DATETIME ||
(*field)->type() == MYSQL_TYPE_DATETIME2 ||
(*field)->type() == MYSQL_TYPE_TIME )
vals.append("'");
while (ptr < end_ptr)
{
if (*ptr == '\r')
{
ptr++;
}
else if (*ptr == '\n')
{
ptr++;
}
else if (*ptr == '\'' )
{
//@Bug 1820. Replace apostrophe with strange character to pass parser.
vals += '\252';
ptr++;
}
else
vals += *ptr++;
}
if ( (*field)->type() == MYSQL_TYPE_VARCHAR ||
/*FIXME: (*field)->type() == MYSQL_TYPE_VARBINARY || */
(*field)->type() == MYSQL_TYPE_VAR_STRING ||
(*field)->type() == MYSQL_TYPE_STRING ||
(*field)->type() == MYSQL_TYPE_DATE ||
(*field)->type() == MYSQL_TYPE_DATETIME ||
(*field)->type() == MYSQL_TYPE_DATETIME2 ||
(*field)->type() == MYSQL_TYPE_TIME )
vals.append("'");
}
}
if (columns)
{
cols.append(") ");
vals.append(") ");
buffer = "INSERT INTO ";
buffer.append(table->s->table_name.str);
buffer.append(cols);
buffer.append(vals);
}
return columns;
}
uint32_t buildValueList (TABLE* table, cal_connection_info& ci ) uint32_t buildValueList (TABLE* table, cal_connection_info& ci )
{ {

View File

@ -239,21 +239,6 @@ struct PartitionInfo
typedef map<LogicalPartition, PartitionInfo> PartitionMap; typedef map<LogicalPartition, PartitionInfo> PartitionMap;
const string charcolToString(int64_t v)
{
ostringstream oss;
char c;
for (int i = 0; i < 8; i++)
{
c = v & 0xff;
oss << c;
v >>= 8;
}
return oss.str();
}
const string format(int64_t v, CalpontSystemCatalog::ColType& ct) const string format(int64_t v, CalpontSystemCatalog::ColType& ct)
{ {
ostringstream oss; ostringstream oss;

View File

@ -71,14 +71,15 @@ namespace
{ {
DistributedEngineComm* Dec; DistributedEngineComm* Dec;
void setupCwd() int8_t setupCwd()
{ {
string workdir = startup::StartUp::tmpDir(); string workdir = startup::StartUp::tmpDir();
if (workdir.length() == 0) if (workdir.length() == 0)
workdir = "."; workdir = ".";
(void)chdir(workdir.c_str()); int8_t rc = chdir(workdir.c_str());
return rc;
} }
void added_a_pm(int) void added_a_pm(int)
@ -103,7 +104,10 @@ int main(int argc, char* argv[])
// This is unset due to the way we start it // This is unset due to the way we start it
program_invocation_short_name = const_cast<char*>("DDLProc"); program_invocation_short_name = const_cast<char*>("DDLProc");
setupCwd(); if ( setupCwd() < 0 )
{
std::cerr << "Could not set working directory" << std::endl;
}
WriteEngine::WriteEngineWrapper::init( WriteEngine::SUBSYSTEM_ID_DDLPROC ); WriteEngine::WriteEngineWrapper::init( WriteEngine::SUBSYSTEM_ID_DDLPROC );
#ifdef _MSC_VER #ifdef _MSC_VER

View File

@ -1325,13 +1325,15 @@ void setupSignalHandlers()
#endif #endif
} }
void setupCwd(ResourceManager* rm) int8_t setupCwd(ResourceManager* rm)
{ {
string workdir = rm->getScWorkingDir(); string workdir = rm->getScWorkingDir();
(void)chdir(workdir.c_str()); int8_t rc = chdir(workdir.c_str());
if (access(".", W_OK) != 0) if (rc < 0 || access(".", W_OK) != 0)
(void)chdir("/tmp"); rc = chdir("/tmp");
return (rc < 0) ? -5 : rc;
} }
void startRssMon(size_t maxPct, int pauseSeconds) void startRssMon(size_t maxPct, int pauseSeconds)
@ -1497,9 +1499,12 @@ int main(int argc, char* argv[])
break; break;
default: default:
errMsg = "Couldn't change working directory or unknown error";
break; break;
} }
err = setupCwd(rm);
if (err < 0) if (err < 0)
{ {
Oam oam; Oam oam;
@ -1523,9 +1528,6 @@ int main(int argc, char* argv[])
return 2; return 2;
} }
setupCwd(rm);
cleanTempDir(); cleanTempDir();
MsgMap msgMap; MsgMap msgMap;

View File

@ -283,71 +283,6 @@ FdCacheType_t fdcache;
boost::mutex fdMapMutex; boost::mutex fdMapMutex;
rwlock::RWLock_local localLock; rwlock::RWLock_local localLock;
void pause_(unsigned secs)
{
struct timespec req;
struct timespec rem;
req.tv_sec = secs;
req.tv_nsec = 0;
rem.tv_sec = 0;
rem.tv_nsec = 0;
#ifdef _MSC_VER
Sleep(req.tv_sec * 1000);
#else
again:
if (nanosleep(&req, &rem) != 0)
if (rem.tv_sec > 0 || rem.tv_nsec > 0)
{
req = rem;
goto again;
}
#endif
}
const vector<pair<string, string> > getDBRootList()
{
vector<pair<string, string> > ret;
Config* config;
uint32_t dbrootCount, i;
string stmp, devname, mountpoint;
char devkey[80], mountkey[80];
config = Config::makeConfig();
stmp = config->getConfig("SystemConfig", "DBRootCount");
if (stmp.empty())
{
Message::Args args;
args.add("getDBRootList: Configuration error. No DBRootCount");
primitiveprocessor::mlp->logMessage(logging::M0006, args, true);
throw runtime_error("getDBRootList: Configuration error. No DBRootCount");
}
dbrootCount = config->uFromText(stmp);
for (i = 1; i <= dbrootCount; i++)
{
snprintf(mountkey, 80, "DBRoot%d", i);
snprintf(devkey, 80, "DBRootStorageLoc%d", i);
mountpoint = config->getConfig("SystemConfig", string(mountkey));
devname = config->getConfig("Installation", string(devkey));
if (mountpoint == "" || devname == "")
throw runtime_error("getDBRootList: Configuration error. Don't know where DBRoots are mounted");
ret.push_back(pair<string, string>(devname, mountpoint));
// cout << "I see " << devname << " should be mounted at " << mountpoint << endl;
}
return ret;
}
char* alignTo(const char* in, int av) char* alignTo(const char* in, int av)
{ {
ptrdiff_t inx = reinterpret_cast<ptrdiff_t>(in); ptrdiff_t inx = reinterpret_cast<ptrdiff_t>(in);
@ -769,7 +704,7 @@ void* thr_popper(ioManager* arg)
int opts = primitiveprocessor::directIOFlag ? IDBDataFile::USE_ODIRECT : 0; int opts = primitiveprocessor::directIOFlag ? IDBDataFile::USE_ODIRECT : 0;
fp = NULL; fp = NULL;
uint32_t openRetries = 0; uint32_t openRetries = 0;
int saveErrno; int saveErrno = 0;
while (fp == NULL && openRetries++ < 5) while (fp == NULL && openRetries++ < 5)
{ {

View File

@ -51,17 +51,6 @@ using namespace logging;
#define llabs labs #define llabs labs
#endif #endif
namespace
{
using namespace primitiveprocessor;
double cotangent(double in)
{
return (1.0 / tan(in));
}
}
namespace primitiveprocessor namespace primitiveprocessor
{ {

View File

@ -1097,33 +1097,6 @@ namespace
{ {
using namespace primitiveprocessor; using namespace primitiveprocessor;
void pause_(unsigned delay)
{
struct timespec req;
struct timespec rem;
req.tv_sec = delay;
req.tv_nsec = 0;
rem.tv_sec = 0;
rem.tv_nsec = 0;
#ifdef _MSC_VER
Sleep(req.tv_sec * 1000);
#else
again:
if (nanosleep(&req, &rem) != 0)
{
if (rem.tv_sec > 0 || rem.tv_nsec > 0)
{
req = rem;
goto again;
}
}
#endif
}
/** @brief The job type to process a dictionary scan (pDictionaryScan class on the UM) /** @brief The job type to process a dictionary scan (pDictionaryScan class on the UM)
* TODO: Move this & the impl into different files * TODO: Move this & the impl into different files
*/ */

View File

@ -146,17 +146,19 @@ void setupSignalHandlers()
#endif #endif
} }
void setupCwd(Config* cf) int8_t setupCwd(Config* cf)
{ {
string workdir = startup::StartUp::tmpDir(); string workdir = startup::StartUp::tmpDir();
if (workdir.length() == 0) if (workdir.length() == 0)
workdir = "."; workdir = ".";
(void)chdir(workdir.c_str()); int8_t rc = chdir(workdir.c_str());
if (access(".", W_OK) != 0) if (rc < 0 || access(".", W_OK) != 0)
(void)chdir("/tmp"); rc = chdir("/tmp");
return rc;
} }
int setupResources() int setupResources()
@ -342,11 +344,11 @@ int main(int argc, char* argv[])
setupSignalHandlers(); setupSignalHandlers();
setupCwd(cf); int err = 0;
err = setupCwd(cf);
mlp = new primitiveprocessor::Logger(); mlp = new primitiveprocessor::Logger();
int err = 0;
if (!gDebug) if (!gDebug)
err = setupResources(); err = setupResources();
string errMsg; string errMsg;
@ -366,6 +368,10 @@ int main(int argc, char* argv[])
errMsg = "Could not install file limits to required value, please see non-root install documentation"; errMsg = "Could not install file limits to required value, please see non-root install documentation";
break; break;
case -5:
errMsg = "Could not change into working directory";
break;
default: default:
break; break;
} }

View File

@ -58,11 +58,11 @@ int setUp()
{ {
#ifndef _MSC_VER #ifndef _MSC_VER
string cmd = "/bin/rm -f " + logFile + " >/dev/null 2>&1"; string cmd = "/bin/rm -f " + logFile + " >/dev/null 2>&1";
(void)system(cmd.c_str()); int rc = system(cmd.c_str());
cmd = "/bin/touch -f " + logFile + " >/dev/null 2>&1"; cmd = "/bin/touch -f " + logFile + " >/dev/null 2>&1";
(void)system(cmd.c_str()); rc = system(cmd.c_str());
#endif #endif
return 0; return rc;
} }
int checkNotThere(WriteEngine::FID fid) int checkNotThere(WriteEngine::FID fid)
@ -72,12 +72,6 @@ int checkNotThere(WriteEngine::FID fid)
return (fileOp.existsOIDDir(fid) ? -1 : 0); return (fileOp.existsOIDDir(fid) ? -1 : 0);
} }
void tearDown()
{
string file = tmpDir + "/oidbitmap";
unlink(file.c_str());
}
void usage() void usage()
{ {
cerr << "Usage: dbbuilder [-h|f] function" << endl cerr << "Usage: dbbuilder [-h|f] function" << endl
@ -130,6 +124,7 @@ int main(int argc, char* argv[])
std::string schema("tpch"); std::string schema("tpch");
Oam oam; Oam oam;
bool fFlg = false; bool fFlg = false;
int rc = 0;
opterr = 0; opterr = 0;
@ -193,7 +188,10 @@ int main(int argc, char* argv[])
if ( buildOption == SYSCATALOG_ONLY ) if ( buildOption == SYSCATALOG_ONLY )
{ {
setUp(); if ( setUp() )
{
cerr << "setUp() call error " << endl;
}
bool canWrite = true; bool canWrite = true;
@ -209,9 +207,13 @@ int main(int argc, char* argv[])
"' > " + logFile; "' > " + logFile;
if (canWrite) if (canWrite)
(void)system(cmd.c_str()); {
rc = system(cmd.c_str());
}
else else
{
cerr << cmd << endl; cerr << cmd << endl;
}
errorHandler(sysCatalogErr, errorHandler(sysCatalogErr,
"Build system catalog", "Build system catalog",
@ -243,7 +245,7 @@ int main(int argc, char* argv[])
string cmd(string("echo 'FAILED: ") + ex.what() + "' > " + logFile); string cmd(string("echo 'FAILED: ") + ex.what() + "' > " + logFile);
if (canWrite) if (canWrite)
(void)system(cmd.c_str()); rc = system(cmd.c_str());
else else
cerr << cmd << endl; cerr << cmd << endl;
@ -255,7 +257,7 @@ int main(int argc, char* argv[])
string cmd = "echo 'FAILED: HDFS checking.' > " + logFile; string cmd = "echo 'FAILED: HDFS checking.' > " + logFile;
if (canWrite) if (canWrite)
(void)system(cmd.c_str()); rc = system(cmd.c_str());
else else
cerr << cmd << endl; cerr << cmd << endl;
@ -274,7 +276,7 @@ int main(int argc, char* argv[])
std::string cmd = "echo 'OK: buildOption=" + oam.itoa(buildOption) + "' > " + logFile; std::string cmd = "echo 'OK: buildOption=" + oam.itoa(buildOption) + "' > " + logFile;
if (canWrite) if (canWrite)
(void)system(cmd.c_str()); rc = system(cmd.c_str());
else else
#ifdef _MSC_VER #ifdef _MSC_VER
(void)0; (void)0;
@ -287,11 +289,9 @@ int main(int argc, char* argv[])
if (canWrite) if (canWrite)
{ {
int err; rc = system(cmd.c_str());
err = system(cmd.c_str()); if (rc != 0)
if (err != 0)
{ {
ostringstream os; ostringstream os;
os << "Warning: running " << cmd << " failed. This is usually non-fatal."; os << "Warning: running " << cmd << " failed. This is usually non-fatal.";
@ -309,7 +309,7 @@ int main(int argc, char* argv[])
string cmd = "echo 'FAILED: buildOption=" + oam.itoa(buildOption) + "' > " + logFile; string cmd = "echo 'FAILED: buildOption=" + oam.itoa(buildOption) + "' > " + logFile;
if (canWrite) if (canWrite)
(void)system(cmd.c_str()); rc = system(cmd.c_str());
else else
cerr << cmd << endl; cerr << cmd << endl;
@ -320,7 +320,7 @@ int main(int argc, char* argv[])
string cmd = "echo 'FAILED: buildOption=" + oam.itoa(buildOption) + "' > " + logFile; string cmd = "echo 'FAILED: buildOption=" + oam.itoa(buildOption) + "' > " + logFile;
if (canWrite) if (canWrite)
(void)system(cmd.c_str()); rc = system(cmd.c_str());
else else
cerr << cmd << endl; cerr << cmd << endl;

View File

@ -46,7 +46,10 @@ int main(int argc, char** argv)
#ifdef _MSC_VER #ifdef _MSC_VER
//FIXME //FIXME
#else #else
#pragma GCC diagnostic ignored "-Wunused-result"
setuid( 0 ); // set effective ID to root; ignore return status setuid( 0 ); // set effective ID to root; ignore return status
// Why should we raise privileges if we don't care?
#pragma GCC diagnostic pop
#endif #endif
setlocale(LC_ALL, ""); setlocale(LC_ALL, "");
WriteEngine::Config::initConfigCache(); // load Columnstore.xml config settings WriteEngine::Config::initConfigCache(); // load Columnstore.xml config settings

View File

@ -673,12 +673,15 @@ inline void DataConvert::timeToString1( long long timevalue, char* buf, unsigned
buf++; buf++;
buflen--; buflen--;
} }
// this snprintf call causes a compiler warning b/c buffer size is less
// then maximum string size.
#pragma GCC diagnostic ignored "-Wformat-truncation="
snprintf( buf, buflen, "%02d%02d%02d", snprintf( buf, buflen, "%02d%02d%02d",
hour, hour,
(unsigned)((timevalue >> 32) & 0xff), (unsigned)((timevalue >> 32) & 0xff),
(unsigned)((timevalue >> 14) & 0xff) (unsigned)((timevalue >> 14) & 0xff)
); );
#pragma GCC diagnostic pop
} }
inline std::string DataConvert::decimalToString(int64_t value, uint8_t scale, execplan::CalpontSystemCatalog::ColDataType colDataType) inline std::string DataConvert::decimalToString(int64_t value, uint8_t scale, execplan::CalpontSystemCatalog::ColDataType colDataType)

View File

@ -80,6 +80,7 @@ struct QStats
QStats fQStats; QStats fQStats;
#ifdef QUERY_TELE_DEBUG
string get_trace_file() string get_trace_file()
{ {
ostringstream oss; ostringstream oss;
@ -94,7 +95,6 @@ string get_trace_file()
return oss.str(); return oss.str();
} }
#ifdef QUERY_TELE_DEBUG
void log_query(const querytele::QueryTele& qtdata) void log_query(const querytele::QueryTele& qtdata)
{ {
ofstream trace(get_trace_file().c_str(), ios::out | ios::app); ofstream trace(get_trace_file().c_str(), ios::out | ios::app);

View File

@ -51,12 +51,14 @@ using namespace idbdatafile;
namespace namespace
{ {
#ifdef USE_VERY_COMPLEX_DROP_CACHES
void timespec_sub(const struct timespec& tv1, void timespec_sub(const struct timespec& tv1,
const struct timespec& tv2, const struct timespec& tv2,
double& tm) double& tm)
{ {
tm = (double)(tv2.tv_sec - tv1.tv_sec) + 1.e-9 * (tv2.tv_nsec - tv1.tv_nsec); tm = (double)(tv2.tv_sec - tv1.tv_sec) + 1.e-9 * (tv2.tv_nsec - tv1.tv_nsec);
} }
#endif
} }
namespace BRM namespace BRM
@ -2176,8 +2178,12 @@ void SlaveComm::do_flushInodeCache()
if ((fd = open("/proc/sys/vm/drop_caches", O_WRONLY)) >= 0) if ((fd = open("/proc/sys/vm/drop_caches", O_WRONLY)) >= 0)
{ {
write(fd, "3\n", 2); ssize_t written = write(fd, "3\n", 2);
close(fd); int rc = close(fd);
if ( !written || rc )
{
std::cerr << "Could not write into or close /proc/sys/vm/drop_caches" << std::endl;
}
} }
#endif #endif

View File

@ -830,10 +830,11 @@ void printInputSource(
if (alternateImportDir == IMPORT_PATH_CWD) if (alternateImportDir == IMPORT_PATH_CWD)
{ {
char cwdBuf[4096]; char cwdBuf[4096];
::getcwd(cwdBuf, sizeof(cwdBuf)); char *bufPtr = &cwdBuf[0];
bufPtr = ::getcwd(cwdBuf, sizeof(cwdBuf));
if (!(BulkLoad::disableConsoleOutput())) if (!(BulkLoad::disableConsoleOutput()))
cout << "Input file(s) will be read from : " << cwdBuf << endl; cout << "Input file(s) will be read from : " << bufPtr << endl;
} }
else else
{ {
@ -1021,7 +1022,9 @@ int main(int argc, char** argv)
#ifdef _MSC_VER #ifdef _MSC_VER
_setmaxstdio(2048); _setmaxstdio(2048);
#else #else
#pragma GCC diagnostic ignored "-Wunused-result"
setuid( 0 ); // set effective ID to root; ignore return status setuid( 0 ); // set effective ID to root; ignore return status
#pragma GCC diagnostic pop
#endif #endif
setupSignalHandlers(); setupSignalHandlers();

View File

@ -1462,9 +1462,11 @@ void TableInfo::writeBadRows( const std::vector<std::string>* errorDatRows,
if (!p.has_root_path()) if (!p.has_root_path())
{ {
// We could fail here having fixed size buffer
char cwdPath[4096]; char cwdPath[4096];
getcwd(cwdPath, sizeof(cwdPath)); char* buffPtr = &cwdPath[0];
boost::filesystem::path rejectFileName2( cwdPath ); buffPtr = getcwd(cwdPath, sizeof(cwdPath));
boost::filesystem::path rejectFileName2( buffPtr );
rejectFileName2 /= fRejectDataFileName; rejectFileName2 /= fRejectDataFileName;
fBadFiles.push_back( rejectFileName2.string() ); fBadFiles.push_back( rejectFileName2.string() );
@ -1569,8 +1571,9 @@ void TableInfo::writeErrReason( const std::vector< std::pair<RID,
if (!p.has_root_path()) if (!p.has_root_path())
{ {
char cwdPath[4096]; char cwdPath[4096];
getcwd(cwdPath, sizeof(cwdPath)); char* buffPtr = &cwdPath[0];
boost::filesystem::path errFileName2( cwdPath ); buffPtr = getcwd(cwdPath, sizeof(cwdPath));
boost::filesystem::path errFileName2( buffPtr );
errFileName2 /= fRejectErrFileName; errFileName2 /= fRejectErrFileName;
fErrFiles.push_back( errFileName2.string() ); fErrFiles.push_back( errFileName2.string() );

View File

@ -269,8 +269,8 @@ int WE_GetFileSizes::processFileName(
std::string& errMsg, int key) std::string& errMsg, int key)
{ {
uint8_t rc = 0; uint8_t rc = 0;
off_t fileSize; off_t fileSize = 0;
off_t compressedFileSize; off_t compressedFileSize = 0;
errMsg.clear(); errMsg.clear();
try try

View File

@ -1923,10 +1923,14 @@ int ChunkManager::reallocateChunks(CompFileData* fileData)
struct tm ltm; struct tm ltm;
localtime_r(reinterpret_cast<time_t*>(&tv.tv_sec), &ltm); localtime_r(reinterpret_cast<time_t*>(&tv.tv_sec), &ltm);
char tmText[24]; char tmText[24];
// this snprintf call causes a compiler warning b/c buffer size is less
// then maximum string size.
#pragma GCC diagnostic ignored "-Wformat-truncation="
snprintf(tmText, sizeof(tmText), ".%04d%02d%02d%02d%02d%02d%06ld", snprintf(tmText, sizeof(tmText), ".%04d%02d%02d%02d%02d%02d%06ld",
ltm.tm_year + 1900, ltm.tm_mon + 1, ltm.tm_year + 1900, ltm.tm_mon + 1,
ltm.tm_mday, ltm.tm_hour, ltm.tm_min, ltm.tm_mday, ltm.tm_hour, ltm.tm_min,
ltm.tm_sec, tv.tv_usec); ltm.tm_sec, tv.tv_usec);
#pragma GCC diagnostic pop
string dbgFileName(rlcFileName + tmText); string dbgFileName(rlcFileName + tmText);
ostringstream oss; ostringstream oss;
@ -2106,10 +2110,14 @@ int ChunkManager::reallocateChunks(CompFileData* fileData)
struct tm ltm; struct tm ltm;
localtime_r(reinterpret_cast<time_t*>(&tv.tv_sec), &ltm); localtime_r(reinterpret_cast<time_t*>(&tv.tv_sec), &ltm);
char tmText[24]; char tmText[24];
// this snprintf call causes a compiler warning b/c buffer size is less
// then maximum string size.
#pragma GCC diagnostic ignored "-Wformat-truncation="
snprintf(tmText, sizeof(tmText), ".%04d%02d%02d%02d%02d%02d%06ld", snprintf(tmText, sizeof(tmText), ".%04d%02d%02d%02d%02d%02d%06ld",
ltm.tm_year + 1900, ltm.tm_mon + 1, ltm.tm_year + 1900, ltm.tm_mon + 1,
ltm.tm_mday, ltm.tm_hour, ltm.tm_min, ltm.tm_mday, ltm.tm_hour, ltm.tm_min,
ltm.tm_sec, tv.tv_usec); ltm.tm_sec, tv.tv_usec);
#pragma GCC diagnostic pop
string dbgFileName(rlcFileName + tmText); string dbgFileName(rlcFileName + tmText);
ostringstream oss; ostringstream oss;

View File

@ -604,7 +604,10 @@ void WESplitterApp::updateWithJobFile(int aIdx)
int main(int argc, char** argv) int main(int argc, char** argv)
{ {
std::string err; std::string err;
#pragma GCC diagnostic ignored "-Wunused-result"
// Why do we need this if we don't care about f()'s rc ?
setuid(0); //@BUG 4343 set effective userid to root. setuid(0); //@BUG 4343 set effective userid to root.
#pragma GCC diagnostic pop
std::cin.sync_with_stdio(false); std::cin.sync_with_stdio(false);
try try

View File

@ -38,9 +38,9 @@ namespace
{ {
const char* DICT_TYPE("D"); const char* DICT_TYPE("D");
const char* ENCODING("UTF-8"); const char* ENCODING("UTF-8");
const char* JOBNAME("Job_");
const char* LOGNAME("Jobxml_"); const char* LOGNAME("Jobxml_");
const std::string LOGDIR("/log/"); const std::string LOGDIR("/log/");
const char* JOBNAME("Job_");
} }
namespace WriteEngine namespace WriteEngine
@ -438,13 +438,11 @@ void XMLGenProc::getColumnsForTable(
throw std::runtime_error( oss.str() ); throw std::runtime_error( oss.str() );
} }
} }
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
// Generate Job XML File Name // Generate Job XML File Name
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
// This isn't used currently, commenting it out
#if 0
std::string XMLGenProc::genJobXMLFileName( ) const std::string XMLGenProc::genJobXMLFileName( ) const
{ {
std::string xmlFileName; std::string xmlFileName;
@ -471,7 +469,7 @@ std::string XMLGenProc::genJobXMLFileName( ) const
char *buf; char *buf;
buf = getcwd(cwdPath, sizeof(cwdPath)); buf = getcwd(cwdPath, sizeof(cwdPath));
if (buf == NULL) if (buf == NULL)
throw runtime_error("Failed to get the current working directory!"); throw std::runtime_error("Failed to get the current working directory!");
boost::filesystem::path p2(cwdPath); boost::filesystem::path p2(cwdPath);
p2 /= p; p2 /= p;
xmlFileName = p2.string(); xmlFileName = p2.string();
@ -485,9 +483,7 @@ std::string XMLGenProc::genJobXMLFileName( ) const
return xmlFileName; return xmlFileName;
} }
#endif
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
// writeXMLFile // writeXMLFile
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------

View File

@ -90,7 +90,7 @@ public:
/** @brief Generate Job XML file name /** @brief Generate Job XML file name
*/ */
//EXPORT std::string genJobXMLFileName( ) const; EXPORT std::string genJobXMLFileName( ) const;
/** @brief Write xml file document to the destination Job XML file. /** @brief Write xml file document to the destination Job XML file.
* *