|
From: <kin...@us...> - 2023-07-08 11:13:45
|
Revision: 7048
http://sourceforge.net/p/teem/code/7048
Author: kindlmann
Date: 2023-07-08 11:13:40 +0000 (Sat, 08 Jul 2023)
Log Message:
-----------
Propgating AIR_STRLEN --> AIR_STRLEN+1, with these API CHANGEs for
structs:
pullEnergy
char name[AIR_STRLEN_SMALL + 1];
and functions:
int pullInfoSpecSprint(char str[AIR_STRLEN_LARGE + 1],
const pullContext *pctx,
const pullInfoSpec *ispec);
Modified Paths:
--------------
teem/trunk/src/pull/constraints.c
teem/trunk/src/pull/corePull.c
teem/trunk/src/pull/energy.c
teem/trunk/src/pull/infoPull.c
teem/trunk/src/pull/pointPull.c
teem/trunk/src/pull/pull.h
teem/trunk/src/pull/trace.c
Modified: teem/trunk/src/pull/constraints.c
===================================================================
--- teem/trunk/src/pull/constraints.c 2023-07-07 21:53:33 UTC (rev 7047)
+++ teem/trunk/src/pull/constraints.c 2023-07-08 11:13:40 UTC (rev 7048)
@@ -703,7 +703,7 @@
if (1) {
Nrrd *nhist;
FILE *fhist;
- char fname[AIR_STRLEN_LARGE];
+ char fname[AIR_STRLEN_LARGE + 1];
nhist = nrrdNew();
sprintf(fname, "%04u-%04u-phist.nrrd", task->pctx->iter, point->idtag);
if (pullPositionHistoryNrrdGet(nhist, task->pctx, point)) {
Modified: teem/trunk/src/pull/corePull.c
===================================================================
--- teem/trunk/src/pull/corePull.c 2023-07-07 21:53:33 UTC (rev 7047)
+++ teem/trunk/src/pull/corePull.c 2023-07-08 11:13:40 UTC (rev 7048)
@@ -320,7 +320,7 @@
#if PULL_HINTER
if (pullProcessModeDescent == mode && pctx->nhinter) {
- char fname[AIR_STRLEN_SMALL];
+ char fname[AIR_STRLEN_SMALL + 1];
sprintf(fname, "hinter-%05u.nrrd", pctx->iter);
if (nrrdSave(fname, pctx->nhinter, NULL)) {
biffMovef(PULL, NRRD, "%s: saving hinter to %s", me, fname);
@@ -335,7 +335,7 @@
int /* Biff: 1 */
pullRun(pullContext *pctx) {
static const char me[] = "pullRun";
- char poutS[AIR_STRLEN_MED];
+ char poutS[AIR_STRLEN_MED + 1];
Nrrd *npos;
double time0, time1, enrLast, enrNew = AIR_NAN, enrDecrease = AIR_NAN,
enrDecreaseAvg = AIR_NAN;
Modified: teem/trunk/src/pull/energy.c
===================================================================
--- teem/trunk/src/pull/energy.c 2023-07-07 21:53:33 UTC (rev 7047)
+++ teem/trunk/src/pull/energy.c 2023-07-08 11:13:40 UTC (rev 7048)
@@ -729,7 +729,7 @@
}
static int
-_pullHestEnergyParse(void *ptr, const char *str, char err[AIR_STRLEN_HUGE]) {
+_pullHestEnergyParse(void *ptr, const char *str, char err[AIR_STRLEN_HUGE + 1]) {
static const char me[] = "_pullHestForceParse";
pullEnergySpec **enspP;
char *perr;
@@ -742,7 +742,7 @@
*enspP = pullEnergySpecNew();
if (pullEnergySpecParse(*enspP, str)) {
perr = biffGetDone(PULL);
- airStrcpy(err, AIR_STRLEN_HUGE, perr);
+ airStrcpy(err, AIR_STRLEN_HUGE + 1, perr);
free(perr);
return 1;
}
Modified: teem/trunk/src/pull/infoPull.c
===================================================================
--- teem/trunk/src/pull/infoPull.c 2023-07-07 21:53:33 UTC (rev 7047)
+++ teem/trunk/src/pull/infoPull.c 2023-07-08 11:13:40 UTC (rev 7048)
@@ -446,11 +446,11 @@
/* HEY this was written in a hurry;
** needs to be checked against parsing code */
int /* Biff: 1 */
-pullInfoSpecSprint(char str[AIR_STRLEN_LARGE], const pullContext *pctx,
+pullInfoSpecSprint(char str[AIR_STRLEN_LARGE + 1], const pullContext *pctx,
const pullInfoSpec *ispec) {
static const char me[] = "pullInfoSpecSprint";
const pullVolume *pvol;
- char stmp[AIR_STRLEN_LARGE];
+ char stmp[AIR_STRLEN_LARGE + 1];
if (!(str && pctx && ispec)) {
biffAddf(PULL, "%s: got NULL pointer", me);
Modified: teem/trunk/src/pull/pointPull.c
===================================================================
--- teem/trunk/src/pull/pointPull.c 2023-07-07 21:53:33 UTC (rev 7047)
+++ teem/trunk/src/pull/pointPull.c 2023-07-08 11:13:40 UTC (rev 7048)
@@ -933,7 +933,7 @@
if (DEBUG) {
Nrrd *nhist;
FILE *fhist;
- char fname[AIR_STRLEN_SMALL];
+ char fname[AIR_STRLEN_SMALL + 1];
nhist = nrrdNew();
if (pullPositionHistoryNrrdGet(nhist, pctx, point)) {
biffAddf(PULL, "%s: trouble", me);
@@ -1063,7 +1063,7 @@
int /* Biff: (private) 1 */
_pullPointSetup(pullContext *pctx) {
static const char me[] = "_pullPointSetup";
- char doneStr[AIR_STRLEN_SMALL];
+ char doneStr[AIR_STRLEN_SMALL + 1];
unsigned int pointIdx, binIdx, tick, pn, initRorHack;
pullPoint *point;
pullBin *bin;
@@ -1297,24 +1297,25 @@
/* Final check: do we have any points? */
pn = pullPointNumber(pctx);
if (!pn) {
- char stmp1[AIR_STRLEN_MED], stmp2[AIR_STRLEN_MED];
+ char stmp[2][AIR_STRLEN_MED + 1];
int guess = AIR_FALSE;
- sprintf(stmp1, "%s: seeded 0 points", me);
+ sprintf(stmp[0], "%s: seeded 0 points", me);
if (pctx->ispec[pullInfoSeedThresh]) {
guess = AIR_TRUE;
- sprintf(stmp2, " (? bad seedthresh %g ?)", pctx->ispec[pullInfoSeedThresh]->zero);
- strcat(stmp1, stmp2);
+ sprintf(stmp[1], " (? bad seedthresh %g ?)",
+ pctx->ispec[pullInfoSeedThresh]->zero);
+ strcat(stmp[0], stmp[1]);
}
if (pctx->flag.nixAtVolumeEdgeSpace) {
guess = AIR_TRUE;
- sprintf(stmp2, " (? flag.nixAtVolumeEdgeSpace true ?)");
- strcat(stmp1, stmp2);
+ sprintf(stmp[1], " (? flag.nixAtVolumeEdgeSpace true ?)");
+ strcat(stmp[0], stmp[1]);
}
if (!guess) {
- sprintf(stmp2, " (no guess as to why)");
- strcat(stmp1, stmp2);
+ sprintf(stmp[1], " (no guess as to why)");
+ strcat(stmp[0], stmp[1]);
}
- biffAddf(PULL, "%s", stmp1);
+ biffAddf(PULL, "%s", stmp[0]);
airMopError(mop);
return 1;
}
Modified: teem/trunk/src/pull/pull.h
===================================================================
--- teem/trunk/src/pull/pull.h 2023-07-07 21:53:33 UTC (rev 7047)
+++ teem/trunk/src/pull/pull.h 2023-07-08 11:13:40 UTC (rev 7048)
@@ -433,7 +433,7 @@
** shape inside the support.
*/
typedef struct {
- char name[AIR_STRLEN_SMALL];
+ char name[AIR_STRLEN_SMALL + 1];
unsigned int parmNum;
double (*well)(double *wx, const double parm[PULL_ENERGY_PARM_NUM]);
double (*eval)(double *denr, double dist, const double parm[PULL_ENERGY_PARM_NUM]);
@@ -1113,7 +1113,7 @@
PULL_EXPORT pullInfoSpec *pullInfoSpecNix(pullInfoSpec *ispec);
PULL_EXPORT int pullInfoSpecAdd(pullContext *pctx, pullInfoSpec *ispec);
PULL_EXPORT int pullInfoGet(Nrrd *ninfo, int info, pullContext *pctx);
-PULL_EXPORT int pullInfoSpecSprint(char str[AIR_STRLEN_LARGE],
+PULL_EXPORT int pullInfoSpecSprint(char str[AIR_STRLEN_LARGE + 1],
const pullContext *pctx,
const pullInfoSpec *ispec);
Modified: teem/trunk/src/pull/trace.c
===================================================================
--- teem/trunk/src/pull/trace.c 2023-07-07 21:53:33 UTC (rev 7047)
+++ teem/trunk/src/pull/trace.c 2023-07-08 11:13:40 UTC (rev 7048)
@@ -1034,12 +1034,12 @@
static int /* Biff: 1 */
traceread(pullTrace *trc, FILE *file, unsigned int _ti) {
static const char me[] = "traceread";
- char line[AIR_STRLEN_MED], name[AIR_STRLEN_MED];
+ char line[AIR_STRLEN_MED + 1], name[AIR_STRLEN_MED + 1];
unsigned int ti, lineLen;
int stops[3], hackhack, vertHN, strnHN, stabHN; /* HN == have nrrd */
sprintf(name, "separator");
- lineLen = airOneLine(file, line, AIR_STRLEN_MED);
+ lineLen = airOneLine(file, line, AIR_STRLEN_MED + 1);
if (!lineLen) {
biffAddf(PULL, "%s: didn't get %s line", me, name);
return 1;
@@ -1053,7 +1053,7 @@
return 1;
}
sprintf(name, "seed pos");
- lineLen = airOneLine(file, line, AIR_STRLEN_MED);
+ lineLen = airOneLine(file, line, AIR_STRLEN_MED + 1);
if (!lineLen) {
biffAddf(PULL, "%s: didn't get %s line", me, name);
return 1;
@@ -1065,7 +1065,7 @@
return 1;
}
sprintf(name, "have nrrds");
- lineLen = airOneLine(file, line, AIR_STRLEN_MED);
+ lineLen = airOneLine(file, line, AIR_STRLEN_MED + 1);
if (!lineLen) {
biffAddf(PULL, "%s: didn't get %s line", me, name);
return 1;
@@ -1082,7 +1082,7 @@
} \
fgetc(file); \
} else { \
- airOneLine(file, line, AIR_STRLEN_MED); \
+ airOneLine(file, line, AIR_STRLEN_MED + 1); \
}
hackhack = nrrdStateVerboseIO; /* should be fixed in Teem v2 */
nrrdStateVerboseIO = 0;
@@ -1092,7 +1092,7 @@
nrrdStateVerboseIO = hackhack;
sprintf(name, "seed idx");
- lineLen = airOneLine(file, line, AIR_STRLEN_MED);
+ lineLen = airOneLine(file, line, AIR_STRLEN_MED + 1);
if (!lineLen) {
biffAddf(PULL, "%s: didn't get %s line", me, name);
return 1;
@@ -1102,7 +1102,7 @@
return 1;
}
sprintf(name, "stops");
- lineLen = airOneLine(file, line, AIR_STRLEN_MED);
+ lineLen = airOneLine(file, line, AIR_STRLEN_MED + 1);
if (!lineLen) {
biffAddf(PULL, "%s: didn't get %s line", me, name);
return 1;
@@ -1118,7 +1118,7 @@
int /* Biff: 1 */
pullTraceMultiRead(pullTraceMulti *mtrc, FILE *file) {
static const char me[] = "pullTraceMultiRead";
- char line[AIR_STRLEN_MED], name[AIR_STRLEN_MED];
+ char line[AIR_STRLEN_MED + 1], name[AIR_STRLEN_MED + 1];
unsigned int lineLen, ti, tnum;
pullTrace *trc;
@@ -1128,7 +1128,7 @@
}
airArrayLenSet(mtrc->traceArr, 0);
sprintf(name, "magic");
- lineLen = airOneLine(file, line, AIR_STRLEN_MED);
+ lineLen = airOneLine(file, line, AIR_STRLEN_MED + 1);
if (!lineLen) {
biffAddf(PULL, "%s: didn't get %s line", me, name);
return 1;
@@ -1140,7 +1140,7 @@
}
sprintf(name, "# of traces");
- lineLen = airOneLine(file, line, AIR_STRLEN_MED);
+ lineLen = airOneLine(file, line, AIR_STRLEN_MED + 1);
if (!lineLen) {
biffAddf(PULL, "%s: didn't get %s line", me, name);
return 1;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|