Commit b98360a4 authored by Olivier Bertrand's avatar Olivier Bertrand

- Trying to get rid of some valgrind warnings

modified:
  storage/connect/mycat.cc
  storage/connect/valblk.cpp
  storage/connect/value.cpp
parent 639ce065
...@@ -426,6 +426,8 @@ int MYCAT::GetColCatInfo(PGLOBAL g, PTABDEF defp) ...@@ -426,6 +426,8 @@ int MYCAT::GetColCatInfo(PGLOBAL g, PTABDEF defp)
PCOLDEF cdp, lcdp= NULL, tocols= NULL; PCOLDEF cdp, lcdp= NULL, tocols= NULL;
PCOLINFO pcf= (PCOLINFO)PlugSubAlloc(g, NULL, sizeof(COLINFO)); PCOLINFO pcf= (PCOLINFO)PlugSubAlloc(g, NULL, sizeof(COLINFO));
memset(pcf, 0, sizeof(COLINFO));
// Get a unique char identifier for type // Get a unique char identifier for type
tc= (defp->Catfunc == FNC_NO) ? GetTypeID(type) : TAB_PRX; tc= (defp->Catfunc == FNC_NO) ? GetTypeID(type) : TAB_PRX;
......
...@@ -654,8 +654,11 @@ void CHRBLK::SetValues(PVBLK pv, int k, int n) ...@@ -654,8 +654,11 @@ void CHRBLK::SetValues(PVBLK pv, int k, int n)
/***********************************************************************/ /***********************************************************************/
void CHRBLK::Move(int i, int j) void CHRBLK::Move(int i, int j)
{ {
if (i != j) {
memcpy(Chrp + j * Long, Chrp + i * Long, Long); memcpy(Chrp + j * Long, Chrp + i * Long, Long);
MoveNull(i, j); MoveNull(i, j);
} // endif i
} // end of Move } // end of Move
/***********************************************************************/ /***********************************************************************/
......
...@@ -578,6 +578,7 @@ void TYPVAL<TYPE>::SetValue_char(char *p, int n) ...@@ -578,6 +578,7 @@ void TYPVAL<TYPE>::SetValue_char(char *p, int n)
template <> template <>
void TYPVAL<double>::SetValue_char(char *p, int n) void TYPVAL<double>::SetValue_char(char *p, int n)
{ {
if (p) {
char *p2, buf[32]; char *p2, buf[32];
for (p2 = p + n; p < p2 && *p == ' '; p++) ; for (p2 = p + n; p < p2 && *p == ' '; p++) ;
...@@ -591,6 +592,11 @@ void TYPVAL<double>::SetValue_char(char *p, int n) ...@@ -591,6 +592,11 @@ void TYPVAL<double>::SetValue_char(char *p, int n)
htrc(" setting double: '%s' -> %lf\n", buf, Tval); htrc(" setting double: '%s' -> %lf\n", buf, Tval);
Null = false; Null = false;
} else {
Reset();
Null = Nullable;
} // endif p
} // end of SetValue } // end of SetValue
/***********************************************************************/ /***********************************************************************/
...@@ -599,8 +605,14 @@ void TYPVAL<double>::SetValue_char(char *p, int n) ...@@ -599,8 +605,14 @@ void TYPVAL<double>::SetValue_char(char *p, int n)
template <class TYPE> template <class TYPE>
void TYPVAL<TYPE>::SetValue_psz(PSZ s) void TYPVAL<TYPE>::SetValue_psz(PSZ s)
{ {
if (s) {
Tval = GetTypedValue(s); Tval = GetTypedValue(s);
Null = false; Null = false;
} else {
Reset();
Null = Nullable;
} // endif p
} // end of SetValue } // end of SetValue
template <> template <>
...@@ -895,6 +907,7 @@ bool TYPVAL<PSZ>::SetValue_pval(PVAL valp, bool chktype) ...@@ -895,6 +907,7 @@ bool TYPVAL<PSZ>::SetValue_pval(PVAL valp, bool chktype)
/***********************************************************************/ /***********************************************************************/
void TYPVAL<PSZ>::SetValue_char(char *p, int n) void TYPVAL<PSZ>::SetValue_char(char *p, int n)
{ {
if (p) {
n = min(n, Len); n = min(n, Len);
strncpy(Strp, p, n); strncpy(Strp, p, n);
...@@ -906,6 +919,11 @@ void TYPVAL<PSZ>::SetValue_char(char *p, int n) ...@@ -906,6 +919,11 @@ void TYPVAL<PSZ>::SetValue_char(char *p, int n)
htrc(" Setting string to: '%s'\n", Strp); htrc(" Setting string to: '%s'\n", Strp);
Null = false; Null = false;
} else {
Reset();
Null = Nullable;
} // endif p
} // end of SetValue_char } // end of SetValue_char
/***********************************************************************/ /***********************************************************************/
...@@ -913,8 +931,14 @@ void TYPVAL<PSZ>::SetValue_char(char *p, int n) ...@@ -913,8 +931,14 @@ void TYPVAL<PSZ>::SetValue_char(char *p, int n)
/***********************************************************************/ /***********************************************************************/
void TYPVAL<PSZ>::SetValue_psz(PSZ s) void TYPVAL<PSZ>::SetValue_psz(PSZ s)
{ {
if (s) {
strncpy(Strp, s, Len); strncpy(Strp, s, Len);
Null = false; Null = false;
} else {
Reset();
Null = Nullable;
} // endif s
} // end of SetValue_psz } // end of SetValue_psz
/***********************************************************************/ /***********************************************************************/
......
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