mirror of
https://github.com/MariaDB/server.git
synced 2025-01-16 03:52:35 +01:00
changed to call internal snprintf/vsnprintf
This commit is contained in:
parent
277c84e2b1
commit
63920158ce
79 changed files with 350 additions and 294 deletions
|
@ -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());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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) \
|
||||
|
|
29
ndb/include/util/basestring_vsnprintf.h
Normal file
29
ndb/include/util/basestring_vsnprintf.h
Normal file
|
@ -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
|
|
@ -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;
|
||||
|
|
|
@ -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>");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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))
|
||||
{
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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 = "
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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()
|
||||
{
|
||||
|
|
|
@ -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); }
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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){
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -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()];
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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],
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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++;
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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__);
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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>
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -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,"|");
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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 :
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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 :
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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:
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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");
|
||||
}
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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 << " (";
|
||||
|
|
|
@ -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())
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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())
|
||||
|
|
|
@ -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{
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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)
|
||||
|
|
Loading…
Reference in a new issue