summaryrefslogtreecommitdiff
path: root/storage
diff options
context:
space:
mode:
authorOlivier Bertrand <bertrandop@gmail.com>2014-09-02 01:40:15 +0200
committerOlivier Bertrand <bertrandop@gmail.com>2014-09-02 01:40:15 +0200
commit7c1af793fc57e711fb0c8fdd12a3de5e45ad2bf7 (patch)
tree1ac86d3b7d01bdbd784e6a4284939891017136f7 /storage
parent16de35114eabca16b60849989244ed491cbd3fda (diff)
downloadmariadb-git-7c1af793fc57e711fb0c8fdd12a3de5e45ad2bf7.tar.gz
- Initialise min/max buffer to 0 to avoid valgrind complaining
that uninitialised characters be written in op file. modified: storage/connect/tabdos.cpp - Typo modified: storage/connect/filamap.cpp storage/connect/filamdbf.cpp storage/connect/filamdbf.h storage/connect/valblk.cpp storage/connect/xindex.cpp
Diffstat (limited to 'storage')
-rw-r--r--storage/connect/filamap.cpp15
-rw-r--r--storage/connect/filamdbf.cpp4
-rw-r--r--storage/connect/filamdbf.h2
-rw-r--r--storage/connect/tabdos.cpp7
-rw-r--r--storage/connect/valblk.cpp4
-rwxr-xr-xstorage/connect/xindex.cpp25
6 files changed, 33 insertions, 24 deletions
diff --git a/storage/connect/filamap.cpp b/storage/connect/filamap.cpp
index 3523c688788..c0ca40f4c01 100644
--- a/storage/connect/filamap.cpp
+++ b/storage/connect/filamap.cpp
@@ -129,9 +129,9 @@ bool MAPFAM::OpenTableFile(PGLOBAL g)
&& fp->Count && fp->Mode == mode)
break;
-#ifdef DEBTRACE
- htrc("Mapping file, fp=%p\n", fp);
-#endif
+ if (trace)
+ htrc("Mapping file, fp=%p\n", fp);
+
} else
fp = NULL;
@@ -347,11 +347,12 @@ int MAPFAM::ReadBuffer(PGLOBAL g)
return RC_EF;
case RC_NF:
// Skip this record
- if ((rc = SkipRecord(g, FALSE)) != RC_OK)
+ if ((rc = SkipRecord(g, false)) != RC_OK)
return rc;
goto next;
} // endswitch rc
+
} else
Placed = false;
@@ -415,9 +416,9 @@ int MAPFAM::DeleteRecords(PGLOBAL g, int irc)
/*******************************************************************/
Tpos = Spos = Fpos;
} else if ((n = Fpos - Spos) > 0) {
- /*****************************************************************/
- /* Non consecutive line to delete. Move intermediate lines. */
- /*****************************************************************/
+ /*******************************************************************/
+ /* Non consecutive line to delete. Move intermediate lines. */
+ /*******************************************************************/
memmove(Tpos, Spos, n);
Tpos += n;
diff --git a/storage/connect/filamdbf.cpp b/storage/connect/filamdbf.cpp
index ea1850b5c85..a214ab8acf2 100644
--- a/storage/connect/filamdbf.cpp
+++ b/storage/connect/filamdbf.cpp
@@ -176,7 +176,7 @@ static int dbfhead(PGLOBAL g, FILE *file, PSZ fn, DBFHEADER *buf)
/* DBFColumns: constructs the result blocks containing the description */
/* of all the columns of a DBF file that will be retrieved by #GetData. */
/****************************************************************************/
-PQRYRES DBFColumns(PGLOBAL g, char *dp, const char *fn, BOOL info)
+PQRYRES DBFColumns(PGLOBAL g, char *dp, const char *fn, bool info)
{
int buftyp[] = {TYPE_STRING, TYPE_SHORT, TYPE_STRING,
TYPE_INT, TYPE_INT, TYPE_SHORT};
@@ -186,7 +186,7 @@ PQRYRES DBFColumns(PGLOBAL g, char *dp, const char *fn, BOOL info)
char buf[2], filename[_MAX_PATH];
int ncol = sizeof(buftyp) / sizeof(int);
int rc, type, len, field, fields;
- BOOL bad;
+ bool bad;
DBFHEADER mainhead;
DESCRIPTOR thisfield;
FILE *infile = NULL;
diff --git a/storage/connect/filamdbf.h b/storage/connect/filamdbf.h
index 49bf5f0db93..da84d7685a8 100644
--- a/storage/connect/filamdbf.h
+++ b/storage/connect/filamdbf.h
@@ -19,7 +19,7 @@ typedef class DBMFAM *PDBMFAM;
/****************************************************************************/
/* Functions used externally. */
/****************************************************************************/
-PQRYRES DBFColumns(PGLOBAL g, char *dp, const char *fn, BOOL info);
+PQRYRES DBFColumns(PGLOBAL g, char *dp, const char *fn, bool info);
/****************************************************************************/
/* This is the base class for dBASE file access methods. */
diff --git a/storage/connect/tabdos.cpp b/storage/connect/tabdos.cpp
index eca6b68f656..054e46f7f10 100644
--- a/storage/connect/tabdos.cpp
+++ b/storage/connect/tabdos.cpp
@@ -664,6 +664,13 @@ int TDBDOS::MakeBlockValues(PGLOBAL g)
cdp->SetMin(PlugSubAlloc(g, NULL, block * lg));
cdp->SetMax(PlugSubAlloc(g, NULL, block * lg));
+ // Valgrind complains if there are uninitialised bytes
+ // after the null character ending
+ if (IsTypeChar(cdp->GetType())) {
+ memset(cdp->GetMin(), 0, block * lg);
+ memset(cdp->GetMax(), 0, block * lg);
+ } // endif Type
+
if (trace)
htrc("min(%p) max(%p) col(%d) %s Block=%d lg=%d\n",
cdp->GetMin(), cdp->GetMax(), i, cdp->GetName(), block, lg);
diff --git a/storage/connect/valblk.cpp b/storage/connect/valblk.cpp
index e435a49cbd2..3827deec43d 100644
--- a/storage/connect/valblk.cpp
+++ b/storage/connect/valblk.cpp
@@ -827,12 +827,12 @@ void CHRBLK::SetValue(PVBLK pv, int n1, int n2)
longjmp(g->jumper[g->jump_level], Type);
} // endif Type
- if (!(b = pv->IsNull(n2) && Nullable))
+ if (!(b = pv->IsNull(n2)))
memcpy(Chrp + n1 * Long, ((CHRBLK*)pv)->Chrp + n2 * Long, Long);
else
Reset(n1);
- SetNull(n1, b);
+ SetNull(n1, b && Nullable);
} // end of SetValue
/***********************************************************************/
diff --git a/storage/connect/xindex.cpp b/storage/connect/xindex.cpp
index b121968277f..7cc52580760 100755
--- a/storage/connect/xindex.cpp
+++ b/storage/connect/xindex.cpp
@@ -544,7 +544,7 @@ bool XINDEX::Make(PGLOBAL g, PIXDEF sxp)
if ((Ndif = Qsort(g, Num_K)) < 0)
goto err; // Error during sort
-// if (trace)
+ if (trace)
htrc("Make: Nk=%d n=%d Num_K=%d Ndif=%d addcolp=%p BlkFil=%p X=%p\n",
Nk, n, Num_K, Ndif, addcolp, Tdbp->To_BlkFil, X);
@@ -817,11 +817,11 @@ bool XINDEX::SaveIndex(PGLOBAL g, PIXDEF sxp)
bool sep, rc = false;
PXCOL kcp = To_KeyCol;
PDOSDEF defp = (PDOSDEF)Tdbp->To_Def;
- PDBUSER dup = PlgGetUser(g);
+//PDBUSER dup = PlgGetUser(g);
- dup->Step = STEP(SAVING_INDEX);
- dup->ProgMax = 15 + 16 * Nk;
- dup->ProgCur = 0;
+//dup->Step = STEP(SAVING_INDEX);
+//dup->ProgMax = 15 + 16 * Nk;
+//dup->ProgCur = 0;
switch (Tdbp->Ftype) {
case RECFM_VAR: ftype = ".dnx"; break;
@@ -881,17 +881,17 @@ bool XINDEX::SaveIndex(PGLOBAL g, PIXDEF sxp)
} // endif trace
size = X->Write(g, n, NZ, sizeof(int), rc);
- dup->ProgCur = 1;
+//dup->ProgCur = 1;
if (Mul) // Write the offset array
size += X->Write(g, Pof, nof, sizeof(int), rc);
- dup->ProgCur = 5;
+//dup->ProgCur = 5;
if (!Incr) // Write the record position array(s)
size += X->Write(g, To_Rec, Num_K, sizeof(int), rc);
- dup->ProgCur = 15;
+//dup->ProgCur = 15;
for (; kcp; kcp = kcp->Next) {
n[0] = kcp->Ndf; // Number of distinct sub-values
@@ -901,20 +901,20 @@ bool XINDEX::SaveIndex(PGLOBAL g, PIXDEF sxp)
n[4] = kcp->Type; // To be checked later
size += X->Write(g, n, NW, sizeof(int), rc);
- dup->ProgCur += 1;
+// dup->ProgCur += 1;
if (n[2])
size += X->Write(g, kcp->To_Bkeys, Nblk, kcp->Klen, rc);
- dup->ProgCur += 5;
+// dup->ProgCur += 5;
size += X->Write(g, kcp->To_Keys, n[0], kcp->Klen, rc);
- dup->ProgCur += 5;
+// dup->ProgCur += 5;
if (n[1])
size += X->Write(g, kcp->Kof, n[1], sizeof(int), rc);
- dup->ProgCur += 5;
+// dup->ProgCur += 5;
} // endfor kcp
if (trace)
@@ -2834,6 +2834,7 @@ void *XHUGE::FileView(PGLOBAL g, char *fn)
/***********************************************************************/
XXROW::XXROW(PTDBDOS tdbp) : XXBASE(tdbp, false)
{
+ Srtd = true;
Tdbp = tdbp;
Valp = NULL;
} // end of XXROW constructor