1
0
mirror of https://github.com/MariaDB/server.git synced 2025-08-08 11:22:35 +03:00

Fixed compiler warnings from gcc 7.4.1

- Fixed possible error in rocksdb/rdb_datadic.cc
This commit is contained in:
Monty
2020-01-29 16:41:04 +02:00
parent cd2c0e013c
commit 4d61f1247a
47 changed files with 282 additions and 197 deletions

View File

@@ -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,12 +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)) {
if (!digit && *p == dechar)
@@ -363,12 +365,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);
type = (digit || n == 0 || (dec && n == 1)) ? TYPE_STRING
@@ -742,6 +745,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())
@@ -754,7 +758,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);
@@ -775,6 +779,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)
@@ -797,7 +802,7 @@ bool TDBCSV::OpenDB(PGLOBAL g)
Fldlen[i] = len;
Fldtyp[i] = IsTypeNum(cdp->GetType());
} // endif cdp
}
} // endif Use
if (Header) {
@@ -1047,6 +1052,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)
@@ -1075,7 +1081,7 @@ bool TDBCSV::PrepareWriting(PGLOBAL g)
else
strcat(To_Line, Field[i]);
}
} // endfor i
#if defined(_DEBUG)
@@ -1135,6 +1141,7 @@ int TDBCSV::CheckWrite(PGLOBAL g)
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;
@@ -1147,7 +1154,7 @@ int TDBCSV::CheckWrite(PGLOBAL g)
n += 2; // Outside quotes
} // endif
}
if ((nlen += n) > maxlen) {
strcpy(g->Message, MSG(LINE_TOO_LONG));
return -1;