Skip to content

Commit

Permalink
Fix gcc compiler warnings reported by Sergei
Browse files Browse the repository at this point in the history
  modified:   storage/connect/array.cpp
  modified:   storage/connect/array.h
  modified:   storage/connect/blkfil.cpp
  modified:   storage/connect/blkfil.h
  modified:   storage/connect/block.h
  modified:   storage/connect/colblk.cpp
  modified:   storage/connect/colblk.h
  modified:   storage/connect/csort.h
  modified:   storage/connect/filamvct.cpp
  modified:   storage/connect/filter.cpp
  modified:   storage/connect/filter.h
  modified:   storage/connect/global.h
  modified:   storage/connect/json.h
  modified:   storage/connect/plgdbsem.h
  modified:   storage/connect/plgdbutl.cpp
  modified:   storage/connect/tabcol.cpp
  modified:   storage/connect/tabcol.h
  modified:   storage/connect/tabdos.cpp
  modified:   storage/connect/tabdos.h
  modified:   storage/connect/tabjson.cpp
  modified:   storage/connect/table.cpp
  modified:   storage/connect/tabodbc.cpp
  modified:   storage/connect/tabodbc.h
  modified:   storage/connect/tabsys.h
  modified:   storage/connect/tabxml.h
  modified:   storage/connect/value.cpp
  modified:   storage/connect/value.h
  modified:   storage/connect/xindex.cpp
  modified:   storage/connect/xindex.h
  modified:   storage/connect/xobject.cpp
  modified:   storage/connect/xobject.h
  modified:   storage/connect/xtable.h

Set values as nullable when retrieving catalog info
  modified:   storage/connect/jdbconn.cpp
  modified:   storage/connect/mysql-test/connect/r/odbc_oracle.result
  modified:   storage/connect/odbconn.cpp

Change format of Jpath
  modified:   storage/connect/json.cpp
  modified:   storage/connect/jsonudf.cpp
  modified:   storage/connect/mysql-test/connect/r/json.result
  modified:   storage/connect/mysql-test/connect/r/json_udf.result
  modified:   storage/connect/mysql-test/connect/r/json_udf_bin.result
  modified:   storage/connect/mysql-test/connect/r/zip.result
  modified:   storage/connect/mysql-test/connect/t/json.test
  modified:   storage/connect/mysql-test/connect/t/json_udf.test
  modified:   storage/connect/mysql-test/connect/t/json_udf_bin.test
  modified:   storage/connect/mysql-test/connect/t/zip.test
  modified:   storage/connect/tabjson.cpp
  modified:   storage/connect/tabjson.h
  modified:   storage/connect/tabmgo.cpp

Change null representation from ??? to <null>
  modified:   storage/connect/json.cpp

Change the name of UDF that are equal to a native JSON function name
  modified:   storage/connect/jsonudf.cpp
  modified:   storage/connect/jsonudf.h
  modified:   storage/connect/mysql-test/connect/t/json_udf.inc
  modified:   storage/connect/mysql-test/connect/t/json_udf2.inc

Fix bug in making JSON project info
  modified:   storage/connect/mongofam.cpp

Fix COMPUTE when one argument is null
  modified:   storage/connect/value.cpp

Value is null only when nullable
  modified:   storage/connect/value.h
  • Loading branch information
Buggynours committed May 23, 2017
1 parent 8f66819 commit 3723529
Show file tree
Hide file tree
Showing 53 changed files with 1,507 additions and 1,245 deletions.
16 changes: 8 additions & 8 deletions storage/connect/array.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -973,7 +973,7 @@ int ARRAY::BlockTest(PGLOBAL, int opc, int opm,
PSZ ARRAY::MakeArrayList(PGLOBAL g)
{
char *p, *tp;
int i;
int i;
size_t z, len = 2;

if (Type == TYPE_LIST)
Expand All @@ -984,7 +984,7 @@ PSZ ARRAY::MakeArrayList(PGLOBAL g)

for (i = 0; i < Nval; i++) {
Value->SetValue_pvblk(Vblp, i);
Value->Print(g, tp, z);
Value->Prints(g, tp, z);
len += strlen(tp);
} // enfor i

Expand All @@ -996,7 +996,7 @@ PSZ ARRAY::MakeArrayList(PGLOBAL g)

for (i = 0; i < Nval;) {
Value->SetValue_pvblk(Vblp, i);
Value->Print(g, tp, z);
Value->Prints(g, tp, z);
strcat(p, tp);
strcat(p, (++i == Nval) ? ")" : ",");
} // enfor i
Expand All @@ -1010,7 +1010,7 @@ PSZ ARRAY::MakeArrayList(PGLOBAL g)
/***********************************************************************/
/* Make file output of ARRAY contents. */
/***********************************************************************/
void ARRAY::Print(PGLOBAL g, FILE *f, uint n)
void ARRAY::Printf(PGLOBAL g, FILE *f, uint n)
{
char m[64];
int lim = MY_MIN(Nval,10);
Expand All @@ -1027,25 +1027,25 @@ void ARRAY::Print(PGLOBAL g, FILE *f, uint n)
if (Vblp)
for (int i = 0; i < lim; i++) {
Value->SetValue_pvblk(Vblp, i);
Value->Print(g, f, n+4);
Value->Printf(g, f, n+4);
} // endfor i

} else
fprintf(f, "%sVALLST: numval=%d\n", m, Nval);

} // end of Print
} // end of Printf

/***********************************************************************/
/* Make string output of ARRAY contents. */
/***********************************************************************/
void ARRAY::Print(PGLOBAL, char *ps, uint z)
void ARRAY::Prints(PGLOBAL, char *ps, uint z)
{
if (z < 16)
return;

sprintf(ps, "ARRAY: type=%d\n", Type);
// More to be implemented later
} // end of Print
} // end of Prints

/* -------------------------- Class MULAR ---------------------------- */

Expand Down
4 changes: 2 additions & 2 deletions storage/connect/array.h
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,8 @@ class DllExport ARRAY : public XOBJECT, public CSORT { // Array descblock
virtual bool Compare(PXOB) {assert(false); return false;}
virtual bool SetFormat(PGLOBAL, FORMAT&) {assert(false); return false;}
//virtual int CheckSpcCol(PTDB, int) {return 0;}
virtual void Print(PGLOBAL g, FILE *f, uint n);
virtual void Print(PGLOBAL g, char *ps, uint z);
virtual void Printf(PGLOBAL g, FILE *f, uint n);
virtual void Prints(PGLOBAL g, char *ps, uint z);
// void Empty(void);
void SetPrecision(PGLOBAL g, int p);
bool AddValue(PGLOBAL g, PSZ sp);
Expand Down
18 changes: 9 additions & 9 deletions storage/connect/blkfil.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ BLOCKFILTER::BLOCKFILTER(PTDBDOS tdbp, int op)
/***********************************************************************/
/* Make file output of BLOCKFILTER contents. */
/***********************************************************************/
void BLOCKFILTER::Print(PGLOBAL, FILE *f, uint n)
void BLOCKFILTER::Printf(PGLOBAL, FILE *f, uint n)
{
char m[64];

Expand All @@ -65,15 +65,15 @@ void BLOCKFILTER::Print(PGLOBAL, FILE *f, uint n)

fprintf(f, "%sBLOCKFILTER: at %p opc=%d opm=%d result=%d\n",
m, this, Opc, Opm, Result);
} // end of Print
} // end of Printf

/***********************************************************************/
/* Make string output of BLOCKFILTER contents. */
/***********************************************************************/
void BLOCKFILTER::Print(PGLOBAL, char *ps, uint z)
void BLOCKFILTER::Prints(PGLOBAL, char *ps, uint z)
{
strncat(ps, "BlockFilter(s)", z);
} // end of Print
} // end of Prints


