Commit 34532803 authored by tomas@mc05.(none)'s avatar tomas@mc05.(none)
Browse files

fix compiler warnings in ndb

parent c745ae95
......@@ -153,7 +153,7 @@ public:
private:
bool m_logDistributed;
int m_ownNodeId;
Uint32 m_ownNodeId;
FILE * outputStream;
int log(int cmd, BlockNumber bno, LogMode logMode);
......
......@@ -80,13 +80,13 @@ extern "C" {
* NDB Cluster node types
*/
enum ndb_mgm_node_type {
NDB_MGM_NODE_TYPE_UNKNOWN = -1, ///< Node type not known
NDB_MGM_NODE_TYPE_API = 0, ///< An application node (API)
NDB_MGM_NODE_TYPE_NDB = 1, ///< A database node (DB)
NDB_MGM_NODE_TYPE_MGM = 2, ///< A management server node (MGM)
NDB_MGM_NODE_TYPE_UNKNOWN = -1, /*/< Node type not known*/
NDB_MGM_NODE_TYPE_API = 0, /*/< An application node (API)*/
NDB_MGM_NODE_TYPE_NDB = 1, /*/< A database node (DB)*/
NDB_MGM_NODE_TYPE_MGM = 2, /*/< A management server node (MGM)*/
NDB_MGM_NODE_TYPE_MIN = 0, ///< Min valid value
NDB_MGM_NODE_TYPE_MAX = 2 ///< Max valid value
NDB_MGM_NODE_TYPE_MIN = 0, /*/< Min valid value*/
NDB_MGM_NODE_TYPE_MAX = 2 /*/< Max valid value*/
};
/**
......
......@@ -47,7 +47,7 @@
* Used by transporter and when communicating with
* managment server
*/
//#define NDB_VERSION_ID 0
/*#define NDB_VERSION_ID 0*/
#endif
......@@ -42,7 +42,7 @@ NDB_TICKS NdbTick_CurrentMillisecond(void);
*/
int NdbTick_CurrentMicrosecond(NDB_TICKS * secs, Uint32 * micros);
//#define TIME_MEASUREMENT
/*#define TIME_MEASUREMENT*/
#ifdef TIME_MEASUREMENT
struct MicroSecondTimer {
......
......@@ -26,7 +26,7 @@ printCREATE_FRAGMENTATION_REQ(FILE * output, const Uint32 * theData,
fprintf(output, " noOfFragments: %x\n", sig->noOfFragments);
fprintf(output, " fragmentNode: %x\n", sig->fragmentNode);
if (sig->primaryTableId == RNIL)
fprintf(output, " primaryTableId: none\n", sig->primaryTableId);
fprintf(output, " primaryTableId: none\n");
else
fprintf(output, " primaryTableId: %x\n", sig->primaryTableId);
return true;
......
......@@ -62,7 +62,6 @@ int NdbMem_MemLockAll(){
#if defined NDB_MACOSX
return 0;
#else
//return mlockall(MCL_CURRENT | MCL_FUTURE);
return mlockall(MCL_CURRENT);
#endif
}
......
......@@ -94,7 +94,7 @@ int NdbThread_WaitFor(struct NdbThread* p_wait_thread, void** status)
if (p_wait_thread == NULL)
return 0;
if (p_wait_thread->thread == NULL)
if (p_wait_thread->thread == 0)
return 0;
result = pthread_join(p_wait_thread->thread, status);
......
......@@ -99,12 +99,12 @@ NdbTick_getMicrosPassed(struct MicroSecondTimer start,
ret_value = ((NDB_TICKS)MICROSEC_PER_SEC) * sec_passed;
} else if (start.seconds > stop.seconds) {
return ret_value;
}//if
}
if (start.micro_seconds < stop.micro_seconds) {
ret_value += (stop.micro_seconds - start.micro_seconds);
} else if (ret_value != (NDB_TICKS)0) {
ret_value -= (start.micro_seconds - stop.micro_seconds);
}//if
}
return ret_value;
}
#endif
......@@ -23,6 +23,7 @@
#include <assert.h>
#include <Base64.hpp>
#undef DEBUG
#define DEBUG(x) ndbout << x << endl;
static void trim(char * str);
......
......@@ -407,12 +407,12 @@ arg_match_long(struct getargs *args, size_t num_args,
}
case arg_string:
{
*(char**)current->value = optarg + 1;
*(char**)current->value = (char*)optarg + 1;
return 0;
}
case arg_strings:
{
add_string((getarg_strings*)current->value, optarg + 1);
add_string((getarg_strings*)current->value, (char*)optarg + 1);
return 0;
}
case arg_flag:
......
......@@ -61,7 +61,7 @@ struct NdbUpGradeCompatible {
UG_MatchType matchType;
};
//#define TEST_VERSION
/*#define TEST_VERSION*/
#ifndef TEST_VERSION
struct NdbUpGradeCompatible ndbCompatibleTable_full[] = {
......@@ -74,7 +74,7 @@ struct NdbUpGradeCompatible ndbCompatibleTable_upgrade[] = {
void ndbSetOwnVersion() {}
#else // testing purposes
#else /* testing purposes */
struct NdbUpGradeCompatible ndbCompatibleTable_full[] = {
{ MAKE_VERSION(4,1,5), MAKE_VERSION(4,1,0), UG_Range },
......@@ -122,7 +122,7 @@ ndbGetOwnVersion()
{
#ifndef TEST_VERSION
return NDB_VERSION_D;
#else // testing purposes
#else /* testing purposes */
if (ndbOwnVersionTesting == 0)
return NDB_VERSION_D;
else
......
......@@ -152,7 +152,10 @@ parse_config_file(struct getargs args[], int num_arg, const Properties& p){
break;
}
}
if(!found)
if(!found) {
printf("Unknown parameter: %s\n", name);
return 1;
}
}
return 0;
}
......@@ -514,7 +514,8 @@ RestoreMetaData::parseTableDescriptor(const Uint32 * data,
NdbDictionary::Column::Type type;
if(getMajor(m_fileHeader.NdbVersion) < VERSION_3X) {
tableImpl->setName(tableName);
for(Uint32 i = 0 ; i < tableImpl->getNoOfColumns(); i++) {
Uint32 noOfColumns = tableImpl->getNoOfColumns();
for(Uint32 i = 0 ; i < noOfColumns; i++) {
type = convertToV3x(tableImpl->getColumn(i)->m_extType,
columnTypeMapping,
-1);
......@@ -562,7 +563,7 @@ bool
TupleS::prepareRecord(const TableS & tab){
m_currentTable = &tab;
for(int i = 0; i<allAttributes.size(); i++) {
if(!allAttributes[i] == NULL)
if(allAttributes[i] != NULL)
delete allAttributes[i];
}
allAttributes.clear();
......
......@@ -49,7 +49,7 @@ void Dbtup::execTUPFRAGREQ(Signal* signal)
Uint32 noOfAttributes = signal->theData[4];
Uint32 fragId = signal->theData[5];
Uint32 noOfNullAttr = signal->theData[7];
Uint32 schemaVersion = signal->theData[8];
/* Uint32 schemaVersion = signal->theData[8];*/
Uint32 noOfKeyAttr = signal->theData[9];
Uint32 noOfNewAttr = signal->theData[10];
......
......@@ -1303,26 +1303,6 @@ DbUtil::prepareOperation(Signal* signal, PreparePtr prepPtr)
TcKeyReq::setAIInTcKeyReq(requestInfo, 0); // Attrinfo sent separately
prepOpPtr.p->tckey.requestInfo = requestInfo;
if (operationType == UtilPrepareReq::Read) {
// ResultSet
AttrMappingBuffer::ConstDataBufferIterator tmpIt;
#if 0 //def EVENT_DEBUG
ResultSetBuffer & rs = prepOpPtr.p->rsInfo;
ResultSetInfoBuffer::DataBufferIterator it;
rs.first(it);
for (prepOpPtr.p->attrMapping.first(tmpIt);
tmpIt.curr.i != RNIL;
prepOpPtr.p->attrMapping.next(tmpIt)) {
AttributeHeader* ah = (AttributeHeader *) tmpIt.data;
ah->print(stdout);
AttributeHeader* rsah = (AttributeHeader *) it.data;
rsah->print(stdout);
rs.next(it,1);
printf("%d\n",it.data);
}
#endif
}
/****************************
* Confirm completed prepare
****************************/
......@@ -1914,7 +1894,6 @@ DbUtil::runOperation(Signal* signal, TransactionPtr & transPtr,
Operation * op = opPtr.p;
const PreparedOperation * pop = op->prepOp;
Uint32 lastFlag = 0;
if(!transPtr.p->operations.next(opPtr)){
TcKeyReq::setCommitFlag(start, 1); // Last operation
TcKeyReq::setExecuteFlag(start, 1);
......@@ -2127,43 +2106,11 @@ DbUtil::execTRANSID_AI(Signal* signal){
/**
* Save result
*/
Uint32 srcSz = dataLen;
const Uint32 *src = &signal->theData[3];
const Uint32 segSize = opP->rs.getSegmentSize();
#if 0 //def EVENT_DEBUG
printf("rsRecv %u, dataLen %u, rsExpect %u\n",
opP->rsRecv, dataLen, opP->rsExpect);
#endif
ResultSetBuffer::DataBufferIterator rs = opP->rsIterator;
#if 0 //def EVENT_DEBUG
for(int i = 0; i < dataLen; i++)
printf("H'%.8x ", src[i]);
#endif
ndbrequire(opP->rs.import(rs,src,dataLen));
opP->rs.next(rs, dataLen);
#if 0 // replaced this section with import() above
while(srcSz > segSize){
ndbrequire(rs.curr.i != RNIL);
memcpy(rs.data, src, segSize << 2);
opP->rs.next(rs, segSize);
srcSz -= segSize;
// src += segSize * 4; // Bug?
src += segSize;
}
if(srcSz > 0){
jam();
memcpy(rs.data, src, srcSz << 2);
rs.curr.i = RNIL;
rs.data = 0;
}
#endif
opP->rsIterator = rs;
if(!opP->complete()){
......@@ -2171,20 +2118,12 @@ DbUtil::execTRANSID_AI(Signal* signal){
return;
}
#if 0 //def EVENT_DEBUG
printf("op complete\n");
#endif
transPtr.p->recv++;
if(!transPtr.p->complete()){
jam();
return;
}
#if 0 //def EVENT_DEBUG
printf("trans complete\n");
#endif
finishTransaction(signal, transPtr);
}
......
......@@ -1294,7 +1294,7 @@ Grep::PSPart::execSUB_REMOVE_REF(Signal* signal)
jamEntry();
SubRemoveRef * const ref = (SubRemoveRef *)signal->getDataPtr();
Uint32 subData = ref->subscriberData;
GrepError::Code err = (GrepError::Code)ref->err;
/* GrepError::Code err = (GrepError::Code)ref->err;*/
SubscriptionPtr subPtr;
c_subscriptions.getPtr(subPtr, subData);
......
......@@ -566,9 +566,8 @@ AsyncFile::writeReq( Request * request)
if (((i + 1) < request->par.readWrite.numberOfPages)) {
// There are more pages to write
// Check that offsets are consequtive
if ((page_offset + request->par.readWrite.pages[i].size)
!=
request->par.readWrite.pages[i+1].offset) {
off_t tmp = page_offset + request->par.readWrite.pages[i].size;
if (tmp != request->par.readWrite.pages[i+1].offset) {
// Next page is not aligned with previous, not allowed
DEBUG(ndbout_c("Page offsets are not aligned"));
request->error = EINVAL;
......
......@@ -132,9 +132,9 @@ SumaParticipant::~SumaParticipant()
Suma::Suma(const Configuration & conf) :
SumaParticipant(conf),
Restart(*this),
c_nodes(c_nodePool),
c_runningSubscriptions(c_subCoordinatorPool),
Restart(*this)
c_runningSubscriptions(c_subCoordinatorPool)
{
c_nodePool.setSize(MAX_NDB_NODES);
......
......@@ -188,9 +188,9 @@ NDB_MAIN(ndb_kernel){
void
systemInfo(const Configuration & config, const LogLevel & logLevel){
#ifdef NDB_WIN32
int processors = 0;
int speed;
#ifdef NDB_WIN32
SYSTEM_INFO sinfo;
GetSystemInfo(&sinfo);
processors = sinfo.dwNumberOfProcessors;
......
......@@ -9,7 +9,7 @@ A_LIB := Y
SO_LIB := Y
PIC_LIB := Y
DIRS := test
#DIRS := test
LIB_TARGET := MGM_API
LIB_TARGET_ARCHIVES := $(ARCHIVE_TARGET) general portlib
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment