- 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
This commit is contained in:
parent
16de35114e
commit
7c1af793fc
@ -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;
|
||||
|
||||
|
@ -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;
|
||||
|
@ -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. */
|
||||
|
@ -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);
|
||||
|
@ -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
|
||||
|
||||
/***********************************************************************/
|
||||
|
@ -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
|
||||
|
Loading…
x
Reference in New Issue
Block a user