/* ---------------------- Class BLKFILLOG ---------------------------- */
Expand Down Expand Up @@ -995,7 +995,7 @@ int BLOCKINDEX::BlockEval(PGLOBAL g)
/***********************************************************************/
/* Make file output of BLOCKINDEX contents. */
/***********************************************************************/
void BLOCKINDEX::Print(PGLOBAL g, FILE *f, UINT n)
void BLOCKINDEX::Printf(PGLOBAL g, FILE *f, UINT n)
{
char m[64];

Expand All @@ -1006,17 +1006,17 @@ void BLOCKINDEX::Print(PGLOBAL g, FILE *f, UINT n)
m, this, Next, (Colp) ? Colp->GetName() : "Rowid", Kxp, Result);

if (Next)
Next->Print(g, f, n);
Next->Printf(g, f, n);

} // end of Print
} // end of Printf

/***********************************************************************/
/* Make string output of BLOCKINDEX contents. */
/***********************************************************************/
void BLOCKINDEX::Print(PGLOBAL g, char *ps, UINT z)
void BLOCKINDEX::Prints(PGLOBAL g, char *ps, UINT z)
{
strncat(ps, "BlockIndex(es)", z);
} // end of Print
} // end of Prints

/* ------------------------------------------------------------------- */

Expand Down
8 changes: 4 additions & 4 deletions storage/connect/blkfil.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ class DllExport BLOCKFILTER : public BLOCK { /* Block Filter */
// Methods
virtual void Reset(PGLOBAL) = 0;
virtual int BlockEval(PGLOBAL) = 0;
virtual void Print(PGLOBAL g, FILE *f, uint n);
virtual void Print(PGLOBAL g, char *ps, uint z);
virtual void Printf(PGLOBAL g, FILE *f, uint n);
virtual void Prints(PGLOBAL g, char *ps, uint z);

protected:
BLOCKFILTER(void) {} // Standard constructor not to be used
Expand Down Expand Up @@ -234,8 +234,8 @@ class DllExport BLOCKINDEX : public BLOCK { /* Indexing Test Block */
// Methods
void Reset(void);
virtual int BlockEval(PGLOBAL);
virtual void Print(PGLOBAL g, FILE *f, UINT n);
virtual void Print(PGLOBAL g, char *ps, UINT z);
virtual void Printf(PGLOBAL g, FILE *f, UINT n);
virtual void Prints(PGLOBAL g, char *ps, UINT z);

protected:
BLOCKINDEX(void) {} // Standard constructor not to be used
Expand Down
4 changes: 2 additions & 2 deletions storage/connect/block.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,8 @@ class DllExport BLOCK {
return (PlugSubAlloc(g, p, size));
} // end of new

virtual void Print(PGLOBAL, FILE *, uint) {} // Produce file desc
virtual void Print(PGLOBAL, char *, uint) {} // Produce string desc
virtual void Printf(PGLOBAL, FILE *, uint) {} // Produce file desc
virtual void Prints(PGLOBAL, char *, uint) {} // Produce string desc

#if !defined(__BORLANDC__)
// Avoid warning C4291 by defining a matching dummy delete operator
Expand Down
8 changes: 4 additions & 4 deletions storage/connect/colblk.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ void COLBLK::WriteColumn(PGLOBAL g)
/***********************************************************************/
/* Make file output of a column descriptor block. */
/***********************************************************************/
void COLBLK::Print(PGLOBAL, FILE *f, uint n)
void COLBLK::Printf(PGLOBAL, FILE *f, uint n)
{
char m[64];
int i;
Expand All @@ -232,15 +232,15 @@ void COLBLK::Print(PGLOBAL, FILE *f, uint n)
fprintf(f,
" coluse=%04X status=%04X buftyp=%d value=%p name=%s\n",
ColUse, Status, Buf_Type, Value, Name);
} // end of Print
} // end of Printf

/***********************************************************************/
/* Make string output of a column descriptor block. */
/***********************************************************************/
void COLBLK::Print(PGLOBAL, char *ps, uint)
void COLBLK::Prints(PGLOBAL, char *ps, uint)
{
sprintf(ps, "R%d.%s", To_Tdb->GetTdb_No(), Name);
} // end of Print
} // end of Prints


