diff options
author | Olivier Bertrand <bertrandop@gmail.com> | 2014-09-30 12:59:24 +0200 |
---|---|---|
committer | Olivier Bertrand <bertrandop@gmail.com> | 2014-09-30 12:59:24 +0200 |
commit | 38c3fd2099577b932999766df41c77a81429fdc4 (patch) | |
tree | ac35245a4aeaa8fb75434d3e16f2f513ef9ba3af | |
parent | dd5eb7ae6781e963c6eb20049087c3f3c7e7b510 (diff) | |
download | mariadb-git-38c3fd2099577b932999766df41c77a81429fdc4.tar.gz |
- Fix MDEV-6802 in a clean way.
Add an union in the PARM structure to contain int values
Use a cast to ptrdiff_t in MAPFAM/MXPFAM::InitDelete required by some compilers
modified:
storage/connect/array.cpp
storage/connect/filamap.cpp
storage/connect/filamtxt.cpp
storage/connect/global.h
- Suppress some GCC warnings
modified:
storage/connect/array.cpp
storage/connect/filter.cpp
storage/connect/tabdos.cpp
storage/connect/tabmysql.cpp
storage/connect/value.cpp
-rw-r--r-- | storage/connect/array.cpp | 6 | ||||
-rw-r--r-- | storage/connect/filamap.cpp | 7 | ||||
-rw-r--r-- | storage/connect/filamtxt.cpp | 2 | ||||
-rw-r--r-- | storage/connect/filter.cpp | 28 | ||||
-rw-r--r-- | storage/connect/global.h | 5 | ||||
-rw-r--r-- | storage/connect/tabdos.cpp | 14 | ||||
-rw-r--r-- | storage/connect/tabmysql.cpp | 5 | ||||
-rw-r--r-- | storage/connect/value.cpp | 26 |
8 files changed, 48 insertions, 45 deletions
diff --git a/storage/connect/array.cpp b/storage/connect/array.cpp index 2519191f6e6..a2ee902bc59 100644 --- a/storage/connect/array.cpp +++ b/storage/connect/array.cpp @@ -130,7 +130,7 @@ PARRAY MakeValueArray(PGLOBAL g, PPARM pp) break; case TYPE_VOID: // Integer stored inside pp->Value - par->AddValue(g, (int)(uintptr_t)parmp->Value); + par->AddValue(g, parmp->Intval); break; } // endswitch valtyp @@ -609,13 +609,13 @@ int ARRAY::Convert(PGLOBAL g, int k, PVAL vp) Size = Nval; Nval = 0; - Vblp = Valblk->Allocate(g, Type, Len, 0, Size); + Vblp = Valblk->Allocate(g, Type, Len, prec, Size); if (!Valblk->GetMemp()) // The error message was built by PlgDBalloc return TYPE_ERROR; else - Value = AllocateValue(g, Type, Len, 0, NULL); + Value = AllocateValue(g, Type, Len, prec, NULL); /*********************************************************************/ /* Converting STRING to DATE can be done according to date format. */ diff --git a/storage/connect/filamap.cpp b/storage/connect/filamap.cpp index 85ad3865237..5efe9c95d81 100644 --- a/storage/connect/filamap.cpp +++ b/storage/connect/filamap.cpp @@ -30,7 +30,6 @@ #include <io.h> #endif // !UNIX #include <fcntl.h> -#include <stdint.h> // for uintprt_h #endif // !WIN32 /***********************************************************************/ @@ -291,8 +290,8 @@ bool MAPFAM::RecordPos(PGLOBAL g) /***********************************************************************/ int MAPFAM::InitDelete(PGLOBAL g, int fpos, int spos) { - Fpos = Memory + (uintptr_t)fpos; - Mempos = Memory + (uintptr_t)spos; + Fpos = Memory + (ptrdiff_t)fpos; + Mempos = Memory + (ptrdiff_t)spos; return RC_OK; } // end of InitDelete @@ -686,7 +685,7 @@ bool MPXFAM::SetPos(PGLOBAL g, int pos) /***********************************************************************/ int MPXFAM::InitDelete(PGLOBAL g, int fpos, int spos) { - Fpos = Memory + Headlen + (uintptr_t)fpos * Lrecl; + Fpos = Memory + Headlen + (ptrdiff_t)fpos * Lrecl; Mempos = Fpos + Lrecl; return RC_OK; } // end of InitDelete diff --git a/storage/connect/filamtxt.cpp b/storage/connect/filamtxt.cpp index 9c23944ff42..f2757e0c0fc 100644 --- a/storage/connect/filamtxt.cpp +++ b/storage/connect/filamtxt.cpp @@ -287,7 +287,7 @@ bool TXTFAM::AddListValue(PGLOBAL g, int type, void *val, PPARM *top) // *((int*)pp->Value) = *((int*)val); // break; case TYPE_VOID: - pp->Value = (void*)*(int*)val; + pp->Intval = *(int*)val; break; // case TYPE_STRING: // pp->Value = PlugSubAlloc(g, NULL, strlen((char*)val) + 1); diff --git a/storage/connect/filter.cpp b/storage/connect/filter.cpp index 9212432cdde..ce4f69c5ecc 100644 --- a/storage/connect/filter.cpp +++ b/storage/connect/filter.cpp @@ -63,7 +63,7 @@ static PPARM MakeParm(PGLOBAL g, PXOB xp) } // end of MakeParm /***********************************************************************/ -/* Routines called externally by FILTER function. */ +/* Routines called internally/externally by FILTER functions. */ /***********************************************************************/ bool PlugEvalLike(PGLOBAL, LPCSTR, LPCSTR, bool); //bool ReadSubQuery(PGLOBAL, PSUBQ); @@ -73,6 +73,32 @@ BYTE OpBmp(PGLOBAL g, OPVAL opc); PARRAY MakeValueArray(PGLOBAL g, PPARM pp); /***********************************************************************/ +/* Returns the bitmap representing the conditions that must not be */ +/* met when returning from TestValue for a given operator. */ +/* Bit one is EQ, bit 2 is LT, and bit 3 is GT. */ +/***********************************************************************/ +BYTE OpBmp(PGLOBAL g, OPVAL opc) + { + BYTE bt; + + switch (opc) { + case OP_IN: + case OP_EQ: bt = 0x06; break; + case OP_NE: bt = 0x01; break; + case OP_GT: bt = 0x03; break; + case OP_GE: bt = 0x02; break; + case OP_LT: bt = 0x05; break; + case OP_LE: bt = 0x04; break; + case OP_EXIST: bt = 0x00; break; + default: + sprintf(g->Message, MSG(BAD_FILTER_OP), opc); + longjmp(g->jumper[g->jump_level], TYPE_ARRAY); + } // endswitch opc + + return bt; + } // end of OpBmp + +/***********************************************************************/ /* Routines called externally by CondFilter. */ /***********************************************************************/ PFIL MakeFilter(PGLOBAL g, PFIL fp1, OPVAL vop, PFIL fp2) diff --git a/storage/connect/global.h b/storage/connect/global.h index d35cef2de6f..ae4440b12bc 100644 --- a/storage/connect/global.h +++ b/storage/connect/global.h @@ -205,7 +205,10 @@ typedef struct _activity { /* Describes activity and language */ /*---------------- UNIT ?????????? VERSION ? ----------------------*/ typedef struct _parm { - void *Value; + union { + void *Value; + int Intval; + }; // end union short Type, Domain; PPARM Next; } PARM; diff --git a/storage/connect/tabdos.cpp b/storage/connect/tabdos.cpp index 054e46f7f10..1af10183687 100644 --- a/storage/connect/tabdos.cpp +++ b/storage/connect/tabdos.cpp @@ -322,7 +322,7 @@ PTDB DOSDEF::GetTable(PGLOBAL g, MODE mode) && mode == MODE_UPDATE) && !(tmp == TMP_FORCE && (mode == MODE_UPDATE || mode == MODE_DELETE)); - PTXF txfp; + PTXF txfp = NULL; PTDBASE tdbp; /*********************************************************************/ @@ -574,7 +574,7 @@ int TDBDOS::ResetTableOpt(PGLOBAL g, bool dop, bool dox) int TDBDOS::MakeBlockValues(PGLOBAL g) { int i, lg, nrec, rc, n = 0; - int curnum, curblk, block, last, savndv, savnbm; + int curnum, curblk, block, savndv, savnbm; void *savmin, *savmax; bool blocked, xdb2 = false; //POOLHEADER save; @@ -611,7 +611,7 @@ int TDBDOS::MakeBlockValues(PGLOBAL g) // to Rows+1 by unblocked variable length table access methods. curblk = -1; curnum = nrec - 1; - last = 0; +//last = 0; Txfp->Block = block; // This is useful mainly for Txfp->CurBlk = curblk; // blocked tables (ZLBFAM), for Txfp->CurNum = curnum; // others it is just to be clean. @@ -742,7 +742,7 @@ int TDBDOS::MakeBlockValues(PGLOBAL g) Txfp->BlkPos[curblk] = Txfp->GetPos(); } // endif CurNum - last = curnum + 1; // curnum is zero based +// last = curnum + 1; // curnum is zero based Txfp->CurBlk = curblk; // Used in COLDOS::SetMinMax Txfp->CurNum = curnum; // Used in COLDOS::SetMinMax } // endif blocked @@ -1351,7 +1351,7 @@ PBF TDBDOS::CheckBlockFilari(PGLOBAL g, PXOB *arg, int op, bool *cnv) //int i, n1, n2, ctype = TYPE_ERROR, n = 0, type[2] = {0,0}; //bool conv = false, xdb2 = false, ok = false, b[2]; //PXOB *xarg1, *xarg2 = NULL, xp[2]; - int i, ctype = TYPE_ERROR, n = 0, type[2] = {0,0}; + int i, n = 0, type[2] = {0,0}; bool conv = false, xdb2 = false, ok = false; PXOB *xarg2 = NULL, xp[2]; PCOL colp; @@ -1363,7 +1363,7 @@ PBF TDBDOS::CheckBlockFilari(PGLOBAL g, PXOB *arg, int op, bool *cnv) switch (arg[i]->GetType()) { case TYPE_CONST: type[i] = 1; - ctype = arg[i]->GetResultType(); + // ctype = arg[i]->GetResultType(); break; case TYPE_COLBLK: conv = cnv[i]; @@ -1388,7 +1388,7 @@ PBF TDBDOS::CheckBlockFilari(PGLOBAL g, PXOB *arg, int op, bool *cnv) // correlated subquery, it has a constant value during // each execution of the subquery. type[i] = 1; - ctype = arg[i]->GetResultType(); +// ctype = arg[i]->GetResultType(); } // endif this break; diff --git a/storage/connect/tabmysql.cpp b/storage/connect/tabmysql.cpp index e11fac3a6b2..08938cb9626 100644 --- a/storage/connect/tabmysql.cpp +++ b/storage/connect/tabmysql.cpp @@ -888,6 +888,7 @@ bool TDBMYSQL::OpenDB(PGLOBAL g) } else if (Mode == MODE_INSERT) { if (Srcdef) { strcpy(g->Message, "No insert into anonym views"); + Myc.Close(); return true; } // endif Srcdef @@ -906,12 +907,12 @@ bool TDBMYSQL::OpenDB(PGLOBAL g) } // endif MakeInsert if (m_Rc != RC_FX) { - int rc; char cmd[64]; int w; sprintf(cmd, "ALTER TABLE `%s` DISABLE KEYS", Tabname); - rc = Myc.ExecSQL(g, cmd, &w); // may fail for some engines + + m_Rc = Myc.ExecSQL(g, cmd, &w); // may fail for some engines } // endif m_Rc } else diff --git a/storage/connect/value.cpp b/storage/connect/value.cpp index 4c1c36369ef..b2935743bd5 100644 --- a/storage/connect/value.cpp +++ b/storage/connect/value.cpp @@ -92,32 +92,6 @@ PSZ strlwr(PSZ s); #endif // !WIN32 /***********************************************************************/ -/* Returns the bitmap representing the conditions that must not be */ -/* met when returning from TestValue for a given operator. */ -/* Bit one is EQ, bit 2 is LT, and bit 3 is GT. */ -/***********************************************************************/ -BYTE OpBmp(PGLOBAL g, OPVAL opc) - { - BYTE bt; - - switch (opc) { - case OP_IN: - case OP_EQ: bt = 0x06; break; - case OP_NE: bt = 0x01; break; - case OP_GT: bt = 0x03; break; - case OP_GE: bt = 0x02; break; - case OP_LT: bt = 0x05; break; - case OP_LE: bt = 0x04; break; - case OP_EXIST: bt = 0x00; break; - default: - sprintf(g->Message, MSG(BAD_FILTER_OP), opc); - longjmp(g->jumper[g->jump_level], TYPE_ARRAY); - } // endswitch opc - - return bt; - } // end of OpBmp - -/***********************************************************************/ /* Get a long long number from its character representation. */ /* IN p: Pointer to the numeric string */ /* IN n: The string length */ |