Commit 385dbaea authored by Olivier Bertrand's avatar Olivier Bertrand

- Fix gcc compilation warnings

modified:
  storage/connect/odbconn.cpp

- Prepare Value and Valblk to support unsigned data types
  (not operational yet)

modified:
  storage/connect/colblk.cpp
  storage/connect/filamvct.cpp
  storage/connect/myconn.cpp
  storage/connect/plgdbutl.cpp
  storage/connect/tabdos.cpp
  storage/connect/tabodbc.cpp
  storage/connect/tabvct.cpp
  storage/connect/valblk.cpp
  storage/connect/valblk.h
  storage/connect/value.cpp
  storage/connect/value.h
  storage/connect/xindex.cpp
parent aaa982e7
...@@ -164,8 +164,7 @@ bool COLBLK::CheckSort(PTDB tdbp) ...@@ -164,8 +164,7 @@ bool COLBLK::CheckSort(PTDB tdbp)
/* Now we use Format.Length for the len parameter to avoid strings */ /* Now we use Format.Length for the len parameter to avoid strings */
/* to be truncated when converting from string to coded string. */ /* to be truncated when converting from string to coded string. */
/* Added in version 1.5 is the arguments GetPrecision() and Domain */ /* Added in version 1.5 is the arguments GetPrecision() and Domain */
/* in calling AllocateValue. Domain is used for TYPE_TOKEN only, */ /* in calling AllocateValue. Domain is used for TYPE_DATE only. */
/* but why was GetPrecision() not specified ? To be checked. */
/***********************************************************************/ /***********************************************************************/
bool COLBLK::InitValue(PGLOBAL g) bool COLBLK::InitValue(PGLOBAL g)
{ {
...@@ -174,8 +173,7 @@ bool COLBLK::InitValue(PGLOBAL g) ...@@ -174,8 +173,7 @@ bool COLBLK::InitValue(PGLOBAL g)
// Allocate a Value object // Allocate a Value object
if (!(Value = AllocateValue(g, Buf_Type, Format.Length, if (!(Value = AllocateValue(g, Buf_Type, Format.Length,
GetPrecision(), GetDomain(), GetPrecision(), GetDomain())))
(To_Tdb) ? To_Tdb->GetCat() : NULL)))
return true; return true;
AddStatus(BUF_READY); AddStatus(BUF_READY);
......
...@@ -91,7 +91,7 @@ typedef struct _vecheader { ...@@ -91,7 +91,7 @@ typedef struct _vecheader {
/* Conversion of block values allowed conditionally for insert only. */ /* Conversion of block values allowed conditionally for insert only. */
/***********************************************************************/ /***********************************************************************/
PVBLK AllocValBlock(PGLOBAL, void *, int, int, int, int, PVBLK AllocValBlock(PGLOBAL, void *, int, int, int, int,
bool check = true, bool blank = true); bool check = true, bool blank = true, bool un = false);
/* -------------------------- Class VCTFAM --------------------------- */ /* -------------------------- Class VCTFAM --------------------------- */
......
...@@ -709,7 +709,7 @@ PQRYRES MYSQLC::GetResult(PGLOBAL g, bool pdb) ...@@ -709,7 +709,7 @@ PQRYRES MYSQLC::GetResult(PGLOBAL g, bool pdb)
crp->Clen = GetTypeSize(crp->Type, crp->Length); crp->Clen = GetTypeSize(crp->Type, crp->Length);
if (!(crp->Kdata = AllocValBlock(g, NULL, crp->Type, m_Rows, if (!(crp->Kdata = AllocValBlock(g, NULL, crp->Type, m_Rows,
crp->Clen, 0, FALSE, TRUE))) { crp->Clen, 0, FALSE, TRUE, FALSE))) {
sprintf(g->Message, MSG(INV_RESULT_TYPE), sprintf(g->Message, MSG(INV_RESULT_TYPE),
GetFormatType(crp->Type)); GetFormatType(crp->Type));
return NULL; return NULL;
......
...@@ -1118,7 +1118,7 @@ bool ODBConn::Connect(DWORD Options) ...@@ -1118,7 +1118,7 @@ bool ODBConn::Connect(DWORD Options)
if (hWnd == NULL) if (hWnd == NULL)
hWnd = GetDesktopWindow(); hWnd = GetDesktopWindow();
#else // !WIN32 #else // !WIN32
HWND hWnd = 1; HWND hWnd = (HWND)1;
#endif // !WIN32 #endif // !WIN32
PGLOBAL& g = m_G; PGLOBAL& g = m_G;
PDBUSER dup = PlgGetUser(g); PDBUSER dup = PlgGetUser(g);
...@@ -1240,8 +1240,8 @@ void ODBConn::GetConnectInfo() ...@@ -1240,8 +1240,8 @@ void ODBConn::GetConnectInfo()
m_IDQuoteChar, sizeof(m_IDQuoteChar), &nResult); m_IDQuoteChar, sizeof(m_IDQuoteChar), &nResult);
if (trace) if (trace)
htrc("DBMS: %s, Version: %s\n", htrc("DBMS: %s, Version: %s, rc=%d\n",
GetStringInfo(SQL_DBMS_NAME), GetStringInfo(SQL_DBMS_VER)); GetStringInfo(SQL_DBMS_NAME), GetStringInfo(SQL_DBMS_VER), rc);
} // end of GetConnectInfo } // end of GetConnectInfo
......
...@@ -330,7 +330,7 @@ PQRYRES PlgAllocResult(PGLOBAL g, int ncol, int maxres, int ids, ...@@ -330,7 +330,7 @@ PQRYRES PlgAllocResult(PGLOBAL g, int ncol, int maxres, int ids,
// Allocate the Value Block that will contain data // Allocate the Value Block that will contain data
if (crp->Length || nonull) if (crp->Length || nonull)
crp->Kdata = AllocValBlock(g, NULL, crp->Type, maxres, crp->Kdata = AllocValBlock(g, NULL, crp->Type, maxres,
crp->Length, 0, true, blank); crp->Length, 0, true, blank, false);
else else
crp->Kdata = NULL; crp->Kdata = NULL;
......
...@@ -77,7 +77,7 @@ extern "C" int trace; ...@@ -77,7 +77,7 @@ extern "C" int trace;
/* No conversion of block values (check = true). */ /* No conversion of block values (check = true). */
/***********************************************************************/ /***********************************************************************/
PVBLK AllocValBlock(PGLOBAL, void *, int, int, int len = 0, int prec = 0, PVBLK AllocValBlock(PGLOBAL, void *, int, int, int len = 0, int prec = 0,
bool check = true, bool blank = false); bool check = true, bool blank = false, bool un = false);
/* --------------------------- Class DOSDEF -------------------------- */ /* --------------------------- Class DOSDEF -------------------------- */
......
...@@ -1078,7 +1078,7 @@ void ODBCCOL::AllocateBuffers(PGLOBAL g, int rows) ...@@ -1078,7 +1078,7 @@ void ODBCCOL::AllocateBuffers(PGLOBAL g, int rows)
if (Buf_Type == TYPE_DATE) if (Buf_Type == TYPE_DATE)
Bufp = PlugSubAlloc(g, NULL, rows * sizeof(TIMESTAMP_STRUCT)); Bufp = PlugSubAlloc(g, NULL, rows * sizeof(TIMESTAMP_STRUCT));
else { else {
Blkp = AllocValBlock(g, NULL, Buf_Type, rows, Long+1, 0, true, false); Blkp = AllocValBlock(g, NULL, Buf_Type, rows, Long+1, 0, true, false, false);
Bufp = Blkp->GetValPointer(); Bufp = Blkp->GetValPointer();
} // endelse } // endelse
......
...@@ -81,7 +81,7 @@ char *strerror(int num); ...@@ -81,7 +81,7 @@ char *strerror(int num);
/* Conversion of block values allowed conditionally for insert only. */ /* Conversion of block values allowed conditionally for insert only. */
/***********************************************************************/ /***********************************************************************/
PVBLK AllocValBlock(PGLOBAL, void *, int, int, int, int, PVBLK AllocValBlock(PGLOBAL, void *, int, int, int, int,
bool check = true, bool blank = true); bool check = true, bool blank = true, bool un = false);
/* --------------------------- Class VCTDEF -------------------------- */ /* --------------------------- Class VCTDEF -------------------------- */
......
This diff is collapsed.
/*************** Valblk H Declares Source Code File (.H) ***************/ /*************** Valblk H Declares Source Code File (.H) ***************/
/* Name: VALBLK.H Version 1.9 */ /* Name: VALBLK.H Version 2.0 */
/* */ /* */
/* (C) Copyright to the author Olivier BERTRAND 2005-2013 */ /* (C) Copyright to the author Olivier BERTRAND 2005-2013 */
/* */ /* */
...@@ -18,8 +18,9 @@ ...@@ -18,8 +18,9 @@
/***********************************************************************/ /***********************************************************************/
/* Utility used to allocate value blocks. */ /* Utility used to allocate value blocks. */
/***********************************************************************/ /***********************************************************************/
DllExport PVBLK AllocValBlock(PGLOBAL, void*, int, int, int, int, bool, bool); DllExport PVBLK AllocValBlock(PGLOBAL, void*, int, int, int, int,
const char *GetFmt(int type); bool, bool, bool);
const char *GetFmt(int type, bool un = false);
/***********************************************************************/ /***********************************************************************/
/* Class VALBLK represent a base class for variable blocks. */ /* Class VALBLK represent a base class for variable blocks. */
...@@ -28,7 +29,7 @@ class VALBLK : public BLOCK { ...@@ -28,7 +29,7 @@ class VALBLK : public BLOCK {
//friend void SemColData(PGLOBAL g, PSEM semp); //friend void SemColData(PGLOBAL g, PSEM semp);
public: public:
// Constructors // Constructors
VALBLK(void *mp, int type, int nval); VALBLK(void *mp, int type, int nval, bool un = false);
// Implementation // Implementation
int GetNval(void) {return Nval;} int GetNval(void) {return Nval;}
...@@ -48,10 +49,14 @@ class VALBLK : public BLOCK { ...@@ -48,10 +49,14 @@ class VALBLK : public BLOCK {
virtual int GetVlen(void) = 0; virtual int GetVlen(void) = 0;
virtual PSZ GetCharValue(int n); virtual PSZ GetCharValue(int n);
virtual short GetShortValue(int n) = 0; virtual short GetShortValue(int n) = 0;
virtual ushort GetUShortValue(int n) = 0;
virtual int GetIntValue(int n) = 0; virtual int GetIntValue(int n) = 0;
virtual uint GetUIntValue(int n) = 0;
virtual longlong GetBigintValue(int n) = 0; virtual longlong GetBigintValue(int n) = 0;
virtual ulonglong GetUBigintValue(int n) = 0;
virtual double GetFloatValue(int n) = 0; virtual double GetFloatValue(int n) = 0;
virtual char GetTinyValue(int n) = 0; virtual char GetTinyValue(int n) = 0;
virtual uchar GetUTinyValue(int n) = 0;
virtual void ReAlloc(void *mp, int n) {Blkp = mp; Nval = n;} virtual void ReAlloc(void *mp, int n) {Blkp = mp; Nval = n;}
virtual void Reset(int n) = 0; virtual void Reset(int n) = 0;
virtual bool SetFormat(PGLOBAL g, PSZ fmt, int len, int year = 0); virtual bool SetFormat(PGLOBAL g, PSZ fmt, int len, int year = 0);
...@@ -60,10 +65,14 @@ class VALBLK : public BLOCK { ...@@ -60,10 +65,14 @@ class VALBLK : public BLOCK {
// Methods // Methods
virtual void SetValue(short sval, int n) {assert(false);} virtual void SetValue(short sval, int n) {assert(false);}
virtual void SetValue(ushort sval, int n) {assert(false);}
virtual void SetValue(int lval, int n) {assert(false);} virtual void SetValue(int lval, int n) {assert(false);}
virtual void SetValue(uint lval, int n) {assert(false);}
virtual void SetValue(longlong lval, int n) {assert(false);} virtual void SetValue(longlong lval, int n) {assert(false);}
virtual void SetValue(ulonglong lval, int n) {assert(false);}
virtual void SetValue(double fval, int n) {assert(false);} virtual void SetValue(double fval, int n) {assert(false);}
virtual void SetValue(char cval, int n) {assert(false);} virtual void SetValue(char cval, int n) {assert(false);}
virtual void SetValue(uchar cval, int n) {assert(false);}
virtual void SetValue(PSZ sp, int n) {assert(false);} virtual void SetValue(PSZ sp, int n) {assert(false);}
virtual void SetValue(char *sp, uint len, int n) {assert(false);} virtual void SetValue(char *sp, uint len, int n) {assert(false);}
virtual void SetValue(PVAL valp, int n) = 0; virtual void SetValue(PVAL valp, int n) = 0;
...@@ -94,6 +103,7 @@ class VALBLK : public BLOCK { ...@@ -94,6 +103,7 @@ class VALBLK : public BLOCK {
void *Blkp; // To value block void *Blkp; // To value block
bool Check; // If true SetValue types must match bool Check; // If true SetValue types must match
bool Nullable; // True if values can be null bool Nullable; // True if values can be null
bool Unsigned; // True if values are unsigned
int Type; // Type of individual values int Type; // Type of individual values
int Nval; // Max number of values in block int Nval; // Max number of values in block
int Prec; // Precision of float values int Prec; // Precision of float values
...@@ -106,18 +116,22 @@ template <class TYPE> ...@@ -106,18 +116,22 @@ template <class TYPE>
class TYPBLK : public VALBLK { class TYPBLK : public VALBLK {
public: public:
// Constructors // Constructors
TYPBLK(void *mp, int size, int type); TYPBLK(void *mp, int size, int type, int prec = 0, bool un = false);
TYPBLK(void *mp, int size, int prec, int type); //TYPBLK(void *mp, int size, int prec, int type);
// Implementation // Implementation
virtual void Init(PGLOBAL g, bool check); virtual void Init(PGLOBAL g, bool check);
virtual int GetVlen(void) {return sizeof(TYPE);} virtual int GetVlen(void) {return sizeof(TYPE);}
//virtual PSZ GetCharValue(int n); //virtual PSZ GetCharValue(int n);
virtual short GetShortValue(int n) {return (short)Typp[n];} virtual short GetShortValue(int n) {return (short)Typp[n];}
virtual ushort GetUShortValue(int n) {return (ushort)Typp[n];}
virtual int GetIntValue(int n) {return (int)Typp[n];} virtual int GetIntValue(int n) {return (int)Typp[n];}
virtual uint GetUIntValue(int n) {return (uint)Typp[n];}
virtual longlong GetBigintValue(int n) {return (longlong)Typp[n];} virtual longlong GetBigintValue(int n) {return (longlong)Typp[n];}
virtual ulonglong GetUBigintValue(int n) {return (ulonglong)Typp[n];}
virtual double GetFloatValue(int n) {return (double)Typp[n];} virtual double GetFloatValue(int n) {return (double)Typp[n];}
virtual char GetTinyValue(int n) {return (char)Typp[n];} virtual char GetTinyValue(int n) {return (char)Typp[n];}
virtual uchar GetUTinyValue(int n) {return (uchar)Typp[n];}
virtual void Reset(int n) {Typp[n] = 0;} virtual void Reset(int n) {Typp[n] = 0;}
// Methods // Methods
...@@ -125,14 +139,22 @@ class TYPBLK : public VALBLK { ...@@ -125,14 +139,22 @@ class TYPBLK : public VALBLK {
virtual void SetValue(char *sp, uint len, int n); virtual void SetValue(char *sp, uint len, int n);
virtual void SetValue(short sval, int n) virtual void SetValue(short sval, int n)
{Typp[n] = (TYPE)sval; SetNull(n, false);} {Typp[n] = (TYPE)sval; SetNull(n, false);}
virtual void SetValue(ushort sval, int n)
{Typp[n] = (TYPE)sval; SetNull(n, false);}
virtual void SetValue(int lval, int n) virtual void SetValue(int lval, int n)
{Typp[n] = (TYPE)lval; SetNull(n, false);} {Typp[n] = (TYPE)lval; SetNull(n, false);}
virtual void SetValue(uint lval, int n)
{Typp[n] = (TYPE)lval; SetNull(n, false);}
virtual void SetValue(longlong lval, int n) virtual void SetValue(longlong lval, int n)
{Typp[n] = (TYPE)lval; SetNull(n, false);} {Typp[n] = (TYPE)lval; SetNull(n, false);}
virtual void SetValue(ulonglong lval, int n)
{Typp[n] = (TYPE)lval; SetNull(n, false);}
virtual void SetValue(double fval, int n) virtual void SetValue(double fval, int n)
{Typp[n] = (TYPE)fval; SetNull(n, false);} {Typp[n] = (TYPE)fval; SetNull(n, false);}
virtual void SetValue(char cval, int n) virtual void SetValue(char cval, int n)
{Typp[n] = (TYPE)cval; SetNull(n, false);} {Typp[n] = (TYPE)cval; SetNull(n, false);}
virtual void SetValue(uchar cval, int n)
{Typp[n] = (TYPE)cval; SetNull(n, false);}
virtual void SetValue(PVAL valp, int n); virtual void SetValue(PVAL valp, int n);
virtual void SetValue(PVBLK pv, int n1, int n2); virtual void SetValue(PVBLK pv, int n1, int n2);
//virtual void SetValues(PVBLK pv, int k, int n); //virtual void SetValues(PVBLK pv, int k, int n);
...@@ -168,10 +190,14 @@ class CHRBLK : public VALBLK { ...@@ -168,10 +190,14 @@ class CHRBLK : public VALBLK {
virtual int GetVlen(void) {return Long;} virtual int GetVlen(void) {return Long;}
virtual PSZ GetCharValue(int n); virtual PSZ GetCharValue(int n);
virtual short GetShortValue(int n); virtual short GetShortValue(int n);
virtual ushort GetUShortValue(int n);
virtual int GetIntValue(int n); virtual int GetIntValue(int n);
virtual uint GetUIntValue(int n);
virtual longlong GetBigintValue(int n); virtual longlong GetBigintValue(int n);
virtual ulonglong GetUBigintValue(int n);
virtual double GetFloatValue(int n); virtual double GetFloatValue(int n);
virtual char GetTinyValue(int n); virtual char GetTinyValue(int n);
virtual uchar GetUTinyValue(int n);
virtual void Reset(int n); virtual void Reset(int n);
virtual void SetPrec(int p) {Ci = (p != 0);} virtual void SetPrec(int p) {Ci = (p != 0);}
virtual bool IsCi(void) {return Ci;} virtual bool IsCi(void) {return Ci;}
...@@ -217,10 +243,14 @@ class STRBLK : public VALBLK { ...@@ -217,10 +243,14 @@ class STRBLK : public VALBLK {
virtual int GetVlen(void) {return sizeof(PSZ);} virtual int GetVlen(void) {return sizeof(PSZ);}
virtual PSZ GetCharValue(int n) {return Strp[n];} virtual PSZ GetCharValue(int n) {return Strp[n];}
virtual short GetShortValue(int n) {return (short)atoi(Strp[n]);} virtual short GetShortValue(int n) {return (short)atoi(Strp[n]);}
virtual ushort GetUShortValue(int n) {return (ushort)atoi(Strp[n]);}
virtual int GetIntValue(int n) {return atol(Strp[n]);} virtual int GetIntValue(int n) {return atol(Strp[n]);}
virtual uint GetUIntValue(int n) {return (unsigned)atol(Strp[n]);}
virtual longlong GetBigintValue(int n) {return atoll(Strp[n]);} virtual longlong GetBigintValue(int n) {return atoll(Strp[n]);}
virtual ulonglong GetUBigintValue(int n) {return (unsigned)atoll(Strp[n]);}
virtual double GetFloatValue(int n) {return atof(Strp[n]);} virtual double GetFloatValue(int n) {return atof(Strp[n]);}
virtual char GetTinyValue(int n) {return (char)atoi(Strp[n]);} virtual char GetTinyValue(int n) {return (char)atoi(Strp[n]);}
virtual uchar GetUTinyValue(int n) {return (uchar)atoi(Strp[n]);}
virtual void Reset(int n) {Strp[n] = NULL;} virtual void Reset(int n) {Strp[n] = NULL;}
// Methods // Methods
......
This diff is collapsed.
This diff is collapsed.
...@@ -66,7 +66,7 @@ extern MBLOCK Nmblk; /* Used to initialize MBLOCK's */ ...@@ -66,7 +66,7 @@ extern MBLOCK Nmblk; /* Used to initialize MBLOCK's */
/* to have rows filled by blanks to be compatible with QRY blocks. */ /* to have rows filled by blanks to be compatible with QRY blocks. */
/***********************************************************************/ /***********************************************************************/
PVBLK AllocValBlock(PGLOBAL, void *, int, int, int, int, PVBLK AllocValBlock(PGLOBAL, void *, int, int, int, int,
bool check = true, bool blank = true); bool check = true, bool blank = true, bool un = false);
/***********************************************************************/ /***********************************************************************/
/* Check whether we have to create/update permanent indexes. */ /* Check whether we have to create/update permanent indexes. */
...@@ -2919,7 +2919,7 @@ void KXYCOL::SetValue(PCOL colp, int i) ...@@ -2919,7 +2919,7 @@ void KXYCOL::SetValue(PCOL colp, int i)
assert (Kblp != NULL); assert (Kblp != NULL);
#endif #endif
Kblp->SetValue(colp->GetValue(), (int)i); Kblp->SetValue(colp->GetValue(), i);
} // end of SetValue } // end of SetValue
/***********************************************************************/ /***********************************************************************/
...@@ -2970,7 +2970,7 @@ void KXYCOL::FillValue(PVAL valp) ...@@ -2970,7 +2970,7 @@ void KXYCOL::FillValue(PVAL valp)
int KXYCOL::Compare(int i1, int i2) int KXYCOL::Compare(int i1, int i2)
{ {
// Do the actual comparison between values. // Do the actual comparison between values.
register int k = (int)Kblp->CompVal((int)i1, (int)i2); register int k = Kblp->CompVal(i1, i2);
#ifdef DEBUG2 #ifdef DEBUG2
htrc("Compare done result=%d\n", k); htrc("Compare done result=%d\n", k);
...@@ -2991,7 +2991,7 @@ int KXYCOL::CompVal(int i) ...@@ -2991,7 +2991,7 @@ int KXYCOL::CompVal(int i)
htrc("Compare done result=%d\n", k); htrc("Compare done result=%d\n", k);
return k; return k;
#endif #endif
return (int)Kblp->CompVal(Valp, (int)i); return Kblp->CompVal(Valp, i);
} // end of CompVal } // end of CompVal
/***********************************************************************/ /***********************************************************************/
...@@ -3000,7 +3000,7 @@ int KXYCOL::CompVal(int i) ...@@ -3000,7 +3000,7 @@ int KXYCOL::CompVal(int i)
int KXYCOL::CompBval(int i) int KXYCOL::CompBval(int i)
{ {
// Do the actual comparison between key values. // Do the actual comparison between key values.
return (int)Blkp->CompVal(Valp, (int)i); return Blkp->CompVal(Valp, i);
} // end of CompBval } // end of CompBval
/***********************************************************************/ /***********************************************************************/
......
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