Commit a0246490 authored by Monty's avatar Monty

Fixed compiler warnings form gcc 7.3.1

parent 4233b284
......@@ -5142,7 +5142,7 @@ xb_process_datadir(
handle_datadir_entry_func_t func) /*!<in: callback */
{
ulint ret;
char dbpath[OS_FILE_MAX_PATH+1];
char dbpath[OS_FILE_MAX_PATH+2];
os_file_dir_t dir;
os_file_dir_t dbdir;
os_file_stat_t dbinfo;
......
......@@ -464,6 +464,7 @@ inline bool is_temporal_type_with_date(enum_field_types type)
case MYSQL_TYPE_DATETIME2:
case MYSQL_TYPE_TIMESTAMP2:
DBUG_ASSERT(0); // field->real_type() should not get to here.
return false;
default:
return false;
}
......
......@@ -618,10 +618,12 @@ int ARRAY::Convert(PGLOBAL g, int k, PVAL vp)
/* Converting STRING to DATE can be done according to date format. */
/*********************************************************************/
if (Type == TYPE_DATE && ovblp->GetType() == TYPE_STRING && vp)
{
if (((DTVAL*)Value)->SetFormat(g, vp))
return TYPE_ERROR;
else
b = true; // Sort the new array on date internal values
}
/*********************************************************************/
/* Do the actual conversion. */
......
......@@ -1947,7 +1947,7 @@ int ha_connect::OpenTable(PGLOBAL g, bool del)
k1= k2= 0;
n1= n2= 1; // 1 is space for final null character
for (field= table->field; fp= *field; field++) {
for (field= table->field; (fp= *field); field++) {
if (bitmap_is_set(map, fp->field_index)) {
n1+= (fp->field_name.length + 1);
k1++;
......@@ -1963,7 +1963,7 @@ int ha_connect::OpenTable(PGLOBAL g, bool del)
if (k1) {
p= c1= (char*)PlugSubAlloc(g, NULL, n1);
for (field= table->field; fp= *field; field++)
for (field= table->field; (fp= *field); field++)
if (bitmap_is_set(map, fp->field_index)) {
strcpy(p, fp->field_name.str);
p+= (fp->field_name.length + 1);
......@@ -1975,7 +1975,7 @@ int ha_connect::OpenTable(PGLOBAL g, bool del)
if (k2) {
p= c2= (char*)PlugSubAlloc(g, NULL, n2);
for (field= table->field; fp= *field; field++)
for (field= table->field; (fp= *field); field++)
if (bitmap_is_set(ump, fp->field_index)) {
strcpy(p, fp->field_name.str);
......@@ -2002,11 +2002,13 @@ int ha_connect::OpenTable(PGLOBAL g, bool del)
istable= true;
// strmake(tname, table_name, sizeof(tname)-1);
#ifdef NOT_USED_VARIABLE
// We may be in a create index query
if (xmod == MODE_ANY && *tdbp->GetName() != '#') {
// The current indexes
PIXDEF oldpix= GetIndexInfo();
} // endif xmod
#endif
} else
htrc("OpenTable: %s\n", g->Message);
......@@ -2033,7 +2035,7 @@ bool ha_connect::CheckColumnList(PGLOBAL g)
MY_BITMAP *map= table->read_set;
try {
for (field= table->field; fp= *field; field++)
for (field= table->field; (fp= *field); field++)
if (bitmap_is_set(map, fp->field_index)) {
if (!(colp= tdbp->ColDB(g, (PSZ)fp->field_name.str, 0))) {
sprintf(g->Message, "Column %s not found in %s",
......@@ -3069,14 +3071,14 @@ PCFIL ha_connect::CheckCond(PGLOBAL g, PCFIL filp, const Item *cond)
strcat(s, "'}");
break;
} // endif ODBC
// fall through
// fall through
case MYSQL_TYPE_DATE:
if (tty == TYPE_AM_ODBC) {
strcat(s, "{d '");
strcat(strncat(s, res->ptr(), res->length()), "'}");
break;
} // endif ODBC
// fall through
case MYSQL_TYPE_TIME:
if (tty == TYPE_AM_ODBC) {
......@@ -3084,6 +3086,7 @@ PCFIL ha_connect::CheckCond(PGLOBAL g, PCFIL filp, const Item *cond)
strcat(strncat(s, res->ptr(), res->length()), "'}");
break;
} // endif ODBC
// fall through
case MYSQL_TYPE_VARCHAR:
if (tty == TYPE_AM_ODBC && i) {
......@@ -4272,8 +4275,6 @@ int ha_connect::info(uint flag)
// tdbp must be available to get updated info
if (xp->CheckQuery(valid_query_id) || !tdbp) {
PDBUSER dup= PlgGetUser(g);
PCATLG cat= (dup) ? dup->Catalog : NULL;
if (xmod == MODE_ANY || xmod == MODE_ALTER) {
// Pure info, not a query
......@@ -4576,12 +4577,14 @@ MODE ha_connect::CheckMode(PGLOBAL g, THD *thd,
// break;
case SQLCOM_DELETE_MULTI:
*cras = true;
// fall through
case SQLCOM_DELETE:
case SQLCOM_TRUNCATE:
newmode= MODE_DELETE;
break;
case SQLCOM_UPDATE_MULTI:
*cras = true;
// fall through
case SQLCOM_UPDATE:
newmode= MODE_UPDATE;
break;
......@@ -4591,6 +4594,7 @@ MODE ha_connect::CheckMode(PGLOBAL g, THD *thd,
break;
case SQLCOM_FLUSH:
locked= 0;
// fall through
case SQLCOM_DROP_TABLE:
case SQLCOM_RENAME_TABLE:
newmode= MODE_ANY;
......@@ -4687,7 +4691,6 @@ MODE ha_connect::CheckMode(PGLOBAL g, THD *thd,
int ha_connect::start_stmt(THD *thd, thr_lock_type lock_type)
{
int rc= 0;
bool chk=false, cras= false;
MODE newmode;
PGLOBAL g= GetPlug(thd, xp);
......@@ -5516,7 +5519,7 @@ static int connect_assisted_discovery(handlerton *, THD* thd,
PCSZ nsp= NULL, cls= NULL;
#endif // __WIN__
//int hdr, mxe;
int port = 0, mxr = 0, rc = 0, mul = 0, lrecl = 0;
int port = 0, mxr __attribute__((unused)) = 0, rc = 0, mul = 0;
//PCSZ tabtyp = NULL;
#if defined(ODBC_SUPPORT)
POPARM sop= NULL;
......@@ -5540,8 +5543,6 @@ static int connect_assisted_discovery(handlerton *, THD* thd,
if (!g)
return HA_ERR_INTERNAL_ERROR;
PDBUSER dup= PlgGetUser(g);
PCATLG cat= (dup) ? dup->Catalog : NULL;
PTOS topt= table_s->option_struct;
char buf[1024];
String sql(buf, sizeof(buf), system_charset_info);
......@@ -5771,6 +5772,7 @@ static int connect_assisted_discovery(handlerton *, THD* thd,
#endif // __WIN__
case TAB_PIVOT:
supfnc = FNC_NO;
// fall through
case TAB_PRX:
case TAB_TBL:
case TAB_XCL:
......@@ -5995,7 +5997,7 @@ static int connect_assisted_discovery(handlerton *, THD* thd,
} // endfor crp
} else {
char *schem = NULL;
char *schem __attribute__((unused)) = NULL;
char *tn = NULL;
// Not a catalog table
......
......@@ -342,7 +342,6 @@ bool TDBEXT::MakeSQL(PGLOBAL g, bool cnt)
char *catp = NULL, buf[NAM_LEN * 3];
int len;
bool first = true;
PTABLE tablep = To_Table;
PCOL colp;
if (Srcdef)
......@@ -455,6 +454,7 @@ void TDBEXT::RemoveConst(PGLOBAL g, char *stmt)
int n, nc;
while ((p = strstr(stmt, "NAME_CONST")))
{
if ((n = sscanf(p, "%*[^,],%1024[^)])%n", val, &nc))) {
if (trace(33))
htrc("p=%s\nn=%d val=%s nc=%d\n", p, n, val, nc);
......@@ -478,8 +478,8 @@ void TDBEXT::RemoveConst(PGLOBAL g, char *stmt)
} else
break;
return;
}
return;
} // end of RemoveConst
/***********************************************************************/
......
......@@ -1259,7 +1259,7 @@ MYSQLCOL::MYSQLCOL(PCOLDEF cdp, PTDB tdbp, PCOL cprec, int i, PCSZ am)
MYSQLCOL::MYSQLCOL(MYSQL_FIELD *fld, PTDB tdbp, int i, PCSZ am)
: COLBLK(NULL, tdbp, i)
{
const char *chset = get_charset_name(fld->charsetnr);
//const char *chset = get_charset_name(fld->charsetnr);
//char v = (!strcmp(chset, "binary")) ? 'B' : 0;
char v = 0;
......@@ -1400,6 +1400,7 @@ void MYSQLCOL::ReadColumn(PGLOBAL g)
/* If physical fetching of the line was deferred, do it now. */
/*********************************************************************/
if (!tdbp->Fetched)
{
if ((rc = tdbp->Myc.Fetch(g, tdbp->N)) != RC_OK) {
if (rc == RC_EF)
sprintf(g->Message, MSG(INV_DEF_READ), rc);
......@@ -1407,7 +1408,7 @@ void MYSQLCOL::ReadColumn(PGLOBAL g)
throw 11;
} else
tdbp->Fetched = true;
}
if ((buf = ((PTDBMY)To_Tdb)->Myc.GetCharField(Rank))) {
if (trace(2))
htrc("MySQL ReadColumn: name=%s buf=%s\n", Name, buf);
......
......@@ -274,7 +274,8 @@ void XCLCOL::ReadColumn(PGLOBAL g)
PSZ p;
// Trim left
for (p = Cp; *p == ' '; p++) ;
for (p = Cp; *p == ' '; p++)
;
if ((Cp = strchr(Cp, Sep)))
// Separator is found
......
......@@ -2599,12 +2599,13 @@ bool DTVAL::MakeDate(PGLOBAL g, int *val, int nval)
// Pass g to have an error return or NULL to set invalid dates to 0
if (MakeTime(&datm))
{
if (g) {
strcpy(g->Message, MSG(BAD_DATETIME));
rc = true;
} else
Tval = 0;
}
return rc;
} // end of MakeDate
......
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