summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMonty <monty@mariadb.org>2019-08-08 22:52:22 +0300
committerSergei Golubchik <serg@mariadb.org>2019-08-23 22:03:54 +0200
commita38f47e90ce8273e83b4151cd93a0a224420f69b (patch)
tree3faafa530d602fe2440dfaf13dec4ad23e24c265
parentde8b51fdc9d998fdf9c2d5c317a6da063c73d84a (diff)
downloadmariadb-git-a38f47e90ce8273e83b4151cd93a0a224420f69b.tar.gz
Fixed compiler warnings from connect engine
- clang complains about register in C++ - Removed not used variables - Fixed bug when printing date in filamdbf.cpp - Added {} to fix warning about dangling else - Changed connect_done_func() to be global to remove conflict with header files - Added extra () around assignment in if
-rw-r--r--storage/connect/filamdbf.cpp2
-rw-r--r--storage/connect/filamgz.cpp6
-rw-r--r--storage/connect/filamtxt.cpp3
-rw-r--r--storage/connect/filter.cpp4
-rw-r--r--storage/connect/fmdlex.c6
-rw-r--r--storage/connect/ha_connect.cc2
-rw-r--r--storage/connect/inihandl.cpp2
-rw-r--r--storage/connect/javaconn.cpp2
-rw-r--r--storage/connect/jdbconn.cpp6
-rw-r--r--storage/connect/jsonudf.cpp15
-rw-r--r--storage/connect/maputil.cpp2
-rw-r--r--storage/connect/myconn.cpp2
-rw-r--r--storage/connect/plgdbutl.cpp3
-rw-r--r--storage/connect/tabdos.cpp31
-rw-r--r--storage/connect/tabfix.cpp1
-rw-r--r--storage/connect/tabfmt.cpp25
-rw-r--r--storage/connect/tabjdbc.cpp8
-rw-r--r--storage/connect/tabjson.cpp7
-rw-r--r--storage/connect/tabmul.cpp8
-rw-r--r--storage/connect/tabmysql.cpp2
-rw-r--r--storage/connect/user_connect.cc2
-rw-r--r--storage/connect/user_connect.h2
-rw-r--r--storage/connect/valblk.cpp2
23 files changed, 81 insertions, 62 deletions
diff --git a/storage/connect/filamdbf.cpp b/storage/connect/filamdbf.cpp
index 350c3ddde35..253ed96a044 100644
--- a/storage/connect/filamdbf.cpp
+++ b/storage/connect/filamdbf.cpp
@@ -253,7 +253,7 @@ PQRYRES DBFColumns(PGLOBAL g, PCSZ dp, PCSZ fn, bool info)
mainhead.Encryptflag, mainhead.Mdxflag, mainhead.Language);
htrc("%hd records, last changed %02d/%02d/%d\n",
mainhead.Records(), mainhead.Filedate[1], mainhead.Filedate[2],
- mainhead.Filedate[0] + (mainhead.Filedate[0] <= 30) ? 2000 : 1900);
+ mainhead.Filedate[0] + ((mainhead.Filedate[0] <= 30) ? 2000 : 1900));
htrc("Field Type Offset Len Dec Set Mdx\n");
} // endif trace
diff --git a/storage/connect/filamgz.cpp b/storage/connect/filamgz.cpp
index 880db54c91d..f7517b53b8f 100644
--- a/storage/connect/filamgz.cpp
+++ b/storage/connect/filamgz.cpp
@@ -647,7 +647,7 @@ int ZBKFAM::WriteBuffer(PGLOBAL g)
int ZBKFAM::DeleteRecords(PGLOBAL g, int irc)
{
if (irc == RC_EF) {
- LPCSTR name = Tdbp->GetName();
+ (void) Tdbp->GetName(); // XXX Should be removed ?
PDOSDEF defp = (PDOSDEF)Tdbp->GetDef();
defp->SetBlock(0);
@@ -673,7 +673,7 @@ void ZBKFAM::CloseTableFile(PGLOBAL g, bool)
int rc = RC_OK;
if (Tdbp->GetMode() == MODE_INSERT) {
- LPCSTR name = Tdbp->GetName();
+ (void) Tdbp->GetName(); // XXX Should be removed?
PDOSDEF defp = (PDOSDEF)Tdbp->GetDef();
if (CurNum && !Closing) {
@@ -1355,7 +1355,7 @@ void ZLBFAM::CloseTableFile(PGLOBAL g, bool)
int rc = RC_OK;
if (Tdbp->GetMode() == MODE_INSERT) {
- LPCSTR name = Tdbp->GetName();
+ (void) Tdbp->GetName(); // XXX Should be removed?
PDOSDEF defp = (PDOSDEF)Tdbp->GetDef();
// Closing is True if last Write was in error
diff --git a/storage/connect/filamtxt.cpp b/storage/connect/filamtxt.cpp
index ca48fc765a1..67ab120c499 100644
--- a/storage/connect/filamtxt.cpp
+++ b/storage/connect/filamtxt.cpp
@@ -1547,13 +1547,14 @@ int BLKFAM::WriteBuffer(PGLOBAL g)
// T_Stream is the temporary stream or the table file stream itself
if (!T_Stream)
+ {
if (UseTemp /*&& Tdbp->GetMode() == MODE_UPDATE*/) {
if (OpenTempFile(g))
return RC_FX;
} else
T_Stream = Stream;
-
+ }
if (UseTemp) {
/*****************************************************************/
/* We are using a temporary file. Before writing the updated */
diff --git a/storage/connect/filter.cpp b/storage/connect/filter.cpp
index 7082b082c67..5bd9fc08ac4 100644
--- a/storage/connect/filter.cpp
+++ b/storage/connect/filter.cpp
@@ -1223,12 +1223,16 @@ bool FILTER::Eval(PGLOBAL g)
PDBUSER dup = PlgGetUser(g);
if (Opc <= OP_XX)
+ {
for (i = 0; i < 2; i++)
+ {
// Evaluate the object and eventually convert it.
if (Arg(i)->Eval(g))
return TRUE;
else if (Test[i].Conv)
Val(i)->SetValue_pval(Arg(i)->GetValue());
+ }
+ }
if (trace(1))
htrc(" Filter: op=%d type=%d %d B_T=%d %d val=%p %p\n",
diff --git a/storage/connect/fmdlex.c b/storage/connect/fmdlex.c
index 729b1b883c1..2a1bd53f51b 100644
--- a/storage/connect/fmdlex.c
+++ b/storage/connect/fmdlex.c
@@ -243,9 +243,6 @@ void yy_init_buffer YY_PROTO(( YY_BUFFER_STATE b, FILE *file ));
static int yy_start_stack_ptr = 0;
static int yy_start_stack_depth = 0;
static int *yy_start_stack = 0;
-static void yy_push_state YY_PROTO(( int new_state ));
-static void yy_pop_state YY_PROTO(( void ));
-static int yy_top_state YY_PROTO(( void ));
static void *yy_flex_alloc YY_PROTO(( unsigned int ));
static void *yy_flex_realloc YY_PROTO(( void *, unsigned int ));
@@ -1266,6 +1263,7 @@ FILE *file;
}
+#ifdef NOT_USED
#ifdef YY_USE_PROTOS
static void yy_push_state( int new_state )
#else
@@ -1297,7 +1295,6 @@ int new_state;
BEGIN(new_state);
}
-
static void yy_pop_state()
{
if ( --yy_start_stack_ptr < 0 )
@@ -1311,6 +1308,7 @@ static int yy_top_state()
{
return yy_start_stack[yy_start_stack_ptr - 1];
}
+#endif /* NOT_USED */
#ifdef YY_USE_PROTOS
diff --git a/storage/connect/ha_connect.cc b/storage/connect/ha_connect.cc
index 9427bf3175b..2b47162bb34 100644
--- a/storage/connect/ha_connect.cc
+++ b/storage/connect/ha_connect.cc
@@ -782,7 +782,7 @@ static int connect_init_func(void *p)
@brief
Plugin clean up
*/
-static int connect_done_func(void *)
+int connect_done_func(void *)
{
int error= 0;
PCONNECT pc, pn;
diff --git a/storage/connect/inihandl.cpp b/storage/connect/inihandl.cpp
index a17d50a18b8..c39c94fb30d 100644
--- a/storage/connect/inihandl.cpp
+++ b/storage/connect/inihandl.cpp
@@ -112,8 +112,6 @@ static PROFILE *MRUProfile[N_CACHED_PROFILES] = {NULL};
//static CRITICAL_SECTION PROFILE_CritSect = CRITICAL_SECTION_INIT("PROFILE_CritSect");
-static const char hex[17] = "0123456789ABCDEF";
-
BOOL WritePrivateProfileString(LPCSTR section, LPCSTR entry,
LPCSTR string, LPCSTR filename);
diff --git a/storage/connect/javaconn.cpp b/storage/connect/javaconn.cpp
index f919344f20b..5a4fe433121 100644
--- a/storage/connect/javaconn.cpp
+++ b/storage/connect/javaconn.cpp
@@ -347,7 +347,7 @@ bool JAVAConn::GetJVM(PGLOBAL g)
/***********************************************************************/
bool JAVAConn::Open(PGLOBAL g)
{
- bool brc = true, err = false;
+ bool brc = true;
jboolean jt = (trace(1));
// Link or check whether jvm library was linked
diff --git a/storage/connect/jdbconn.cpp b/storage/connect/jdbconn.cpp
index e0aca3333e6..b718f7f108f 100644
--- a/storage/connect/jdbconn.cpp
+++ b/storage/connect/jdbconn.cpp
@@ -769,7 +769,6 @@ bool JDBConn::Connect(PJPARM sop)
int irc = RC_FX;
bool err = false;
jint rc;
- jboolean jt = (trace(1));
PGLOBAL& g = m_G;
/*******************************************************************/
@@ -939,7 +938,7 @@ int JDBConn::Rewind(PCSZ sql)
if (gmID(m_G, fetchid, "Fetch", "(I)Z"))
return -1;
- jboolean b = env->CallBooleanMethod(job, fetchid, 0);
+ (void) env->CallBooleanMethod(job, fetchid, 0);
rbuf = m_Rows;
} else if (ExecuteCommand(sql) != RC_FX)
@@ -1191,7 +1190,7 @@ int JDBConn::ExecuteUpdate(PCSZ sql)
/***********************************************************************/
int JDBConn::GetResultSize(PCSZ sql, PCOL colp)
{
- int rc, n = 0;
+ int rc;
if ((rc = ExecuteQuery(sql)) != RC_OK)
return -1;
@@ -1493,7 +1492,6 @@ bool JDBConn::SetParam(JDBCCOL *colp)
PCSZ fnc = "Unknown";
uint n;
short len, tp;
- int crow = 0;
PQRYRES qrp = cap->Qrp;
PCOLRES crp;
jboolean rc = false;
diff --git a/storage/connect/jsonudf.cpp b/storage/connect/jsonudf.cpp
index d521322edb6..c634d722c31 100644
--- a/storage/connect/jsonudf.cpp
+++ b/storage/connect/jsonudf.cpp
@@ -247,7 +247,7 @@ my_bool JSNX::ParseJpath(PGLOBAL g)
{
char *p, *p1 = NULL, *p2 = NULL, *pbuf = NULL;
int i;
- my_bool a, mul = false;
+ my_bool a;
if (Parsed)
return false; // Already done
@@ -424,7 +424,6 @@ PVAL JSNX::GetColumnValue(PGLOBAL g, PJSON row, int i)
/*********************************************************************************/
PJVAL JSNX::GetRowValue(PGLOBAL g, PJSON row, int i, my_bool b)
{
- my_bool expd = false;
PJAR arp;
PJVAL val = NULL;
@@ -763,7 +762,7 @@ my_bool JSNX::WriteValue(PGLOBAL g, PJVAL jvalp)
PSZ JSNX::Locate(PGLOBAL g, PJSON jsp, PJVAL jvp, int k)
{
PSZ str = NULL;
- my_bool b = false, err = true;
+ my_bool err = true;
g->Message[0] = 0;
@@ -885,7 +884,7 @@ my_bool JSNX::LocateValue(PJVAL jvp)
PSZ JSNX::LocateAll(PGLOBAL g, PJSON jsp, PJVAL jvp, int mx)
{
PSZ str = NULL;
- my_bool b = false, err = true;
+ my_bool err = true;
PJPN jnp;
if (!jsp) {
@@ -1352,7 +1351,7 @@ static PBSON MakeBinResult(PGLOBAL g, UDF_ARGS *args, PJSON top, ulong len, int
bsnp->Pretty = pretty;
- if (bsnp->Filename = (char*)args->args[0]) {
+ if ((bsnp->Filename = (char*)args->args[0])) {
bsnp->Filename = MakePSZ(g, args, 0);
strncpy(bsnp->Msg, bsnp->Filename, BMX);
} else
@@ -3755,11 +3754,13 @@ my_bool jsonlocate_init(UDF_INIT *initid, UDF_ARGS *args, char *message)
strcpy(message, "Third argument is not an integer (rank)");
return true;
} else if (args->arg_count > 3)
+ {
if (args->arg_type[3] != INT_RESULT) {
strcpy(message, "Fourth argument is not an integer (memory)");
return true;
} else
more += (ulong)*(longlong*)args->args[2];
+ }
CalcLen(args, false, reslen, memlen);
@@ -5178,7 +5179,7 @@ char *jbin_object_delete(UDF_INIT *initid, UDF_ARGS *args, char *result,
PCSZ key;
PJOB jobp;
PJVAL jvp = MakeValue(g, args, 0, &top);
- PJSON jsp = jvp->GetJson();
+ (void) jvp->GetJson(); // XXX Should be removed?
if (CheckPath(g, args, top, jvp, 2))
PUSH_WARNING(g->Message);
@@ -5889,7 +5890,7 @@ long long countin(UDF_INIT *initid, UDF_ARGS *args, char *result,
memcpy(str2, args->args[1], lg);
str2[lg] = 0;
- while (s = strstr(s, str2)) {
+ while ((s = strstr(s, str2))) {
n++;
s += lg;
} // endwhile
diff --git a/storage/connect/maputil.cpp b/storage/connect/maputil.cpp
index 87263b3adf6..71290511f8e 100644
--- a/storage/connect/maputil.cpp
+++ b/storage/connect/maputil.cpp
@@ -190,7 +190,7 @@ bool CloseMemMap(void *memory, size_t dwSize)
{
if (memory) {
// All this must be redesigned
- int rc = msync((char*)memory, dwSize, MS_SYNC);
+ msync((char*)memory, dwSize, MS_SYNC);
return (munmap((char*)memory, dwSize) < 0) ? true : false;
} else
return false;
diff --git a/storage/connect/myconn.cpp b/storage/connect/myconn.cpp
index 6de5a73875c..448ee7dc782 100644
--- a/storage/connect/myconn.cpp
+++ b/storage/connect/myconn.cpp
@@ -140,7 +140,7 @@ PQRYRES MyColumns(PGLOBAL g, THD *thd, const char *host, const char *db,
PCSZ fmt;
char *fld, *colname, *chset, v, buf[128], uns[16], zero[16];
int i, n, nf = 0, ncol = sizeof(buftyp) / sizeof(int);
- int len, type, prec, rc, k = 0;
+ int len, type, prec, rc;
bool b;
PQRYRES qrp;
PCOLRES crp;
diff --git a/storage/connect/plgdbutl.cpp b/storage/connect/plgdbutl.cpp
index e296553d8e2..54808aa682f 100644
--- a/storage/connect/plgdbutl.cpp
+++ b/storage/connect/plgdbutl.cpp
@@ -425,6 +425,8 @@ char *ExtractFromPath(PGLOBAL g, char *pBuff, char *FileName, OPVAL op)
return pBuff;
} // end of PlgExtractFromPath
+
+#ifdef NOT_USED
/***********************************************************************/
/* Check the occurence and matching of a pattern against a string. */
/* Because this function is only used for catalog name checking, */
@@ -443,6 +445,7 @@ static bool PlugCheckPattern(PGLOBAL g, LPCSTR string, LPCSTR pat)
return true;
} // end of PlugCheckPattern
+#endif /* NOT_USED */
/***********************************************************************/
/* PlugEvalLike: evaluates a LIKE clause. */
diff --git a/storage/connect/tabdos.cpp b/storage/connect/tabdos.cpp
index 4f6e2c81744..b3cb510b5b9 100644
--- a/storage/connect/tabdos.cpp
+++ b/storage/connect/tabdos.cpp
@@ -562,8 +562,6 @@ int TDBDOS::ResetTableOpt(PGLOBAL g, bool dop, bool dox)
MaxSize = -1; // Size must be recalculated
Cardinal = -1; // as well as Cardinality
- PTXF xp = Txfp;
-
To_Filter = NULL; // Disable filtering
//To_BlkIdx = NULL; // and index filtering
To_BlkFil = NULL; // and block filtering
@@ -635,8 +633,9 @@ int TDBDOS::MakeBlockValues(PGLOBAL g)
PDOSDEF defp = (PDOSDEF)To_Def;
PDOSCOL colp = NULL;
PDBUSER dup = PlgGetUser(g);
- PCATLG cat = defp->GetCat();
//void *memp = cat->GetDescp();
+ (void) defp->GetCat(); // XXX Should be removed?
+
if ((nrec = defp->GetElemt()) < 2) {
if (!To_Def->Partitioned()) {
@@ -998,15 +997,17 @@ bool TDBDOS::GetBlockValues(PGLOBAL g)
{
char filename[_MAX_PATH];
int i, lg, n[NZ];
- int nrec, block = 0, last = 0, allocblk = 0;
+ int nrec, block = 0, last = 0;
int len;
bool newblk = false;
size_t ndv, nbm, nbk, blk;
FILE *opfile;
PCOLDEF cdp;
PDOSDEF defp = (PDOSDEF)To_Def;
- PCATLG cat = defp->GetCat();
- PDBUSER dup = PlgGetUser(g);
+ PDBUSER dup = PlgGetUser(g);
+
+ (void) defp->GetCat(); // XXX Should be removed?
+
#if 0
if (Mode == MODE_INSERT && Txfp->GetAmType() == TYPE_AM_DOS)
@@ -1287,7 +1288,7 @@ PBF TDBDOS::InitBlockFilter(PGLOBAL g, PFIL filp)
} // endif blk
- int i, op = filp->GetOpc(), opm = filp->GetOpm(), n = 0;
+ int i, op = filp->GetOpc(), opm = filp->GetOpm();
bool cnv[2];
PCOL colp;
PXOB arg[2] = {NULL,NULL};
@@ -1330,13 +1331,14 @@ PBF TDBDOS::InitBlockFilter(PGLOBAL g, PFIL filp)
bfp = new(g) BLKSPCIN(g, this, op, opm, arg, Txfp->Nrec);
} else if (blk && Txfp->Nrec > 1 && colp->IsClustered())
+ {
// Clustered column and constant array
if (colp->GetClustered() == 2)
bfp = new(g) BLKFILIN2(g, this, op, opm, arg);
else
bfp = new(g) BLKFILIN(g, this, op, opm, arg);
-
- } // endif this
+ }
+ } // endif this
#if 0
} else if (filp->GetArgType(0) == TYPE_SCALF &&
@@ -1412,12 +1414,12 @@ PBF TDBDOS::CheckBlockFilari(PGLOBAL g, PXOB *arg, int op, bool *cnv)
//bool conv = false, xdb2 = false, ok = false, b[2];
//PXOB *xarg1, *xarg2 = NULL, xp[2];
int i, n = 0, type[2] = {0,0};
- bool conv = false, xdb2 = false, ok = false;
- PXOB *xarg2 = NULL, xp[2];
+ bool conv = false, xdb2 = false;
+ PXOB xp[2];
PCOL colp;
//LSTVAL *vlp = NULL;
//SFROW *sfr[2];
- PBF *fp = NULL, bfp = NULL;
+ PBF bfp = NULL;
for (i = 0; i < 2; i++) {
switch (arg[i]->GetType()) {
@@ -1648,7 +1650,7 @@ int TDBDOS::TestBlock(PGLOBAL g)
int TDBDOS::MakeIndex(PGLOBAL g, PIXDEF pxdf, bool add)
{
int k, n, rc = RC_OK;
- bool fixed, doit, sep, b = (pxdf != NULL);
+ bool fixed, doit, sep;
PCOL *keycols, colp;
PIXDEF xdp, sxp = NULL;
PKPDEF kdp;
@@ -2822,6 +2824,7 @@ bool DOSCOL::SetBitMap(PGLOBAL g)
bool DOSCOL::CheckSorted(PGLOBAL g)
{
if (Sorted)
+ {
if (OldVal) {
// Verify whether this column is sorted all right
if (OldVal->CompareValue(Value) > 0) {
@@ -2834,7 +2837,7 @@ bool DOSCOL::CheckSorted(PGLOBAL g)
} else
OldVal = AllocateValue(g, Value);
-
+ }
return false;
} // end of CheckSorted
diff --git a/storage/connect/tabfix.cpp b/storage/connect/tabfix.cpp
index 1969fd4465f..14afe511640 100644
--- a/storage/connect/tabfix.cpp
+++ b/storage/connect/tabfix.cpp
@@ -53,7 +53,6 @@
/***********************************************************************/
extern int num_read, num_there, num_eq[2]; // Statistics
static const longlong M2G = 0x80000000;
-static const longlong M4G = (longlong)2 * M2G;
char BINCOL::Endian = 'H';
/***********************************************************************/
diff --git a/storage/connect/tabfmt.cpp b/storage/connect/tabfmt.cpp
index 23cca6f6837..4d9a46b6af5 100644
--- a/storage/connect/tabfmt.cpp
+++ b/storage/connect/tabfmt.cpp
@@ -312,12 +312,13 @@ PQRYRES CSVColumns(PGLOBAL g, PCSZ dp, PTOS topt, bool info)
} else if (*p == q) {
if (phase == 0) {
if (blank)
+ {
if (++nerr > mxr) {
sprintf(g->Message, MSG(MISPLACED_QUOTE), num_read);
goto err;
} else
goto skip;
-
+ }
n = 0;
phase = digit = 1;
} else if (phase == 1) {
@@ -342,11 +343,13 @@ PQRYRES CSVColumns(PGLOBAL g, PCSZ dp, PTOS topt, bool info)
} else {
if (phase == 2)
+ {
if (++nerr > mxr) {
sprintf(g->Message, MSG(MISPLACED_QUOTE), num_read);
goto err;
} else
goto skip;
+ }
// isdigit cannot be used here because of debug assert
if (!strchr("0123456789", *p)) {
@@ -363,11 +366,13 @@ PQRYRES CSVColumns(PGLOBAL g, PCSZ dp, PTOS topt, bool info)
} // endif's *p
if (phase == 1)
+ {
if (++nerr > mxr) {
sprintf(g->Message, MSG(UNBALANCE_QUOTE), num_read);
goto err;
} else
goto skip;
+ }
if (n) {
len[i] = MY_MAX(len[i], n);
@@ -741,6 +746,7 @@ bool TDBCSV::OpenDB(PGLOBAL g)
PCSVCOL colp;
if (!Fields) // May have been set in TABFMT::OpenDB
+ {
if (Mode != MODE_UPDATE && Mode != MODE_INSERT) {
for (colp = (PCSVCOL)Columns; colp; colp = (PCSVCOL)colp->Next)
if (!colp->IsSpecial() && !colp->IsVirtual())
@@ -753,6 +759,7 @@ bool TDBCSV::OpenDB(PGLOBAL g)
for (cdp = tdp->GetCols(); cdp; cdp = cdp->GetNext())
if (!cdp->IsSpecial() && !cdp->IsVirtual())
Fields++;
+ }
Offset = (int*)PlugSubAlloc(g, NULL, sizeof(int) * Fields);
Fldlen = (int*)PlugSubAlloc(g, NULL, sizeof(int) * Fields);
@@ -774,6 +781,7 @@ bool TDBCSV::OpenDB(PGLOBAL g)
} // endfor i
if (Field)
+ {
// Prepare writing fields
if (Mode != MODE_UPDATE) {
for (colp = (PCSVCOL)Columns; colp; colp = (PCSVCOL)colp->Next)
@@ -796,8 +804,8 @@ bool TDBCSV::OpenDB(PGLOBAL g)
Fldlen[i] = len;
Fldtyp[i] = IsTypeNum(cdp->GetType());
} // endif cdp
-
- } // endif Use
+ }
+ } // endif Use
if (Header) {
// Check that the Lrecl is at least equal to the header line length
@@ -1046,6 +1054,7 @@ bool TDBCSV::PrepareWriting(PGLOBAL g)
strcat(To_Line, sep);
if (Field[i])
+ {
if (!strlen(Field[i])) {
// Generally null fields are not quoted
if (Quoted > 2)
@@ -1074,8 +1083,8 @@ bool TDBCSV::PrepareWriting(PGLOBAL g)
else
strcat(To_Line, Field[i]);
-
- } // endfor i
+ }
+ } // endfor i
#if defined(_DEBUG)
assert ((unsigned)nlen == strlen(To_Line));
@@ -1129,11 +1138,13 @@ int TDBCSV::CheckWrite(PGLOBAL g)
// Check whether record is too int
for (int i = 0; i < Fields; i++)
+ {
if (Field[i]) {
if (!(n = strlen(Field[i])))
n += (Quoted > 2 ? 2 : 0);
else if (strchr(Field[i], Sep) || (Qot && *Field[i] == Qot)
|| Quoted > 1 || (Quoted == 1 && !Fldtyp[i]))
+ {
if (!Qot) {
sprintf(g->Message, MSG(SEP_IN_FIELD), i + 1);
return -1;
@@ -1146,14 +1157,14 @@ int TDBCSV::CheckWrite(PGLOBAL g)
n += 2; // Outside quotes
} // endif
-
+ }
if ((nlen += n) > maxlen) {
strcpy(g->Message, MSG(LINE_TOO_LONG));
return -1;
} // endif nlen
} // endif Field
-
+ }
return nlen;
} // end of CheckWrite
diff --git a/storage/connect/tabjdbc.cpp b/storage/connect/tabjdbc.cpp
index 789daff6fcd..3576f7ef0d5 100644
--- a/storage/connect/tabjdbc.cpp
+++ b/storage/connect/tabjdbc.cpp
@@ -378,7 +378,7 @@ bool TDBJDBC::MakeInsert(PGLOBAL g)
int len = 0;
uint pos;
bool b = false;
- PTABLE tablep = To_Table;
+ // PTABLE tablep = To_Table;
PCOL colp;
for (colp = Columns; colp; colp = colp->GetNext())
@@ -582,11 +582,13 @@ bool TDBJDBC::OpenDB(PGLOBAL g)
if (Memory < 3) {
// Method will depend on cursor type
if ((Rbuf = Query ? Jcp->Rewind(Query->GetStr()) : 0) < 0)
+ {
if (Mode != MODE_READX) {
Jcp->Close();
return true;
} else
Rbuf = 0;
+ }
} else
Rbuf = Qrp->Nblin;
@@ -1017,7 +1019,7 @@ JDBCCOL::JDBCCOL(JDBCCOL *col1, PTDB tdbp) : EXTCOL(col1, tdbp)
void JDBCCOL::ReadColumn(PGLOBAL g)
{
PTDBJDBC tdbp = (PTDBJDBC)To_Tdb;
- int i = tdbp->Fpos - 1, n = tdbp->CurNum;
+ int i = tdbp->Fpos - 1;
if (tdbp->Memory == 3) {
// Get the value from the stored memory
@@ -1137,8 +1139,6 @@ int TDBXJDC::GetMaxSize(PGLOBAL g)
/***********************************************************************/
bool TDBXJDC::OpenDB(PGLOBAL g)
{
- bool rc = false;
-
if (trace(1))
htrc("JDBC OpenDB: tdbp=%p tdb=R%d use=%d mode=%d\n",
this, Tdb_No, Use, Mode);
diff --git a/storage/connect/tabjson.cpp b/storage/connect/tabjson.cpp
index afab52aa282..1a7dbd485c6 100644
--- a/storage/connect/tabjson.cpp
+++ b/storage/connect/tabjson.cpp
@@ -255,11 +255,13 @@ int JSONDISC::GetColumns(PGLOBAL g, PCSZ db, PCSZ dsn, PTOS topt)
jsp = (tjsp->GetDoc()) ? tjsp->GetDoc()->GetValue(0) : NULL;
} else {
if (!(tdp->Lrecl = GetIntegerTableOption(g, topt, "Lrecl", 0)))
+ {
if (!mgo) {
sprintf(g->Message, "LRECL must be specified for pretty=%d", tdp->Pretty);
return 0;
} else
tdp->Lrecl = 8192; // Should be enough
+ }
tdp->Ending = GetIntegerTableOption(g, topt, "Ending", CRLF);
@@ -1315,7 +1317,7 @@ bool JSONCOL::ParseJpath(PGLOBAL g)
{
char *p, *p1 = NULL, *p2 = NULL, *pbuf = NULL;
int i;
- bool a, mul = false;
+ bool a;
if (Parsed)
return false; // Already done
@@ -1545,7 +1547,6 @@ void JSONCOL::ReadColumn(PGLOBAL g)
PVAL JSONCOL::GetColumnValue(PGLOBAL g, PJSON row, int i)
{
int n = Nod - 1;
- bool expd = false;
PJAR arp;
PJVAL val = NULL;
@@ -2106,12 +2107,14 @@ int TDBJSON::Cardinality(PGLOBAL g)
if (!g)
return (Xcol || Multiple) ? 0 : 1;
else if (Cardinal < 0)
+ {
if (!Multiple) {
if (MakeDocument(g) == RC_OK)
Cardinal = Doc->size();
} else
return 10;
+ }
return Cardinal;
} // end of Cardinality
diff --git a/storage/connect/tabmul.cpp b/storage/connect/tabmul.cpp
index ee5f81d0188..3da72dcc29c 100644
--- a/storage/connect/tabmul.cpp
+++ b/storage/connect/tabmul.cpp
@@ -671,8 +671,8 @@ TDBDIR::TDBDIR(PSZ fpat) : TDBASE((PTABDEF)NULL)
/***********************************************************************/
char* TDBDIR::Path(PGLOBAL g)
{
- PCATLG cat = PlgGetCatalog(g);
- PTABDEF defp = (PTABDEF)To_Def;
+ (void) PlgGetCatalog(g); // XXX Should be removed?
+ PTABDEF defp = (PTABDEF)To_Def;
#if defined(__WIN__)
if (!*Drive) {
@@ -708,9 +708,9 @@ PCOL TDBDIR::MakeCol(PGLOBAL g, PCOLDEF cdp, PCOL cprec, int n)
int TDBDIR::GetMaxSize(PGLOBAL g)
{
if (MaxSize < 0) {
- int rc, n = -1;
+ int n = -1;
#if defined(__WIN__)
-
+ int rc;
// Start searching files in the target directory.
hSearch = FindFirstFile(Path(g), &FileData);
diff --git a/storage/connect/tabmysql.cpp b/storage/connect/tabmysql.cpp
index 83c20b26701..9d60319a83f 100644
--- a/storage/connect/tabmysql.cpp
+++ b/storage/connect/tabmysql.cpp
@@ -246,7 +246,7 @@ bool MYSQLDEF::ParseURL(PGLOBAL g, char *url, bool b)
// Found that if the string is:
// user:@hostname:port/db/table
// Then password is a null string, so set to NULL
- if ((pwd[0] == 0))
+ if (pwd[0] == 0)
Password = NULL;
else
Password = pwd;
diff --git a/storage/connect/user_connect.cc b/storage/connect/user_connect.cc
index 3bde2fa58eb..dec50aa8e6c 100644
--- a/storage/connect/user_connect.cc
+++ b/storage/connect/user_connect.cc
@@ -112,7 +112,7 @@ bool user_connect::user_init()
if (g)
printf("%s\n", g->Message);
- int rc= PlugExit(g);
+ (void) PlugExit(g);
g= NULL;
if (dup)
diff --git a/storage/connect/user_connect.h b/storage/connect/user_connect.h
index 22783d7fc12..af40a88cea0 100644
--- a/storage/connect/user_connect.h
+++ b/storage/connect/user_connect.h
@@ -35,7 +35,7 @@
//typedef struct _global *PGLOBAL;
typedef class user_connect *PCONNECT;
typedef class ha_connect *PHC;
-static int connect_done_func(void *);
+int connect_done_func(void *);
/*****************************************************************************/
/* The CONNECT users. There should be one by connected users. */
diff --git a/storage/connect/valblk.cpp b/storage/connect/valblk.cpp
index 5179fa654cf..355691fbd4d 100644
--- a/storage/connect/valblk.cpp
+++ b/storage/connect/valblk.cpp
@@ -1129,7 +1129,7 @@ void STRBLK::SetValues(PVBLK pv, int k, int n)
CheckType(pv)
PSZ *sp = ((STRBLK*)pv)->Strp;
- for (register int i = k; i < n; i++)
+ for (int i = k; i < n; i++)
Strp[i] = (!pv->IsNull(i)) ? sp[i] : NULL;
} // end of SetValues