diff options
author | Monty <monty@mariadb.org> | 2021-03-19 22:55:40 +0200 |
---|---|---|
committer | Monty <monty@mariadb.org> | 2021-03-20 21:17:32 +0200 |
commit | c22e6eeda81b9c3b8c79d4ef527b2a002d6d691b (patch) | |
tree | c475a17ecc723e91268fe00991765b1b9454c1b9 | |
parent | 93bb755dc8a9e68719c12ba621e048d3603d0123 (diff) | |
download | mariadb-git-c22e6eeda81b9c3b8c79d4ef527b2a002d6d691b.tar.gz |
Fix compiler warnings in connect engine
- Removed not used variables
- Added /* fall through */ to switches
- Removed not used static variable 'slash' from header file
- Removed test of fp->field_length >= 0 as it is always true
-rw-r--r-- | storage/connect/bson.cpp | 8 | ||||
-rw-r--r-- | storage/connect/bsonudf.cpp | 21 | ||||
-rw-r--r-- | storage/connect/ha_connect.cc | 6 | ||||
-rw-r--r-- | storage/connect/jdbconn.cpp | 13 | ||||
-rw-r--r-- | storage/connect/json.cpp | 5 | ||||
-rw-r--r-- | storage/connect/mycat.cc | 2 | ||||
-rw-r--r-- | storage/connect/odbconn.cpp | 4 | ||||
-rw-r--r-- | storage/connect/tabbson.cpp | 11 | ||||
-rw-r--r-- | storage/connect/tabjson.cpp | 2 | ||||
-rw-r--r-- | storage/connect/tabrest.h | 2 |
10 files changed, 39 insertions, 35 deletions
diff --git a/storage/connect/bson.cpp b/storage/connect/bson.cpp index 3c33551cb68..4a0849155ee 100644 --- a/storage/connect/bson.cpp +++ b/storage/connect/bson.cpp @@ -83,7 +83,7 @@ BDOC::BDOC(PGLOBAL G) : BJSON(G, NULL) PBVAL BDOC::ParseJson(PGLOBAL g, char* js, size_t lng) { size_t i; - bool b = false, ptyp = (bool *)pty; + bool b = false; PBVAL bvp = NULL; s = js; @@ -145,7 +145,7 @@ PBVAL BDOC::ParseJson(PGLOBAL g, char* js, size_t lng) b = false; break; } // endif b - + /* fall through */ default: if (bvp->Type != TYPE_UNKNOWN) { bvp->To_Val = ParseAsArray(i); @@ -683,7 +683,7 @@ bool BDOC::SerializeArray(OFFSET arp, bool b) } else if (jp->WriteChr('[')) return true; - for (vp; vp; vp = MVP(vp->Next)) { + for (; vp; vp = MVP(vp->Next)) { if (first) first = false; else if ((!b || jp->Prty()) && jp->WriteChr(',')) @@ -718,7 +718,7 @@ bool BDOC::SerializeObject(OFFSET obp) if (jp->WriteChr('{')) return true; - for (prp; prp; prp = GetNext(prp)) { + for (; prp; prp = GetNext(prp)) { if (first) first = false; else if (jp->WriteChr(',')) diff --git a/storage/connect/bsonudf.cpp b/storage/connect/bsonudf.cpp index 5b4332d6e9e..f6921b75b1e 100644 --- a/storage/connect/bsonudf.cpp +++ b/storage/connect/bsonudf.cpp @@ -87,6 +87,7 @@ static PBSON BbinAlloc(PGLOBAL g, ulong len, PBVAL jsp) /*********************************************************************************/ /* SubAlloc a new BJNX class with protection against memory exhaustion. */ /*********************************************************************************/ +#ifdef NOT_USED static PBJNX BjnxNew(PGLOBAL g, PBVAL vlp, int type, int len) { PBJNX bjnx; @@ -103,7 +104,7 @@ static PBJNX BjnxNew(PGLOBAL g, PBVAL vlp, int type, int len) return bjnx; } /* end of BjnxNew */ - +#endif /* ----------------------------------- BSNX ------------------------------------ */ /*********************************************************************************/ @@ -320,7 +321,7 @@ my_bool BJNX::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 @@ -529,6 +530,7 @@ void BJNX::SetJsonValue(PGLOBAL g, PVAL vp, PBVAL vlp) break; case TYPE_NULL: vp->SetNull(true); + /* fall through */ default: vp->Reset(); } // endswitch Type @@ -572,7 +574,6 @@ PVAL BJNX::GetColumnValue(PGLOBAL g, PBVAL row, int i) /*********************************************************************************/ PBVAL BJNX::GetRowValue(PGLOBAL g, PBVAL row, int i) { - my_bool expd = false; PBVAL bap; PBVAL vlp = NULL; @@ -1115,7 +1116,7 @@ my_bool BJNX::CheckPath(PGLOBAL g, UDF_ARGS *args, PBVAL jsp, PBVAL& jvp, int n) PSZ BJNX::Locate(PGLOBAL g, PBVAL jsp, PBVAL jvp, int k) { PSZ str = NULL; - my_bool b = false, err = true; + my_bool err = true; g->Message[0] = 0; @@ -1236,7 +1237,7 @@ my_bool BJNX::LocateValue(PGLOBAL g, PBVAL jvp) PSZ BJNX::LocateAll(PGLOBAL g, PBVAL jsp, PBVAL bvp, int mx) { PSZ str = NULL; - my_bool b = false, err = true; + my_bool err = true; PJPN jnp; if (!jsp) { @@ -2926,7 +2927,7 @@ my_bool bson_array_grp_init(UDF_INIT *initid, UDF_ARGS *args, char *message) return true; PGLOBAL g = (PGLOBAL)initid->ptr; - PBJNX bxp = new(g) BJNX(g); + (void) new(g) BJNX(g); JsonMemSave(g); return false; @@ -2999,7 +3000,7 @@ my_bool bson_object_grp_init(UDF_INIT *initid, UDF_ARGS *args, char *message) return true; PGLOBAL g = (PGLOBAL)initid->ptr; - PBJNX bxp = new(g) BJNX(g); + (void) new(g) BJNX(g); JsonMemSave(g); return false; @@ -3069,7 +3070,7 @@ my_bool bson_test_init(UDF_INIT* initid, UDF_ARGS* args, char* message) { char* bson_test(UDF_INIT* initid, UDF_ARGS* args, char* result, unsigned long* res_length, char* is_null, char* error) { - char* str = NULL, * sap = NULL, * fn = NULL; + char* str = NULL, * fn = NULL; int pretty = 1; PBVAL bvp; PGLOBAL g = (PGLOBAL)initid->ptr; @@ -5067,7 +5068,7 @@ char* bbin_array_add_values(UDF_INIT* initid, UDF_ARGS* args, char* result, if (!CheckMemory(g, initid, args, args->arg_count, true)) { uint i = 0; BJNX bnx(g); - PBVAL arp, top, jvp = NULL; + PBVAL arp, top; PBVAL bvp = bnx.MakeValue(args, 0, true, &top); if (bvp->Type == TYPE_JAR) { @@ -5691,7 +5692,7 @@ char *bbin_get_item(UDF_INIT *initid, UDF_ARGS *args, char *result, if (g->Xchk) { bsp = (PBSON)g->Xchk; } else if (!CheckMemory(g, initid, args, 1, true, true)) { - char *path = MakePSZ(g, args, 1); + // char *path = MakePSZ(g, args, 1); BJNX bnx(g, NULL, TYPE_STRING, initid->max_length); PBVAL top, jvp = NULL; PBVAL jsp = bnx.MakeValue(args, 0, true, &top); diff --git a/storage/connect/ha_connect.cc b/storage/connect/ha_connect.cc index b1449af9636..eb53f4c3bc5 100644 --- a/storage/connect/ha_connect.cc +++ b/storage/connect/ha_connect.cc @@ -1609,15 +1609,15 @@ void *ha_connect::GetColumnOption(PGLOBAL g, void *field, PCOLINFO pcf) pcf->Scale= 0; pcf->Opt= (fop) ? (int)fop->opt : 0; - if (fp->field_length >= 0) { +// if (fp->field_length >= 0) { pcf->Length = fp->field_length; // length is bytes for Connect, not characters if (!strnicmp(chset, "utf8", 4)) pcf->Length /= 3; - } else - pcf->Length= 256; // BLOB? +// } else +// pcf->Length= 256; // BLOB? pcf->Precision= pcf->Length; diff --git a/storage/connect/jdbconn.cpp b/storage/connect/jdbconn.cpp index cea4d0a5b30..c50516a6af5 100644 --- a/storage/connect/jdbconn.cpp +++ b/storage/connect/jdbconn.cpp @@ -117,7 +117,7 @@ int TranslateJDBCType(int stp, char *tn, int prec, int& len, char& v) else len = MY_MIN(abs(len), GetConvSize()); - // Pass through + /* fall through */ case 12: // VARCHAR if (tn && !stricmp(tn, "TEXT")) // Postgresql returns 12 for TEXT @@ -128,14 +128,14 @@ int TranslateJDBCType(int stp, char *tn, int prec, int& len, char& v) if (len == 0x7FFFFFFF) len = GetConvSize(); - // Pass through + /* fall through */ case -9: // NVARCHAR (unicode) // Postgresql can return this when size is unknown if (len == 0x7FFFFFFF) len = GetConvSize(); v = 'V'; - // Pass through + /* fall through */ case 1: // CHAR case -15: // NCHAR (unicode) case -8: // ROWID @@ -194,7 +194,7 @@ int TranslateJDBCType(int stp, char *tn, int prec, int& len, char& v) break; } // endif tn - // Pass through + /* fall through */ case 0: // NULL case -2: // BINARY case -4: // LONGVARBINARY @@ -294,7 +294,7 @@ public: } // endif name - // If it was not specified, set schema as the passed db name + // If it was not specified, set schema as the passed db name if (db && !m_part[1].length) lex_string_set(&m_part[1], db, strlen(db)); @@ -766,7 +766,6 @@ void JDBConn::AddJars(PSTRG jpop, char sep) /***********************************************************************/ bool JDBConn::Connect(PJPARM sop) { - int irc = RC_FX; bool err = false; jint rc; PGLOBAL& g = m_G; @@ -1087,7 +1086,7 @@ void JDBConn::SetColumnValue(int rank, PSZ name, PVAL val) break; case 0: // NULL val->SetNull(true); - // passthru + /* fall through */ default: val->Reset(); } // endswitch Type diff --git a/storage/connect/json.cpp b/storage/connect/json.cpp index bd9c4fac7a1..d9fe3db7aa0 100644 --- a/storage/connect/json.cpp +++ b/storage/connect/json.cpp @@ -1001,7 +1001,7 @@ int JOBJECT::GetSize(bool b) { for (PJPR jpp = First; jpp; jpp = jpp->Next) // If b return only non null pairs - if (!b || jpp->Val && !jpp->Val->IsNull()) + if (!b || (jpp->Val && !jpp->Val->IsNull())) n++; return n; @@ -1530,10 +1530,12 @@ PVAL JVALUE::GetValue(PGLOBAL g) PVAL valp = NULL; if (DataType != TYPE_JSON) + { if (DataType == TYPE_STRG) valp = AllocateValue(g, Strp, DataType, Nd); else valp = AllocateValue(g, &LLn, DataType, Nd); + } return valp; } // end of GetValue @@ -1704,6 +1706,7 @@ void JVALUE::SetValue(PGLOBAL g, PVAL valp) case TYPE_TINY: B = valp->GetTinyValue() != 0; DataType = TYPE_BOOL; + break; case TYPE_INT: N = valp->GetIntValue(); DataType = TYPE_INTG; diff --git a/storage/connect/mycat.cc b/storage/connect/mycat.cc index e3fa00e119f..5f73d1713ce 100644 --- a/storage/connect/mycat.cc +++ b/storage/connect/mycat.cc @@ -508,7 +508,7 @@ PTABDEF MYCAT::MakeTableDesc(PGLOBAL g, PTABLE tablep, LPCSTR am) tdp = new(g) MGODEF; break; } // endif enabled - // fall through + /* fall through */ #endif // JAVA_SUPPORT || CMGO_SUPPORT default: sprintf(g->Message, MSG(BAD_TABLE_TYPE), am, name); diff --git a/storage/connect/odbconn.cpp b/storage/connect/odbconn.cpp index 514951d8d2a..92f18aec348 100644 --- a/storage/connect/odbconn.cpp +++ b/storage/connect/odbconn.cpp @@ -125,17 +125,20 @@ int TranslateSQLType(int stp, int prec, int& len, char& v, bool& w) switch (stp) { case SQL_WVARCHAR: // (-9) w = true; + /* fall through */ case SQL_VARCHAR: // 12 v = 'V'; type = TYPE_STRING; break; case SQL_WCHAR: // (-8) w = true; + /* fall through */ case SQL_CHAR: // 1 type = TYPE_STRING; break; case SQL_WLONGVARCHAR: // (-10) w = true; + /* fall through */ case SQL_LONGVARCHAR: // (-1) if (GetTypeConv() == TPC_YES || GetTypeConv() == TPC_FORCE) { v = 'V'; @@ -2344,6 +2347,7 @@ int ODBConn::GetCatInfo(CATPARM *cap) break; case CAT_SPC: ThrowDBX("SQLSpecialColumns not available yet"); + break; default: ThrowDBX("Invalid SQL function id"); } // endswitch infotype diff --git a/storage/connect/tabbson.cpp b/storage/connect/tabbson.cpp index db63b8e78db..ccc519f22fa 100644 --- a/storage/connect/tabbson.cpp +++ b/storage/connect/tabbson.cpp @@ -824,7 +824,7 @@ PBVAL BCUTIL::MakeBson(PGLOBAL g, PBVAL jsp, int n) /***********************************************************************/ PBVAL BCUTIL::GetRowValue(PGLOBAL g, PBVAL row, int i) { - int nod = Cp->Nod, n = nod - 1; + int nod = Cp->Nod; JNODE *nodes = Cp->Nodes; PBVAL arp; PBVAL bvp = NULL; @@ -1956,6 +1956,7 @@ PSZ BSONCOL::GetJpath(PGLOBAL g, bool proj) return NULL; for (p1 = p2 = mgopath; *p1; p1++) + { if (i) { // Inside [] if (isdigit(*p1)) { if (!proj) @@ -1993,14 +1994,14 @@ PSZ BSONCOL::GetJpath(PGLOBAL g, bool proj) p2--; // Suppress last :* break; } // endif p2 - + /* fall through */ default: *p2++ = *p1; break; } // endswitch p1; - - *p2 = 0; - return mgopath; + } + *p2 = 0; + return mgopath; } else return NULL; diff --git a/storage/connect/tabjson.cpp b/storage/connect/tabjson.cpp index 402a0a1de37..aa048ebffc4 100644 --- a/storage/connect/tabjson.cpp +++ b/storage/connect/tabjson.cpp @@ -1023,7 +1023,6 @@ bool TDBJSN::OpenDB(PGLOBAL g) /*********************************************************************/ /* Lrecl is Ok. */ /*********************************************************************/ - size_t linelen = Lrecl; MODE mode = Mode; // Buffer must be allocated in g->Sarea @@ -1732,7 +1731,6 @@ void JSONCOL::ReadColumn(PGLOBAL g) /***********************************************************************/ PVAL JSONCOL::GetColumnValue(PGLOBAL g, PJSON row, int i) { - int n = Nod - 1; PJAR arp; PJVAL val = NULL; diff --git a/storage/connect/tabrest.h b/storage/connect/tabrest.h index 9cf2d10a6b8..6a6b874d5bf 100644 --- a/storage/connect/tabrest.h +++ b/storage/connect/tabrest.h @@ -6,9 +6,7 @@ #pragma once #if defined(__WIN__) -static PCSZ slash = "\\"; #else // !__WIN__ -static PCSZ slash = "/"; #define stricmp strcasecmp #endif // !__WIN__ |