/***********************************************************************/
Expand Down
4 changes: 2 additions & 2 deletions storage/connect/colblk.h
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,8 @@ class DllExport COLBLK : public XOBJECT {
virtual void SetTo_Val(PVAL) {}
virtual void ReadColumn(PGLOBAL g);
virtual void WriteColumn(PGLOBAL g);
virtual void Print(PGLOBAL g, FILE *, uint);
virtual void Print(PGLOBAL g, char *, uint);
virtual void Printf(PGLOBAL g, FILE *, uint);
virtual void Prints(PGLOBAL g, char *, uint);
virtual bool VarSize(void) {return false;}
bool InitValue(PGLOBAL g);

Expand Down
4 changes: 2 additions & 2 deletions storage/connect/csort.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,8 @@ class DllExport CSORT {
public:
// Methods
int Qsort(PGLOBAL g, int n); /* Sort calling routine */
//virtual void Print(PGLOBAL g, FILE *f, uint n);
//virtual void Print(PGLOBAL g, char *ps, uint z);
//virtual void Printf(PGLOBAL g, FILE *f, uint n);
//virtual void Prints(PGLOBAL g, char *ps, uint z);
#ifdef DEBTRACE
int GetNcmp(void) {return num_comp;}
#endif
Expand Down
3 changes: 1 addition & 2 deletions storage/connect/filamvct.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
/* */
/* COPYRIGHT: */
/* ---------- */
/* (C) Copyright to the author Olivier BERTRAND 2005-2015 */
/* (C) Copyright to the author Olivier BERTRAND 2005-2017 */
/* */
/* WHAT THIS PROGRAM DOES: */
/* ----------------------- */
Expand Down Expand Up @@ -568,7 +568,6 @@ bool VCTFAM::InitInsert(PGLOBAL g)
CurNum = 0;
AddBlock = !MaxBlk;
} else {
int rc;
PVCTCOL cp = (PVCTCOL)Tdbp->GetColumns();

// The starting point must be at the end of file as for append.
Expand Down
18 changes: 8 additions & 10 deletions storage/connect/filter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1490,7 +1490,7 @@ bool FILTER::MakeSelector(PGLOBAL g, PSTRG s, bool m)
if (GetArgType(1) == TYPE_COLBLK)
return true;

Arg(1)->Print(g, buf, 500);
Arg(1)->Prints(g, buf, 500);
s->Append(buf);
s->Append('}');
} // endif Opc
Expand All @@ -1503,7 +1503,7 @@ bool FILTER::MakeSelector(PGLOBAL g, PSTRG s, bool m)
/*********************************************************************/
/* Make file output of FILTER contents. */
/*********************************************************************/
void FILTER::Print(PGLOBAL g, FILE *f, uint n)
void FILTER::Printf(PGLOBAL g, FILE *f, uint n)
{
char m[64];

Expand All @@ -1525,18 +1525,18 @@ void FILTER::Print(PGLOBAL g, FILE *f, uint n)
if (lin && fp->GetArgType(i) == TYPE_FILTER)
fprintf(f, "%s Filter at %p\n", m, fp->Arg(i));
else
fp->Arg(i)->Print(g, f, n + 2);
fp->Arg(i)->Printf(g, f, n + 2);

} // endfor i

} // endfor fp

} // end of Print
} // end of Printf

