mirror of
https://github.com/MariaDB/server.git
synced 2025-08-08 11:22:35 +03:00
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
This commit is contained in:
@@ -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
|
||||
|
||||
|
Reference in New Issue
Block a user