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