/***********************************************************************/
/* Make string output of TABLE contents (z should be checked). */
/***********************************************************************/
void FILTER::Print(PGLOBAL g, char *ps, uint z)
void FILTER::Prints(PGLOBAL g, char *ps, uint z)
{
#define FLEN 100

Expand Down Expand Up @@ -1564,7 +1564,7 @@ void FILTER::Print(PGLOBAL g, char *ps, uint z)
bcp = bxp;
p = bcp->Cold;
n = FLEN;
fp->Arg(0)->Print(g, p, n);
fp->Arg(0)->Prints(g, p, n);
n = FLEN - strlen(p);

switch (fp->Opc) {
Expand Down Expand Up @@ -1610,7 +1610,7 @@ void FILTER::Print(PGLOBAL g, char *ps, uint z)

n = FLEN - strlen(p);
p += strlen(p);
fp->Arg(1)->Print(g, p, n);
fp->Arg(1)->Prints(g, p, n);
} else
if (!bcp) {
strncat(ps, "???", z);
Expand Down Expand Up @@ -1673,7 +1673,7 @@ void FILTER::Print(PGLOBAL g, char *ps, uint z)
bcp = bxp;
} while (bcp); // enddo

} // end of Print
} // end of Prints


/* -------------------- Derived Classes Functions -------------------- */
Expand Down Expand Up @@ -1791,8 +1791,6 @@ PFIL PrepareFilter(PGLOBAL g, PFIL fp, bool having)

if (trace)
htrc("PrepareFilter: fp=%p having=%d\n", fp, having);
//if (fp)
// fp->Print(g, debug, 0);

while (fp) {
if (fp->Opc == OP_SEP)
Expand Down
4 changes: 2 additions & 2 deletions storage/connect/filter.h
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,8 @@ class DllExport FILTER : public XOBJECT { /* Filter description block */
#if defined(MONGO_SUPPORT)
bool MakeSelector(PGLOBAL g, PSTRG s, bool m);
#endif // MONGO_SUPPORT
virtual void Print(PGLOBAL g, FILE *f, uint n);
virtual void Print(PGLOBAL g, char *ps, uint z);
virtual void Printf(PGLOBAL g, FILE *f, uint n);
virtual void Prints(PGLOBAL g, char *ps, uint z);
// PFIL Linearize(bool nosep);
// PFIL Link(PGLOBAL g, PFIL fil2);
// PFIL RemoveLastSep(void);
Expand Down
1 change: 1 addition & 0 deletions storage/connect/global.h
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@
#define TYPE_BIGINT 5
#define TYPE_LIST 6
#define TYPE_INT 7
#define TYPE_DATE 8
#define TYPE_DECIM 9
#define TYPE_BIN 10
#define TYPE_PCHAR 11
Expand Down
4 changes: 2 additions & 2 deletions storage/connect/ha_connect.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1045,8 +1045,8 @@ PCSZ GetListOption(PGLOBAL g, PCSZ opname, PCSZ oplist, PCSZ def)
pv= strchr(pk, '=');

if (pv && (!pn || pv < pn)) {
n= MY_MIN(pv - pk, sizeof(key) - 1);
memcpy(key, pk, n);
n = MY_MIN(static_cast<size_t>(pv - pk), sizeof(key) - 1);
memcpy(key, pk, n);
key[n]= 0;
pv++;
n= MY_MIN((pn ? pn - pv : strlen(pv)), sizeof(val) - 1);
Expand Down
1 change: 1 addition & 0 deletions storage/connect/jdbconn.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1943,6 +1943,7 @@ bool JDBConn::SetParam(JDBCCOL *colp)
} // endif len

pval[n] = AllocateValue(g, crp->Type, len);
pval[n]->SetNullable(true);

if (crp->Type == TYPE_STRING) {
pbuf[n] = (char*)PlugSubAlloc(g, NULL, len);
Expand Down
Loading

0 comments on commit 3723529

Please sign in to comment.