Commit 46553c25 authored by Noel Kuntze's avatar Noel Kuntze Committed by Robert Bindar

Fix compiler warnings GCC8

parent 0d5d8d2e
......@@ -79,15 +79,15 @@ COLBLK::COLBLK(PCOL col1, PTDB tdbp)
if (trace(2))
htrc(" copying COLBLK %s from %p to %p\n", Name, col1, this);
if (tdbp)
if (tdbp) {
// Attach the new column to the table block
if (!tdbp->GetColumns())
if (!tdbp->GetColumns()) {
tdbp->SetColumns(this);
else {
} else {
for (colp = tdbp->GetColumns(); colp->Next; colp = colp->Next) ;
colp->Next = this;
} // endelse
} // endelse
}
} // end of COLBLK copy constructor
......
......@@ -642,7 +642,7 @@ int CntIndexInit(PGLOBAL g, PTDB ptdb, int id, bool sorted)
// This is a pseudo indexed sorted block optimized column
// return 0;
if (tdbp->To_Kindex)
if (tdbp->To_Kindex) {
if (((XXBASE*)tdbp->To_Kindex)->GetID() == id) {
tdbp->To_Kindex->Reset(); // Same index
return (tdbp->To_Kindex->IsMul()) ? 2 : 1;
......@@ -650,6 +650,7 @@ int CntIndexInit(PGLOBAL g, PTDB ptdb, int id, bool sorted)
tdbp->To_Kindex->Close();
tdbp->To_Kindex= NULL;
} // endif colp
}
for (xdp= dfp->To_Indx; xdp; xdp= xdp->GetNext())
if (xdp->GetID() == id)
......
......@@ -840,7 +840,7 @@ int DBFFAM::DeleteRecords(PGLOBAL g, int irc)
{
if (irc == RC_OK) {
// T_Stream is the temporary stream or the table file stream itself
if (!T_Stream)
if (!T_Stream) {
if (UseTemp) {
if (OpenTempFile(g))
return RC_FX;
......@@ -850,10 +850,11 @@ int DBFFAM::DeleteRecords(PGLOBAL g, int irc)
} else
T_Stream = Stream;
}
*Tdbp->GetLine() = '*';
Modif++; // Modified line in Delete mode
} // endif irc
} // endif irc
return RC_OK;
} // end of DeleteRecords
......
......@@ -135,8 +135,6 @@ bool FIXFAM::AllocateBuffer(PGLOBAL g)
// The buffer must be prepared depending on column types
int n = 0;
bool b = false;
PDOSDEF defp = (PDOSDEF)Tdbp->GetDef();
// PCOLDEF cdp;
PBINCOL colp;
// Prepare the first line of the buffer
......
......@@ -301,7 +301,7 @@ int VCTFAM::Cardinality(PGLOBAL g)
if (!g)
return 1;
if (Block < 0)
if (Block < 0) {
if (Split) {
// Separate column files and no pre setting of Block and Last
// This allows to see a table modified externally, but Block
......@@ -347,6 +347,7 @@ int VCTFAM::Cardinality(PGLOBAL g)
return -1; // Error
} // endif split
}
return (Block) ? ((Block - 1) * Nrec + Last) : 0;
} // end of Cardinality
......@@ -1163,7 +1164,6 @@ bool VCTFAM::ResetTableSize(PGLOBAL g, int block, int last)
if (!Header) {
// Update catalog values for Block and Last
PVCTDEF defp = (PVCTDEF)Tdbp->GetDef();
LPCSTR name = Tdbp->GetName();
defp->SetBlock(Block);
defp->SetLast(Last);
......
......@@ -91,8 +91,6 @@ static bool ZipFile(PGLOBAL g, ZIPUTIL *zutp, PCSZ fn, PCSZ entry, char *buf)
static bool ZipFiles(PGLOBAL g, ZIPUTIL *zutp, PCSZ pat, char *buf)
{
char filename[_MAX_PATH];
int rc;
/*********************************************************************/
/* pat is a multiple file name with wildcard characters */
/*********************************************************************/
......@@ -100,6 +98,7 @@ static bool ZipFiles(PGLOBAL g, ZIPUTIL *zutp, PCSZ pat, char *buf)
#if defined(__WIN__)
char drive[_MAX_DRIVE], direc[_MAX_DIR];
int rc;
WIN32_FIND_DATA FileData;
HANDLE hSearch;
......
......@@ -1340,6 +1340,7 @@ BOOL WritePrivateProfileSection(LPCSTR section,
* Note that when the buffer is big enough then the return value may be any
* value between 1 and len-1 (or len in Win95), including len-2.
*/
#ifdef TEST_MODULE
static DWORD
GetPrivateProfileSectionNames(LPSTR buffer, DWORD size, LPCSTR filename)
{
......@@ -1361,7 +1362,6 @@ GetPrivateProfileSectionNames(LPSTR buffer, DWORD size, LPCSTR filename)
/************************************************************************
* Program to test the above
************************************************************************/
#ifdef TEST_MODULE
int main(int argc, char**argv) {
char buff[128];
char *p, *inifile = "D:\\Plug\\Data\\contact.ini";
......
......@@ -378,7 +378,7 @@ bool LIBXMLDOC::Initialize(PGLOBAL g, PCSZ entry, bool zipped)
if (zipped && InitZip(g, entry))
return true;
int n = xmlKeepBlanksDefault(1);
xmlKeepBlanksDefault(1);
return MakeNSlist(g);
} // end of Initialize
......
......@@ -1290,9 +1290,7 @@ bool ODBConn::DriverConnect(DWORD Options)
HWND hWnd = (HWND)1;
#endif // !__WIN__
PGLOBAL& g = m_G;
PDBUSER dup = PlgGetUser(g);
//if (Options & noOdbcDialog || dup->Remote)
wConnectOption = SQL_DRIVER_NOPROMPT;
//else if (Options & forceOdbcDialog)
// wConnectOption = SQL_DRIVER_PROMPT;
......@@ -1686,7 +1684,7 @@ int ODBConn::PrepareSQL(char *sql)
b = false;
if (m_hstmt) {
RETCODE rc = SQLFreeStmt(m_hstmt, SQL_CLOSE);
SQLFreeStmt(m_hstmt, SQL_CLOSE);
hstmt = m_hstmt;
m_hstmt = NULL;
......@@ -1694,7 +1692,7 @@ int ODBConn::PrepareSQL(char *sql)
if (m_Tdb->GetAmType() != TYPE_AM_XDBC)
ThrowDBX(MSG(SEQUENCE_ERROR));
} // endif m_hstmt
} // endif m_hstmt
rc = SQLAllocStmt(m_hdbc, &hstmt);
......
......@@ -1041,11 +1041,12 @@ int TDBSDR::GetMaxSize(PGLOBAL g)
/***********************************************************************/
int TDBSDR::FindInDir(PGLOBAL g)
{
int rc, n = 0;
int n = 0;
size_t m = strlen(Direc);
// Start searching files in the target directory.
#if defined(__WIN__)
int rc;
HANDLE h;
#if defined(PATHMATCHSPEC)
......@@ -1174,7 +1175,7 @@ int TDBSDR::FindInDir(PGLOBAL g)
// Look in the name sub-directory
strcat(strcat(Direc, Entry->d_name), "/");
if ((k = FindInDir(g)) < 0)
if ((k= FindInDir(g)) < 0)
return k;
else
n += k;
......
......@@ -202,7 +202,7 @@ bool OcrSrcCols(PGLOBAL g, PQRYRES qrp, const char *col,
/**********************************************************************/
/* Replace the columns of the colist by the rank and occur columns. */
/**********************************************************************/
for (i = 0, pcrp = &qrp->Colresp; crp = *pcrp; ) {
for (i = 0, pcrp = &qrp->Colresp; (crp = *pcrp); ) {
for (k = 0, pn = colist; k < m; k++, pn += (strlen(pn) + 1))
if (!stricmp(pn, crp->Name))
break;
......@@ -450,8 +450,9 @@ bool TDBOCCUR::OpenDB(PGLOBAL g)
N = M = 0;
RowFlag = 0;
if (Xcolp)
if (Xcolp) {
Xcolp->Xreset();
}
return Tdbp->OpenDB(g);
} // endif use
......
......@@ -301,7 +301,6 @@ bool TDBODBC::MakeInsert(PGLOBAL g)
char *catp = NULL, buf[NAM_LEN * 3];
int len = 0;
bool oom, b = false;
PTABLE tablep = To_Table;
PCOL colp;
for (colp = Columns; colp; colp = colp->GetNext())
......@@ -322,9 +321,6 @@ bool TDBODBC::MakeInsert(PGLOBAL g)
if (catp)
len += strlen(catp) + 1;
//if (tablep->GetSchema())
// schmp = (char*)tablep->GetSchema();
//else
if (Schema && *Schema)
schmp = Schema;
......@@ -557,15 +553,17 @@ bool TDBODBC::OpenDB(PGLOBAL g)
if (Memory < 3) {
// Method will depend on cursor type
if ((Rbuf = Ocp->Rewind(Query->GetStr(), (PODBCCOL)Columns)) < 0)
if (Mode != MODE_READX) {
Ocp->Close();
return true;
} else
Rbuf = 0;
} else
if ((Rbuf = Ocp->Rewind(Query->GetStr(), (PODBCCOL)Columns)) < 0) {
if (Mode != MODE_READX) {
Ocp->Close();
return true;
} else {
Rbuf = 0;
}
}
} else {
Rbuf = Qrp->Nblin;
}
CurNum = 0;
Fpos = 0;
......@@ -1213,8 +1211,6 @@ int TDBXDBC::GetMaxSize(PGLOBAL g)
/***********************************************************************/
bool TDBXDBC::OpenDB(PGLOBAL g)
{
bool rc = false;
if (trace(1))
htrc("ODBC OpenDB: tdbp=%p tdb=R%d use=%dmode=%d\n",
this, Tdb_No, Use, Mode);
......
......@@ -187,7 +187,7 @@ PQRYRES PIVAID::MakePivotColumns(PGLOBAL g)
} // endif picol
// Prepare the column list
for (pcrp = &Qryp->Colresp; crp = *pcrp; )
for (pcrp = &Qryp->Colresp; (crp = *pcrp); ) {
if (SkipColumn(crp, skc)) {
// Ignore this column
*pcrp = crp->Next;
......@@ -204,7 +204,7 @@ PQRYRES PIVAID::MakePivotColumns(PGLOBAL g)
*pcrp = crp->Next;
} else
pcrp = &crp->Next;
}
if (!Rblkp) {
strcpy(g->Message, MSG(NO_DEF_PIVOTCOL));
goto err;
......@@ -340,7 +340,6 @@ int PIVAID::Qcompare(int *i1, int *i2)
bool PIVOTDEF::DefineAM(PGLOBAL g, LPCSTR am, int poff)
{
char *p1, *p2;
PHC hc = ((MYCAT*)Cat)->GetHandler();
if (PRXDEF::DefineAM(g, am, poff))
return TRUE;
......@@ -748,7 +747,7 @@ int TDBPIVOT::ReadDB(PGLOBAL g)
colp->ReadColumn(g);
for (colp = Columns; colp; colp = colp->GetNext())
if (colp->GetAmType() == TYPE_AM_SRC)
if (colp->GetAmType() == TYPE_AM_SRC) {
if (FileStatus) {
if (((PSRCCOL)colp)->CompareLast()) {
newrow = (RowFlag) ? TRUE : FALSE;
......@@ -757,6 +756,7 @@ int TDBPIVOT::ReadDB(PGLOBAL g)
} else
((PSRCCOL)colp)->SetColumn();
}
FileStatus = 1;
} // endif RowFlag
......
......@@ -218,8 +218,8 @@ PQRYRES XMLColumns(PGLOBAL g, char *db, char *tab, PTOS topt, bool info)
while (true) {
if (!vp->atp &&
!(node = (vp->nl) ? vp->nl->GetItem(g, vp->k++, tdp->Usedom ? node : NULL)
: NULL))
!(node = (vp->nl) ? vp->nl->GetItem(g, vp->k++, tdp->Usedom ? node : NULL)
: NULL)) {
if (j) {
vp = lvlp[--j];
......@@ -234,6 +234,7 @@ PQRYRES XMLColumns(PGLOBAL g, char *db, char *tab, PTOS topt, bool info)
continue;
} else
break;
}
xcol->Name[vp->n] = 0;
fmt[vp->m] = 0;
......@@ -1268,7 +1269,7 @@ int TDBXML::ReadDB(PGLOBAL g)
/***********************************************************************/
bool TDBXML::CheckRow(PGLOBAL g, bool b)
{
if (NewRow && Mode == MODE_INSERT)
if (NewRow && Mode == MODE_INSERT) {
if (Rowname) {
TabNode->AddText(g, "\n\t");
RowNode = TabNode->AddChildNode(g, Rowname, RowNode);
......@@ -1276,6 +1277,7 @@ bool TDBXML::CheckRow(PGLOBAL g, bool b)
strcpy(g->Message, MSG(NO_ROW_NODE));
return true;
} // endif Rowname
}
if (Colname && (NewRow || b))
Clist = RowNode->SelectNodes(g, Colname, Clist);
......@@ -1522,12 +1524,13 @@ bool XMLCOL::ParseXpath(PGLOBAL g, bool mode)
// Analyze the Xpath for this column
for (i = 0, p = pbuf; (p2 = strchr(p, '/')); i++, p = p2 + 1) {
if (Tdbp->Mulnode && !strncmp(p, Tdbp->Mulnode, p2 - p))
if (Tdbp->Mulnode && !strncmp(p, Tdbp->Mulnode, p2 - p)) {
if (!Tdbp->Xpand && mode) {
strcpy(g->Message, MSG(CONCAT_SUBNODE));
return true;
} else
Inod = i; // Index of multiple node
}
if (mode) {
// For Update or Insert the Xpath must be explicit
......@@ -1773,11 +1776,12 @@ void XMLCOL::WriteColumn(PGLOBAL g)
else
break;
if (ColNode)
if (ColNode) {
if (Type)
ValNode = ColNode->SelectSingleNode(g, Xname, Vxnp);
else
AttNode = ColNode->GetAttribute(g, Xname, Vxap);
}
if (TopNode || ValNode || AttNode)
break; // We found the good column
......@@ -1790,7 +1794,7 @@ void XMLCOL::WriteColumn(PGLOBAL g)
/* Create missing nodes. */
/*********************************************************************/
if (ColNode == NULL) {
if (TopNode == NULL)
if (TopNode == NULL) {
if (Tdbp->Clist) {
Tdbp->RowNode->AddText(g, "\n\t\t");
ColNode = Tdbp->RowNode->AddChildNode(g, Tdbp->Colname);
......@@ -1798,7 +1802,7 @@ void XMLCOL::WriteColumn(PGLOBAL g)
TopNode = ColNode;
} else
TopNode = Tdbp->RowNode;
}
for (; k < Nod && TopNode; k++) {
if (!done) {
TopNode->AddText(g, "\n\t\t");
......@@ -2012,7 +2016,7 @@ void XMULCOL::WriteColumn(PGLOBAL g)
TopNode = ColNode;
} // endfor k
if (ColNode)
if (ColNode) {
if (Inod == Nod) {
/***************************************************************/
/* The node value can be multiple. */
......@@ -2034,7 +2038,7 @@ void XMULCOL::WriteColumn(PGLOBAL g)
ValNode = ColNode->SelectSingleNode(g, Xname, Vxnp);
else
AttNode = ColNode->GetAttribute(g, Xname, Vxap);
}
if (TopNode || ValNode || AttNode)
break; // We found the good column
else if (Tdbp->Clist)
......@@ -2046,7 +2050,7 @@ void XMULCOL::WriteColumn(PGLOBAL g)
/* Create missing nodes. */
/*********************************************************************/
if (ColNode == NULL) {
if (TopNode == NULL)
if (TopNode == NULL) {
if (Tdbp->Clist) {
Tdbp->RowNode->AddText(g, "\n\t\t");
ColNode = Tdbp->RowNode->AddChildNode(g, Tdbp->Colname);
......@@ -2054,7 +2058,7 @@ void XMULCOL::WriteColumn(PGLOBAL g)
TopNode = ColNode;
} else
TopNode = Tdbp->RowNode;
}
for (; k < Nod && TopNode; k++) {
if (!done) {
TopNode->AddText(g, "\n\t\t");
......
......@@ -558,13 +558,14 @@ bool XINDEX::Make(PGLOBAL g, PIXDEF sxp)
Nk, n, Num_K, Ndif, addcolp, Tdbp->To_BlkFil, X);
// Check whether the unique index is unique indeed
if (!Mul)
if (!Mul) {
if (Ndif < Num_K) {
strcpy(g->Message, MSG(INDEX_NOT_UNIQ));
brc = true;
goto err;
} else
PlgDBfree(Offset); // Not used anymore
}
// Restore kcp list
To_LastCol->Next = addcolp;
......@@ -1207,7 +1208,6 @@ bool XINDEX::MapInit(PGLOBAL g)
PCOL colp;
PXCOL prev = NULL, kcp = NULL;
PDOSDEF defp = (PDOSDEF)Tdbp->To_Def;
PDBUSER dup = PlgGetUser(g);
/*********************************************************************/
/* Get the estimated table size. */
......@@ -2038,12 +2038,12 @@ int XINDXS::Range(PGLOBAL g, int limit, bool incl)
kp->Valp->SetValue_pval(xp->GetValue(), !kp->Prefix);
k = FastFind();
if (k < Num_K || Op != OP_EQ)
if (k < Num_K || Op != OP_EQ) {
if (limit)
n = (Mul) ? k : kp->Val_K;
else
n = (Mul) ? Pof[kp->Val_K + 1] - k : 1;
}
} else {
strcpy(g->Message, MSG(RANGE_NO_JOIN));
n = -1; // Logical error
......
......@@ -518,16 +518,16 @@ local ZPOS64_T zip64local_SearchCentralDir(const zlib_filefunc64_32_def* pzlib_f
if (ZREAD64(*pzlib_filefunc_def,filestream,buf,uReadSize)!=uReadSize)
break;
for (i=(int)uReadSize-3; (i--)>0;)
for (i=(int)uReadSize-3; (i--)>0;) {
if (((*(buf+i))==0x50) && ((*(buf+i+1))==0x4b) &&
((*(buf+i+2))==0x05) && ((*(buf+i+3))==0x06))
{
uPosFound = uReadPos+i;
break;
}
if (uPosFound!=0)
break;
}
if (uPosFound!=0)
break;
}
TRYFREE(buf);
return uPosFound;
......@@ -1066,11 +1066,10 @@ extern int ZEXPORT zipOpenNewFileInZip4_64 (zipFile file, const char* filename,
uInt i;
int err = ZIP_OK;
# ifdef NOCRYPT
(crcForCrypting);
#ifdef NOCRYPT
if (password != NULL)
return ZIP_PARAMERROR;
# endif
#endif
if (file == NULL)
return ZIP_PARAMERROR;
......
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