summaryrefslogtreecommitdiff
path: root/ndb
diff options
context:
space:
mode:
authorunknown <tomas@poseidon.ndb.mysql.com>2004-10-21 19:02:01 +0000
committerunknown <tomas@poseidon.ndb.mysql.com>2004-10-21 19:02:01 +0000
commit63920158ced1f2b343b14b723c2f5d9a92b06e62 (patch)
treeeba95bbc6b196e98a9035458df02703db497dd86 /ndb
parent277c84e2b12233624bdcc8f904bf86bbf9512e8e (diff)
downloadmariadb-git-63920158ced1f2b343b14b723c2f5d9a92b06e62.tar.gz
changed to call internal snprintf/vsnprintf
Diffstat (limited to 'ndb')
-rw-r--r--ndb/examples/select_all/select_all.cpp2
-rw-r--r--ndb/include/kernel/signaldata/ArbitSignalData.hpp12
-rw-r--r--ndb/include/kernel/signaldata/SignalData.hpp1
-rw-r--r--ndb/include/util/basestring_vsnprintf.h29
-rw-r--r--ndb/src/common/debugger/DebuggerNames.cpp3
-rw-r--r--ndb/src/common/debugger/signaldata/CopyGCI.cpp12
-rw-r--r--ndb/src/common/debugger/signaldata/CreateTrig.cpp28
-rw-r--r--ndb/src/common/debugger/signaldata/MasterLCP.cpp8
-rw-r--r--ndb/src/common/logger/Logger.cpp2
-rw-r--r--ndb/src/common/logger/listtest/LogHandlerListUnitTest.cpp2
-rw-r--r--ndb/src/common/mgmcommon/ConfigRetriever.cpp16
-rw-r--r--ndb/src/common/mgmcommon/LocalConfig.cpp4
-rw-r--r--ndb/src/common/portlib/NdbThread.c3
-rw-r--r--ndb/src/common/transporter/OSE_Receiver.cpp2
-rw-r--r--ndb/src/common/transporter/OSE_Transporter.cpp4
-rw-r--r--ndb/src/common/transporter/perftest/perfTransporterTest.cpp4
-rw-r--r--ndb/src/common/transporter/priotest/prioTransporterTest.cpp4
-rw-r--r--ndb/src/common/util/BaseString.cpp5
-rw-r--r--ndb/src/common/util/NdbErrHnd.cpp22
-rw-r--r--ndb/src/common/util/NdbOut.cpp6
-rw-r--r--ndb/src/common/util/OutputStream.cpp4
-rw-r--r--ndb/src/common/util/Properties.cpp26
-rw-r--r--ndb/src/common/util/basestring_vsnprintf.c27
-rw-r--r--ndb/src/common/util/socket_io.cpp8
-rw-r--r--ndb/src/cw/cpcd/APIService.cpp4
-rw-r--r--ndb/src/cw/cpcd/CPCD.cpp8
-rw-r--r--ndb/src/cw/cpcd/Process.cpp8
-rw-r--r--ndb/src/kernel/blocks/backup/Backup.cpp4
-rw-r--r--ndb/src/kernel/blocks/backup/restore/Restore.cpp12
-rw-r--r--ndb/src/kernel/blocks/backup/restore/consumer_restore.cpp2
-rw-r--r--ndb/src/kernel/blocks/dbdih/DbdihMain.cpp12
-rw-r--r--ndb/src/kernel/blocks/dblqh/DblqhMain.cpp2
-rw-r--r--ndb/src/kernel/blocks/dbtc/DbtcMain.cpp4
-rw-r--r--ndb/src/kernel/blocks/ndbcntr/NdbcntrMain.cpp12
-rw-r--r--ndb/src/kernel/blocks/ndbfs/AsyncFile.cpp4
-rw-r--r--ndb/src/kernel/blocks/ndbfs/Filename.cpp22
-rw-r--r--ndb/src/kernel/blocks/qmgr/QmgrMain.cpp6
-rw-r--r--ndb/src/kernel/error/ErrorReporter.cpp10
-rw-r--r--ndb/src/kernel/main.cpp2
-rw-r--r--ndb/src/kernel/vm/ClusterConfiguration.cpp8
-rw-r--r--ndb/src/kernel/vm/Configuration.cpp12
-rw-r--r--ndb/src/kernel/vm/SignalCounter.hpp2
-rw-r--r--ndb/src/kernel/vm/SimulatedBlock.cpp24
-rw-r--r--ndb/src/kernel/vm/SimulatedBlock.hpp4
-rw-r--r--ndb/src/mgmapi/mgmapi.cpp4
-rw-r--r--ndb/src/mgmclient/CommandInterpreter.cpp16
-rw-r--r--ndb/src/mgmclient/main.cpp2
-rw-r--r--ndb/src/mgmsrv/ConfigInfo.cpp16
-rw-r--r--ndb/src/mgmsrv/InitConfigFileParser.cpp20
-rw-r--r--ndb/src/mgmsrv/MgmtSrvr.cpp2
-rw-r--r--ndb/src/mgmsrv/Services.cpp2
-rw-r--r--ndb/src/mgmsrv/main.cpp5
-rw-r--r--ndb/src/ndbapi/Ndb.cpp8
-rw-r--r--ndb/src/ndbapi/NdbDictionaryImpl.cpp6
-rw-r--r--ndb/src/ndbapi/Ndbinit.cpp6
-rw-r--r--ndb/src/ndbapi/ndberror.c7
-rw-r--r--ndb/test/include/NDBT_Test.hpp2
-rw-r--r--ndb/test/ndbapi/asyncGenerator.cpp2
-rw-r--r--ndb/test/ndbapi/bulk_copy.cpp2
-rw-r--r--ndb/test/ndbapi/cdrserver.cpp34
-rw-r--r--ndb/test/ndbapi/flexAsynch.cpp6
-rw-r--r--ndb/test/ndbapi/flexBench.cpp8
-rw-r--r--ndb/test/ndbapi/flexHammer.cpp6
-rw-r--r--ndb/test/ndbapi/flexScan.cpp6
-rw-r--r--ndb/test/ndbapi/flexTT.cpp12
-rw-r--r--ndb/test/ndbapi/flex_bench_mysql.cpp14
-rw-r--r--ndb/test/ndbapi/interpreterInTup.cpp4
-rw-r--r--ndb/test/ndbapi/testDataBuffers.cpp4
-rw-r--r--ndb/test/ndbapi/testDict.cpp8
-rw-r--r--ndb/test/ndbapi/testIndex.cpp10
-rw-r--r--ndb/test/ndbapi/testReadPerf.cpp6
-rw-r--r--ndb/test/ndbapi/testScanInterpreter.cpp2
-rw-r--r--ndb/test/ndbapi/testScanPerf.cpp4
-rw-r--r--ndb/test/src/HugoCalculator.cpp2
-rw-r--r--ndb/test/src/NDBT_Test.cpp6
-rw-r--r--ndb/test/src/NdbBackup.cpp4
-rw-r--r--ndb/test/src/NdbGrep.cpp4
-rw-r--r--ndb/test/tools/transproxy.cpp4
-rw-r--r--ndb/tools/listTables.cpp4
79 files changed, 350 insertions, 294 deletions
diff --git a/ndb/examples/select_all/select_all.cpp b/ndb/examples/select_all/select_all.cpp
index bd25fb60128..24bb1214bd2 100644
--- a/ndb/examples/select_all/select_all.cpp
+++ b/ndb/examples/select_all/select_all.cpp
@@ -98,7 +98,7 @@ void ResultSetContainer::init(NdbDictionary::Dictionary * dict,
// Store all attribute names for the table
for (int i = 0; i < m_cols; i++) {
m_names[i] = new char[255];
- snprintf(m_names[i], 255, "%s", tab->getColumn(i)->getName());
+ BaseString::snprintf(m_names[i], 255, "%s", tab->getColumn(i)->getName());
}
}
diff --git a/ndb/include/kernel/signaldata/ArbitSignalData.hpp b/ndb/include/kernel/signaldata/ArbitSignalData.hpp
index 271b9920cd0..f255b8dcbbe 100644
--- a/ndb/include/kernel/signaldata/ArbitSignalData.hpp
+++ b/ndb/include/kernel/signaldata/ArbitSignalData.hpp
@@ -54,7 +54,7 @@ public:
}
inline void getText(char *buf, size_t buf_len) const {
- snprintf(buf, buf_len, "%08x%08x", data[0], data[1]);
+ BaseString::snprintf(buf, buf_len, "%08x%08x", data[0], data[1]);
}
/* inline char* getText() const {
@@ -113,19 +113,19 @@ public:
static inline void getErrText(Uint32 code, char* buf, size_t buf_len) {
switch (code) {
case ErrTicket:
- snprintf(buf, buf_len, "invalid arbitrator-ticket");
+ BaseString::snprintf(buf, buf_len, "invalid arbitrator-ticket");
break;
case ErrToomany:
- snprintf(buf, buf_len, "too many requests");
+ BaseString::snprintf(buf, buf_len, "too many requests");
break;
case ErrState:
- snprintf(buf, buf_len, "invalid state");
+ BaseString::snprintf(buf, buf_len, "invalid state");
break;
case ErrTimeout:
- snprintf(buf, buf_len, "timeout");
+ BaseString::snprintf(buf, buf_len, "timeout");
break;
default:
- snprintf(buf, buf_len, "unknown error [code=%u]", code);
+ BaseString::snprintf(buf, buf_len, "unknown error [code=%u]", code);
break;
}
}
diff --git a/ndb/include/kernel/signaldata/SignalData.hpp b/ndb/include/kernel/signaldata/SignalData.hpp
index f216e2eecb0..f9d3a6faa64 100644
--- a/ndb/include/kernel/signaldata/SignalData.hpp
+++ b/ndb/include/kernel/signaldata/SignalData.hpp
@@ -20,6 +20,7 @@
#include <ndb_global.h>
#include <ndb_limits.h>
#include <kernel_types.h>
+#include <BaseString.hpp>
#define ASSERT_BOOL(flag, message) assert(flag<=1)
#define ASSERT_RANGE(value, min, max, message) \
diff --git a/ndb/include/util/basestring_vsnprintf.h b/ndb/include/util/basestring_vsnprintf.h
new file mode 100644
index 00000000000..7c804f22841
--- /dev/null
+++ b/ndb/include/util/basestring_vsnprintf.h
@@ -0,0 +1,29 @@
+/* Copyright (C) 2003 MySQL AB
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+
+#ifndef BASESTRING_VSNPRINTF_H
+#define BASESTRING_VSNPRINTF_H
+#include <stdarg.h>
+#if defined(__cplusplus)
+extern "C"
+{
+#endif
+int basestring_snprintf(char*, size_t, const char*, ...);
+int basestring_vsnprintf(char*,size_t, const char*,va_list);
+#if defined(__cplusplus)
+}
+#endif
+#endif
diff --git a/ndb/src/common/debugger/DebuggerNames.cpp b/ndb/src/common/debugger/DebuggerNames.cpp
index c9ba9e46e9f..8571b8ece86 100644
--- a/ndb/src/common/debugger/DebuggerNames.cpp
+++ b/ndb/src/common/debugger/DebuggerNames.cpp
@@ -15,6 +15,7 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
#include <ndb_global.h>
+#include <BaseString.hpp>
#include "DebuggerNames.hpp"
@@ -131,7 +132,7 @@ getBlockName(unsigned short blockNo, const char * ret){
return localBlockNames[blockNo-MIN_BLOCK_NO];
if (ret == 0) {
static char buf[20];
- snprintf(buf, sizeof(buf), "BLOCK#%d", (int)blockNo);
+ BaseString::snprintf(buf, sizeof(buf), "BLOCK#%d", (int)blockNo);
return buf;
}
return ret;
diff --git a/ndb/src/common/debugger/signaldata/CopyGCI.cpp b/ndb/src/common/debugger/signaldata/CopyGCI.cpp
index 96186e82525..173b3f6708f 100644
--- a/ndb/src/common/debugger/signaldata/CopyGCI.cpp
+++ b/ndb/src/common/debugger/signaldata/CopyGCI.cpp
@@ -21,22 +21,22 @@ void
print(char * buf, size_t buf_len, CopyGCIReq::CopyReason r){
switch(r){
case CopyGCIReq::IDLE:
- snprintf(buf, buf_len, "IDLE");
+ BaseString::snprintf(buf, buf_len, "IDLE");
break;
case CopyGCIReq::LOCAL_CHECKPOINT:
- snprintf(buf, buf_len, "LOCAL_CHECKPOINT");
+ BaseString::snprintf(buf, buf_len, "LOCAL_CHECKPOINT");
break;
case CopyGCIReq::RESTART:
- snprintf(buf, buf_len, "RESTART");
+ BaseString::snprintf(buf, buf_len, "RESTART");
break;
case CopyGCIReq::GLOBAL_CHECKPOINT:
- snprintf(buf, buf_len, "GLOBAL_CHECKPOINT");
+ BaseString::snprintf(buf, buf_len, "GLOBAL_CHECKPOINT");
break;
case CopyGCIReq::INITIAL_START_COMPLETED:
- snprintf(buf, buf_len, "INITIAL_START_COMPLETED");
+ BaseString::snprintf(buf, buf_len, "INITIAL_START_COMPLETED");
break;
default:
- snprintf(buf, buf_len, "<Unknown>");
+ BaseString::snprintf(buf, buf_len, "<Unknown>");
}
}
diff --git a/ndb/src/common/debugger/signaldata/CreateTrig.cpp b/ndb/src/common/debugger/signaldata/CreateTrig.cpp
index ddd45080cba..db5344cfbe7 100644
--- a/ndb/src/common/debugger/signaldata/CreateTrig.cpp
+++ b/ndb/src/common/debugger/signaldata/CreateTrig.cpp
@@ -28,51 +28,51 @@ bool printCREATE_TRIG_REQ(FILE * output, const Uint32 * theData, Uint32 len, Uin
//sig->getTriggerName((char *) &triggerName);
switch (sig->getTriggerType()) {
case(TriggerType::SECONDARY_INDEX):
- snprintf(triggerType, sizeof(triggerType), "SECONDARY_INDEX");
+ BaseString::snprintf(triggerType, sizeof(triggerType), "SECONDARY_INDEX");
break;
case(TriggerType::SUBSCRIPTION):
- snprintf(triggerType, sizeof(triggerType), "SUBSCRIPTION");
+ BaseString::snprintf(triggerType, sizeof(triggerType), "SUBSCRIPTION");
break;
case(TriggerType::ORDERED_INDEX):
- snprintf(triggerType, sizeof(triggerType), "ORDERED_INDEX");
+ BaseString::snprintf(triggerType, sizeof(triggerType), "ORDERED_INDEX");
break;
default:
- snprintf(triggerType, sizeof(triggerType), "UNKNOWN [%d]", (int)sig->getTriggerType());
+ BaseString::snprintf(triggerType, sizeof(triggerType), "UNKNOWN [%d]", (int)sig->getTriggerType());
break;
}
switch (sig->getTriggerActionTime()) {
case (TriggerActionTime::TA_BEFORE):
- snprintf(triggerActionTime, sizeof(triggerActionTime), "BEFORE");
+ BaseString::snprintf(triggerActionTime, sizeof(triggerActionTime), "BEFORE");
break;
case(TriggerActionTime::TA_AFTER):
- snprintf(triggerActionTime, sizeof(triggerActionTime), "AFTER");
+ BaseString::snprintf(triggerActionTime, sizeof(triggerActionTime), "AFTER");
break;
case (TriggerActionTime::TA_DEFERRED):
- snprintf(triggerActionTime, sizeof(triggerActionTime), "DEFERRED");
+ BaseString::snprintf(triggerActionTime, sizeof(triggerActionTime), "DEFERRED");
break;
case (TriggerActionTime::TA_DETACHED):
- snprintf(triggerActionTime, sizeof(triggerActionTime), "DETACHED");
+ BaseString::snprintf(triggerActionTime, sizeof(triggerActionTime), "DETACHED");
break;
default:
- snprintf(triggerActionTime, sizeof(triggerActionTime),
+ BaseString::snprintf(triggerActionTime, sizeof(triggerActionTime),
"UNKNOWN [%d]", (int)sig->getTriggerActionTime());
break;
}
switch (sig->getTriggerEvent()) {
case (TriggerEvent::TE_INSERT):
- snprintf(triggerEvent, sizeof(triggerEvent), "INSERT");
+ BaseString::snprintf(triggerEvent, sizeof(triggerEvent), "INSERT");
break;
case(TriggerEvent::TE_DELETE):
- snprintf(triggerEvent, sizeof(triggerEvent), "DELETE");
+ BaseString::snprintf(triggerEvent, sizeof(triggerEvent), "DELETE");
break;
case(TriggerEvent::TE_UPDATE):
- snprintf(triggerEvent, sizeof(triggerEvent), "UPDATE");
+ BaseString::snprintf(triggerEvent, sizeof(triggerEvent), "UPDATE");
break;
case(TriggerEvent::TE_CUSTOM):
- snprintf(triggerEvent, sizeof(triggerEvent), "CUSTOM");
+ BaseString::snprintf(triggerEvent, sizeof(triggerEvent), "CUSTOM");
break;
default:
- snprintf(triggerEvent, sizeof(triggerEvent), "UNKNOWN [%d]", (int)sig->getTriggerEvent());
+ BaseString::snprintf(triggerEvent, sizeof(triggerEvent), "UNKNOWN [%d]", (int)sig->getTriggerEvent());
break;
}
diff --git a/ndb/src/common/debugger/signaldata/MasterLCP.cpp b/ndb/src/common/debugger/signaldata/MasterLCP.cpp
index aa30404524f..078b92f6f2e 100644
--- a/ndb/src/common/debugger/signaldata/MasterLCP.cpp
+++ b/ndb/src/common/debugger/signaldata/MasterLCP.cpp
@@ -23,16 +23,16 @@ void
print(char *buf, size_t buf_len, MasterLCPConf::State s){
switch(s){
case MasterLCPConf::LCP_STATUS_IDLE:
- snprintf(buf, buf_len, "LCP_STATUS_IDLE");
+ BaseString::snprintf(buf, buf_len, "LCP_STATUS_IDLE");
break;
case MasterLCPConf::LCP_STATUS_ACTIVE:
- snprintf(buf, buf_len, "LCP_STATUS_ACTIVE");
+ BaseString::snprintf(buf, buf_len, "LCP_STATUS_ACTIVE");
break;
case MasterLCPConf::LCP_TAB_COMPLETED:
- snprintf(buf, buf_len, "LCP_TAB_COMPLETED");
+ BaseString::snprintf(buf, buf_len, "LCP_TAB_COMPLETED");
break;
case MasterLCPConf::LCP_TAB_SAVED:
- snprintf(buf, buf_len, "LCP_TAB_SAVED");
+ BaseString::snprintf(buf, buf_len, "LCP_TAB_SAVED");
break;
}
}
diff --git a/ndb/src/common/logger/Logger.cpp b/ndb/src/common/logger/Logger.cpp
index c2fdecb642b..fed5c211149 100644
--- a/ndb/src/common/logger/Logger.cpp
+++ b/ndb/src/common/logger/Logger.cpp
@@ -340,7 +340,7 @@ Logger::log(LoggerLevel logLevel, const char* pMsg, va_list ap) const
while ( (pHandler = m_pHandlerList->next()) != NULL)
{
char buf[1024];
- vsnprintf(buf, sizeof(buf), pMsg, ap);
+ BaseString::vsnprintf(buf, sizeof(buf), pMsg, ap);
pHandler->append(m_pCategory, logLevel, buf);
}
}
diff --git a/ndb/src/common/logger/listtest/LogHandlerListUnitTest.cpp b/ndb/src/common/logger/listtest/LogHandlerListUnitTest.cpp
index 44ee11717b4..2bb02ad688f 100644
--- a/ndb/src/common/logger/listtest/LogHandlerListUnitTest.cpp
+++ b/ndb/src/common/logger/listtest/LogHandlerListUnitTest.cpp
@@ -48,7 +48,7 @@ int main(int argc, char* argv[])
{
ndbout << "-- " << " Test " << i + 1
<< " [" << testCases[i].name << "] --" << endl;
- snprintf(str, 256, "%s %s %s %d", "Logging ",
+ BaseString::snprintf(str, 256, "%s %s %s %d", "Logging ",
testCases[i].name, " message ", i);
if (testCases[i].test(str))
{
diff --git a/ndb/src/common/mgmcommon/ConfigRetriever.cpp b/ndb/src/common/mgmcommon/ConfigRetriever.cpp
index b4f2d0b9897..d8417ac146a 100644
--- a/ndb/src/common/mgmcommon/ConfigRetriever.cpp
+++ b/ndb/src/common/mgmcommon/ConfigRetriever.cpp
@@ -186,7 +186,7 @@ ConfigRetriever::getConfig(const char * filename){
const int res = stat(filename, &sbuf);
if(res != 0){
char buf[255];
- snprintf(buf, sizeof(buf), "Could not find file: \"%s\"", filename);
+ BaseString::snprintf(buf, sizeof(buf), "Could not find file: \"%s\"", filename);
setError(CR_ERROR, buf);
return 0;
}
@@ -211,7 +211,7 @@ ConfigRetriever::getConfig(const char * filename){
ConfigValuesFactory cvf;
if(!cvf.unpack(buf2, bytes)){
char buf[255];
- snprintf(buf, sizeof(buf), "Error while unpacking");
+ BaseString::snprintf(buf, sizeof(buf), "Error while unpacking");
setError(CR_ERROR, buf);
delete []buf2;
return 0;
@@ -241,7 +241,7 @@ ConfigRetriever::verifyConfig(const struct ndb_mgm_configuration * conf, Uint32
it = ndb_mgm_create_configuration_iterator((struct ndb_mgm_configuration *)conf, CFG_SECTION_NODE);
if(it == 0){
- snprintf(buf, 255, "Unable to create config iterator");
+ BaseString::snprintf(buf, 255, "Unable to create config iterator");
setError(CR_ERROR, buf);
return false;
@@ -249,14 +249,14 @@ ConfigRetriever::verifyConfig(const struct ndb_mgm_configuration * conf, Uint32
NdbAutoPtr<ndb_mgm_configuration_iterator> ptr(it);
if(ndb_mgm_find(it, CFG_NODE_ID, nodeid) != 0){
- snprintf(buf, 255, "Unable to find node with id: %d", nodeid);
+ BaseString::snprintf(buf, 255, "Unable to find node with id: %d", nodeid);
setError(CR_ERROR, buf);
return false;
}
const char * hostname;
if(ndb_mgm_get_string_parameter(it, CFG_NODE_HOST, &hostname)){
- snprintf(buf, 255, "Unable to get hostname(%d) from config",CFG_NODE_HOST);
+ BaseString::snprintf(buf, 255, "Unable to get hostname(%d) from config",CFG_NODE_HOST);
setError(CR_ERROR, buf);
return false;
}
@@ -268,7 +268,7 @@ ConfigRetriever::verifyConfig(const struct ndb_mgm_configuration * conf, Uint32
if (hostname && hostname[0] != 0 &&
!SocketServer::tryBind(0,hostname)) {
- snprintf(buf, 255, "Config hostname(%s) don't match a local interface,"
+ BaseString::snprintf(buf, 255, "Config hostname(%s) don't match a local interface,"
" tried to bind, error = %d - %s",
hostname, errno, strerror(errno));
setError(CR_ERROR, buf);
@@ -277,14 +277,14 @@ ConfigRetriever::verifyConfig(const struct ndb_mgm_configuration * conf, Uint32
unsigned int _type;
if(ndb_mgm_get_int_parameter(it, CFG_TYPE_OF_SECTION, &_type)){
- snprintf(buf, 255, "Unable to get type of node(%d) from config",
+ BaseString::snprintf(buf, 255, "Unable to get type of node(%d) from config",
CFG_TYPE_OF_SECTION);
setError(CR_ERROR, buf);
return false;
}
if(_type != m_node_type){
- snprintf(buf, 255, "Supplied node type(%d) and config node type(%d) "
+ BaseString::snprintf(buf, 255, "Supplied node type(%d) and config node type(%d) "
" don't match", m_node_type, _type);
setError(CR_ERROR, buf);
return false;
diff --git a/ndb/src/common/mgmcommon/LocalConfig.cpp b/ndb/src/common/mgmcommon/LocalConfig.cpp
index 4a558d8421a..3cd4341c6b7 100644
--- a/ndb/src/common/mgmcommon/LocalConfig.cpp
+++ b/ndb/src/common/mgmcommon/LocalConfig.cpp
@@ -90,7 +90,7 @@ LocalConfig::init(const char *connectString,
//7. Check
{
char buf[256];
- snprintf(buf, sizeof(buf), "host=localhost:%s", NDB_BASE_PORT);
+ BaseString::snprintf(buf, sizeof(buf), "host=localhost:%s", NDB_BASE_PORT);
if(readConnectString(buf, "default connect string"))
return true;
}
@@ -234,7 +234,7 @@ bool LocalConfig::readFile(const char * filename, bool &fopenError)
FILE * file = fopen(filename, "r");
if(file == 0){
- snprintf(line, sizeof(line),
+ BaseString::snprintf(line, sizeof(line),
"Unable to open local config file: %s", filename);
setError(0, line);
fopenError = true;
diff --git a/ndb/src/common/portlib/NdbThread.c b/ndb/src/common/portlib/NdbThread.c
index 8fc077edcdc..859b5cf1ec3 100644
--- a/ndb/src/common/portlib/NdbThread.c
+++ b/ndb/src/common/portlib/NdbThread.c
@@ -51,8 +51,7 @@ struct NdbThread* NdbThread_Create(NDB_THREAD_FUNC *p_thread_func,
if (tmpThread == NULL)
return NULL;
- snprintf(tmpThread->thread_name, sizeof(tmpThread->thread_name),
- "%s", p_thread_name);
+ strnmov(tmpThread->thread_name,p_thread_name,sizeof(tmpThread->thread_name));
pthread_attr_init(&thread_attr);
pthread_attr_setstacksize(&thread_attr, thread_stack_size);
diff --git a/ndb/src/common/transporter/OSE_Receiver.cpp b/ndb/src/common/transporter/OSE_Receiver.cpp
index b7d47b2f88c..63a33fc8f24 100644
--- a/ndb/src/common/transporter/OSE_Receiver.cpp
+++ b/ndb/src/common/transporter/OSE_Receiver.cpp
@@ -41,7 +41,7 @@ OSE_Receiver::OSE_Receiver(TransporterRegistry * tr,
phantomCreated = false;
localNodeId = _localNodeId;
- snprintf(localHostName, sizeof(localHostName),
+ BaseString::snprintf(localHostName, sizeof(localHostName),
"ndb_node%d", localNodeId);
DEBUG("localNodeId = " << localNodeId << " -> localHostName = "
diff --git a/ndb/src/common/transporter/OSE_Transporter.cpp b/ndb/src/common/transporter/OSE_Transporter.cpp
index c9b0f777319..a52862a80e5 100644
--- a/ndb/src/common/transporter/OSE_Transporter.cpp
+++ b/ndb/src/common/transporter/OSE_Transporter.cpp
@@ -51,10 +51,10 @@ OSE_Transporter::OSE_Transporter(int _prioASignalSize,
prioBSignalSize = _prioBSignalSize;
if (strcmp(lHostName, rHostName) == 0){
- snprintf(remoteNodeName, sizeof(remoteNodeName),
+ BaseString::snprintf(remoteNodeName, sizeof(remoteNodeName),
"ndb_node%d", remoteNodeId);
} else {
- snprintf(remoteNodeName, sizeof(remoteNodeName),
+ BaseString::snprintf(remoteNodeName, sizeof(remoteNodeName),
"%s/ndb_node%d", rHostName, remoteNodeId);
}
diff --git a/ndb/src/common/transporter/perftest/perfTransporterTest.cpp b/ndb/src/common/transporter/perftest/perfTransporterTest.cpp
index d33221c2835..71df9f12a4c 100644
--- a/ndb/src/common/transporter/perftest/perfTransporterTest.cpp
+++ b/ndb/src/common/transporter/perftest/perfTransporterTest.cpp
@@ -276,7 +276,7 @@ printReport(TestPhase & p){
char buf[255];
if(p.signalSize != 0){
- snprintf(buf, 255,
+ BaseString::snprintf(buf, 255,
"%d\t%d\t%s\t%s\t%s\t%s\t%d\t%d",
p.noOfSignals,
4*p.signalSize,
@@ -287,7 +287,7 @@ printReport(TestPhase & p){
(int)(p.sendLenBytes / (p.sendCount == 0 ? 1 : p.sendCount)),
(int)(p.recvLenBytes / (p.recvCount == 0 ? 1 : p.recvCount)));
} else {
- snprintf(buf, 255,
+ BaseString::snprintf(buf, 255,
"%d\trand\t%s\t%s\t%s\t%s\t%d\t%d",
p.noOfSignals,
st,
diff --git a/ndb/src/common/transporter/priotest/prioTransporterTest.cpp b/ndb/src/common/transporter/priotest/prioTransporterTest.cpp
index 0fce6aaad39..6c5623a49a6 100644
--- a/ndb/src/common/transporter/priotest/prioTransporterTest.cpp
+++ b/ndb/src/common/transporter/priotest/prioTransporterTest.cpp
@@ -375,7 +375,7 @@ printReport(TestPhase & p){
char buf[255];
if(p.signalSize != 0){
- snprintf(buf, 255,
+ BaseString::snprintf(buf, 255,
"%d\t%d\t%d\t%s\t%s\t%s\t%d\t%d\t%d\t%d",
p.noOfSignals,
p.signalSize,
@@ -388,7 +388,7 @@ printReport(TestPhase & p){
(int)(p.totTimePrioA / p.loopCount),
(int)(p.bytesSentBeforePrioA));
} else {
- snprintf(buf, 255,
+ BaseString::snprintf(buf, 255,
"%d\trand\t4*rand\t%s\t%s\t%s\t%d\t%d\t%d\t%d",
p.noOfSignals,
st,
diff --git a/ndb/src/common/util/BaseString.cpp b/ndb/src/common/util/BaseString.cpp
index ac6038ffcfd..dbff44c377d 100644
--- a/ndb/src/common/util/BaseString.cpp
+++ b/ndb/src/common/util/BaseString.cpp
@@ -17,10 +17,7 @@
/* -*- c-basic-offset: 4; -*- */
#include <ndb_global.h>
#include <BaseString.hpp>
-
-extern "C"
-int
-basestring_vsnprintf(char *str, size_t size, const char *format, va_list ap);
+#include <basestring_vsnprintf.h>
BaseString::BaseString()
{
diff --git a/ndb/src/common/util/NdbErrHnd.cpp b/ndb/src/common/util/NdbErrHnd.cpp
index f1c28a7bbdd..c6c2962b429 100644
--- a/ndb/src/common/util/NdbErrHnd.cpp
+++ b/ndb/src/common/util/NdbErrHnd.cpp
@@ -359,13 +359,13 @@ extern "C" OSBOOLEAN ndb_err_hnd(bool user_called,
"An Error has been reported:\r\n");
if (user_called == (OSBOOLEAN) 0 ) {
- snprintf(error_message.user_called_line,
+ BaseString::snprintf(error_message.user_called_line,
BUFSIZE,
"user_called: 0x%x (Error detected by the kernel)\r\n",
user_called);
}
else {
- snprintf(error_message.user_called_line,
+ BaseString::snprintf(error_message.user_called_line,
BUFSIZE,
"user_called: 0x%x (Error detected by an application)\r\n",
user_called);
@@ -401,22 +401,22 @@ extern "C" OSBOOLEAN ndb_err_hnd(bool user_called,
struct OS_pcb *pcb = get_pcb(current_process());
const char *process_name = &pcb->strings[pcb->name];
- snprintf(error_message.current_process_id_line,
+ BaseString::snprintf(error_message.current_process_id_line,
BUFSIZE,
"Current Process: 0x%08x\r\n",
current_process());
- snprintf(error_message.current_process_name_line,
+ BaseString::snprintf(error_message.current_process_name_line,
BUFSIZE,
"Process Name: %s\r\n",
process_name);
- snprintf(error_message.file_line,
+ BaseString::snprintf(error_message.file_line,
BUFSIZE,
"File: %s\r\n",
&pcb->strings[pcb->file]);
- snprintf(error_message.line_line,
+ BaseString::snprintf(error_message.line_line,
BUFSIZE,
"Line: %d\r\n",
pcb->line);
@@ -452,7 +452,7 @@ extern "C" OSBOOLEAN ndb_err_hnd(bool user_called,
char *expr = ((char **)extra)[0];
char *file = ((char **)extra)[1];
unsigned line = ((unsigned *)extra)[2];
- snprintf(assert_line, BUFSIZE, "Assertion Failed: %s:%u: %s\r\n", file, line, expr);
+ BaseString::snprintf(assert_line, BUFSIZE, "Assertion Failed: %s:%u: %s\r\n", file, line, expr);
ndbout << assert_line;
}
}
@@ -467,13 +467,13 @@ extern "C" OSBOOLEAN ndb_err_hnd(bool user_called,
const char *rcv_name = &rcv->strings[rcv->name];
struct OS_pcb *snd = get_pcb(snd_);
const char *snd_name = &snd->strings[snd->name];
- snprintf(unknown_signal_line, BUFSIZE,
+ BaseString::snprintf(unknown_signal_line, BUFSIZE,
"Unknown Signal Received\r\n");
- snprintf(unknown_signal_line, BUFSIZE,
+ BaseString::snprintf(unknown_signal_line, BUFSIZE,
"Signal Number: 0x%08lx\r\n", signo);
- snprintf(unknown_signal_line, BUFSIZE,
+ BaseString::snprintf(unknown_signal_line, BUFSIZE,
"Sending Process: 0x%08lx (%s))\r\n", snd_, snd_name);
- snprintf(unknown_signal_line, BUFSIZE,
+ BaseString::snprintf(unknown_signal_line, BUFSIZE,
"Receiving Process: 0x%08lx (%s))\r\n", rcv_, rcv_name);
free_buf((union SIGNAL **)&rcv);
free_buf((union SIGNAL **)&snd); }
diff --git a/ndb/src/common/util/NdbOut.cpp b/ndb/src/common/util/NdbOut.cpp
index 6d76cf22402..fa74cb364f3 100644
--- a/ndb/src/common/util/NdbOut.cpp
+++ b/ndb/src/common/util/NdbOut.cpp
@@ -102,7 +102,7 @@ NdbOut::print(const char * fmt, ...){
va_start(ap, fmt);
if (fmt != 0)
- vsnprintf(buf, sizeof(buf)-1, fmt, ap);
+ BaseString::vsnprintf(buf, sizeof(buf)-1, fmt, ap);
ndbout << buf;
va_end(ap);
}
@@ -114,7 +114,7 @@ NdbOut::println(const char * fmt, ...){
va_start(ap, fmt);
if (fmt != 0)
- vsnprintf(buf, sizeof(buf)-1, fmt, ap);
+ BaseString::vsnprintf(buf, sizeof(buf)-1, fmt, ap);
ndbout << buf << endl;
va_end(ap);
}
@@ -127,7 +127,7 @@ ndbout_c(const char * fmt, ...){
va_start(ap, fmt);
if (fmt != 0)
- vsnprintf(buf, sizeof(buf)-1, fmt, ap);
+ BaseString::vsnprintf(buf, sizeof(buf)-1, fmt, ap);
ndbout << buf << endl;
va_end(ap);
}
diff --git a/ndb/src/common/util/OutputStream.cpp b/ndb/src/common/util/OutputStream.cpp
index bf3599dbac9..a41eef649dd 100644
--- a/ndb/src/common/util/OutputStream.cpp
+++ b/ndb/src/common/util/OutputStream.cpp
@@ -74,7 +74,7 @@ SoftOseOutputStream::print(const char * fmt, ...){
va_start(ap, fmt);
if (fmt != 0)
- vsnprintf(buf, sizeof(buf)-1, fmt, ap);
+ BaseString::vsnprintf(buf, sizeof(buf)-1, fmt, ap);
else
buf[0] = 0;
va_end(ap);
@@ -88,7 +88,7 @@ SoftOseOutputStream::println(const char * fmt, ...){
va_start(ap, fmt);
if (fmt != 0)
- vsnprintf(buf, sizeof(buf)-1, fmt, ap);
+ BaseString::vsnprintf(buf, sizeof(buf)-1, fmt, ap);
else
buf[0] = 0;
va_end(ap);
diff --git a/ndb/src/common/util/Properties.cpp b/ndb/src/common/util/Properties.cpp
index 80fb0027830..a13e31780eb 100644
--- a/ndb/src/common/util/Properties.cpp
+++ b/ndb/src/common/util/Properties.cpp
@@ -371,7 +371,7 @@ Properties::print(FILE * out, const char * prefix) const{
break;
case PropertiesType_Properties:
char buf2 [1024];
- snprintf(buf2, sizeof(buf2), "%s%s%c",buf, impl->content[i]->name,
+ BaseString::snprintf(buf2, sizeof(buf2), "%s%s%c",buf, impl->content[i]->name,
Properties::delimiter);
((Properties *)impl->content[i]->value)->print(out, buf2);
break;
@@ -994,7 +994,7 @@ bool
Properties::put(const char * name, Uint32 no, Uint32 val, bool replace){
size_t tmp_len = strlen(name)+20;
char * tmp = (char*)malloc(tmp_len);
- snprintf(tmp, tmp_len, "%s_%d", name, no);
+ BaseString::snprintf(tmp, tmp_len, "%s_%d", name, no);
bool res = put(tmp, val, replace);
free(tmp);
return res;
@@ -1004,7 +1004,7 @@ bool
Properties::put64(const char * name, Uint32 no, Uint64 val, bool replace){
size_t tmp_len = strlen(name)+20;
char * tmp = (char*)malloc(tmp_len);
- snprintf(tmp, tmp_len, "%s_%d", name, no);
+ BaseString::snprintf(tmp, tmp_len, "%s_%d", name, no);
bool res = put(tmp, val, replace);
free(tmp);
return res;
@@ -1015,7 +1015,7 @@ bool
Properties::put(const char * name, Uint32 no, const char * val, bool replace){
size_t tmp_len = strlen(name)+20;
char * tmp = (char*)malloc(tmp_len);
- snprintf(tmp, tmp_len, "%s_%d", name, no);
+ BaseString::snprintf(tmp, tmp_len, "%s_%d", name, no);
bool res = put(tmp, val, replace);
free(tmp);
return res;
@@ -1027,7 +1027,7 @@ Properties::put(const char * name, Uint32 no, const Properties * val,
bool replace){
size_t tmp_len = strlen(name)+20;
char * tmp = (char*)malloc(tmp_len);
- snprintf(tmp, tmp_len, "%s_%d", name, no);
+ BaseString::snprintf(tmp, tmp_len, "%s_%d", name, no);
bool res = put(tmp, val, replace);
free(tmp);
return res;
@@ -1039,7 +1039,7 @@ Properties::getTypeOf(const char * name, Uint32 no,
PropertiesType * type) const {
size_t tmp_len = strlen(name)+20;
char * tmp = (char*)malloc(tmp_len);
- snprintf(tmp, tmp_len, "%s_%d", name, no);
+ BaseString::snprintf(tmp, tmp_len, "%s_%d", name, no);
bool res = getTypeOf(tmp, type);
free(tmp);
return res;
@@ -1049,7 +1049,7 @@ bool
Properties::contains(const char * name, Uint32 no) const {
size_t tmp_len = strlen(name)+20;
char * tmp = (char*)malloc(tmp_len);
- snprintf(tmp, tmp_len, "%s_%d", name, no);
+ BaseString::snprintf(tmp, tmp_len, "%s_%d", name, no);
bool res = contains(tmp);
free(tmp);
return res;
@@ -1059,7 +1059,7 @@ bool
Properties::get(const char * name, Uint32 no, Uint32 * value) const{
size_t tmp_len = strlen(name)+20;
char * tmp = (char*)malloc(tmp_len);
- snprintf(tmp, tmp_len, "%s_%d", name, no);
+ BaseString::snprintf(tmp, tmp_len, "%s_%d", name, no);
bool res = get(tmp, value);
free(tmp);
return res;
@@ -1069,7 +1069,7 @@ bool
Properties::get(const char * name, Uint32 no, Uint64 * value) const{
size_t tmp_len = strlen(name)+20;
char * tmp = (char*)malloc(tmp_len);
- snprintf(tmp, tmp_len, "%s_%d", name, no);
+ BaseString::snprintf(tmp, tmp_len, "%s_%d", name, no);
bool res = get(tmp, value);
free(tmp);
return res;
@@ -1080,7 +1080,7 @@ bool
Properties::get(const char * name, Uint32 no, const char ** value) const {
size_t tmp_len = strlen(name)+20;
char * tmp = (char*)malloc(tmp_len);
- snprintf(tmp, tmp_len, "%s_%d", name, no);
+ BaseString::snprintf(tmp, tmp_len, "%s_%d", name, no);
bool res = get(tmp, value);
free(tmp);
return res;
@@ -1091,7 +1091,7 @@ bool
Properties::get(const char * name, Uint32 no, const Properties ** value) const{
size_t tmp_len = strlen(name)+20;
char * tmp = (char*)malloc(tmp_len);
- snprintf(tmp, tmp_len, "%s_%d", name, no);
+ BaseString::snprintf(tmp, tmp_len, "%s_%d", name, no);
bool res = get(tmp, value);
free(tmp);
return res;
@@ -1102,7 +1102,7 @@ bool
Properties::getCopy(const char * name, Uint32 no, char ** value) const {
size_t tmp_len = strlen(name)+20;
char * tmp = (char*)malloc(tmp_len);
- snprintf(tmp, tmp_len, "%s_%d", name, no);
+ BaseString::snprintf(tmp, tmp_len, "%s_%d", name, no);
bool res = getCopy(tmp, value);
free(tmp);
return res;
@@ -1113,7 +1113,7 @@ bool
Properties::getCopy(const char * name, Uint32 no, Properties ** value) const {
size_t tmp_len = strlen(name)+20;
char * tmp = (char*)malloc(tmp_len);
- snprintf(tmp, tmp_len, "%s_%d", name, no);
+ BaseString::snprintf(tmp, tmp_len, "%s_%d", name, no);
bool res = getCopy(tmp, value);
free(tmp);
return res;
diff --git a/ndb/src/common/util/basestring_vsnprintf.c b/ndb/src/common/util/basestring_vsnprintf.c
index 65a92f6fa4b..0f3d3ae1d2b 100644
--- a/ndb/src/common/util/basestring_vsnprintf.c
+++ b/ndb/src/common/util/basestring_vsnprintf.c
@@ -1,6 +1,33 @@
+/* Copyright (C) 2003 MySQL AB
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+
// define on IRIX to get posix complian vsnprintf
#define _XOPEN_SOURCE 500
#include <stdio.h>
+#include <basestring_vsnprintf.h>
+
+int
+basestring_snprintf(char *str, size_t size, const char *format, ...)
+{
+ va_list ap;
+ va_start(ap, format);
+ int ret= basestring_vsnprintf(str, size, format, ap);
+ va_end(ap);
+ return(ret);
+}
int
basestring_vsnprintf(char *str, size_t size, const char *format, va_list ap)
diff --git a/ndb/src/common/util/socket_io.cpp b/ndb/src/common/util/socket_io.cpp
index b2f4ef91031..6f4c7e63684 100644
--- a/ndb/src/common/util/socket_io.cpp
+++ b/ndb/src/common/util/socket_io.cpp
@@ -175,13 +175,13 @@ vprint_socket(NDB_SOCKET_TYPE socket, int timeout_millis,
size_t size = sizeof(buf);
if (fmt != 0) {
- size = vsnprintf(buf, sizeof(buf), fmt, ap);
+ size = BaseString::vsnprintf(buf, sizeof(buf), fmt, ap);
/* Check if the output was truncated */
if(size >= sizeof(buf)) {
buf2 = (char *)malloc(size+1);
if(buf2 == NULL)
return -1;
- vsnprintf(buf2, size, fmt, ap);
+ BaseString::vsnprintf(buf2, size, fmt, ap);
} else
size = sizeof(buf);
} else
@@ -202,13 +202,13 @@ vprintln_socket(NDB_SOCKET_TYPE socket, int timeout_millis,
size_t size = sizeof(buf);
if (fmt != 0) {
- size = vsnprintf(buf, sizeof(buf), fmt, ap);
+ size = BaseString::vsnprintf(buf, sizeof(buf), fmt, ap);
/* Check if the output was truncated */
if(size >= sizeof(buf)-1) {
buf2 = (char *)malloc(size+2);
if(buf2 == NULL)
return -1;
- vsnprintf(buf2, size+1, fmt, ap);
+ BaseString::vsnprintf(buf2, size+1, fmt, ap);
} else
size = sizeof(buf);
} else
diff --git a/ndb/src/cw/cpcd/APIService.cpp b/ndb/src/cw/cpcd/APIService.cpp
index de0e40cebfc..63d0aaafe86 100644
--- a/ndb/src/cw/cpcd/APIService.cpp
+++ b/ndb/src/cw/cpcd/APIService.cpp
@@ -309,7 +309,7 @@ propToString(Properties *prop, const char *key) {
case PropertiesType_Uint32:
Uint32 val;
prop->get(key, &val);
- snprintf(buf, sizeof buf, "%d", val);
+ BaseString::snprintf(buf, sizeof buf, "%d", val);
retval = buf;
break;
case PropertiesType_char:
@@ -318,7 +318,7 @@ propToString(Properties *prop, const char *key) {
retval = str;
break;
default:
- snprintf(buf, sizeof buf, "(unknown)");
+ BaseString::snprintf(buf, sizeof buf, "(unknown)");
retval = buf;
}
return retval;
diff --git a/ndb/src/cw/cpcd/CPCD.cpp b/ndb/src/cw/cpcd/CPCD.cpp
index bc9f350755f..69a7b840528 100644
--- a/ndb/src/cw/cpcd/CPCD.cpp
+++ b/ndb/src/cw/cpcd/CPCD.cpp
@@ -237,9 +237,9 @@ CPCD::saveProcessList(){
FILE *f;
/* Create the filenames that we will use later */
- snprintf(newfile, sizeof(newfile), "%s.new", m_procfile.c_str());
- snprintf(oldfile, sizeof(oldfile), "%s.old", m_procfile.c_str());
- snprintf(curfile, sizeof(curfile), "%s", m_procfile.c_str());
+ BaseString::snprintf(newfile, sizeof(newfile), "%s.new", m_procfile.c_str());
+ BaseString::snprintf(oldfile, sizeof(oldfile), "%s.old", m_procfile.c_str());
+ BaseString::snprintf(curfile, sizeof(curfile), "%s", m_procfile.c_str());
f = fopen(newfile, "w");
@@ -380,7 +380,7 @@ CPCD::getProcessList() {
void
CPCD::RequestStatus::err(enum RequestStatusCode status, const char *msg) {
m_status = status;
- snprintf(m_errorstring, sizeof(m_errorstring), "%s", msg);
+ BaseString::snprintf(m_errorstring, sizeof(m_errorstring), "%s", msg);
}
#if 0
diff --git a/ndb/src/cw/cpcd/Process.cpp b/ndb/src/cw/cpcd/Process.cpp
index c38b2a45145..2d3973d1aba 100644
--- a/ndb/src/cw/cpcd/Process.cpp
+++ b/ndb/src/cw/cpcd/Process.cpp
@@ -140,7 +140,7 @@ CPCD::Process::readPid() {
memset(buf, 0, sizeof(buf));
- snprintf(filename, sizeof(filename), "%d", m_id);
+ BaseString::snprintf(filename, sizeof(filename), "%d", m_id);
f = fopen(filename, "r");
@@ -167,8 +167,8 @@ CPCD::Process::writePid(int pid) {
char filename[PATH_MAX*2+1];
FILE *f;
- snprintf(tmpfilename, sizeof(tmpfilename), "tmp.XXXXXX");
- snprintf(filename, sizeof(filename), "%d", m_id);
+ BaseString::snprintf(tmpfilename, sizeof(tmpfilename), "tmp.XXXXXX");
+ BaseString::snprintf(filename, sizeof(filename), "%d", m_id);
int fd = mkstemp(tmpfilename);
if(fd < 0) {
@@ -439,7 +439,7 @@ void
CPCD::Process::stop() {
char filename[PATH_MAX*2+1];
- snprintf(filename, sizeof(filename), "%d", m_id);
+ BaseString::snprintf(filename, sizeof(filename), "%d", m_id);
unlink(filename);
if(m_pid <= 1){
diff --git a/ndb/src/kernel/blocks/backup/Backup.cpp b/ndb/src/kernel/blocks/backup/Backup.cpp
index 569b3f98faa..e6fe63d9014 100644
--- a/ndb/src/kernel/blocks/backup/Backup.cpp
+++ b/ndb/src/kernel/blocks/backup/Backup.cpp
@@ -1307,7 +1307,7 @@ Backup::sendCreateTrig(Signal* signal,
for (int i=0; i < 3; i++) {
req->setTriggerEvent(triggerEventValues[i]);
- snprintf(triggerName, sizeof(triggerName), triggerNameFormat[i],
+ BaseString::snprintf(triggerName, sizeof(triggerName), triggerNameFormat[i],
ptr.p->backupId, tabPtr.p->tableId);
w.reset();
w.add(CreateTrigReq::TriggerNameKey, triggerName);
@@ -1945,7 +1945,7 @@ Backup::sendDropTrig(Signal* signal, BackupRecordPtr ptr, TablePtr tabPtr)
sendSignal(DBDICT_REF, GSN_DROP_TRIG_REQ,
signal, DropTrigReq::SignalLength, JBB);
} else {
- snprintf(triggerName, sizeof(triggerName), triggerNameFormat[i],
+ BaseString::snprintf(triggerName, sizeof(triggerName), triggerNameFormat[i],
ptr.p->backupId, tabPtr.p->tableId);
w.reset();
w.add(CreateTrigReq::TriggerNameKey, triggerName);
diff --git a/ndb/src/kernel/blocks/backup/restore/Restore.cpp b/ndb/src/kernel/blocks/backup/restore/Restore.cpp
index ddd955fc96c..fb3bde6bdef 100644
--- a/ndb/src/kernel/blocks/backup/restore/Restore.cpp
+++ b/ndb/src/kernel/blocks/backup/restore/Restore.cpp
@@ -515,7 +515,7 @@ BackupFile::setCtlFile(Uint32 nodeId, Uint32 backupId, const char * path){
m_expectedFileHeader.FileType = BackupFormat::CTL_FILE;
char name[PATH_MAX]; const Uint32 sz = sizeof(name);
- snprintf(name, sz, "BACKUP-%d.%d.ctl", backupId, nodeId);
+ BaseString::snprintf(name, sz, "BACKUP-%d.%d.ctl", backupId, nodeId);
setName(path, name);
}
@@ -526,7 +526,7 @@ BackupFile::setDataFile(const BackupFile & bf, Uint32 no){
m_expectedFileHeader.FileType = BackupFormat::DATA_FILE;
char name[PATH_MAX]; const Uint32 sz = sizeof(name);
- snprintf(name, sz, "BACKUP-%d-%d.%d.Data",
+ BaseString::snprintf(name, sz, "BACKUP-%d-%d.%d.Data",
m_expectedFileHeader.BackupId, no, m_nodeId);
setName(bf.m_path, name);
}
@@ -538,7 +538,7 @@ BackupFile::setLogFile(const BackupFile & bf, Uint32 no){
m_expectedFileHeader.FileType = BackupFormat::LOG_FILE;
char name[PATH_MAX]; const Uint32 sz = sizeof(name);
- snprintf(name, sz, "BACKUP-%d.%d.log",
+ BaseString::snprintf(name, sz, "BACKUP-%d.%d.log",
m_expectedFileHeader.BackupId, m_nodeId);
setName(bf.m_path, name);
}
@@ -548,15 +548,15 @@ BackupFile::setName(const char * p, const char * n){
const Uint32 sz = sizeof(m_path);
if(p != 0 && strlen(p) > 0){
if(p[strlen(p)-1] == '/'){
- snprintf(m_path, sz, "%s", p);
+ BaseString::snprintf(m_path, sz, "%s", p);
} else {
- snprintf(m_path, sz, "%s%s", p, "/");
+ BaseString::snprintf(m_path, sz, "%s%s", p, "/");
}
} else {
m_path[0] = 0;
}
- snprintf(m_fileName, sizeof(m_fileName), "%s%s", m_path, n);
+ BaseString::snprintf(m_fileName, sizeof(m_fileName), "%s%s", m_path, n);
debug << "Filename = " << m_fileName << endl;
}
diff --git a/ndb/src/kernel/blocks/backup/restore/consumer_restore.cpp b/ndb/src/kernel/blocks/backup/restore/consumer_restore.cpp
index fb82570b0b9..a35d9d22c65 100644
--- a/ndb/src/kernel/blocks/backup/restore/consumer_restore.cpp
+++ b/ndb/src/kernel/blocks/backup/restore/consumer_restore.cpp
@@ -121,7 +121,7 @@ BackupRestore::get_table(const NdbDictionary::Table* tab){
int cnt, id1, id2;
char buf[256];
if((cnt = sscanf(tab->getName(), "%[^/]/%[^/]/NDB$BLOB_%d_%d", buf, buf, &id1, &id2)) == 4){
- snprintf(buf, sizeof(buf), "NDB$BLOB_%d_%d", m_new_tables[id1]->getTableId(), id2);
+ BaseString::snprintf(buf, sizeof(buf), "NDB$BLOB_%d_%d", m_new_tables[id1]->getTableId(), id2);
m_cache.m_new_table = m_ndb->getDictionary()->getTable(buf);
} else {
m_cache.m_new_table = m_new_tables[tab->getTableId()];
diff --git a/ndb/src/kernel/blocks/dbdih/DbdihMain.cpp b/ndb/src/kernel/blocks/dbdih/DbdihMain.cpp
index bf9e02ead30..6784724c086 100644
--- a/ndb/src/kernel/blocks/dbdih/DbdihMain.cpp
+++ b/ndb/src/kernel/blocks/dbdih/DbdihMain.cpp
@@ -1438,7 +1438,7 @@ void Dbdih::execREAD_NODESCONF(Signal* signal)
continue;
}
char buf[255];
- snprintf(buf, sizeof(buf),
+ BaseString::snprintf(buf, sizeof(buf),
"Illegal configuration change."
" Initial start needs to be performed "
" when changing no of storage nodes (node %d)", i);
@@ -3500,7 +3500,7 @@ void Dbdih::selectMasterCandidateAndSend(Signal* signal)
Uint32 count = node_groups[nodePtr.i];
if(count != 0 && count != cnoReplicas){
char buf[255];
- snprintf(buf, sizeof(buf),
+ BaseString::snprintf(buf, sizeof(buf),
"Illegal configuration change."
" Initial start needs to be performed "
" when changing no of replicas (%d != %d)",
@@ -8634,7 +8634,7 @@ void Dbdih::startFragment(Signal* signal, Uint32 tableId, Uint32 fragId)
/* POSSIBLE TO RESTORE THE SYSTEM. */
/* --------------------------------------------------------------------- */
char buf[100];
- snprintf(buf, sizeof(buf),
+ BaseString::snprintf(buf, sizeof(buf),
"Unable to find restorable replica for "
"table: %d fragment: %d gci: %d",
tableId, fragId, SYSFILE->newestRestorableGCI);
@@ -12942,7 +12942,7 @@ Dbdih::execDUMP_STATE_ORD(Signal* signal)
snprintf(buf, sizeof(buf), " Table %d Fragment %d - ", tabPtr.i, j);
for(Uint32 k = 0; k < noOfReplicas; k++){
char tmp[100];
- snprintf(tmp, sizeof(tmp), "%d ", nodeOrder[k]);
+ BaseString::snprintf(tmp, sizeof(tmp), "%d ", nodeOrder[k]);
strcat(buf, tmp);
}
infoEvent(buf);
@@ -13158,12 +13158,12 @@ Dbdih::execDUMP_STATE_ORD(Signal* signal)
replicaPtr.i = fragPtr.p->storedReplicas;
do {
ptrCheckGuard(replicaPtr, creplicaFileSize, replicaRecord);
- snprintf(buf2, sizeof(buf2), "%s %d(on %d)=%d(%s)",
+ BaseString::snprintf(buf2, sizeof(buf2), "%s %d(on %d)=%d(%s)",
buf, num,
replicaPtr.p->procNode,
replicaPtr.p->lcpIdStarted,
replicaPtr.p->lcpOngoingFlag ? "Ongoing" : "Idle");
- snprintf(buf, sizeof(buf), "%s", buf2);
+ BaseString::snprintf(buf, sizeof(buf), "%s", buf2);
num++;
replicaPtr.i = replicaPtr.p->nextReplica;
diff --git a/ndb/src/kernel/blocks/dblqh/DblqhMain.cpp b/ndb/src/kernel/blocks/dblqh/DblqhMain.cpp
index e6a689eb8d7..cd15ad0c3b2 100644
--- a/ndb/src/kernel/blocks/dblqh/DblqhMain.cpp
+++ b/ndb/src/kernel/blocks/dblqh/DblqhMain.cpp
@@ -14807,7 +14807,7 @@ void Dblqh::execDEBUG_SIG(Signal* signal)
tdebug = logPagePtr.p->logPageWord[0];
char buf[100];
- snprintf(buf, 100,
+ BaseString::snprintf(buf, 100,
"Error while reading REDO log.\n"
"D=%d, F=%d Mb=%d FP=%d W1=%d W2=%d",
signal->theData[2], signal->theData[3], signal->theData[4],
diff --git a/ndb/src/kernel/blocks/dbtc/DbtcMain.cpp b/ndb/src/kernel/blocks/dbtc/DbtcMain.cpp
index 3276e4e5bce..d8b3ee10532 100644
--- a/ndb/src/kernel/blocks/dbtc/DbtcMain.cpp
+++ b/ndb/src/kernel/blocks/dbtc/DbtcMain.cpp
@@ -6369,8 +6369,8 @@ void Dbtc::sendAbortedAfterTimeout(Signal* signal, int Tcheck)
snprintf(buf, sizeof(buf), "TC %d: %d ops:",
__LINE__, apiConnectptr.i);
for(Uint32 i = 0; i<TloopCount; i++){
- snprintf(buf2, sizeof(buf2), "%s %d", buf, tmp[i]);
- snprintf(buf, sizeof(buf), buf2);
+ BaseString::snprintf(buf2, sizeof(buf2), "%s %d", buf, tmp[i]);
+ BaseString::snprintf(buf, sizeof(buf), buf2);
}
warningEvent(buf);
ndbout_c(buf);
diff --git a/ndb/src/kernel/blocks/ndbcntr/NdbcntrMain.cpp b/ndb/src/kernel/blocks/ndbcntr/NdbcntrMain.cpp
index 568ed6c6566..089cf613b03 100644
--- a/ndb/src/kernel/blocks/ndbcntr/NdbcntrMain.cpp
+++ b/ndb/src/kernel/blocks/ndbcntr/NdbcntrMain.cpp
@@ -135,42 +135,42 @@ void Ndbcntr::execSYSTEM_ERROR(Signal* signal)
jamEntry();
switch (sysErr->errorCode){
case SystemError::StartInProgressError:
- snprintf(buf, sizeof(buf),
+ BaseString::snprintf(buf, sizeof(buf),
"Node %d killed this node because "
"master start in progress error",
killingNode);
break;
case SystemError::GCPStopDetected:
- snprintf(buf, sizeof(buf),
+ BaseString::snprintf(buf, sizeof(buf),
"Node %d killed this node because "
"GCP stop was detected",
killingNode);
break;
case SystemError::ScanfragTimeout:
- snprintf(buf, sizeof(buf),
+ BaseString::snprintf(buf, sizeof(buf),
"Node %d killed this node because "
"a fragment scan timed out and could not be stopped",
killingNode);
break;
case SystemError::ScanfragStateError:
- snprintf(buf, sizeof(buf),
+ BaseString::snprintf(buf, sizeof(buf),
"Node %d killed this node because "
"the state of a fragment scan was out of sync.",
killingNode);
break;
case SystemError::CopyFragRefError:
- snprintf(buf, sizeof(buf),
+ BaseString::snprintf(buf, sizeof(buf),
"Node %d killed this node because "
"it could not copy a fragment during node restart",
killingNode);
break;
default:
- snprintf(buf, sizeof(buf), "System error %d, "
+ BaseString::snprintf(buf, sizeof(buf), "System error %d, "
" this node was killed by node %d",
sysErr->errorCode, killingNode);
break;
diff --git a/ndb/src/kernel/blocks/ndbfs/AsyncFile.cpp b/ndb/src/kernel/blocks/ndbfs/AsyncFile.cpp
index c61fccad22a..a02bfd459b3 100644
--- a/ndb/src/kernel/blocks/ndbfs/AsyncFile.cpp
+++ b/ndb/src/kernel/blocks/ndbfs/AsyncFile.cpp
@@ -119,7 +119,7 @@ AsyncFile::doStart(Uint32 nodeId,
char buf[16];
numAsyncFiles++;
- snprintf(buf, sizeof(buf), "AsyncFile%d", numAsyncFiles);
+ BaseString::snprintf(buf, sizeof(buf), "AsyncFile%d", numAsyncFiles);
theStartMutexPtr = NdbMutex_Create();
theStartConditionPtr = NdbCondition_Create();
@@ -816,7 +816,7 @@ AsyncFile::rmrfReq(Request * request, char * path, bool removePath){
struct dirent * dp;
while ((dp = readdir(dirp)) != NULL){
if ((strcmp(".", dp->d_name) != 0) && (strcmp("..", dp->d_name) != 0)) {
- snprintf(path_add, (size_t)path_max_copy, "%s%s",
+ BaseString::snprintf(path_add, (size_t)path_max_copy, "%s%s",
DIR_SEPARATOR, dp->d_name);
if(remove((const char*)path) == 0){
path[path_len] = 0;
diff --git a/ndb/src/kernel/blocks/ndbfs/Filename.cpp b/ndb/src/kernel/blocks/ndbfs/Filename.cpp
index 28aa1d23df4..15158ec19ef 100644
--- a/ndb/src/kernel/blocks/ndbfs/Filename.cpp
+++ b/ndb/src/kernel/blocks/ndbfs/Filename.cpp
@@ -56,7 +56,7 @@ Filename::init(Uint32 nodeid,
return;
}
- snprintf(theFileSystemDirectory, sizeof(theFileSystemDirectory),
+ BaseString::snprintf(theFileSystemDirectory, sizeof(theFileSystemDirectory),
"%sndb_%u_fs%s", pFileSystemPath, nodeid, DIR_SEPARATOR);
strncpy(theBackupDirectory, pBackupDirPath, sizeof(theBackupDirectory));
@@ -101,7 +101,7 @@ Filename::set(BlockReference blockReference,
const Uint32 P_val = FsOpenReq::v1_getP(filenumber);
if (diskNo < 0xff){
- snprintf(buf, sizeof(buf), "D%d%s", diskNo, DIR_SEPARATOR);
+ BaseString::snprintf(buf, sizeof(buf), "D%d%s", diskNo, DIR_SEPARATOR);
strcat(theName, buf);
theLevelDepth++;
}
@@ -112,31 +112,31 @@ Filename::set(BlockReference blockReference,
ERROR_SET(ecError, AFS_ERROR_PARAMETER,"","No Block Name");
return;
}
- snprintf(buf, sizeof(buf), "%s%s", blockName, DIR_SEPARATOR);
+ BaseString::snprintf(buf, sizeof(buf), "%s%s", blockName, DIR_SEPARATOR);
strcat(theName, buf);
theLevelDepth++;
}
if (table < 0xffffffff){
- snprintf(buf, sizeof(buf), "T%d%s", table, DIR_SEPARATOR);
+ BaseString::snprintf(buf, sizeof(buf), "T%d%s", table, DIR_SEPARATOR);
strcat(theName, buf);
theLevelDepth++;
}
if (frag < 0xffffffff){
- snprintf(buf, sizeof(buf), "F%d%s", frag, DIR_SEPARATOR);
+ BaseString::snprintf(buf, sizeof(buf), "F%d%s", frag, DIR_SEPARATOR);
strcat(theName, buf);
theLevelDepth++;
}
if (S_val < 0xffffffff){
- snprintf(buf, sizeof(buf), "S%d", S_val);
+ BaseString::snprintf(buf, sizeof(buf), "S%d", S_val);
strcat(theName, buf);
}
if (P_val < 0xff){
- snprintf(buf, sizeof(buf), "P%d", P_val);
+ BaseString::snprintf(buf, sizeof(buf), "P%d", P_val);
strcat(theName, buf);
}
@@ -147,14 +147,14 @@ Filename::set(BlockReference blockReference,
const Uint32 nodeId = FsOpenReq::v2_getNodeId(filenumber);
const Uint32 count = FsOpenReq::v2_getCount(filenumber);
- snprintf(buf, sizeof(buf), "BACKUP%sBACKUP-%d%s",
+ BaseString::snprintf(buf, sizeof(buf), "BACKUP%sBACKUP-%d%s",
DIR_SEPARATOR, seq, DIR_SEPARATOR);
strcat(theName, buf);
if(count == 0xffffffff) {
- snprintf(buf, sizeof(buf), "BACKUP-%d.%d",
+ BaseString::snprintf(buf, sizeof(buf), "BACKUP-%d.%d",
seq, nodeId); strcat(theName, buf);
} else {
- snprintf(buf, sizeof(buf), "BACKUP-%d-%d.%d",
+ BaseString::snprintf(buf, sizeof(buf), "BACKUP-%d-%d.%d",
seq, count, nodeId); strcat(theName, buf);
}
theLevelDepth = 2;
@@ -168,7 +168,7 @@ Filename::set(BlockReference blockReference,
ERROR_SET(ecError, AFS_ERROR_PARAMETER,"","Invalid disk specification");
}
- snprintf(buf, sizeof(buf), "D%d%s", diskNo, DIR_SEPARATOR);
+ BaseString::snprintf(buf, sizeof(buf), "D%d%s", diskNo, DIR_SEPARATOR);
strcat(theName, buf);
theLevelDepth++;
}
diff --git a/ndb/src/kernel/blocks/qmgr/QmgrMain.cpp b/ndb/src/kernel/blocks/qmgr/QmgrMain.cpp
index 6017365a463..9c0c6e141e1 100644
--- a/ndb/src/kernel/blocks/qmgr/QmgrMain.cpp
+++ b/ndb/src/kernel/blocks/qmgr/QmgrMain.cpp
@@ -592,7 +592,7 @@ void Qmgr::execCM_REGCONF(Signal* signal)
if (!ndbCompatible_ndb_ndb(NDB_VERSION, cmRegConf->presidentVersion)) {
jam();
char buf[128];
- snprintf(buf,sizeof(buf),"incompatible version own=0x%x other=0x%x, shutting down", NDB_VERSION, cmRegConf->presidentVersion);
+ BaseString::snprintf(buf,sizeof(buf),"incompatible version own=0x%x other=0x%x, shutting down", NDB_VERSION, cmRegConf->presidentVersion);
systemErrorLab(signal, buf);
return;
}
@@ -1666,7 +1666,7 @@ void Qmgr::checkStartInterface(Signal* signal)
} else {
if(((nodePtr.p->alarmCount + 1) % 60) == 0){
char buf[100];
- snprintf(buf, sizeof(buf),
+ BaseString::snprintf(buf, sizeof(buf),
"Failure handling of node %d has not completed in %d min."
" - state = %d",
nodePtr.i,
@@ -2672,7 +2672,7 @@ void Qmgr::systemErrorBecauseOtherNodeFailed(Signal* signal,
failReport(signal, getOwnNodeId(), (UintR)ZTRUE, FailRep::ZOWN_FAILURE);
char buf[100];
- snprintf(buf, 100,
+ BaseString::snprintf(buf, 100,
"Node was shutdown during startup because node %d failed",
failedNodeId);
diff --git a/ndb/src/kernel/error/ErrorReporter.cpp b/ndb/src/kernel/error/ErrorReporter.cpp
index d43001ef1f5..35c99b30994 100644
--- a/ndb/src/kernel/error/ErrorReporter.cpp
+++ b/ndb/src/kernel/error/ErrorReporter.cpp
@@ -60,7 +60,7 @@ ErrorReporter::formatTimeStampString(){
DateTime.setTimeStamp();
- snprintf(theDateTimeString, 39, "%s %d %s %d - %s:%s:%s",
+ BaseString::snprintf(theDateTimeString, 39, "%s %d %s %d - %s:%s:%s",
DateTime.getDayName(), DateTime.getDayOfMonth(),
DateTime.getMonthName(), DateTime.getYear(), DateTime.getHour(),
DateTime.getMinute(), DateTime.getSecond());
@@ -126,7 +126,7 @@ ErrorReporter::formatMessage(ErrorCategory type,
processId = NdbHost_GetProcessId();
- snprintf(messptr, MESSAGE_LENGTH,
+ BaseString::snprintf(messptr, MESSAGE_LENGTH,
"Date/Time: %s\nType of error: %s\n"
"Message: %s\nFault ID: %d\nProblem data: %s"
"\nObject of reference: %s\nProgramName: %s\n"
@@ -157,13 +157,13 @@ ErrorReporter::handleAssert(const char* message, const char* file, int line)
char refMessage[100];
#ifdef NO_EMULATED_JAM
- snprintf(refMessage, 100, "file: %s lineNo: %d",
+ BaseString::snprintf(refMessage, 100, "file: %s lineNo: %d",
file, line);
#else
const Uint32 blockNumber = theEmulatedJamBlockNumber;
const char *blockName = getBlockName(blockNumber);
- snprintf(refMessage, 100, "%s line: %d (block: %s)",
+ BaseString::snprintf(refMessage, 100, "%s line: %d (block: %s)",
file, line, blockName);
#endif
WriteMessage(assert, ERR_ERROR_PRGERR, message, refMessage,
@@ -178,7 +178,7 @@ ErrorReporter::handleThreadAssert(const char* message,
int line)
{
char refMessage[100];
- snprintf(refMessage, 100, "file: %s lineNo: %d - %s",
+ BaseString::snprintf(refMessage, 100, "file: %s lineNo: %d - %s",
file, line, message);
NdbShutdown(NST_ErrorHandler);
diff --git a/ndb/src/kernel/main.cpp b/ndb/src/kernel/main.cpp
index 9c25da79065..fa44704807d 100644
--- a/ndb/src/kernel/main.cpp
+++ b/ndb/src/kernel/main.cpp
@@ -363,6 +363,6 @@ handler_error(int signum){
g_eventLogger.info("Received signal %d. Running error handler.", signum);
// restart the system
char errorData[40];
- snprintf(errorData, 40, "Signal %d received", signum);
+ BaseString::snprintf(errorData, 40, "Signal %d received", signum);
ERROR_SET_SIGNAL(fatal, 0, errorData, __FILE__);
}
diff --git a/ndb/src/kernel/vm/ClusterConfiguration.cpp b/ndb/src/kernel/vm/ClusterConfiguration.cpp
index 3a6478380d1..d5bd03f69d5 100644
--- a/ndb/src/kernel/vm/ClusterConfiguration.cpp
+++ b/ndb/src/kernel/vm/ClusterConfiguration.cpp
@@ -358,7 +358,7 @@ void ClusterConfiguration::init(const Properties & p, const Properties & db){
for(int i = 0; i<sz; i++){
if(!db.get(tmp[i].attrib, tmp[i].storage)){
char buf[255];
- snprintf(buf, sizeof(buf), "%s not found", tmp[i].attrib);
+ BaseString::snprintf(buf, sizeof(buf), "%s not found", tmp[i].attrib);
ERROR_SET(fatal, ERR_INVALID_CONFIG, msg, buf);
}
}
@@ -406,7 +406,7 @@ void ClusterConfiguration::init(const Properties & p, const Properties & db){
for(unsigned j = 0; j<nodeNo; j++){
if(cd.nodeData[j].nodeId == nodeId){
char buf[255];
- snprintf(buf, sizeof(buf), "Two node can not have the same node id");
+ BaseString::snprintf(buf, sizeof(buf), "Two node can not have the same node id");
ERROR_SET(fatal, ERR_INVALID_CONFIG, msg, buf);
}
}
@@ -429,12 +429,12 @@ void ClusterConfiguration::init(const Properties & p, const Properties & db){
if(nodeId > MAX_NDB_NODES){
char buf[255];
- snprintf(buf, sizeof(buf), "Maximum node id for a ndb node is: %d", MAX_NDB_NODES);
+ BaseString::snprintf(buf, sizeof(buf), "Maximum node id for a ndb node is: %d", MAX_NDB_NODES);
ERROR_SET(fatal, ERR_INVALID_CONFIG, msg, buf);
}
if(cd.SizeAltData.noOfNDBNodes > MAX_NDB_NODES){
char buf[255];
- snprintf(buf, sizeof(buf),
+ BaseString::snprintf(buf, sizeof(buf),
"Maximum %d ndb nodes is allowed in the cluster",
MAX_NDB_NODES);
ERROR_SET(fatal, ERR_INVALID_CONFIG, msg, buf);
diff --git a/ndb/src/kernel/vm/Configuration.cpp b/ndb/src/kernel/vm/Configuration.cpp
index 7fb8dbcb003..706f60fd9cf 100644
--- a/ndb/src/kernel/vm/Configuration.cpp
+++ b/ndb/src/kernel/vm/Configuration.cpp
@@ -487,7 +487,7 @@ Configuration::calcSizeAlt(ConfigValues * ownConfig){
if (tmp[i].computable) {
*tmp[i].storage = 0;
} else {
- snprintf(buf, sizeof(buf),"ConfigParam: %d not found", tmp[i].paramId);
+ BaseString::snprintf(buf, sizeof(buf),"ConfigParam: %d not found", tmp[i].paramId);
ERROR_SET(fatal, ERR_INVALID_CONFIG, msg, buf);
}
}
@@ -497,12 +497,12 @@ Configuration::calcSizeAlt(ConfigValues * ownConfig){
ndb_mgm_get_int64_parameter(&db, CFG_DB_DATA_MEM, &dataMem);
ndb_mgm_get_int64_parameter(&db, CFG_DB_INDEX_MEM, &indexMem);
if(dataMem == 0){
- snprintf(buf, sizeof(buf), "ConfigParam: %d not found", CFG_DB_DATA_MEM);
+ BaseString::snprintf(buf, sizeof(buf), "ConfigParam: %d not found", CFG_DB_DATA_MEM);
ERROR_SET(fatal, ERR_INVALID_CONFIG, msg, buf);
}
if(indexMem == 0){
- snprintf(buf, sizeof(buf), "ConfigParam: %d not found", CFG_DB_INDEX_MEM);
+ BaseString::snprintf(buf, sizeof(buf), "ConfigParam: %d not found", CFG_DB_INDEX_MEM);
ERROR_SET(fatal, ERR_INVALID_CONFIG, msg, buf);
}
@@ -535,13 +535,13 @@ Configuration::calcSizeAlt(ConfigValues * ownConfig){
}
if(nodeId > MAX_NODES || nodeId == 0){
- snprintf(buf, sizeof(buf),
+ BaseString::snprintf(buf, sizeof(buf),
"Invalid node id: %d", nodeId);
ERROR_SET(fatal, ERR_INVALID_CONFIG, msg, buf);
}
if(nodes.get(nodeId)){
- snprintf(buf, sizeof(buf), "Two node can not have the same node id: %d",
+ BaseString::snprintf(buf, sizeof(buf), "Two node can not have the same node id: %d",
nodeId);
ERROR_SET(fatal, ERR_INVALID_CONFIG, msg, buf);
}
@@ -568,7 +568,7 @@ Configuration::calcSizeAlt(ConfigValues * ownConfig){
case NODE_TYPE_EXT_REP:
break;
default:
- snprintf(buf, sizeof(buf), "Unknown node type: %d", nodeType);
+ BaseString::snprintf(buf, sizeof(buf), "Unknown node type: %d", nodeType);
ERROR_SET(fatal, ERR_INVALID_CONFIG, msg, buf);
}
}
diff --git a/ndb/src/kernel/vm/SignalCounter.hpp b/ndb/src/kernel/vm/SignalCounter.hpp
index ea770324aa6..62242cb65bd 100644
--- a/ndb/src/kernel/vm/SignalCounter.hpp
+++ b/ndb/src/kernel/vm/SignalCounter.hpp
@@ -151,7 +151,7 @@ const char *
SignalCounter::getText() const {
static char buf[255];
static char nodes[NodeBitmask::TextLength+1];
- snprintf(buf, sizeof(buf), "[SignalCounter: m_count=%d %s]", m_count, m_nodes.getText(nodes));
+ BaseString::snprintf(buf, sizeof(buf), "[SignalCounter: m_count=%d %s]", m_count, m_nodes.getText(nodes));
return buf;
}
diff --git a/ndb/src/kernel/vm/SimulatedBlock.cpp b/ndb/src/kernel/vm/SimulatedBlock.cpp
index 18b7f474ddc..e6b97771d36 100644
--- a/ndb/src/kernel/vm/SimulatedBlock.cpp
+++ b/ndb/src/kernel/vm/SimulatedBlock.cpp
@@ -68,25 +68,25 @@ SimulatedBlock::SimulatedBlock(BlockNumber blockNumber,
char buf[255];
count = 10;
- snprintf(buf, 255, "%s.FragmentSendPool", getBlockName(blockNumber));
+ BaseString::snprintf(buf, 255, "%s.FragmentSendPool", getBlockName(blockNumber));
if(!p->get(buf, &count))
p->get("FragmentSendPool", &count);
c_fragmentSendPool.setSize(count);
count = 10;
- snprintf(buf, 255, "%s.FragmentInfoPool", getBlockName(blockNumber));
+ BaseString::snprintf(buf, 255, "%s.FragmentInfoPool", getBlockName(blockNumber));
if(!p->get(buf, &count))
p->get("FragmentInfoPool", &count);
c_fragmentInfoPool.setSize(count);
count = 10;
- snprintf(buf, 255, "%s.FragmentInfoHash", getBlockName(blockNumber));
+ BaseString::snprintf(buf, 255, "%s.FragmentInfoHash", getBlockName(blockNumber));
if(!p->get(buf, &count))
p->get("FragmentInfoHash", &count);
c_fragmentInfoHash.setSize(count);
count = 5;
- snprintf(buf, 255, "%s.ActiveMutexes", getBlockName(blockNumber));
+ BaseString::snprintf(buf, 255, "%s.ActiveMutexes", getBlockName(blockNumber));
if(!p->get(buf, &count))
p->get("ActiveMutexes", &count);
c_mutexMgr.setSize(count);
@@ -147,7 +147,7 @@ SimulatedBlock::addRecSignalImpl(GlobalSignalNumber gsn,
ExecFunction f, bool force){
if(gsn > MAX_GSN || (!force && theExecArray[gsn] != 0)){
char errorMsg[255];
- snprintf(errorMsg, 255,
+ BaseString::snprintf(errorMsg, 255,
"Illeagal signal (%d %d)", gsn, MAX_GSN);
ERROR_SET(fatal, ERR_ERROR_PRGERR, errorMsg, errorMsg);
}
@@ -159,9 +159,9 @@ SimulatedBlock::signal_error(Uint32 gsn, Uint32 len, Uint32 recBlockNo,
const char* filename, int lineno) const
{
char objRef[255];
- snprintf(objRef, 255, "%s:%d", filename, lineno);
+ BaseString::snprintf(objRef, 255, "%s:%d", filename, lineno);
char probData[255];
- snprintf(probData, 255,
+ BaseString::snprintf(probData, 255,
"Signal (GSN: %d, Length: %d, Rec Block No: %d)",
gsn, len, recBlockNo);
@@ -664,9 +664,9 @@ SimulatedBlock::allocRecord(const char * type, size_t s, size_t n, bool clear)
if (p == NULL){
char buf1[255];
char buf2[255];
- snprintf(buf1, sizeof(buf1), "%s could not allocate memory for %s",
+ BaseString::snprintf(buf1, sizeof(buf1), "%s could not allocate memory for %s",
getBlockName(number()), type);
- snprintf(buf2, sizeof(buf2), "Requested: %ux%u = %u bytes",
+ BaseString::snprintf(buf2, sizeof(buf2), "Requested: %ux%u = %u bytes",
(Uint32)s, (Uint32)n, (Uint32)size);
ERROR_SET(fatal, ERR_MEMALLOC, buf1, buf2);
}
@@ -722,7 +722,7 @@ SimulatedBlock::progError(int line, int err_code, const char* extra) const {
/* Add line number to block name */
char buf[100];
- snprintf(&buf[0], 100, "%s (Line: %d) 0x%.8x",
+ BaseString::snprintf(&buf[0], 100, "%s (Line: %d) 0x%.8x",
aBlockName, line, magicStatus);
ErrorReporter::handleError(ecError, err_code, extra, buf);
@@ -740,7 +740,7 @@ SimulatedBlock::infoEvent(const char * msg, ...) const {
va_list ap;
va_start(ap, msg);
- vsnprintf(buf, 96, msg, ap); // 96 = 100 - 4
+ BaseString::vsnprintf(buf, 96, msg, ap); // 96 = 100 - 4
va_end(ap);
int len = strlen(buf) + 1;
@@ -781,7 +781,7 @@ SimulatedBlock::warningEvent(const char * msg, ...) const {
va_list ap;
va_start(ap, msg);
- vsnprintf(buf, 96, msg, ap); // 96 = 100 - 4
+ BaseString::vsnprintf(buf, 96, msg, ap); // 96 = 100 - 4
va_end(ap);
int len = strlen(buf) + 1;
diff --git a/ndb/src/kernel/vm/SimulatedBlock.hpp b/ndb/src/kernel/vm/SimulatedBlock.hpp
index 6d46e9cc377..7972cb39746 100644
--- a/ndb/src/kernel/vm/SimulatedBlock.hpp
+++ b/ndb/src/kernel/vm/SimulatedBlock.hpp
@@ -472,11 +472,11 @@ SimulatedBlock::executeFunction(GlobalSignalNumber gsn, Signal* signal){
*/
char errorMsg[255];
if (!(gsn <= MAX_GSN)) {
- snprintf(errorMsg, 255, "Illegal signal received (GSN %d too high)", gsn);
+ BaseString::snprintf(errorMsg, 255, "Illegal signal received (GSN %d too high)", gsn);
ERROR_SET(fatal, ERR_ERROR_PRGERR, errorMsg, errorMsg);
}
if (!(theExecArray[gsn] != 0)) {
- snprintf(errorMsg, 255, "Illegal signal received (GSN %d not added)", gsn);
+ BaseString::snprintf(errorMsg, 255, "Illegal signal received (GSN %d not added)", gsn);
ERROR_SET(fatal, ERR_ERROR_PRGERR, errorMsg, errorMsg);
}
ndbrequire(false);
diff --git a/ndb/src/mgmapi/mgmapi.cpp b/ndb/src/mgmapi/mgmapi.cpp
index 3699ea2626a..4b62df968b3 100644
--- a/ndb/src/mgmapi/mgmapi.cpp
+++ b/ndb/src/mgmapi/mgmapi.cpp
@@ -110,7 +110,7 @@ setError(NdbMgmHandle h, int error, int error_line, const char * msg, ...){
va_list ap;
va_start(ap, msg);
- vsnprintf(h->last_error_desc, sizeof(h->last_error_desc), msg, ap);
+ BaseString::vsnprintf(h->last_error_desc, sizeof(h->last_error_desc), msg, ap);
va_end(ap);
}
@@ -359,7 +359,7 @@ ndb_mgm_connect(NdbMgmHandle handle, const char * mgmsrv)
* Open the log file
*/
char logname[64];
- snprintf(logname, 64, "mgmapi.log");
+ BaseString::snprintf(logname, 64, "mgmapi.log");
handle->logfile = fopen(logname, "w");
#endif
diff --git a/ndb/src/mgmclient/CommandInterpreter.cpp b/ndb/src/mgmclient/CommandInterpreter.cpp
index 1258f86ccc4..e0935c2104e 100644
--- a/ndb/src/mgmclient/CommandInterpreter.cpp
+++ b/ndb/src/mgmclient/CommandInterpreter.cpp
@@ -2020,46 +2020,46 @@ CmdBackupCallback(const MgmtSrvr::BackupEvent & event){
switch(event.Event){
case MgmtSrvr::BackupEvent::BackupStarted:
ok = true;
- snprintf(str, sizeof(str),
+ BaseString::snprintf(str, sizeof(str),
"Backup %d started", event.Started.BackupId);
break;
case MgmtSrvr::BackupEvent::BackupFailedToStart:
ok = true;
- snprintf(str, sizeof(str),
+ BaseString::snprintf(str, sizeof(str),
"Backup failed to start (Error %d)",
event.FailedToStart.ErrorCode);
break;
case MgmtSrvr::BackupEvent::BackupCompleted:
ok = true;
- snprintf(str, sizeof(str),
+ BaseString::snprintf(str, sizeof(str),
"Backup %d completed",
event.Completed.BackupId);
ndbout << str << endl;
- snprintf(str, sizeof(str),
+ BaseString::snprintf(str, sizeof(str),
" StartGCP: %d StopGCP: %d",
event.Completed.startGCP, event.Completed.stopGCP);
ndbout << str << endl;
- snprintf(str, sizeof(str),
+ BaseString::snprintf(str, sizeof(str),
" #Records: %d #LogRecords: %d",
event.Completed.NoOfRecords, event.Completed.NoOfLogRecords);
ndbout << str << endl;
- snprintf(str, sizeof(str),
+ BaseString::snprintf(str, sizeof(str),
" Data: %d bytes Log: %d bytes",
event.Completed.NoOfBytes, event.Completed.NoOfLogBytes);
break;
case MgmtSrvr::BackupEvent::BackupAborted:
ok = true;
- snprintf(str, sizeof(str),
+ BaseString::snprintf(str, sizeof(str),
"Backup %d has been aborted reason %d",
event.Aborted.BackupId,
event.Aborted.Reason);
break;
}
if(!ok){
- snprintf(str, sizeof(str),
+ BaseString::snprintf(str, sizeof(str),
"Unknown backup event: %d",
event.Event);
diff --git a/ndb/src/mgmclient/main.cpp b/ndb/src/mgmclient/main.cpp
index 69f968677cd..cc6d4bf600e 100644
--- a/ndb/src/mgmclient/main.cpp
+++ b/ndb/src/mgmclient/main.cpp
@@ -85,7 +85,7 @@ int main(int argc, const char** argv){
}
char buf[MAXHOSTNAMELEN+10];
- snprintf(buf, sizeof(buf), "%s:%d", _host, _port);
+ BaseString::snprintf(buf, sizeof(buf), "%s:%d", _host, _port);
ndbout << "-- NDB Cluster -- Management Client --" << endl;
printf("Connecting to Management Server: %s\n", buf);
diff --git a/ndb/src/mgmsrv/ConfigInfo.cpp b/ndb/src/mgmsrv/ConfigInfo.cpp
index 22338b1a801..aff75241074 100644
--- a/ndb/src/mgmsrv/ConfigInfo.cpp
+++ b/ndb/src/mgmsrv/ConfigInfo.cpp
@@ -2504,7 +2504,7 @@ transformNode(InitConfigFileParser::Context & ctx, const char * data){
}
ctx.m_userProperties.put("AllocatedNodeId_", id, id);
- snprintf(ctx.pname, sizeof(ctx.pname), "Node_%d", id);
+ BaseString::snprintf(ctx.pname, sizeof(ctx.pname), "Node_%d", id);
ctx.m_currentSection->put("Type", ctx.fname);
@@ -2569,7 +2569,7 @@ fixNodeHostname(InitConfigFileParser::Context & ctx, const char * data){
const Properties * computer;
char tmp[255];
- snprintf(tmp, sizeof(tmp), "Computer_%s", compId);
+ BaseString::snprintf(tmp, sizeof(tmp), "Computer_%s", compId);
if(!ctx.m_config->get(tmp, &computer)){
ctx.reportError("Computer \"%s\" not declared"
"- [%s] starting at line: %d",
@@ -2647,7 +2647,7 @@ transformExtNode(InitConfigFileParser::Context & ctx, const char * data){
ctx.m_userProperties.get("ExtNoOfNodes", &nodes);
require(ctx.m_userProperties.put("ExtNoOfNodes",++nodes, true));
- snprintf(ctx.pname, sizeof(ctx.pname), "EXTERNAL SYSTEM_%s:Node_%d",
+ BaseString::snprintf(ctx.pname, sizeof(ctx.pname), "EXTERNAL SYSTEM_%s:Node_%d",
systemName, id);
return true;
@@ -2661,7 +2661,7 @@ transformConnection(InitConfigFileParser::Context & ctx, const char * data){
Uint32 connections = 0;
ctx.m_userProperties.get("NoOfConnections", &connections);
- snprintf(ctx.pname, sizeof(ctx.pname), "Connection_%d", connections);
+ BaseString::snprintf(ctx.pname, sizeof(ctx.pname), "Connection_%d", connections);
ctx.m_userProperties.put("NoOfConnections", ++connections, true);
ctx.m_currentSection->put("Type", ctx.fname);
@@ -2684,7 +2684,7 @@ transformSystem(InitConfigFileParser::Context & ctx, const char * data){
ndbout << "transformSystem " << name << endl;
- snprintf(ctx.pname, sizeof(ctx.pname), "SYSTEM_%s", name);
+ BaseString::snprintf(ctx.pname, sizeof(ctx.pname), "SYSTEM_%s", name);
return true;
}
@@ -2701,7 +2701,7 @@ transformExternalSystem(InitConfigFileParser::Context & ctx, const char * data){
ctx.fname, ctx.m_sectionLineno);
return false;
}
- snprintf(ctx.pname, sizeof(ctx.pname), "EXTERNAL SYSTEM_%s", name);
+ BaseString::snprintf(ctx.pname, sizeof(ctx.pname), "EXTERNAL SYSTEM_%s", name);
return true;
}
@@ -2718,7 +2718,7 @@ transformComputer(InitConfigFileParser::Context & ctx, const char * data){
ctx.fname, ctx.m_sectionLineno);
return false;
}
- snprintf(ctx.pname, sizeof(ctx.pname), "Computer_%s", id);
+ BaseString::snprintf(ctx.pname, sizeof(ctx.pname), "Computer_%s", id);
Uint32 computers = 0;
ctx.m_userProperties.get("NoOfComputers", &computers);
@@ -2894,7 +2894,7 @@ fixExtConnection(InitConfigFileParser::Context & ctx, const char * data){
require(ctx.m_userProperties.put("ExtNoOfConnections",++connections, true));
char tmpLine1[MAX_LINE_LENGTH];
- snprintf(tmpLine1, MAX_LINE_LENGTH, "Connection_%d", connections-1);
+ BaseString::snprintf(tmpLine1, MAX_LINE_LENGTH, "Connection_%d", connections-1);
/**
* Section: EXTERNAL SYSTEM_<Ext System Name>
diff --git a/ndb/src/mgmsrv/InitConfigFileParser.cpp b/ndb/src/mgmsrv/InitConfigFileParser.cpp
index 008a9d0551f..fdfe7823fc2 100644
--- a/ndb/src/mgmsrv/InitConfigFileParser.cpp
+++ b/ndb/src/mgmsrv/InitConfigFileParser.cpp
@@ -110,7 +110,7 @@ InitConfigFileParser::parseConfig(FILE * file) {
"of configuration file.");
return 0;
}
- snprintf(ctx.fname, sizeof(ctx.fname), section); free(section);
+ BaseString::snprintf(ctx.fname, sizeof(ctx.fname), section); free(section);
ctx.type = InitConfigFileParser::DefaultSection;
ctx.m_sectionLineno = ctx.m_lineno;
ctx.m_currentSection = new Properties(true);
@@ -130,7 +130,7 @@ InitConfigFileParser::parseConfig(FILE * file) {
"of configuration file.");
return 0;
}
- snprintf(ctx.fname, sizeof(ctx.fname), section);
+ BaseString::snprintf(ctx.fname, sizeof(ctx.fname), section);
free(section);
ctx.type = InitConfigFileParser::Section;
ctx.m_sectionLineno = ctx.m_lineno;
@@ -172,7 +172,7 @@ InitConfigFileParser::parseConfig(FILE * file) {
return 0;
for(size_t j = 0; j<tmp.size(); j++){
- snprintf(ctx.fname, sizeof(ctx.fname), tmp[j].m_sectionType.c_str());
+ BaseString::snprintf(ctx.fname, sizeof(ctx.fname), tmp[j].m_sectionType.c_str());
ctx.type = InitConfigFileParser::Section;
ctx.m_currentSection = tmp[j].m_sectionData;
ctx.m_userDefaults = getSection(ctx.fname, ctx.m_defaults);
@@ -198,7 +198,7 @@ InitConfigFileParser::parseConfig(FILE * file) {
ctx.m_config->put("NoOfNodes", nNodes);
char tmpLine[MAX_LINE_LENGTH];
- snprintf(tmpLine, MAX_LINE_LENGTH, "EXTERNAL SYSTEM_");
+ BaseString::snprintf(tmpLine, MAX_LINE_LENGTH, "EXTERNAL SYSTEM_");
strncat(tmpLine, system, MAX_LINE_LENGTH);
strncat(tmpLine, ":NoOfConnections", MAX_LINE_LENGTH);
ctx.m_config->put(tmpLine, nExtConnections);
@@ -549,13 +549,13 @@ InitConfigFileParser::storeSection(Context& ctx){
for(int i = strlen(ctx.fname) - 1; i>=0; i--){
ctx.fname[i] = toupper(ctx.fname[i]);
}
- snprintf(ctx.pname, sizeof(ctx.pname), ctx.fname);
+ BaseString::snprintf(ctx.pname, sizeof(ctx.pname), ctx.fname);
char buf[255];
if(ctx.type == InitConfigFileParser::Section)
- snprintf(buf, sizeof(buf), "%s", ctx.fname);
+ BaseString::snprintf(buf, sizeof(buf), "%s", ctx.fname);
if(ctx.type == InitConfigFileParser::DefaultSection)
- snprintf(buf, sizeof(buf), "%s DEFAULT", ctx.fname);
- snprintf(ctx.fname, sizeof(ctx.fname), buf);
+ BaseString::snprintf(buf, sizeof(buf), "%s DEFAULT", ctx.fname);
+ BaseString::snprintf(ctx.fname, sizeof(ctx.fname), buf);
if(ctx.type == InitConfigFileParser::Section){
for(int i = 0; i<m_info->m_NoOfRules; i++){
const ConfigInfo::SectionRule & rule = m_info->m_SectionRules[i];
@@ -581,7 +581,7 @@ InitConfigFileParser::Context::reportError(const char * fmt, ...){
va_start(ap, fmt);
if (fmt != 0)
- vsnprintf(buf, sizeof(buf)-1, fmt, ap);
+ BaseString::vsnprintf(buf, sizeof(buf)-1, fmt, ap);
ndbout << "Error line " << m_lineno << ": " << buf << endl;
va_end(ap);
@@ -595,7 +595,7 @@ InitConfigFileParser::Context::reportWarning(const char * fmt, ...){
va_start(ap, fmt);
if (fmt != 0)
- vsnprintf(buf, sizeof(buf)-1, fmt, ap);
+ BaseString::vsnprintf(buf, sizeof(buf)-1, fmt, ap);
ndbout << "Warning line " << m_lineno << ": " << buf << endl;
va_end(ap);
}
diff --git a/ndb/src/mgmsrv/MgmtSrvr.cpp b/ndb/src/mgmsrv/MgmtSrvr.cpp
index 92a8025295f..3dc081700ba 100644
--- a/ndb/src/mgmsrv/MgmtSrvr.cpp
+++ b/ndb/src/mgmsrv/MgmtSrvr.cpp
@@ -1825,7 +1825,7 @@ const char* MgmtSrvr::getErrorText(int errorCode)
}
}
- snprintf(text, 255, "Unknown management server error code %d", errorCode);
+ BaseString::snprintf(text, 255, "Unknown management server error code %d", errorCode);
return text;
}
diff --git a/ndb/src/mgmsrv/Services.cpp b/ndb/src/mgmsrv/Services.cpp
index 55f89a164b5..201168c1726 100644
--- a/ndb/src/mgmsrv/Services.cpp
+++ b/ndb/src/mgmsrv/Services.cpp
@@ -1123,7 +1123,7 @@ MgmApiSession::logSignals(Parser<MgmApiSession>::Context &,
args.get("blocks", blockList);
// fast fix - pekka
char buf[200];
- snprintf(buf, 200, "%s", blockList.c_str());
+ BaseString::snprintf(buf, 200, "%s", blockList.c_str());
Vector<BaseString> blocks;
blockName=strtok(buf,"|");
diff --git a/ndb/src/mgmsrv/main.cpp b/ndb/src/mgmsrv/main.cpp
index 1a2b95391a9..51282416c24 100644
--- a/ndb/src/mgmsrv/main.cpp
+++ b/ndb/src/mgmsrv/main.cpp
@@ -131,6 +131,7 @@ int num_args = sizeof(args) / sizeof(args[0]);
*/
NDB_MAIN(mgmsrv){
ndb_init();
+
/**
* OSE specific. Enable shared ownership of file system resources.
* This is needed in order to use the cluster log since the events
@@ -266,12 +267,12 @@ NDB_MAIN(mgmsrv){
mapi->setMgm(glob.mgmObject);
char msg[256];
- snprintf(msg, sizeof(msg),
+ BaseString::snprintf(msg, sizeof(msg),
"NDB Cluster Management Server. %s", NDB_VERSION_STRING);
ndbout_c(msg);
g_EventLogger.info(msg);
- snprintf(msg, 256, "Id: %d, Command port: %d",
+ BaseString::snprintf(msg, 256, "Id: %d, Command port: %d",
glob.localNodeId, glob.port);
ndbout_c(msg);
g_EventLogger.info(msg);
diff --git a/ndb/src/ndbapi/Ndb.cpp b/ndb/src/ndbapi/Ndb.cpp
index 04632665aff..be0445bceb3 100644
--- a/ndb/src/ndbapi/Ndb.cpp
+++ b/ndb/src/ndbapi/Ndb.cpp
@@ -1158,10 +1158,10 @@ const char * Ndb::getCatalogName() const
void Ndb::setCatalogName(const char * a_catalog_name)
{
if (a_catalog_name) {
- snprintf(theDataBase, sizeof(theDataBase), "%s",
+ BaseString::snprintf(theDataBase, sizeof(theDataBase), "%s",
a_catalog_name ? a_catalog_name : "");
- int len = snprintf(prefixName, sizeof(prefixName), "%s%c%s%c",
+ int len = BaseString::snprintf(prefixName, sizeof(prefixName), "%s%c%s%c",
theDataBase, table_name_separator,
theDataBaseSchema, table_name_separator);
prefixEnd = prefixName + (len < (int) sizeof(prefixName) ? len :
@@ -1177,10 +1177,10 @@ const char * Ndb::getSchemaName() const
void Ndb::setSchemaName(const char * a_schema_name)
{
if (a_schema_name) {
- snprintf(theDataBaseSchema, sizeof(theDataBase), "%s",
+ BaseString::snprintf(theDataBaseSchema, sizeof(theDataBase), "%s",
a_schema_name ? a_schema_name : "");
- int len = snprintf(prefixName, sizeof(prefixName), "%s%c%s%c",
+ int len = BaseString::snprintf(prefixName, sizeof(prefixName), "%s%c%s%c",
theDataBase, table_name_separator,
theDataBaseSchema, table_name_separator);
prefixEnd = prefixName + (len < (int) sizeof(prefixName) ? len :
diff --git a/ndb/src/ndbapi/NdbDictionaryImpl.cpp b/ndb/src/ndbapi/NdbDictionaryImpl.cpp
index 28aceb536ee..cf51a30fe0b 100644
--- a/ndb/src/ndbapi/NdbDictionaryImpl.cpp
+++ b/ndb/src/ndbapi/NdbDictionaryImpl.cpp
@@ -1469,7 +1469,7 @@ NdbDictInterface::createOrAlterTable(Ndb & ndb,
impl.m_internalName.assign(internalName);
UtilBufferWriter w(m_buffer);
DictTabInfo::Table tmpTab; tmpTab.init();
- snprintf(tmpTab.TableName,
+ BaseString::snprintf(tmpTab.TableName,
sizeof(tmpTab.TableName),
internalName);
@@ -1525,7 +1525,7 @@ NdbDictInterface::createOrAlterTable(Ndb & ndb,
continue;
DictTabInfo::Attribute tmpAttr; tmpAttr.init();
- snprintf(tmpAttr.AttributeName, sizeof(tmpAttr.AttributeName),
+ BaseString::snprintf(tmpAttr.AttributeName, sizeof(tmpAttr.AttributeName),
col->m_name.c_str());
tmpAttr.AttributeId = i;
tmpAttr.AttributeKeyFlag = col->m_pk || col->m_tupleKey;
@@ -1560,7 +1560,7 @@ NdbDictInterface::createOrAlterTable(Ndb & ndb,
(void)tmpAttr.translateExtType();
tmpAttr.AttributeAutoIncrement = col->m_autoIncrement;
- snprintf(tmpAttr.AttributeDefaultValue,
+ BaseString::snprintf(tmpAttr.AttributeDefaultValue,
sizeof(tmpAttr.AttributeDefaultValue),
col->m_defaultValue.c_str());
s = SimpleProperties::pack(w,
diff --git a/ndb/src/ndbapi/Ndbinit.cpp b/ndb/src/ndbapi/Ndbinit.cpp
index 28b94d31159..b8927f2abba 100644
--- a/ndb/src/ndbapi/Ndbinit.cpp
+++ b/ndb/src/ndbapi/Ndbinit.cpp
@@ -160,12 +160,12 @@ void Ndb::setup(Ndb_cluster_connection *ndb_cluster_connection,
theLastTupleId[i] = 0;
}//for
- snprintf(theDataBase, sizeof(theDataBase), "%s",
+ BaseString::snprintf(theDataBase, sizeof(theDataBase), "%s",
aDataBase ? aDataBase : "");
- snprintf(theDataBaseSchema, sizeof(theDataBaseSchema), "%s",
+ BaseString::snprintf(theDataBaseSchema, sizeof(theDataBaseSchema), "%s",
aSchema ? aSchema : "");
- int len = snprintf(prefixName, sizeof(prefixName), "%s%c%s%c",
+ int len = BaseString::snprintf(prefixName, sizeof(prefixName), "%s%c%s%c",
theDataBase, table_name_separator,
theDataBaseSchema, table_name_separator);
prefixEnd = prefixName + (len < (int) sizeof(prefixName) ? len :
diff --git a/ndb/src/ndbapi/ndberror.c b/ndb/src/ndbapi/ndberror.c
index fffef023fbc..20661b89517 100644
--- a/ndb/src/ndbapi/ndberror.c
+++ b/ndb/src/ndbapi/ndberror.c
@@ -16,7 +16,6 @@
#include <ndb_global.h>
-
#include <ndberror.h>
typedef struct ErrorBundle {
@@ -594,8 +593,10 @@ int ndb_error_string(int err_no, char *str, unsigned int size)
error.code = err_no;
ndberror_update(&error);
- len = snprintf(str, size-1, "%s: %s: %s", error.message,
- ndberror_status_message(error.status), ndberror_classification_message(error.classification));
+ len =
+ snprintf(str, size-1, "%s: %s: %s", error.message,
+ ndberror_status_message(error.status),
+ ndberror_classification_message(error.classification));
str[size-1]= '\0';
return len;
diff --git a/ndb/test/include/NDBT_Test.hpp b/ndb/test/include/NDBT_Test.hpp
index 176cec3cd27..b0b5fe15960 100644
--- a/ndb/test/include/NDBT_Test.hpp
+++ b/ndb/test/include/NDBT_Test.hpp
@@ -251,7 +251,7 @@ public:
// Convert to Uint32 in order to be able to print it to screen
Uint32 lapTime = (Uint32)m_ticks;
Uint32 secTime = lapTime/1000;
- snprintf(buf, 255, "%d secs (%d ms)", secTime, lapTime);
+ BaseString::snprintf(buf, 255, "%d secs (%d ms)", secTime, lapTime);
return buf;
}
private:
diff --git a/ndb/test/ndbapi/asyncGenerator.cpp b/ndb/test/ndbapi/asyncGenerator.cpp
index 84a93414712..d91e38dff1a 100644
--- a/ndb/test/ndbapi/asyncGenerator.cpp
+++ b/ndb/test/ndbapi/asyncGenerator.cpp
@@ -248,7 +248,7 @@ doTransaction_T1(Ndb * pNDB, ThreadData * td, int async)
/*----------------*/
getRandomSubscriberNumber(td->transactionData.number);
getRandomChangedBy(td->transactionData.changed_by);
- snprintf(td->transactionData.changed_time,
+ BaseString::snprintf(td->transactionData.changed_time,
sizeof(td->transactionData.changed_time),
"%ld - %d", td->changedTime++, myRandom48(65536*1024));
//getRandomChangedTime(td->transactionData.changed_time);
diff --git a/ndb/test/ndbapi/bulk_copy.cpp b/ndb/test/ndbapi/bulk_copy.cpp
index 8821a92fb27..b53654ce0fb 100644
--- a/ndb/test/ndbapi/bulk_copy.cpp
+++ b/ndb/test/ndbapi/bulk_copy.cpp
@@ -263,7 +263,7 @@ int main(int argc, const char** argv){
}
char buf[255];
- snprintf(buf, sizeof(buf), "%s.data", (const char*)_tabname);
+ BaseString::snprintf(buf, sizeof(buf), "%s.data", (const char*)_tabname);
if (insertFile(&MyNdb, pTab, buf) != 0){
return NDBT_ProgramExit(NDBT_FAILED);
}
diff --git a/ndb/test/ndbapi/cdrserver.cpp b/ndb/test/ndbapi/cdrserver.cpp
index 8d15061e94b..976319034bf 100644
--- a/ndb/test/ndbapi/cdrserver.cpp
+++ b/ndb/test/ndbapi/cdrserver.cpp
@@ -501,11 +501,11 @@ server(long int servernum)
/* that this program could easily be ported to a host */
/* that does require it. */
- snprintf(msg,sizeof(msg),"Startup from %s port %u",hostname,ntohs(peeraddr_in.sin_port));
+ BaseString::snprintf(msg,sizeof(msg),"Startup from %s port %u",hostname,ntohs(peeraddr_in.sin_port));
if ((checkchangelog(fi,temp))==0)
c2log(fi,msg);
n2log(log,msg);
- snprintf(msg,sizeof(msg),"For further information, see log(%s)",lognamn);
+ BaseString::snprintf(msg,sizeof(msg),"For further information, see log(%s)",lognamn);
if ((checkchangelog(fi,temp))==0)
c2log(fi,msg);
@@ -516,7 +516,7 @@ server(long int servernum)
linger.l_onoff =1;
linger.l_linger =0;
if (setsockopt(s, SOL_SOCKET, SO_LINGER,(const char*)&linger,sizeof(linger)) == -1) {
- snprintf(msg,sizeof(msg),"Setting SO_LINGER, l_onoff=%d, l_linger=%d",linger.l_onoff,linger.l_linger);
+ BaseString::snprintf(msg,sizeof(msg),"Setting SO_LINGER, l_onoff=%d, l_linger=%d",linger.l_onoff,linger.l_linger);
if ((checkchangelog(log,lognamn))==0)
n2log(log,msg);
goto errout;
@@ -529,7 +529,7 @@ server(long int servernum)
rcvbuf_size=64*1024;
if (setsockopt(s, SOL_SOCKET, SO_RCVBUF,(const char*) &rcvbuf_size,sizeof(rcvbuf_size)) == -1) {
- snprintf(msg,sizeof(msg),"Setting SO_RCVBUF = %d",rcvbuf_size);
+ BaseString::snprintf(msg,sizeof(msg),"Setting SO_RCVBUF = %d",rcvbuf_size);
if ((checkchangelog(log,lognamn))==0)
n2log(log,msg);
goto errout;
@@ -913,7 +913,7 @@ server(long int servernum)
tmpcdrptr->USED_FIELDS |= B_ReroutingIndicator;
break;
default :
- snprintf(msg,sizeof(msg),"ERROR: Redirection information has wrong length %d\n",parmlen);
+ BaseString::snprintf(msg,sizeof(msg),"ERROR: Redirection information has wrong length %d\n",parmlen);
if ((checkchangelog(log,lognamn))==0)
n2log(log,msg);
break;
@@ -1060,7 +1060,7 @@ server(long int servernum)
tmpcdrptr->USED_FIELDS |= B_RINParameter;
break;
default :
- snprintf(msg,sizeof(msg),"ERROR: Rin parameter has wrong length %d\n",parmlen);
+ BaseString::snprintf(msg,sizeof(msg),"ERROR: Rin parameter has wrong length %d\n",parmlen);
if ((checkchangelog(log,lognamn))==0)
n2log(log,msg);
break;
@@ -1088,7 +1088,7 @@ server(long int servernum)
tmpcdrptr->USED_FIELDS |= B_OriginatingPointCode;
break;
default :
- snprintf(msg,sizeof(msg),"ERROR: OriginatingPointCode parameter has wrong length %d\n",parmlen);
+ BaseString::snprintf(msg,sizeof(msg),"ERROR: OriginatingPointCode parameter has wrong length %d\n",parmlen);
if ((checkchangelog(log,lognamn))==0)
n2log(log,msg);
break;
@@ -1119,7 +1119,7 @@ server(long int servernum)
tmpcdrptr->USED_FIELDS |= B_DestinationPointCode;
break;
default :
- snprintf(msg,sizeof(msg),"ERROR: DestinationPointCode parameter has wrong length %d\n",parmlen);
+ BaseString::snprintf(msg,sizeof(msg),"ERROR: DestinationPointCode parameter has wrong length %d\n",parmlen);
if ((checkchangelog(log,lognamn))==0)
n2log(log,msg);
break;
@@ -1146,7 +1146,7 @@ server(long int servernum)
break;
default:
printf("ERROR: Undefined parmtype %d , previous %d, length %d\n",parmtype,parmtype_prev,parmlen);
- snprintf(msg,sizeof(msg),"ERROR: Undefined parmtype %d , previous %d, length %d\n",parmtype,parmtype_prev,parmlen);
+ BaseString::snprintf(msg,sizeof(msg),"ERROR: Undefined parmtype %d , previous %d, length %d\n",parmtype,parmtype_prev,parmlen);
if ((checkchangelog(log,lognamn))==0)
n2log(log,msg);
if (parmlen == 0) {
@@ -1289,17 +1289,17 @@ server(long int servernum)
/* that this program could easily be ported to a host */
/* that does require it. */
- snprintf(msg,sizeof(msg),"Completed %s port %u, %d requests",hostname,ntohs(peeraddr_in.sin_port), reqcnt);
+ BaseString::snprintf(msg,sizeof(msg),"Completed %s port %u, %d requests",hostname,ntohs(peeraddr_in.sin_port), reqcnt);
if ((checkchangelog(fi,temp))==0)
c2log(fi,msg);
error_from_client = 1;
- snprintf(msg,sizeof(msg),"Communicate with threads");
+ BaseString::snprintf(msg,sizeof(msg),"Communicate with threads");
if ((checkchangelog(log,lognamn))==0)
n2log(log,msg);
- snprintf(msg,sizeof(msg),"Waiting for threads to return from work");
+ BaseString::snprintf(msg,sizeof(msg),"Waiting for threads to return from work");
if ((checkchangelog(log,lognamn))==0)
n2log(log,msg);
- snprintf(msg,sizeof(msg),"Closing down");
+ BaseString::snprintf(msg,sizeof(msg),"Closing down");
if ((checkchangelog(log,lognamn))==0)
n2log(log,msg);
close(s);
@@ -1307,19 +1307,19 @@ server(long int servernum)
return EXIT_SUCCESS;
errout:
- snprintf(msg,sizeof(msg),"Connection with %s aborted on error\n", hostname);
+ BaseString::snprintf(msg,sizeof(msg),"Connection with %s aborted on error\n", hostname);
if ((checkchangelog(log,lognamn))==0)
n2log(log,msg);
if ((checkchangelog(fi,temp))==0)
c2log(fi,msg);
error_from_client = 1;
- snprintf(msg,sizeof(msg),"Communicate with threads");
+ BaseString::snprintf(msg,sizeof(msg),"Communicate with threads");
if ((checkchangelog(log,lognamn))==0)
n2log(log,msg);
- snprintf(msg,sizeof(msg),"Waiting for threads to return from work");
+ BaseString::snprintf(msg,sizeof(msg),"Waiting for threads to return from work");
if ((checkchangelog(log,lognamn))==0)
n2log(log,msg);
- snprintf(msg,sizeof(msg),"Closing down");
+ BaseString::snprintf(msg,sizeof(msg),"Closing down");
if ((checkchangelog(log,lognamn))==0)
n2log(log,msg);
close(s);
diff --git a/ndb/test/ndbapi/flexAsynch.cpp b/ndb/test/ndbapi/flexAsynch.cpp
index 8c0ba46130c..1953444d640 100644
--- a/ndb/test/ndbapi/flexAsynch.cpp
+++ b/ndb/test/ndbapi/flexAsynch.cpp
@@ -710,7 +710,7 @@ static void setAttrNames()
int i;
for (i = 0; i < MAXATTR ; i++){
- snprintf(attrName[i], MAXSTRLEN, "COL%d", i);
+ BaseString::snprintf(attrName[i], MAXSTRLEN, "COL%d", i);
}
}
@@ -722,10 +722,10 @@ static void setTableNames()
int i;
for (i = 0; i < MAXTABLES ; i++){
if (theStdTableNameFlag==0){
- snprintf(tableName[i], MAXSTRLEN, "TAB%d_%d", i,
+ BaseString::snprintf(tableName[i], MAXSTRLEN, "TAB%d_%d", i,
(int)(NdbTick_CurrentMillisecond()/1000));
} else {
- snprintf(tableName[i], MAXSTRLEN, "TAB%d", i);
+ BaseString::snprintf(tableName[i], MAXSTRLEN, "TAB%d", i);
}
}
}
diff --git a/ndb/test/ndbapi/flexBench.cpp b/ndb/test/ndbapi/flexBench.cpp
index b19944498f4..2a2388109a1 100644
--- a/ndb/test/ndbapi/flexBench.cpp
+++ b/ndb/test/ndbapi/flexBench.cpp
@@ -1032,7 +1032,7 @@ static int readArguments(int argc, const char** argv)
const char *q = strrchr(p, ':');
if (q == 0)
return -1;
- snprintf(statHost, sizeof(statHost), "%.*s", q-p, p);
+ BaseString::snprintf(statHost, sizeof(statHost), "%.*s", q-p, p);
statPort = atoi(q+1);
statEnable = true;
argc -= 1;
@@ -1068,17 +1068,17 @@ static int
createTables(Ndb* pMyNdb){
int i;
for (i = 0; i < tNoOfAttributes; i++){
- snprintf(attrName[i], MAXSTRLEN, "COL%d", i);
+ BaseString::snprintf(attrName[i], MAXSTRLEN, "COL%d", i);
}
// Note! Uses only uppercase letters in table name's
// so that we can look at the tables with SQL
for (i = 0; i < tNoOfTables; i++){
if (theStdTableNameFlag == 0){
- snprintf(tableName[i], MAXSTRLEN, "TAB%d_%d", i,
+ BaseString::snprintf(tableName[i], MAXSTRLEN, "TAB%d_%d", i,
(int)(NdbTick_CurrentMillisecond() / 1000));
} else {
- snprintf(tableName[i], MAXSTRLEN, "TAB%d", i);
+ BaseString::snprintf(tableName[i], MAXSTRLEN, "TAB%d", i);
}
}
diff --git a/ndb/test/ndbapi/flexHammer.cpp b/ndb/test/ndbapi/flexHammer.cpp
index 80cc7c5a53f..688e70d501a 100644
--- a/ndb/test/ndbapi/flexHammer.cpp
+++ b/ndb/test/ndbapi/flexHammer.cpp
@@ -840,7 +840,7 @@ static int setAttrNames()
int retVal = 0;
for (i = 0; i < MAXATTR ; i++) {
- retVal = snprintf(attrName[i], MAXSTRLEN, "COL%d", i);
+ retVal = BaseString::snprintf(attrName[i], MAXSTRLEN, "COL%d", i);
if (retVal < 0) {
// Error in conversion
return(-1);
@@ -859,11 +859,11 @@ static int setTableNames()
for (i = 0; i < MAXTABLES ; i++) {
if (theStandardTableNameFlag == 0) {
- retVal = snprintf(tableName[i], MAXSTRLEN, "TAB%d_%d", i,
+ retVal = BaseString::snprintf(tableName[i], MAXSTRLEN, "TAB%d_%d", i,
NdbTick_CurrentMillisecond()/1000);
} // if
else {
- retVal = snprintf(tableName[i], MAXSTRLEN, "TAB%d", i);
+ retVal = BaseString::snprintf(tableName[i], MAXSTRLEN, "TAB%d", i);
} // else
if (retVal < 0) {
// Error in conversion
diff --git a/ndb/test/ndbapi/flexScan.cpp b/ndb/test/ndbapi/flexScan.cpp
index b09d71fb010..c7f4041a525 100644
--- a/ndb/test/ndbapi/flexScan.cpp
+++ b/ndb/test/ndbapi/flexScan.cpp
@@ -713,7 +713,7 @@ static int setAttrNames()
int retVal = 0;
for (i = 0; i < MAXATTR ; i++) {
- retVal = snprintf(attrName[i], MAXSTRLEN, "COL%d", i);
+ retVal = BaseString::snprintf(attrName[i], MAXSTRLEN, "COL%d", i);
if (retVal < 0) {
return(-1);
} // if
@@ -733,11 +733,11 @@ static int setTableNames()
for (i = 0; i < MAXTABLES ; i++) {
if (theStdTableNameFlag == 0) {
- retVal = snprintf(tableName[i], MAXSTRLEN, "TAB%d_%d", i,
+ retVal = BaseString::snprintf(tableName[i], MAXSTRLEN, "TAB%d_%d", i,
(int)(NdbTick_CurrentMillisecond() / 1000));
} // if
else {
- retVal = snprintf(tableName[i], MAXSTRLEN, "TAB%d", i);
+ retVal = BaseString::snprintf(tableName[i], MAXSTRLEN, "TAB%d", i);
} // if else
if (retVal < 0) {
diff --git a/ndb/test/ndbapi/flexTT.cpp b/ndb/test/ndbapi/flexTT.cpp
index 162fc080218..3b976f9f87e 100644
--- a/ndb/test/ndbapi/flexTT.cpp
+++ b/ndb/test/ndbapi/flexTT.cpp
@@ -641,17 +641,17 @@ defineOperation(NdbConnection* localNdbConnection, TransNdb* transNdbRef,
static void setAttrNames()
{
- snprintf(attrName[0], MAXSTRLEN, "VPN_ID");
- snprintf(attrName[1], MAXSTRLEN, "VPN_NB");
- snprintf(attrName[2], MAXSTRLEN, "DIRECTORY_NB");
- snprintf(attrName[3], MAXSTRLEN, "LAST_CALL_PARTY");
- snprintf(attrName[4], MAXSTRLEN, "DESCR");
+ BaseString::snprintf(attrName[0], MAXSTRLEN, "VPN_ID");
+ BaseString::snprintf(attrName[1], MAXSTRLEN, "VPN_NB");
+ BaseString::snprintf(attrName[2], MAXSTRLEN, "DIRECTORY_NB");
+ BaseString::snprintf(attrName[3], MAXSTRLEN, "LAST_CALL_PARTY");
+ BaseString::snprintf(attrName[4], MAXSTRLEN, "DESCR");
}
static void setTableNames()
{
- snprintf(tableName[0], MAXSTRLEN, "VPN_USERS");
+ BaseString::snprintf(tableName[0], MAXSTRLEN, "VPN_USERS");
}
static
diff --git a/ndb/test/ndbapi/flex_bench_mysql.cpp b/ndb/test/ndbapi/flex_bench_mysql.cpp
index 8e1fbcd9058..c8d4d85bedf 100644
--- a/ndb/test/ndbapi/flex_bench_mysql.cpp
+++ b/ndb/test/ndbapi/flex_bench_mysql.cpp
@@ -1552,7 +1552,7 @@ static int readArguments(int argc, const char** argv)
const char *q = strrchr(p, ':');
if (q == 0)
return -1;
- snprintf(statHost, sizeof(statHost), "%.*s", q-p, p);
+ BaseString::snprintf(statHost, sizeof(statHost), "%.*s", q-p, p);
statPort = atoi(q+1);
statEnable = true;
argc -= 1;
@@ -1618,17 +1618,17 @@ static int
createTables(MYSQL* mysqlp){
for (Uint32 i = 0; i < tNoOfAttributes; i++){
- snprintf(attrName[i], MAXSTRLEN, "COL%d", i);
+ BaseString::snprintf(attrName[i], MAXSTRLEN, "COL%d", i);
}
// Note! Uses only uppercase letters in table name's
// so that we can look at the tables with SQL
for (Uint32 i = 0; i < tNoOfTables; i++){
if (theStdTableNameFlag == 0){
- snprintf(tableName[i], MAXSTRLEN, "TAB%d_%d", i,
+ BaseString::snprintf(tableName[i], MAXSTRLEN, "TAB%d_%d", i,
(int)(NdbTick_CurrentMillisecond() / 1000));
} else {
- snprintf(tableName[i], MAXSTRLEN, "TAB%d", i);
+ BaseString::snprintf(tableName[i], MAXSTRLEN, "TAB%d", i);
}
}
@@ -1663,17 +1663,17 @@ static int
createTables(Ndb* pMyNdb){
for (Uint32 i = 0; i < tNoOfAttributes; i++){
- snprintf(attrName[i], MAXSTRLEN, "COL%d", i);
+ BaseString::snprintf(attrName[i], MAXSTRLEN, "COL%d", i);
}
// Note! Uses only uppercase letters in table name's
// so that we can look at the tables with SQL
for (Uint32 i = 0; i < tNoOfTables; i++){
if (theStdTableNameFlag == 0){
- snprintf(tableName[i], MAXSTRLEN, "TAB%d_%d", i,
+ BaseString::snprintf(tableName[i], MAXSTRLEN, "TAB%d_%d", i,
(int)(NdbTick_CurrentMillisecond() / 1000));
} else {
- snprintf(tableName[i], MAXSTRLEN, "TAB%d", i);
+ BaseString::snprintf(tableName[i], MAXSTRLEN, "TAB%d", i);
}
}
diff --git a/ndb/test/ndbapi/interpreterInTup.cpp b/ndb/test/ndbapi/interpreterInTup.cpp
index 20d84e6e96d..a07d5898213 100644
--- a/ndb/test/ndbapi/interpreterInTup.cpp
+++ b/ndb/test/ndbapi/interpreterInTup.cpp
@@ -1507,12 +1507,12 @@ void delete_rows(Ndb* pMyNdb, int tupleTest, int opType) {
inline void setAttrNames(){
for (int i = 0; i < MAXATTR; i++){
- snprintf(attrName[i], MAXSTRLEN, "COL%d", i);
+ BaseString::snprintf(attrName[i], MAXSTRLEN, "COL%d", i);
}
}
inline void setTableNames(){
- snprintf(tableName, MAXSTRLEN, "TAB1");
+ BaseString::snprintf(tableName, MAXSTRLEN, "TAB1");
}
diff --git a/ndb/test/ndbapi/testDataBuffers.cpp b/ndb/test/ndbapi/testDataBuffers.cpp
index 94658d5c6b9..04602f51d5f 100644
--- a/ndb/test/ndbapi/testDataBuffers.cpp
+++ b/ndb/test/ndbapi/testDataBuffers.cpp
@@ -93,7 +93,7 @@ ndberror(char const* fmt, ...)
va_list ap;
char buf[200];
va_start(ap, fmt);
- vsnprintf(buf, sizeof(buf), fmt, ap);
+ BaseString::vsnprintf(buf, sizeof(buf), fmt, ap);
va_end(ap);
ndbout << buf << " --" << endl;
if (ndb)
@@ -115,7 +115,7 @@ chkerror(char const* fmt, ...)
va_list ap;
char buf[200];
va_start(ap, fmt);
- vsnprintf(buf, sizeof(buf), fmt, ap);
+ BaseString::vsnprintf(buf, sizeof(buf), fmt, ap);
va_end(ap);
ndbout << "*** check failed: " << buf << " ***" << endl;
return -1;
diff --git a/ndb/test/ndbapi/testDict.cpp b/ndb/test/ndbapi/testDict.cpp
index 7cba5ce4cc8..89232de2535 100644
--- a/ndb/test/ndbapi/testDict.cpp
+++ b/ndb/test/ndbapi/testDict.cpp
@@ -55,7 +55,7 @@ int runCreateInvalidTables(NDBT_Context* ctx, NDBT_Step* step){
char failTabName[256];
for (int i = 0; i < 10; i++){
- snprintf(failTabName, 256, "F%d", i);
+ BaseString::snprintf(failTabName, 256, "F%d", i);
const NdbDictionary::Table* pFailTab = NDBT_Tables::getTable(failTabName);
if (pFailTab != NULL){
@@ -425,7 +425,7 @@ int runCreateMaxTables(NDBT_Context* ctx, NDBT_Step* step){
Ndb* pNdb = GETNDB(step);
for (int i = 0; i < numTables && failures < 5; i++){
- snprintf(tabName, 256, "MAXTAB%d", i);
+ BaseString::snprintf(tabName, 256, "MAXTAB%d", i);
if (pNdb->waitUntilReady(30) != 0){
// Db is not ready, return with failure
@@ -491,7 +491,7 @@ int runDropMaxTables(NDBT_Context* ctx, NDBT_Step* step){
Ndb* pNdb = GETNDB(step);
for (int i = 0; i < numTables; i++){
- snprintf(tabName, 256, "MAXTAB%d", i);
+ BaseString::snprintf(tabName, 256, "MAXTAB%d", i);
if (pNdb->waitUntilReady(30) != 0){
// Db is not ready, return with failure
@@ -707,7 +707,7 @@ int runPkSizes(NDBT_Context* ctx, NDBT_Step* step){
int numRecords = ctx->getNumRecords();
for (int i = minPkSize; i < maxPkSize; i++){
- snprintf(tabName, 256, "TPK_%d", i);
+ BaseString::snprintf(tabName, 256, "TPK_%d", i);
int records = numRecords;
int max = ~0;
diff --git a/ndb/test/ndbapi/testIndex.cpp b/ndb/test/ndbapi/testIndex.cpp
index aca8514c931..ed9e114fd92 100644
--- a/ndb/test/ndbapi/testIndex.cpp
+++ b/ndb/test/ndbapi/testIndex.cpp
@@ -150,7 +150,7 @@ int create_index(NDBT_Context* ctx, int indxNum,
}
// Create index
- snprintf(idxName, 255, "IDC%d", indxNum);
+ BaseString::snprintf(idxName, 255, "IDC%d", indxNum);
if (orderedIndex)
ndbout << "Creating " << ((logged)?"logged ": "temporary ") << "ordered index "<<idxName << " (";
else
@@ -194,7 +194,7 @@ int drop_index(int indxNum, Ndb* pNdb,
if (attr->indexCreated == false)
return NDBT_OK;
- snprintf(idxName, 255, "IDC%d", indxNum);
+ BaseString::snprintf(idxName, 255, "IDC%d", indxNum);
// Drop index
ndbout << "Dropping index "<<idxName<<"(" << pTab->getName() << ") ";
@@ -284,7 +284,7 @@ int createRandomIndex_Drop(NDBT_Context* ctx, NDBT_Step* step){
Uint32 i = ctx->getProperty("createRandomIndex");
- snprintf(idxName, 255, "IDC%d", i);
+ BaseString::snprintf(idxName, 255, "IDC%d", i);
// Drop index
ndbout << "Dropping index " << idxName << " ";
@@ -309,7 +309,7 @@ int createPkIndex(NDBT_Context* ctx, NDBT_Step* step){
bool logged = ctx->getProperty("LoggedIndexes", 1);
// Create index
- snprintf(pkIdxName, 255, "IDC_PK_%s", pTab->getName());
+ BaseString::snprintf(pkIdxName, 255, "IDC_PK_%s", pTab->getName());
if (orderedIndex)
ndbout << "Creating " << ((logged)?"logged ": "temporary ") << "ordered index "
<< pkIdxName << " (";
@@ -1068,7 +1068,7 @@ runUniqueNullTransactions(NDBT_Context* ctx, NDBT_Step* step){
const NdbDictionary::Table* pTab = ctx->getTab();
// Create index
char nullIndex[255];
- snprintf(nullIndex, 255, "IDC_PK_%s_NULL", pTab->getName());
+ BaseString::snprintf(nullIndex, 255, "IDC_PK_%s_NULL", pTab->getName());
if (orderedIndex)
ndbout << "Creating " << ((logged)?"logged ": "temporary ") << "ordered index "
<< pkIdxName << " (";
diff --git a/ndb/test/ndbapi/testReadPerf.cpp b/ndb/test/ndbapi/testReadPerf.cpp
index 7cf3755d66f..8d0d78cbe8c 100644
--- a/ndb/test/ndbapi/testReadPerf.cpp
+++ b/ndb/test/ndbapi/testReadPerf.cpp
@@ -130,9 +130,9 @@ main(int argc, const char** argv){
for(int i = optind; i<argc; i++){
const char * T = argv[i];
g_info << "Testing " << T << endl;
- snprintf(g_table, sizeof(g_table), T);
- snprintf(g_ordered, sizeof(g_ordered), "IDX_O_%s", T);
- snprintf(g_unique, sizeof(g_unique), "IDX_U_%s", T);
+ BaseString::snprintf(g_table, sizeof(g_table), T);
+ BaseString::snprintf(g_ordered, sizeof(g_ordered), "IDX_O_%s", T);
+ BaseString::snprintf(g_unique, sizeof(g_unique), "IDX_U_%s", T);
if(create_table())
goto error;
if(load_table())
diff --git a/ndb/test/ndbapi/testScanInterpreter.cpp b/ndb/test/ndbapi/testScanInterpreter.cpp
index 3a5ef22b613..5a7ca30cd2a 100644
--- a/ndb/test/ndbapi/testScanInterpreter.cpp
+++ b/ndb/test/ndbapi/testScanInterpreter.cpp
@@ -90,7 +90,7 @@ int runCreateResultTable(NDBT_Context* ctx, NDBT_Step* step){
const NdbDictionary::Table* pTab = ctx->getTab();
char newTabName[256];
- snprintf(newTabName, 256, "%s_RES", pTab->getName());
+ BaseString::snprintf(newTabName, 256, "%s_RES", pTab->getName());
ctx->setProperty("ResultTabName", newTabName);
NdbDictionary::Table resTab(* pTab);
diff --git a/ndb/test/ndbapi/testScanPerf.cpp b/ndb/test/ndbapi/testScanPerf.cpp
index 8c1a41047ca..c1334125978 100644
--- a/ndb/test/ndbapi/testScanPerf.cpp
+++ b/ndb/test/ndbapi/testScanPerf.cpp
@@ -110,8 +110,8 @@ main(int argc, const char** argv){
for(int i = optind; i<argc; i++){
const char * T = argv[i];
g_info << "Testing " << T << endl;
- snprintf(g_tablename, sizeof(g_tablename), T);
- snprintf(g_indexname, sizeof(g_indexname), "IDX_%s", T);
+ BaseString::snprintf(g_tablename, sizeof(g_tablename), T);
+ BaseString::snprintf(g_indexname, sizeof(g_indexname), "IDX_%s", T);
if(create_table())
goto error;
if(load_table())
diff --git a/ndb/test/src/HugoCalculator.cpp b/ndb/test/src/HugoCalculator.cpp
index 147c8b104d8..62c35c54a7a 100644
--- a/ndb/test/src/HugoCalculator.cpp
+++ b/ndb/test/src/HugoCalculator.cpp
@@ -96,7 +96,7 @@ HugoCalculator::calcValue(int record,
// of the string, then fill with other chars
// The string length is set to the same size as the attribute
len = attr->getLength();
- snprintf(buf, len, "%d", val);
+ BaseString::snprintf(buf, len, "%d", val);
for(int i=strlen(buf); i < len; i++)
buf[i] = a[((val^i)%25)];
} else{
diff --git a/ndb/test/src/NDBT_Test.cpp b/ndb/test/src/NDBT_Test.cpp
index 24446f08947..367223f8c98 100644
--- a/ndb/test/src/NDBT_Test.cpp
+++ b/ndb/test/src/NDBT_Test.cpp
@@ -484,7 +484,7 @@ void NDBT_TestCaseImpl1::startStepInThread(int stepNo, NDBT_Context* ctx){
NDBT_Step* pStep = steps[stepNo];
pStep->setContext(ctx);
char buf[16];
- snprintf(buf, sizeof(buf), "step_%d", stepNo);
+ BaseString::snprintf(buf, sizeof(buf), "step_%d", stepNo);
NdbThread* pThread = NdbThread_Create(runStep_C,
(void**)pStep,
65535,
@@ -704,7 +704,7 @@ void NDBT_TestCaseImpl1::printTestResult(){
res = "FAILED TO CREATE TABLE";
else if (tcr->getResult() == FAILED_TO_DISCOVER)
res = "FAILED TO DISCOVER TABLE";
- snprintf(buf, 255," %-10s %-5s %-20s", tcr->getName(), res, tcr->getTimeStr());
+ BaseString::snprintf(buf, 255," %-10s %-5s %-20s", tcr->getName(), res, tcr->getTimeStr());
ndbout << buf<<endl;
}
}
@@ -1078,7 +1078,7 @@ const char* NDBT_TestSuite::getDate(){
tm_now = gmtime(&now);
#endif
- snprintf(theTime, 128,
+ BaseString::snprintf(theTime, 128,
"%d-%.2d-%.2d %.2d:%.2d:%.2d",
tm_now->tm_year + 1900,
tm_now->tm_mon + 1,
diff --git a/ndb/test/src/NdbBackup.cpp b/ndb/test/src/NdbBackup.cpp
index ad26dbeab16..1ce48d495a5 100644
--- a/ndb/test/src/NdbBackup.cpp
+++ b/ndb/test/src/NdbBackup.cpp
@@ -143,7 +143,7 @@ NdbBackup::execRestore(bool _restore_data,
* Copy backup files to local dir
*/
- snprintf(buf, buf_len,
+ BaseString::snprintf(buf, buf_len,
"scp %s:%s/BACKUP/BACKUP-%d/BACKUP-%d*.%d.* .",
host, path,
_backup_id,
@@ -155,7 +155,7 @@ NdbBackup::execRestore(bool _restore_data,
ndbout << "scp res: " << res << endl;
- snprintf(buf, 255, "%sndb_restore -c \"host=%s\" -n %d -b %d %s %s .",
+ BaseString::snprintf(buf, 255, "%sndb_restore -c \"host=%s\" -n %d -b %d %s %s .",
#if 1
"",
#else
diff --git a/ndb/test/src/NdbGrep.cpp b/ndb/test/src/NdbGrep.cpp
index 8b7442b0e77..6c0c9cabfcb 100644
--- a/ndb/test/src/NdbGrep.cpp
+++ b/ndb/test/src/NdbGrep.cpp
@@ -60,10 +60,10 @@ NdbGrep::verify(NDBT_Context * ctx){
return -1;
char cheat_table[255];
- snprintf(cheat_table, 255, "TEST_DB/def/%s",ctx->getTab()->getName());
+ BaseString::snprintf(cheat_table, 255, "TEST_DB/def/%s",ctx->getTab()->getName());
char buf[255];
- snprintf(buf, 255, "testGrepVerify -c \"nodeid=%d;host=%s\" -t %s -r %d",
+ BaseString::snprintf(buf, 255, "testGrepVerify -c \"nodeid=%d;host=%s\" -t %s -r %d",
4, //cheat. Hardcoded nodeid....
ctx->getRemoteMgm(),
cheat_table,
diff --git a/ndb/test/tools/transproxy.cpp b/ndb/test/tools/transproxy.cpp
index 90e216ec785..88267801172 100644
--- a/ndb/test/tools/transproxy.cpp
+++ b/ndb/test/tools/transproxy.cpp
@@ -32,7 +32,7 @@ fatal(char const* fmt, ...)
va_list ap;
char buf[200];
va_start(ap, fmt);
- vsnprintf(buf, sizeof(buf), fmt, ap);
+ BaseString::vsnprintf(buf, sizeof(buf), fmt, ap);
va_end(ap);
ndbout << "FATAL: " << buf << endl;
sleep(1);
@@ -45,7 +45,7 @@ debug(char const* fmt, ...)
va_list ap;
char buf[200];
va_start(ap, fmt);
- vsnprintf(buf, sizeof(buf), fmt, ap);
+ BaseString::vsnprintf(buf, sizeof(buf), fmt, ap);
va_end(ap);
ndbout << buf << endl;
}
diff --git a/ndb/tools/listTables.cpp b/ndb/tools/listTables.cpp
index 4b24929ee4b..4fc5bcd7f21 100644
--- a/ndb/tools/listTables.cpp
+++ b/ndb/tools/listTables.cpp
@@ -38,7 +38,7 @@ fatal(char const* fmt, ...)
va_list ap;
char buf[500];
va_start(ap, fmt);
- vsnprintf(buf, sizeof(buf), fmt, ap);
+ BaseString::vsnprintf(buf, sizeof(buf), fmt, ap);
va_end(ap);
ndbout << buf;
if (ndb)
@@ -54,7 +54,7 @@ fatal_dict(char const* fmt, ...)
va_list ap;
char buf[500];
va_start(ap, fmt);
- vsnprintf(buf, sizeof(buf), fmt, ap);
+ BaseString::vsnprintf(buf, sizeof(buf), fmt, ap);
va_end(ap);
ndbout << buf;
if (dic)