You can subscribe to this list here.
| 2003 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
(19) |
Nov
(45) |
Dec
(80) |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2004 |
Jan
(58) |
Feb
(127) |
Mar
(74) |
Apr
(34) |
May
(117) |
Jun
(14) |
Jul
(26) |
Aug
(13) |
Sep
(1) |
Oct
(38) |
Nov
(13) |
Dec
(5) |
| 2005 |
Jan
(108) |
Feb
(134) |
Mar
(54) |
Apr
(133) |
May
(16) |
Jun
(54) |
Jul
(128) |
Aug
(99) |
Sep
(157) |
Oct
(182) |
Nov
(236) |
Dec
(212) |
| 2006 |
Jan
(86) |
Feb
(76) |
Mar
(121) |
Apr
(27) |
May
(7) |
Jun
(1) |
Jul
(6) |
Aug
(28) |
Sep
(1) |
Oct
(27) |
Nov
(5) |
Dec
|
| 2007 |
Jan
(32) |
Feb
(22) |
Mar
(22) |
Apr
(11) |
May
(3) |
Jun
(12) |
Jul
(11) |
Aug
(9) |
Sep
(37) |
Oct
(4) |
Nov
(9) |
Dec
(51) |
| 2008 |
Jan
(7) |
Feb
(31) |
Mar
(46) |
Apr
(31) |
May
(5) |
Jun
(27) |
Jul
(12) |
Aug
(5) |
Sep
(13) |
Oct
(24) |
Nov
(112) |
Dec
(15) |
| 2009 |
Jan
(6) |
Feb
(103) |
Mar
(66) |
Apr
(9) |
May
(8) |
Jun
(1) |
Jul
(20) |
Aug
(9) |
Sep
(2) |
Oct
(81) |
Nov
(88) |
Dec
(30) |
| 2010 |
Jan
(65) |
Feb
(57) |
Mar
(22) |
Apr
(12) |
May
(4) |
Jun
(12) |
Jul
(43) |
Aug
(6) |
Sep
(6) |
Oct
(4) |
Nov
(6) |
Dec
(3) |
| 2011 |
Jan
(10) |
Feb
(27) |
Mar
(11) |
Apr
(9) |
May
(69) |
Jun
(73) |
Jul
(67) |
Aug
(116) |
Sep
(40) |
Oct
(11) |
Nov
(34) |
Dec
(19) |
| 2012 |
Jan
|
Feb
(4) |
Mar
(28) |
Apr
(18) |
May
(9) |
Jun
(7) |
Jul
(4) |
Aug
(155) |
Sep
(264) |
Oct
(172) |
Nov
(15) |
Dec
(40) |
| 2013 |
Jan
(1) |
Feb
(2) |
Mar
|
Apr
|
May
|
Jun
(20) |
Jul
(76) |
Aug
(67) |
Sep
(49) |
Oct
(27) |
Nov
(3) |
Dec
(3) |
| 2014 |
Jan
(7) |
Feb
(7) |
Mar
(16) |
Apr
|
May
(4) |
Jun
(1) |
Jul
(18) |
Aug
|
Sep
|
Oct
|
Nov
(1) |
Dec
|
| 2015 |
Jan
(6) |
Feb
(5) |
Mar
(3) |
Apr
(23) |
May
(5) |
Jun
|
Jul
(2) |
Aug
(4) |
Sep
|
Oct
|
Nov
(2) |
Dec
(4) |
| 2016 |
Jan
(2) |
Feb
(7) |
Mar
(2) |
Apr
(1) |
May
(14) |
Jun
(3) |
Jul
|
Aug
(3) |
Sep
|
Oct
|
Nov
(1) |
Dec
(3) |
| 2017 |
Jan
(6) |
Feb
|
Mar
(3) |
Apr
|
May
|
Jun
|
Jul
|
Aug
(12) |
Sep
(6) |
Oct
|
Nov
(3) |
Dec
|
| 2018 |
Jan
(4) |
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
(1) |
Aug
(8) |
Sep
|
Oct
|
Nov
|
Dec
(1) |
| 2019 |
Jan
|
Feb
|
Mar
(4) |
Apr
|
May
|
Jun
|
Jul
|
Aug
(3) |
Sep
(8) |
Oct
|
Nov
(2) |
Dec
(25) |
| 2020 |
Jan
|
Feb
(3) |
Mar
|
Apr
|
May
(1) |
Jun
|
Jul
|
Aug
|
Sep
(3) |
Oct
(53) |
Nov
(33) |
Dec
|
| 2021 |
Jan
(2) |
Feb
|
Mar
|
Apr
|
May
|
Jun
(2) |
Jul
|
Aug
|
Sep
|
Oct
|
Nov
(4) |
Dec
(5) |
| 2022 |
Jan
(1) |
Feb
|
Mar
|
Apr
|
May
|
Jun
(5) |
Jul
(93) |
Aug
(206) |
Sep
(39) |
Oct
(19) |
Nov
(11) |
Dec
|
| 2023 |
Jan
|
Feb
|
Mar
|
Apr
|
May
(2) |
Jun
(150) |
Jul
(124) |
Aug
(14) |
Sep
(5) |
Oct
|
Nov
(1) |
Dec
|
| 2024 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
(12) |
Jul
(62) |
Aug
|
Sep
(7) |
Oct
|
Nov
(7) |
Dec
|
| 2025 |
Jan
|
Feb
|
Mar
|
Apr
(14) |
May
(3) |
Jun
|
Jul
|
Aug
(76) |
Sep
(214) |
Oct
(6) |
Nov
|
Dec
|
|
From: <kin...@us...> - 2023-07-08 14:29:46
|
Revision: 7061
http://sourceforge.net/p/teem/code/7061
Author: kindlmann
Date: 2023-07-08 14:29:44 +0000 (Sat, 08 Jul 2023)
Log Message:
-----------
addressing warning from gcc
Modified Paths:
--------------
teem/trunk/src/pull/pointPull.c
Modified: teem/trunk/src/pull/pointPull.c
===================================================================
--- teem/trunk/src/pull/pointPull.c 2023-07-08 14:13:02 UTC (rev 7060)
+++ teem/trunk/src/pull/pointPull.c 2023-07-08 14:29:44 UTC (rev 7061)
@@ -1297,25 +1297,24 @@
/* Final check: do we have any points? */
pn = pullPointNumber(pctx);
if (!pn) {
- char stmp[2][AIR_STRLEN_MED + 1];
+ char stmp0[AIR_STRLEN_MED + 1], stmp1[AIR_STRLEN_SMALL + 1];
int guess = AIR_FALSE;
- sprintf(stmp[0], "%s: seeded 0 points", me);
+ sprintf(stmp0, "%s: seeded 0 points", me);
if (pctx->ispec[pullInfoSeedThresh]) {
guess = AIR_TRUE;
- sprintf(stmp[1], " (? bad seedthresh %g ?)",
- pctx->ispec[pullInfoSeedThresh]->zero);
- strcat(stmp[0], stmp[1]);
+ sprintf(stmp1, " (? bad seedthresh %g ?)", pctx->ispec[pullInfoSeedThresh]->zero);
+ strcat(stmp0, stmp1);
}
if (pctx->flag.nixAtVolumeEdgeSpace) {
guess = AIR_TRUE;
- sprintf(stmp[1], " (? flag.nixAtVolumeEdgeSpace true ?)");
- strcat(stmp[0], stmp[1]);
+ sprintf(stmp1, " (? flag.nixAtVolumeEdgeSpace true ?)");
+ strcat(stmp0, stmp1);
}
if (!guess) {
- sprintf(stmp[1], " (no guess as to why)");
- strcat(stmp[0], stmp[1]);
+ sprintf(stmp1, " (no guess as to why)");
+ strcat(stmp0, stmp1);
}
- biffAddf(PULL, "%s", stmp[0]);
+ biffAddf(PULL, "%s", stmp0);
airMopError(mop);
return 1;
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <kin...@us...> - 2023-07-08 14:13:05
|
Revision: 7060
http://sourceforge.net/p/teem/code/7060
Author: kindlmann
Date: 2023-07-08 14:13:02 +0000 (Sat, 08 Jul 2023)
Log Message:
-----------
syncing with source
Modified Paths:
--------------
teem/trunk/python/cffi/biffdata/bane.csv
teem/trunk/python/cffi/biffdata/nrrd.csv
teem/trunk/python/cffi/cdef/cdef_air.h
teem/trunk/python/cffi/cdef/cdef_bane.h
teem/trunk/python/cffi/cdef/cdef_coil.h
teem/trunk/python/cffi/cdef/cdef_gage.h
teem/trunk/python/cffi/cdef/cdef_hest.h
teem/trunk/python/cffi/cdef/cdef_meet.h
teem/trunk/python/cffi/cdef/cdef_mite.h
teem/trunk/python/cffi/cdef/cdef_nrrd.h
teem/trunk/python/cffi/cdef/cdef_pull.h
teem/trunk/python/cffi/cdef/cdef_push.h
teem/trunk/python/cffi/cdef/cdef_ten.h
teem/trunk/python/cffi/teem.py
Modified: teem/trunk/python/cffi/biffdata/bane.csv
===================================================================
--- teem/trunk/python/cffi/biffdata/bane.csv 2023-07-08 13:59:39 UTC (rev 7059)
+++ teem/trunk/python/cffi/biffdata/bane.csv 2023-07-08 14:13:02 UTC (rev 7060)
@@ -3,8 +3,8 @@
baneClipAnswer,int,1,0,bane,bane/clip.c:152
baneClipCopy,baneClip *,NULL,0,bane,bane/clip.c:167
baneFindInclusion,int,1,0,bane,bane/hvol.c:87
-baneMakeHVol,int,1,0,bane,bane/hvol.c:249
-baneGKMSHVol,Nrrd *,NULL,0,bane,bane/hvol.c:448
+baneMakeHVol,int,1,0,bane,bane/hvol.c:250
+baneGKMSHVol,Nrrd *,NULL,0,bane,bane/hvol.c:449
baneIncNew,baneInc *,NULL,0,bane,bane/inc.c:251
baneIncAnswer,int,1,0,bane,bane/inc.c:360
baneIncCopy,baneInc *,NULL,0,bane,bane/inc.c:375
Modified: teem/trunk/python/cffi/biffdata/nrrd.csv
===================================================================
--- teem/trunk/python/cffi/biffdata/nrrd.csv 2023-07-08 13:59:39 UTC (rev 7059)
+++ teem/trunk/python/cffi/biffdata/nrrd.csv 2023-07-08 14:13:02 UTC (rev 7060)
@@ -1,14 +1,14 @@
func_name,return_type,error_val(s),mubi,biff_key,filename:linenumber
nrrdArrayCompare,int,1,0,nrrd,nrrd/accessors.c:517
-nrrdApply1DLut,int,1,0,nrrd,nrrd/apply1D.c:433
-nrrdApplyMulti1DLut,int,1,0,nrrd,nrrd/apply1D.c:464
-nrrdApply1DRegMap,int,1,0,nrrd,nrrd/apply1D.c:513
-nrrdApplyMulti1DRegMap,int,1,0,nrrd,nrrd/apply1D.c:544
-nrrd1DIrregMapCheck,int,1,0,nrrd,nrrd/apply1D.c:586
-nrrd1DIrregAclCheck,int,1,0,nrrd,nrrd/apply1D.c:683
-nrrd1DIrregAclGenerate,int,1,0,nrrd,nrrd/apply1D.c:815
-nrrdApply1DIrregMap,int,1,0,nrrd,nrrd/apply1D.c:880
-nrrdApply1DSubstitution,int,1,0,nrrd,nrrd/apply1D.c:1054
+nrrdApply1DLut,int,1,0,nrrd,nrrd/apply1D.c:434
+nrrdApplyMulti1DLut,int,1,0,nrrd,nrrd/apply1D.c:465
+nrrdApply1DRegMap,int,1,0,nrrd,nrrd/apply1D.c:514
+nrrdApplyMulti1DRegMap,int,1,0,nrrd,nrrd/apply1D.c:545
+nrrd1DIrregMapCheck,int,1,0,nrrd,nrrd/apply1D.c:587
+nrrd1DIrregAclCheck,int,1,0,nrrd,nrrd/apply1D.c:684
+nrrd1DIrregAclGenerate,int,1,0,nrrd,nrrd/apply1D.c:816
+nrrdApply1DIrregMap,int,1,0,nrrd,nrrd/apply1D.c:881
+nrrdApply1DSubstitution,int,1,0,nrrd,nrrd/apply1D.c:1055
nrrdApply2DLut,int,1,0,nrrd,nrrd/apply2D.c:297
nrrdArithGamma,int,1,0,nrrd,nrrd/arith.c:50
nrrdArithSRGBGamma,int,1,0,nrrd,nrrd/arith.c:138
Modified: teem/trunk/python/cffi/cdef/cdef_air.h
===================================================================
--- teem/trunk/python/cffi/cdef/cdef_air.h 2023-07-08 13:59:39 UTC (rev 7059)
+++ teem/trunk/python/cffi/cdef/cdef_air.h 2023-07-08 14:13:02 UTC (rev 7060)
@@ -59,25 +59,16 @@
* but in many contexts the implementation complexity of handling them reliably is
* distracts from more urgent implementation goals. In the mean time, these can be used
* safely as long as the lengths are used consistently.
- *
- * The possibly unfortunate convention that has become established in Teem is code using
- * these tends to NOT add the +1 to explicitly indicate the space for 0-termination, and
- * instead assumes it is part of the numbers below, even though this is at the cost of
- * confusion about how the maximal strlen() will be less than each of
- * these numbers. This will be addressed in Teem 2.0.
- *
- * (NOTE: The +1 has been done manually here to assist the modest C parser used in
- * (Python module) cffi's FFI.cdef())
*/
-#define AIR_STRLEN_SMALL 129
+#define AIR_STRLEN_SMALL 128
/* SMALL has to be big enough to hold:
- printed value of size_t and
- ptrdiff_t, line of text that
- should contain file format "magic"
*/
-#define AIR_STRLEN_MED 257
-#define AIR_STRLEN_LARGE 513
-#define AIR_STRLEN_HUGE 1025
+#define AIR_STRLEN_MED 256
+#define AIR_STRLEN_LARGE 512
+#define AIR_STRLEN_HUGE 1024
/* HUGE has to be big enough to hold one line of biff error message */
/*
******** airPtrPtrUnion
@@ -150,7 +141,7 @@
extern char *airEnumFmtDesc(const airEnum *enm, int val, int canon, const char *fmt);
extern void airEnumPrint(FILE *file, const airEnum *enm);
/* ---- BEGIN non-NrrdIO */
-extern int airEnumCheck(char err[AIR_STRLEN_LARGE], const airEnum *enm);
+extern int airEnumCheck(char err[AIR_STRLEN_LARGE + 1], const airEnum *enm);
/* ---- END non-NrrdIO */
/*
******** airEndian enum
@@ -486,7 +477,7 @@
extern const char *const airTeemVersion;
extern const int airTeemReleaseDone;
extern const char *const airTeemReleaseDate;
-extern void airTeemVersionSprint(char buff[AIR_STRLEN_LARGE]);
+extern void airTeemVersionSprint(char buff[AIR_STRLEN_LARGE + 1]);
extern void *airNull(void);
extern void *airSetNull(void **ptrP);
extern void *airFree(void *ptr);
@@ -493,11 +484,11 @@
extern FILE *airFopen(const char *name, FILE *std, const char *mode);
extern FILE *airFclose(FILE *file);
extern int airSinglePrintf(FILE *file, char *str, const char *fmt, ...);
-extern char *airSprintSize_t(char str[AIR_STRLEN_SMALL], size_t val);
+extern char *airSprintSize_t(char str[AIR_STRLEN_SMALL + 1], size_t val);
/* ---- BEGIN non-NrrdIO */
extern char *airSprintVecSize_t(char *str, const size_t *vec, unsigned int len);
-extern char *airPrettySprintSize_t(char str[AIR_STRLEN_SMALL], size_t v);
-extern char *airSprintPtrdiff_t(char str[AIR_STRLEN_SMALL], ptrdiff_t v);
+extern char *airPrettySprintSize_t(char str[AIR_STRLEN_SMALL + 1], size_t v);
+extern char *airSprintPtrdiff_t(char str[AIR_STRLEN_SMALL + 1], ptrdiff_t v);
extern const int airPresent;
extern FILE *airStderr(void);
extern FILE *airStdout(void);
@@ -510,7 +501,7 @@
extern airULLong airIndexClampULL(double min, double val, double max, airULLong N);
extern char *airDoneStr(double start, double here, double end, char *str);
extern double airTime(void);
-extern const char airTypeStr[AIR_TYPE_MAX + 1][AIR_STRLEN_SMALL];
+extern const char airTypeStr[AIR_TYPE_MAX + 1][AIR_STRLEN_SMALL + 1];
extern const size_t airTypeSize[AIR_TYPE_MAX + 1];
extern void airEqvAdd(airArray *eqvArr, unsigned int j, unsigned int k);
extern unsigned int airEqvMap(airArray *eqvArr, unsigned int *map, unsigned int len);
Modified: teem/trunk/python/cffi/cdef/cdef_bane.h
===================================================================
--- teem/trunk/python/cffi/cdef/cdef_bane.h 2023-07-08 13:59:39 UTC (rev 7059)
+++ teem/trunk/python/cffi/cdef/cdef_bane.h 2023-07-08 14:13:02 UTC (rev 7060)
@@ -61,7 +61,7 @@
** things used to operate on ranges
*/
typedef struct {
- char name[AIR_STRLEN_SMALL];
+ char name[AIR_STRLEN_SMALL + 1];
int type;
double center; /* for baneRangeAnywhere: nominal center of value range
NOTE: there is currently no API for setting this,
@@ -112,7 +112,7 @@
** from histNew should be eventually passed to nrrdNuke.
*/
typedef struct baneInc_t {
- char name[AIR_STRLEN_SMALL];
+ char name[AIR_STRLEN_SMALL + 1];
int type;
double S, SS;
int num; /* used for calculating standard dev */
@@ -145,7 +145,7 @@
** things used to calculate and describe clipping
*/
typedef struct {
- char name[AIR_STRLEN_SMALL];
+ char name[AIR_STRLEN_SMALL + 1];
int type;
double parm[BANE_PARM_NUM];
int (*answer)(int *countP, Nrrd *hvol, double *clipParm);
@@ -197,7 +197,7 @@
** things used to calculate and describe measurements
*/
typedef struct baneMeasr_t {
- char name[AIR_STRLEN_SMALL];
+ char name[AIR_STRLEN_SMALL + 1];
int type;
double parm[BANE_PARM_NUM];
gageQuery query; /* the gageScl query needed for this measure,
Modified: teem/trunk/python/cffi/cdef/cdef_coil.h
===================================================================
--- teem/trunk/python/cffi/cdef/cdef_coil.h 2023-07-08 13:59:39 UTC (rev 7059)
+++ teem/trunk/python/cffi/cdef/cdef_coil.h 2023-07-08 14:13:02 UTC (rev 7060)
@@ -69,7 +69,7 @@
** running one method, regardless of kind
*/
typedef struct {
- char name[AIR_STRLEN_SMALL];
+ char name[AIR_STRLEN_SMALL + 1];
int type; /* from coilMethodType* enum */
int numParm; /* number of parameters we need */
} coilMethod;
@@ -98,11 +98,11 @@
** at some point in the future where appropriate.
*/
typedef struct {
- char name[AIR_STRLEN_SMALL]; /* short identifying string for kind */
- unsigned int valLen; /* number of scalars per data point
- 1 for plain scalars (baseDim=0),
- or something else (baseDim=1) */
- /* all the available methods */
+ char name[AIR_STRLEN_SMALL + 1]; /* short identifying string for kind */
+ unsigned int valLen; /* number of scalars per data point
+ 1 for plain scalars (baseDim=0),
+ or something else (baseDim=1) */
+ /* all the available methods */
void (*filter[COIL_METHOD_TYPE_MAX + 1])(coil_t *delta, int xi, int yi, int zi,
coil_t **iv3, double spacing[3],
double parm[COIL_PARMS_NUM]);
Modified: teem/trunk/python/cffi/cdef/cdef_gage.h
===================================================================
--- teem/trunk/python/cffi/cdef/cdef_gage.h 2023-07-08 13:59:39 UTC (rev 7059)
+++ teem/trunk/python/cffi/cdef/cdef_gage.h 2023-07-08 14:13:02 UTC (rev 7060)
@@ -646,7 +646,7 @@
something is actually sprintf'ed into errStr is controlled by
parm.generateErrStr.
NOTE: these variables used to be globals "gageErrStr" and "gageErrNum" */
- char errStr[AIR_STRLEN_LARGE];
+ char errStr[AIR_STRLEN_LARGE + 1];
int errNum; /* takes values from the gageErr enum */
/* what fraction of the values in the kernel support had to be invented
(by bleeding out the margin) in order to satisfy a probe that was near
@@ -714,25 +714,25 @@
** and set everything in a single shot).
*/
typedef struct gageKind_t {
- int dynamicAlloc; /* non-zero if this kind struct was
- dynamically allocated */
- char name[AIR_STRLEN_SMALL]; /* short identifying string for kind */
- const airEnum *enm; /* such as gageScl. NB: the "unknown"
- value in the enum *must* be 0. */
- unsigned int baseDim, /* dimension that x,y,z axes start on
- (e.g. 0 for scalars, 1 for vectors) */
- valLen; /* number of scalars per data point,
- -or- 0 to represent "this value will
- be learned later at runtime" */
- int itemMax; /* such as GAGE_SCL_ITEM_MAX */
- gageItemEntry *table; /* array of gageItemEntry's, indexed
- by the item value,
- -or- NULL if the table cannot be
- statically allocated (not because it
- can come in different sizes, but
- because it needs to be a modified
- version of the compile-time table */
- void (*iv3Print)(FILE *, /* such as _gageSclIv3Print() */
+ int dynamicAlloc; /* non-zero if this kind struct was
+ dynamically allocated */
+ char name[AIR_STRLEN_SMALL + 1]; /* short identifying string for kind */
+ const airEnum *enm; /* such as gageScl. NB: the "unknown"
+ value in the enum *must* be 0. */
+ unsigned int baseDim, /* dimension that x,y,z axes start on
+ (e.g. 0 for scalars, 1 for vectors) */
+ valLen; /* number of scalars per data point,
+ -or- 0 to represent "this value will
+ be learned later at runtime" */
+ int itemMax; /* such as GAGE_SCL_ITEM_MAX */
+ gageItemEntry *table; /* array of gageItemEntry's, indexed
+ by the item value,
+ -or- NULL if the table cannot be
+ statically allocated (not because it
+ can come in different sizes, but
+ because it needs to be a modified
+ version of the compile-time table */
+ void (*iv3Print)(FILE *, /* such as _gageSclIv3Print() */
gageContext *,
gagePerVolume *),
(*filter)(gageContext *, /* such as _gageSclFilter() */
@@ -1053,7 +1053,7 @@
const gageStackBlurParm *sbpB,
const char *nameB,
int *differ,
- char explain[AIR_STRLEN_LARGE]);
+ char explain[AIR_STRLEN_LARGE + 1]);
extern int gageStackBlurParmScaleSet(gageStackBlurParm *sbp, unsigned int num,
double sigmaMin, double sigmaMax,
int uniformSigma, int optimalL2L2);
@@ -1080,7 +1080,7 @@
char **extraParmsP,
const char *str);
extern const hestCB *const gageHestStackBlurParm;
-extern int gageStackBlurParmSprint(char str[AIR_STRLEN_LARGE],
+extern int gageStackBlurParmSprint(char str[AIR_STRLEN_LARGE + 1],
const gageStackBlurParm *sbp,
int extraFlag[256],
char *extraParm);
Modified: teem/trunk/python/cffi/cdef/cdef_hest.h
===================================================================
--- teem/trunk/python/cffi/cdef/cdef_hest.h 2023-07-08 13:59:39 UTC (rev 7059)
+++ teem/trunk/python/cffi/cdef/cdef_hest.h 2023-07-08 14:13:02 UTC (rev 7060)
@@ -48,7 +48,7 @@
typedef struct {
size_t size; /* sizeof() one thing */
const char *type; /* used by hestGlossary() to describe the type */
- int (*parse)(void *ptr, const char *str, char err[AIR_STRLEN_HUGE]);
+ int (*parse)(void *ptr, const char *str, char err[AIR_STRLEN_HUGE + 1]);
/* how to parse one thing from a string. This will be called multiple times for
multiple parameter options. A non-zero return value is considered an error. Error
message goes in the err string */
@@ -61,9 +61,13 @@
/*
******** hestOpt struct
**
-** information which specifies one command-line option
+** information which specifies one command-line option,
+** and describes it how it was parsed
*/
typedef struct {
+ /* --------------------- "input" fields
+ set by user, possibly directly, more likely indirectly via one of the various
+ functions (like hestOptAdd or hestOptAdd_nva or hestOptSingleSet ... ) */
char *flag, /* how the option is identified on the cmd line */
*name; /* simple description of option's parameter(s) */
int type; /* type of option (from airType enum) */
@@ -75,21 +79,25 @@
*info; /* description to be printed with "glossary" info */
unsigned int *sawP; /* used ONLY for multiple variable parameter options
(min < max >= 2): storage of # of parsed values */
- airEnum *enm; /* used ONLY for airTypeEnum options */
- hestCB *CB; /* used ONLY for airTypeOther options */
- /* --------------------- end of user-defined fields; the following fields must be set
- by hestParse() as part of its operation. This does prevent adding const to much
- usage of the hestOpt */
- int kind, /* what kind of option is this, based on min and max,set by hestParse()
- (actually _hestPanic()), later used by hestFree():
+ const airEnum *enm; /* used ONLY for airTypeEnum options */
+ const hestCB *CB; /* used ONLY for airTypeOther options */
+ /* --------------------- end of user-defined fields
+ These are set by hest functions to remember state for the sake of other hest functions.
+ It is probably a drawback of the simple design of hest that this internal state ends
+ up in the same struct as the input parameters above, because it blocks some
+ const-correctness opportunities that would otherwise make sense. */
+ int kind, /* What kind of option is this, based on min and max:
+ 0: (invalid; unset)
1: min == max == 0 stand-alone flag; no parameters
2: min == max == 1 single fixed parameter
3: min == max >= 2 multiple fixed parameters
4: min == 0; max == 1; single variable parameter
- 5: min < max; max >= 2 multiple variable parameters */
- alloc; /* information about whether flag is non-NULL, and what parameters were used,
- that determines whether or not memory was allocated by hestParse(); info
- later used by hestParseFree():
+ 5: min < max; max >= 2 multiple variable parameters
+ This is set by hest functions as part of building up an array of hestOpt,
+ and informs the later action of hestOptFree */
+ alloc; /* Information (set by hestParse) about whether flag is non-NULL, and what
+ parameters were used, that determines whether or not memory was allocated
+ by hestParse(). Informs later action of hestParseFree():
0: no free()ing needed
1: free(*valueP), either because it is a single string, or because was a
dynamically allocated array of non-strings
@@ -97,16 +105,38 @@
array of strings
3: free((*valueP)[i]) and free(*valueP), because it is a dynamically
allocated array of strings */
- /* --------------------- Output */
+ /* Since hest's beginning, the basic container for a set of options was an array of
+ hestOpt structs (not pointers to them, which rules out argv-style NULL-termination of
+ the array), also unfortunately with no other top-level container (which is why
+ helpWanted below is set only in the first hestOpt of the array). hestOptAdd has
+ historically reallocated the entire array, incrementing the length only by one with
+ each call, while maintaining a single terminating hestOpt, wherein some fields were set
+ to special values to indicate termination. With the 2023 code revisit, that was deemed
+ even uglier than this hack: the first hestOpt now stores here in arrAlloc the allocated
+ length of the hestOpt array, and in arrLen the number of hestOpts actually used and
+ set. This facilitates implementing something much like an airArray, but without the
+ burden of extra calls for the user (like airArrayLenIncr), nor new kinds of containers
+ for hest and its users to manage: just same same array of hestOpt structs */
+ unsigned int arrAlloc, arrLen;
+ /* --------------------- Output
+ Things set/allocated by hestParse. */
int source; /* from the hestSource* enum; from whence was this information learned,
- else hestSourceUnknown if not */
+ else hestSourceUnknown if not */
+ char *parmStr; /* if non-NULL: a string (freed by hestParseFree) from which hestParse
+ ultimately parsed whatever values were set in *valueP. All the
+ parameters associated with this option are joined (with " " separation)
+ into this single string. hestParse has always formed this string
+ internally as part of its operation, but only belatedly (in 2023) is a
+ copy of that string being made available here to the caller. Note that
+ in the case of single variable parameter options used without a
+ parameter, the value stored will be "inverted" from the string here. */
int helpWanted; /* hestParse() saw something (like "--help") in one of the given
- arguments that looks like a call for help (and respectDashDashHelp
- is set in the hestParm), so it recorded that here. There is
- unfortunately no other top-level output container for info generated
- by hestParse(), so this field is going to be set only in the *first*
- hestOpt passed to hestParse(), even though that hestOpt has no
- particular relation to where hestParse() saw the call for help. */
+ arguments that looks like a call for help (and respectDashDashHelp is
+ set in the hestParm), so it recorded that here. There is unfortunately
+ no other top-level output container for info generated by hestParse(),
+ so this field is going to be set only in the *first* hestOpt passed to
+ hestParse(), even though that hestOpt has no particular relation to
+ where hestParse() saw the call for help. */
} hestOpt;
/*
******** hestParm struct
@@ -152,10 +182,12 @@
char respFileFlag, /* the character at the beginning of an argument
indicating that this is a response file name */
respFileComment, /* comment character for the response files */
- varParamStopFlag, /* prefixed by '-' to form the flag which signals the end of a
- variable parameter option (single or multiple), flagged or
- unflagged. Originally imagined as most useful for flagged
- options, but also works in unflagged. */
+ varParamStopFlag, /* prefixed by '-' to form the flag (usually "--") that signals the
+ end of a *flagged* variable parameter option (single or
+ multiple). This is important to use if there is a flagged
+ variable parameter option preceeding an unflagged variable
+ parameter option, because otherwise how will you know where the
+ first stops and the second begins */
multiFlagSep; /* character in flag which signifies that there is a long and short
version, and which separates the two. Or, can be set to '\0' to
disable this behavior entirely. */
@@ -183,6 +215,15 @@
extern hestParm *hestParmNew(void);
extern hestParm *hestParmFree(hestParm *parm);
extern void *hestParmFree_vp(void *parm);
+extern void hestOptSingleSet(hestOpt *opt, const char *flag, const char *name,
+ int type, int min, int max, void *valueP,
+ const char *dflt, const char *info, unsigned int *sawP,
+ const airEnum *enm, const hestCB *CB);
+extern unsigned int hestOptAdd_nva(hestOpt **optP, const char *flag,
+ const char *name, int type, int min, int max,
+ void *valueP, const char *dflt, const char *info,
+ unsigned int *sawP, const airEnum *enm,
+ const hestCB *CB);
extern unsigned int hestOptAdd(hestOpt **optP,
const char *flag, const char *name,
int type, int min, int max,
@@ -189,8 +230,10 @@
void *valueP, const char *dflt,
const char *info,
... /* unsigned int *sawP,
- airEnum *enm,
+ const airEnum *enm,
const hestCB *CB */);
+/* see also all the special-purpose and type-checked versions in adders.c, below */
+extern unsigned int hestOptNum(const hestOpt *opt);
extern hestOpt *hestOptFree(hestOpt *opt);
extern void *hestOptFree_vp(void *opt);
extern int hestOptCheck(hestOpt *opt, char **errP);
@@ -210,3 +253,44 @@
extern void hestGlossary(FILE *file, hestOpt *opt, const hestParm *parm);
extern void hestInfo(FILE *file, const char *argv0, const char *info,
const hestParm *parm);
+/* adders.c */
+extern unsigned int hestOptAdd_Flag(hestOpt **optP, const char *flag, int *valueP,
+ const char *info);
+extern unsigned int hestOptAdd_1_Bool(hestOpt **optP, const char *flag,
+ const char *name, int *valueP, int dflt,
+ const char *info);
+extern unsigned int hestOptAdd_1_Int(hestOpt **optP, const char *flag,
+ const char *name, int *valueP, int dflt,
+ const char *info);
+extern unsigned int hestOptAdd_1_UInt(hestOpt **optP, const char *flag,
+ const char *name, unsigned int *valueP,
+ unsigned int dflt, const char *info);
+extern unsigned int hestOptAdd_1_LongInt(hestOpt **optP, const char *flag,
+ const char *name, long int *valueP,
+ long int dflt, const char *info);
+extern unsigned int hestOptAdd_1_ULongInt(hestOpt **optP, const char *flag,
+ const char *name,
+ unsigned long int *valueP,
+ unsigned long int dflt, const char *info);
+extern unsigned int hestOptAdd_1_Size_t(hestOpt **optP, const char *flag,
+ const char *name, size_t *valueP,
+ size_t dflt, const char *info);
+extern unsigned int hestOptAdd_1_Float(hestOpt **optP, const char *flag,
+ const char *name, float *valueP, float dflt,
+ const char *info);
+extern unsigned int hestOptAdd_1_Double(hestOpt **optP, const char *flag,
+ const char *name, double *valueP,
+ double dflt, const char *info);
+extern unsigned int hestOptAdd_1_Char(hestOpt **optP, const char *flag,
+ const char *name, char *valueP, char dflt,
+ const char *info);
+extern unsigned int hestOptAdd_1_String(hestOpt **optP, const char *flag,
+ const char *name, char **valueP,
+ const char *dflt, const char *info);
+extern unsigned int hestOptAdd_1_Enum(hestOpt **optP, const char *flag,
+ const char *name, int *valueP, int dflt,
+ const char *info, const airEnum *enm);
+extern unsigned int hestOptAdd_1_Other(hestOpt **optP, const char *flag,
+ const char *name, void *valueP,
+ const char *dflt, const char *info,
+ const hestCB *CB);
Modified: teem/trunk/python/cffi/cdef/cdef_meet.h
===================================================================
--- teem/trunk/python/cffi/cdef/cdef_meet.h 2023-07-08 13:59:39 UTC (rev 7059)
+++ teem/trunk/python/cffi/cdef/cdef_meet.h 2023-07-08 14:13:02 UTC (rev 7060)
@@ -105,7 +105,7 @@
extern int meetPullVolLeechable(const meetPullVol *lchr,
const meetPullVol *orig,
int *can,
- char explain[AIR_STRLEN_HUGE]);
+ char explain[AIR_STRLEN_HUGE + 1]);
extern meetPullVol *meetPullVolNix(meetPullVol *pvol);
extern const hestCB *const meetHestPullVol;
extern int meetPullVolStackBlurParmFinishMulti(meetPullVol **mpv,
Modified: teem/trunk/python/cffi/cdef/cdef_mite.h
===================================================================
--- teem/trunk/python/cffi/cdef/cdef_mite.h 2023-07-08 13:59:39 UTC (rev 7059)
+++ teem/trunk/python/cffi/cdef/cdef_mite.h 2023-07-08 14:13:02 UTC (rev 7060)
@@ -108,8 +108,8 @@
specification, its up to them to verify that the normalStr and the
shadeStr refer to the same vector.
*/
- char shadeStr[AIR_STRLEN_MED], /* how to do shading */
- normalStr[AIR_STRLEN_MED]; /* what is the "surface normal" */
+ char shadeStr[AIR_STRLEN_MED + 1], /* how to do shading */
+ normalStr[AIR_STRLEN_MED + 1]; /* what is the "surface normal" */
/* for each possible element of the txf range, what value should it
start at prior to rendering. Mainly needed to store non-unity values
for the quantities not covered by a transfer function */
Modified: teem/trunk/python/cffi/cdef/cdef_nrrd.h
===================================================================
--- teem/trunk/python/cffi/cdef/cdef_nrrd.h 2023-07-08 13:59:39 UTC (rev 7059)
+++ teem/trunk/python/cffi/cdef/cdef_nrrd.h 2023-07-08 14:13:02 UTC (rev 7060)
@@ -959,12 +959,12 @@
** All information and behavior relevent to one datafile format
*/
typedef struct {
- char name[AIR_STRLEN_SMALL]; /* short identifying string */
- int isImage, /* this format is intended solely for "2D" images, which
- controls the invocation of nrrdAxesInsert()
- if nrrdStateGrayscaleImage3D */
- readable, /* we can read as well as write this format */
- usesDIO; /* this format can use Direct IO */
+ char name[AIR_STRLEN_SMALL + 1]; /* short identifying string */
+ int isImage, /* this format is intended solely for "2D" images, which
+ controls the invocation of nrrdAxesInsert()
+ if nrrdStateGrayscaleImage3D */
+ readable, /* we can read as well as write this format */
+ usesDIO; /* this format can use Direct IO */
/* tests if this format is currently available in this build */
int (*available)(void);
/* (for writing) returns non-zero if a given filename could likely be
@@ -989,8 +989,8 @@
** This is necessitated by the memory restrictions of direct I/O
*/
typedef struct NrrdEncoding_t {
- char name[AIR_STRLEN_SMALL], /* short identifying string */
- suffix[AIR_STRLEN_SMALL]; /* costumary filename suffix */
+ char name[AIR_STRLEN_SMALL + 1], /* short identifying string */
+ suffix[AIR_STRLEN_SMALL + 1]; /* customary filename suffix */
int endianMatters, isCompression;
int (*available)(void);
/* The "data" and "elementNum" values have to be passed explicitly
@@ -1218,7 +1218,7 @@
typedef struct {
/* terse string representation of kernel function, irrespective of
the parameter vector */
- char name[AIR_STRLEN_SMALL];
+ char name[AIR_STRLEN_SMALL + 1];
/* number of parameters needed (# elements in parm[] used) */
unsigned int numParm; /* HEY: should be "parmNum" in standard convention */
/* smallest x (x > 0) such that k(y) = 0 for all y > x, y < -x */
@@ -1490,7 +1490,7 @@
/* ---- END non-NrrdIO */
/******** arrays of things (poor-man's functions/predicates) */
/* arraysNrrd.c */
-extern const char nrrdTypePrintfStr[NRRD_TYPE_MAX + 1][AIR_STRLEN_SMALL];
+extern const char nrrdTypePrintfStr[NRRD_TYPE_MAX + 1][AIR_STRLEN_SMALL + 1];
extern const size_t nrrdTypeSize[NRRD_TYPE_MAX + 1];
extern const double nrrdTypeMin[NRRD_TYPE_MAX + 1];
extern const double nrrdTypeMax[NRRD_TYPE_MAX + 1];
@@ -1505,12 +1505,12 @@
extern NrrdBoundarySpec *nrrdBoundarySpecCopy(const NrrdBoundarySpec *bsp);
extern int nrrdBoundarySpecCheck(const NrrdBoundarySpec *bspec);
extern int nrrdBoundarySpecParse(NrrdBoundarySpec *bspec, const char *str);
-extern int nrrdBoundarySpecSprint(char str[AIR_STRLEN_LARGE],
+extern int nrrdBoundarySpecSprint(char str[AIR_STRLEN_LARGE + 1],
const NrrdBoundarySpec *bspec);
extern int nrrdBoundarySpecCompare(const NrrdBoundarySpec *bspecA,
const NrrdBoundarySpec *bspecB,
int *differ,
- char explain[AIR_STRLEN_LARGE]);
+ char explain[AIR_STRLEN_LARGE + 1]);
/* ---- END non-NrrdIO */
extern NrrdIoState *nrrdIoStateNew(void);
extern void nrrdIoStateInit(NrrdIoState *nio);
@@ -1549,7 +1549,8 @@
... /* size_t sx, sy, .., ax(dim-1) size */);
/* ---- BEGIN non-NrrdIO */
extern int nrrdCompare(const Nrrd *ninA, const Nrrd *ninB, int onlyData,
- double epsilon, int *differ, char explain[AIR_STRLEN_LARGE]);
+ double epsilon, int *differ,
+ char explain[AIR_STRLEN_LARGE + 1]);
extern int nrrdPPM(Nrrd *, size_t sx, size_t sy);
extern int nrrdPGM(Nrrd *, size_t sx, size_t sy);
/* ---- END non-NrrdIO */
@@ -1575,7 +1576,7 @@
extern int nrrdAxisInfoCompare(const NrrdAxisInfo *axisA,
const NrrdAxisInfo *axisB,
int *differ,
- char explain[AIR_STRLEN_LARGE]);
+ char explain[AIR_STRLEN_LARGE + 1]);
/* ---- END non-NrrdIO */
extern unsigned int nrrdDomainAxesGet(const Nrrd *nrrd,
unsigned int axisIdx[NRRD_DIM_MAX]);
@@ -1751,7 +1752,7 @@
const void *);
extern int nrrdArrayCompare(int type, const void *valA, const void *valB,
size_t valNum, double epsilon, int *differ,
- char explain[AIR_STRLEN_LARGE]);
+ char explain[AIR_STRLEN_LARGE + 1]);
/* ---- END non-NrrdIO */
/******** permuting, shuffling, and all flavors of reshaping */
/* reorder.c */
@@ -2190,9 +2191,9 @@
double *parm,
const char *str);
extern int nrrdKernelSpecParse(NrrdKernelSpec *ksp, const char *str);
-extern int nrrdKernelSpecSprint(char str[AIR_STRLEN_LARGE],
+extern int nrrdKernelSpecSprint(char str[AIR_STRLEN_LARGE + 1],
const NrrdKernelSpec *ksp);
-extern int nrrdKernelSprint(char str[AIR_STRLEN_LARGE],
+extern int nrrdKernelSprint(char str[AIR_STRLEN_LARGE + 1],
const NrrdKernel *kernel,
const double kparm[NRRD_KERNEL_PARMS_NUM]);
extern int nrrdKernelCompare(const NrrdKernel *kernA,
@@ -2200,11 +2201,11 @@
const NrrdKernel *kernB,
const double parmB[NRRD_KERNEL_PARMS_NUM],
int *differ,
- char explain[AIR_STRLEN_LARGE]);
+ char explain[AIR_STRLEN_LARGE + 1]);
extern int nrrdKernelSpecCompare(const NrrdKernelSpec *aa,
const NrrdKernelSpec *bb,
int *differ,
- char explain[AIR_STRLEN_LARGE]);
+ char explain[AIR_STRLEN_LARGE + 1]);
extern int nrrdKernelCheck(const NrrdKernel *kern,
const double parm[NRRD_KERNEL_PARMS_NUM], size_t evalNum,
double epsilon, unsigned int diffOkEvalMax,
Modified: teem/trunk/python/cffi/cdef/cdef_pull.h
===================================================================
--- teem/trunk/python/cffi/cdef/cdef_pull.h 2023-07-08 13:59:39 UTC (rev 7059)
+++ teem/trunk/python/cffi/cdef/cdef_pull.h 2023-07-08 14:13:02 UTC (rev 7060)
@@ -371,7 +371,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]);
@@ -973,7 +973,7 @@
extern pullInfoSpec *pullInfoSpecNix(pullInfoSpec *ispec);
extern int pullInfoSpecAdd(pullContext *pctx, pullInfoSpec *ispec);
extern int pullInfoGet(Nrrd *ninfo, int info, pullContext *pctx);
-extern int pullInfoSpecSprint(char str[AIR_STRLEN_LARGE],
+extern int pullInfoSpecSprint(char str[AIR_STRLEN_LARGE + 1],
const pullContext *pctx,
const pullInfoSpec *ispec);
/* contextPull.c */
Modified: teem/trunk/python/cffi/cdef/cdef_push.h
===================================================================
--- teem/trunk/python/cffi/cdef/cdef_push.h 2023-07-08 13:59:39 UTC (rev 7059)
+++ teem/trunk/python/cffi/cdef/cdef_push.h 2023-07-08 14:13:02 UTC (rev 7060)
@@ -105,7 +105,7 @@
** non-NULL pointers into which to store energy and force
*/
typedef struct {
- char name[AIR_STRLEN_SMALL];
+ char name[AIR_STRLEN_SMALL + 1];
unsigned int parmNum;
void (*eval)(double *energy, double *force, double dist,
const double parm[PUSH_ENERGY_PARM_NUM]);
Modified: teem/trunk/python/cffi/cdef/cdef_ten.h
===================================================================
--- teem/trunk/python/cffi/cdef/cdef_ten.h 2023-07-08 13:59:39 UTC (rev 7059)
+++ teem/trunk/python/cffi/cdef/cdef_ten.h 2023-07-08 14:13:02 UTC (rev 7060)
@@ -1033,13 +1033,13 @@
/* description of *one* parameter in the parameter vector that
defines one instance of a given model */
typedef struct {
- char name[AIR_STRLEN_SMALL]; /* name */
- double min, max; /* bounds */
- int cyclic; /* non-zero if effectively min == max */
- int vec3; /* non-zero if this is a coefficient
- of a UNIT-LENGTH 3-vector */
- unsigned int vecIdx; /* *if* this param is part of vector,
- the index into it, i.e. 0, 1, or 2 */
+ char name[AIR_STRLEN_SMALL + 1]; /* name */
+ double min, max; /* bounds */
+ int cyclic; /* non-zero if effectively min == max */
+ int vec3; /* non-zero if this is a coefficient
+ of a UNIT-LENGTH 3-vector */
+ unsigned int vecIdx; /* *if* this param is part of vector,
+ the index into it, i.e. 0, 1, or 2 */
} tenModelParmDesc;
/*
******** struct tenModel
@@ -1067,13 +1067,13 @@
** The "parmNum" field below therefore always includes the B0 value
*/
typedef struct tenModel_t {
- char name[AIR_STRLEN_SMALL];
+ char name[AIR_STRLEN_SMALL + 1];
unsigned int parmNum;
const tenModelParmDesc *parmDesc;
/* noise free simulation */
void (*simulate)(double *dwiSim, const double *parm, const tenExperSpec *espec);
/* parameter vector operations */
- char *(*sprint)(char str[AIR_STRLEN_MED], const double *parm);
+ char *(*sprint)(char str[AIR_STRLEN_MED + 1], const double *parm);
double *(*alloc)(void);
void (*rand)(double *parm, airRandMTState *rng, int knownB0);
void (*step)(double *parm1, const double scl, const double *grad, const double *parm0);
Modified: teem/trunk/python/cffi/teem.py
===================================================================
--- teem/trunk/python/cffi/teem.py 2023-07-08 13:59:39 UTC (rev 7059)
+++ teem/trunk/python/cffi/teem.py 2023-07-08 14:13:02 UTC (rev 7060)
@@ -123,15 +123,15 @@
_BIFF_DICT = { # contents here are filled in by teem/python/cffi/exult.py Tffi.wrap()
'nrrdArrayCompare': (_equals_one, 0, b'nrrd', 'nrrd/accessors.c:517'),
- 'nrrdApply1DLut': (_equals_one, 0, b'nrrd', 'nrrd/apply1D.c:433'),
- 'nrrdApplyMulti1DLut': (_equals_one, 0, b'nrrd', 'nrrd/apply1D.c:464'),
- 'nrrdApply1DRegMap': (_equals_one, 0, b'nrrd', 'nrrd/apply1D.c:513'),
- 'nrrdApplyMulti1DRegMap': (_equals_one, 0, b'nrrd', 'nrrd/apply1D.c:544'),
- 'nrrd1DIrregMapCheck': (_equals_one, 0, b'nrrd', 'nrrd/apply1D.c:586'),
- 'nrrd1DIrregAclCheck': (_equals_one, 0, b'nrrd', 'nrrd/apply1D.c:683'),
- 'nrrd1DIrregAclGenerate': (_equals_one, 0, b'nrrd', 'nrrd/apply1D.c:815'),
- 'nrrdApply1DIrregMap': (_equals_one, 0, b'nrrd', 'nrrd/apply1D.c:880'),
- 'nrrdApply1DSubstitution': (_equals_one, 0, b'nrrd', 'nrrd/apply1D.c:1054'),
+ 'nrrdApply1DLut': (_equals_one, 0, b'nrrd', 'nrrd/apply1D.c:434'),
+ 'nrrdApplyMulti1DLut': (_equals_one, 0, b'nrrd', 'nrrd/apply1D.c:465'),
+ 'nrrdApply1DRegMap': (_equals_one, 0, b'nrrd', 'nrrd/apply1D.c:514'),
+ 'nrrdApplyMulti1DRegMap': (_equals_one, 0, b'nrrd', 'nrrd/apply1D.c:545'),
+ 'nrrd1DIrregMapCheck': (_equals_one, 0, b'nrrd', 'nrrd/apply1D.c:587'),
+ 'nrrd1DIrregAclCheck': (_equals_one, 0, b'nrrd', 'nrrd/apply1D.c:684'),
+ 'nrrd1DIrregAclGenerate': (_equals_one, 0, b'nrrd', 'nrrd/apply1D.c:816'),
+ 'nrrdApply1DIrregMap': (_equals_one, 0, b'nrrd', 'nrrd/apply1D.c:881'),
+ 'nrrdApply1DSubstitution': (_equals_one, 0, b'nrrd', 'nrrd/apply1D.c:1055'),
'nrrdApply2DLut': (_equals_one, 0, b'nrrd', 'nrrd/apply2D.c:297'),
'nrrdArithGamma': (_equals_one, 0, b'nrrd', 'nrrd/arith.c:50'),
'nrrdArithSRGBGamma': (_equals_one, 0, b'nrrd', 'nrrd/arith.c:138'),
@@ -351,8 +351,8 @@
'baneClipAnswer': (_equals_one, 0, b'bane', 'bane/clip.c:152'),
'baneClipCopy': (_equals_null, 0, b'bane', 'bane/clip.c:167'),
'baneFindInclusion': (_equals_one, 0, b'bane', 'bane/hvol.c:87'),
- 'baneMakeHVol': (_equals_one, 0, b'bane', 'bane/hvol.c:249'),
- 'baneGKMSHVol': (_equals_null, 0, b'bane', 'bane/hvol.c:448'),
+ 'baneMakeHVol': (_equals_one, 0, b'bane', 'bane/hvol.c:250'),
+ 'baneGKMSHVol': (_equals_null, 0, b'bane', 'bane/hvol.c:449'),
'baneIncNew': (_equals_null, 0, b'bane', 'bane/inc.c:251'),
'baneIncAnswer': (_equals_one, 0, b'bane', 'bane/inc.c:360'),
'baneIncCopy': (_equals_null, 0, b'bane', 'bane/inc.c:375'),
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <kin...@us...> - 2023-07-08 13:59:41
|
Revision: 7059
http://sourceforge.net/p/teem/code/7059
Author: kindlmann
Date: 2023-07-08 13:59:39 +0000 (Sat, 08 Jul 2023)
Log Message:
-----------
now done, with hestOpt->parmStr
Modified Paths:
--------------
teem/trunk/src/TODO.txt
Modified: teem/trunk/src/TODO.txt
===================================================================
--- teem/trunk/src/TODO.txt 2023-07-08 12:30:58 UTC (rev 7058)
+++ teem/trunk/src/TODO.txt 2023-07-08 13:59:39 UTC (rev 7059)
@@ -103,9 +103,6 @@
optional parameters is why things like "unu make" learn centerings via
strings: the string can be given or not, and if its given, then the
information is used.
-******* There's no way to access the string that was parsed to get the
-information for an option (could be from default, or command-line,
-or response file)
******* (from tendGlyph.c): there needs to be an alternative API for hest
that is not var-args based (as is hestOptAdd). You can't tell when
you've passed multiple strings for the detailed usage information by
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <kin...@us...> - 2023-07-08 12:31:07
|
Revision: 7058
http://sourceforge.net/p/teem/code/7058
Author: kindlmann
Date: 2023-07-08 12:30:58 +0000 (Sat, 08 Jul 2023)
Log Message:
-----------
fixing sloppy propagation of AIR_STRLEN --> AIR_STRLEN+1
Modified Paths:
--------------
teem/trunk/src/ten/miscTen.c
Modified: teem/trunk/src/ten/miscTen.c
===================================================================
--- teem/trunk/src/ten/miscTen.c 2023-07-08 12:25:44 UTC (rev 7057)
+++ teem/trunk/src/ten/miscTen.c 2023-07-08 12:30:58 UTC (rev 7058)
@@ -233,7 +233,7 @@
return 1;
}
if (!(minnum <= nbmat->axis[1].size)) {
- char stmp[AIR_STRLEN_SMALL];
+ char stmp[AIR_STRLEN_SMALL + 1];
biffAddf(TEN, "%s: have only %s B-matrices, need at least %d", me,
airSprintSize_t(stmp, nbmat->axis[1].size), minnum);
return 1;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <kin...@us...> - 2023-07-08 12:25:46
|
Revision: 7057
http://sourceforge.net/p/teem/code/7057
Author: kindlmann
Date: 2023-07-08 12:25:44 +0000 (Sat, 08 Jul 2023)
Log Message:
-----------
Propagating AIR_STRLEN --> AIR_STRLEN+1 with API CHANGES to structs:
baneRange:
char name[AIR_STRLEN_SMALL + 1];
baneInc:
char name[AIR_STRLEN_SMALL + 1];
baneClip:
char name[AIR_STRLEN_SMALL + 1];
baneMeasr:
char name[AIR_STRLEN_SMALL + 1];
Modified Paths:
--------------
teem/trunk/src/bane/bane.h
teem/trunk/src/bane/gkmsFlotsam.c
teem/trunk/src/bane/hvol.c
teem/trunk/src/bane/trex.c
teem/trunk/src/bane/valid.c
Modified: teem/trunk/src/bane/bane.h
===================================================================
--- teem/trunk/src/bane/bane.h 2023-07-08 12:18:19 UTC (rev 7056)
+++ teem/trunk/src/bane/bane.h 2023-07-08 12:25:44 UTC (rev 7057)
@@ -92,7 +92,7 @@
** things used to operate on ranges
*/
typedef struct {
- char name[AIR_STRLEN_SMALL];
+ char name[AIR_STRLEN_SMALL + 1];
int type;
double center; /* for baneRangeAnywhere: nominal center of value range
NOTE: there is currently no API for setting this,
@@ -146,7 +146,7 @@
** from histNew should be eventually passed to nrrdNuke.
*/
typedef struct baneInc_t {
- char name[AIR_STRLEN_SMALL];
+ char name[AIR_STRLEN_SMALL + 1];
int type;
double S, SS;
int num; /* used for calculating standard dev */
@@ -182,7 +182,7 @@
** things used to calculate and describe clipping
*/
typedef struct {
- char name[AIR_STRLEN_SMALL];
+ char name[AIR_STRLEN_SMALL + 1];
int type;
double parm[BANE_PARM_NUM];
int (*answer)(int *countP, Nrrd *hvol, double *clipParm);
@@ -237,7 +237,7 @@
** things used to calculate and describe measurements
*/
typedef struct baneMeasr_t {
- char name[AIR_STRLEN_SMALL];
+ char name[AIR_STRLEN_SMALL + 1];
int type;
double parm[BANE_PARM_NUM];
gageQuery query; /* the gageScl query needed for this measure,
Modified: teem/trunk/src/bane/gkmsFlotsam.c
===================================================================
--- teem/trunk/src/bane/gkmsFlotsam.c 2023-07-08 12:18:19 UTC (rev 7056)
+++ teem/trunk/src/bane/gkmsFlotsam.c 2023-07-08 12:25:44 UTC (rev 7057)
@@ -33,7 +33,7 @@
** inc[1], inc[2] ... : incParm[0], incParm[1] ...
*/
static int
-baneGkmsParseIncStrategy(void *ptr, const char *str, char err[AIR_STRLEN_HUGE]) {
+baneGkmsParseIncStrategy(void *ptr, const char *str, char err[AIR_STRLEN_HUGE + 1]) {
static const char me[] = "baneGkmsParseIncStrategy";
double *inc, *incParm;
int i, bins;
@@ -90,9 +90,9 @@
/* ----------------------------------------------------------- */
static int
-baneGkmsParseBEF(void *ptr, const char *str, char err[AIR_STRLEN_HUGE]) {
+baneGkmsParseBEF(void *ptr, const char *str, char err[AIR_STRLEN_HUGE + 1]) {
static const char me[] = "baneGkmsParseBEF";
- char mesg[AIR_STRLEN_MED], *nerr;
+ char mesg[AIR_STRLEN_MED + 1], *nerr;
float cent, width, shape, alpha, off, *bef;
Nrrd **nrrdP;
airArray *mop;
@@ -109,7 +109,7 @@
if (nrrdMaybeAlloc_va(*nrrdP, nrrdTypeFloat, 2, AIR_CAST(size_t, 2),
AIR_CAST(size_t, 6))) {
airMopAdd(mop, nerr = biffGetDone(NRRD), airFree, airMopOnError);
- airStrcpy(err, AIR_STRLEN_HUGE, nerr);
+ airStrcpy(err, AIR_STRLEN_HUGE + 1, nerr);
airMopError(mop);
return 1;
}
@@ -142,7 +142,7 @@
"as a nrrd filename\n",
me, str);
strcpy(err, mesg);
- strncat(err, nerr, AIR_STRLEN_HUGE - 1 - strlen(mesg) - 1);
+ strncat(err, nerr, AIR_STRLEN_HUGE - strlen(mesg) - 1);
airMopError(mop);
return 1;
}
@@ -168,7 +168,7 @@
** gthr[1] = the scaling, or the absolute
*/
static int
-baneGkmsParseGthresh(void *ptr, const char *str, char err[AIR_STRLEN_HUGE]) {
+baneGkmsParseGthresh(void *ptr, const char *str, char err[AIR_STRLEN_HUGE + 1]) {
static const char me[] = "baneGkmsParseGthresh";
float *gthr;
@@ -219,7 +219,7 @@
*/
void
baneGkmsUsage(const char *me, hestParm *hparm) {
- char buff[AIR_STRLEN_LARGE], fmt[AIR_STRLEN_LARGE];
+ char buff[AIR_STRLEN_LARGE + 1], fmt[AIR_STRLEN_LARGE + 1];
unsigned int ci, si, len, maxlen;
maxlen = 0;
Modified: teem/trunk/src/bane/hvol.c
===================================================================
--- teem/trunk/src/bane/hvol.c 2023-07-08 12:18:19 UTC (rev 7056)
+++ teem/trunk/src/bane/hvol.c 2023-07-08 12:25:44 UTC (rev 7057)
@@ -87,7 +87,8 @@
baneFindInclusion(double min[3], double max[3], Nrrd *nin, baneHVolParm *hvp,
gageContext *ctx) {
static const char me[] = "baneFindInclusion";
- char prog[13], aname[3][AIR_STRLEN_SMALL] = {"grad-mag", "2nd deriv", "data value"};
+ char prog[13],
+ aname[3][AIR_STRLEN_SMALL + 1] = {"grad-mag", "2nd deriv", "data value"};
int sx, sy, sz, x, y, z, E, ai;
baneInc *inc[3];
/* HEY HEY HEY: The variable "hist" is used before its value is set.
Modified: teem/trunk/src/bane/trex.c
===================================================================
--- teem/trunk/src/bane/trex.c 2023-07-08 12:18:19 UTC (rev 7056)
+++ teem/trunk/src/bane/trex.c 2023-07-08 12:25:44 UTC (rev 7057)
@@ -45,7 +45,7 @@
return NULL;
}
if (TREX_LUTLEN != baneNpos->axis[0].size) {
- char stmp[AIR_STRLEN_SMALL];
+ char stmp[AIR_STRLEN_SMALL + 1];
fprintf(stderr, "%s: !!! need a length %d p(x) (not %s)\n", me, TREX_LUTLEN,
airSprintSize_t(stmp, baneNpos->axis[0].size));
return NULL;
Modified: teem/trunk/src/bane/valid.c
===================================================================
--- teem/trunk/src/bane/valid.c 2023-07-08 12:18:19 UTC (rev 7056)
+++ teem/trunk/src/bane/valid.c 2023-07-08 12:25:44 UTC (rev 7057)
@@ -132,7 +132,7 @@
return 1;
}
if (2 != info->axis[0].size) {
- char stmp[AIR_STRLEN_SMALL];
+ char stmp[AIR_STRLEN_SMALL + 1];
biffAddf(BANE, "%s: 1st axis needs size 2 (not %s)", me,
airSprintSize_t(stmp, info->axis[0].size));
return 1;
@@ -186,7 +186,7 @@
return 1;
}
if (2 != Bcpts->axis[0].size) {
- char stmp[AIR_STRLEN_SMALL];
+ char stmp[AIR_STRLEN_SMALL + 1];
biffAddf(BANE, "%s: axis#0 needs size 2 (not %s)", me,
airSprintSize_t(stmp, Bcpts->axis[0].size));
return 1;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <kin...@us...> - 2023-07-08 12:18:21
|
Revision: 7056
http://sourceforge.net/p/teem/code/7056
Author: kindlmann
Date: 2023-07-08 12:18:19 +0000 (Sat, 08 Jul 2023)
Log Message:
-----------
fixing sloppy propgation of AIR_STRLEN --> AIR_STRLEN+1
Modified Paths:
--------------
teem/trunk/src/unrrdu/resample.c
Modified: teem/trunk/src/unrrdu/resample.c
===================================================================
--- teem/trunk/src/unrrdu/resample.c 2023-07-08 12:03:12 UTC (rev 7055)
+++ teem/trunk/src/unrrdu/resample.c 2023-07-08 12:18:19 UTC (rev 7056)
@@ -310,7 +310,7 @@
}
if (!E) E |= nrrdResampleKernelSet(rsmc, ai, unuk->kernel, unuk->parm);
switch (dowhat) {
- char stmp[AIR_STRLEN_SMALL] + 1;
+ char stmp[AIR_STRLEN_SMALL + 1];
case unrrduScaleMultiply:
samplesOut = AIR_ROUNDUP_UI(nin->axis[ai].size * scale[1 + 2 * ai]);
break;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <kin...@us...> - 2023-07-08 12:03:15
|
Revision: 7055
http://sourceforge.net/p/teem/code/7055
Author: kindlmann
Date: 2023-07-08 12:03:12 +0000 (Sat, 08 Jul 2023)
Log Message:
-----------
avoiding needless string copy
Modified Paths:
--------------
teem/trunk/src/hest/adders.c
Modified: teem/trunk/src/hest/adders.c
===================================================================
--- teem/trunk/src/hest/adders.c 2023-07-08 11:54:14 UTC (rev 7054)
+++ teem/trunk/src/hest/adders.c 2023-07-08 12:03:12 UTC (rev 7055)
@@ -135,10 +135,9 @@
hestOptAdd_1_Enum(hestOpt **optP, const char *flag, const char *name, /* */
int *valueP, int dflt, const char *info, /* */
const airEnum *enm) {
- char dfltStr[AIR_STRLEN_SMALL + 1];
- airStrcpy(dfltStr, AIR_STRLEN_SMALL + 1, airEnumStr(enm, dflt));
+
return hestOptAdd_nva(optP, flag, name, airTypeEnum, 1, 1, /* */
- valueP, dfltStr, info, /* */
+ valueP, airEnumStr(enm, dflt), info, /* */
NULL, enm, NULL);
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <kin...@us...> - 2023-07-08 11:54:16
|
Revision: 7054
http://sourceforge.net/p/teem/code/7054
Author: kindlmann
Date: 2023-07-08 11:54:14 +0000 (Sat, 08 Jul 2023)
Log Message:
-----------
simplifiying declarations of string arrays
Modified Paths:
--------------
teem/trunk/src/air/enum.c
Modified: teem/trunk/src/air/enum.c
===================================================================
--- teem/trunk/src/air/enum.c 2023-07-08 11:51:11 UTC (rev 7053)
+++ teem/trunk/src/air/enum.c 2023-07-08 11:54:14 UTC (rev 7054)
@@ -328,17 +328,17 @@
return 1;
}
if (!enm->sense) {
- char bb1[AIR_STRLEN_SMALL + 1], bb2[AIR_STRLEN_SMALL + 1];
- strcpy(bb1, enm->str[ii]);
- airToLower(bb1);
- strcpy(bb2, enm->str[jj]);
- airToLower(bb2);
- if (!strcmp(bb1, bb2)) {
+ char bb[2][AIR_STRLEN_SMALL + 1];
+ strcpy(bb[0], enm->str[ii]);
+ airToLower(bb[0]);
+ strcpy(bb[1], enm->str[jj]);
+ airToLower(bb[1]);
+ if (!strcmp(bb[0], bb[1])) {
if (err) {
snprintf(err, ASL,
"%s(%s): after case-lowering, "
"str[%d] and [%u] both \"%s\"",
- me, enm->name, ii, jj, bb1);
+ me, enm->name, ii, jj, bb[0]);
}
return 1;
}
@@ -452,17 +452,17 @@
return 1;
}
if (!enm->sense) {
- char bb1[AIR_STRLEN_SMALL + 1], bb2[AIR_STRLEN_SMALL + 1];
- strcpy(bb1, enm->strEqv[ii]);
- airToLower(bb1);
- strcpy(bb2, enm->strEqv[jj]);
- airToLower(bb2);
- if (!strcmp(bb1, bb2)) {
+ char bb[2][AIR_STRLEN_SMALL + 1];
+ strcpy(bb[0], enm->strEqv[ii]);
+ airToLower(bb[0]);
+ strcpy(bb[1], enm->strEqv[jj]);
+ airToLower(bb[1]);
+ if (!strcmp(bb[0], bb[1])) {
if (err) {
snprintf(err, ASL,
"%s(%s): after case-lowering, "
"strEqv[%d] and [%u] both \"%s\"",
- me, enm->name, ii, jj, bb1);
+ me, enm->name, ii, jj, bb[0]);
}
return 1;
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <kin...@us...> - 2023-07-08 11:51:13
|
Revision: 7053
http://sourceforge.net/p/teem/code/7053
Author: kindlmann
Date: 2023-07-08 11:51:11 +0000 (Sat, 08 Jul 2023)
Log Message:
-----------
clarifying descriptive comment
Modified Paths:
--------------
teem/trunk/src/air/string.c
Modified: teem/trunk/src/air/string.c
===================================================================
--- teem/trunk/src/air/string.c 2023-07-08 11:33:02 UTC (rev 7052)
+++ teem/trunk/src/air/string.c 2023-07-08 11:51:11 UTC (rev 7053)
@@ -180,12 +180,13 @@
**
** Like strncpy but logic is different (and perhaps more useful), being:
** "dst is allocated for dstSize chars. Copy as much of src as can
-** "fit in dst, and always 0-terminate the resulting dst.",
+** fit in dst, while always 0-terminating the resulting dst.",
** instead of strncpy's "Copy at most n characters, blah blah blah,
** and you still have to 0-terminate the rest yourself".
**
** E.g. with declaration buff[AIR_STRLEN_SMALL+1], you call
-** airStrcpy(buff, AIR_STRLEN_SMALL+1, src), and know that then
+** airStrcpy(buff, AIR_STRLEN_SMALL+1, src), and know then that
+** strlen(buff) will not run off the end of the buffer, and that
** strlen(buff) <= AIR_STRLEN_SMALL.
**
** Returns NULL if there was a problem (NULL dst or dstSize zero),
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <kin...@us...> - 2023-07-08 11:33:08
|
Revision: 7052
http://sourceforge.net/p/teem/code/7052
Author: kindlmann
Date: 2023-07-08 11:33:02 +0000 (Sat, 08 Jul 2023)
Log Message:
-----------
Propagating AIR_STRLEN --> AIR_STRLEN+1, with this API CHANGE to function:
int meetPullVolLeechable(const meetPullVol *lchr,
const meetPullVol *orig,
int *can,
char explain[AIR_STRLEN_HUGE + 1]);
Modified Paths:
--------------
teem/trunk/src/meet/enumall.c
teem/trunk/src/meet/meet.h
teem/trunk/src/meet/meetGage.c
teem/trunk/src/meet/meetPull.c
teem/trunk/src/meet/test/strace.c
Modified: teem/trunk/src/meet/enumall.c
===================================================================
--- teem/trunk/src/meet/enumall.c 2023-07-08 11:27:11 UTC (rev 7051)
+++ teem/trunk/src/meet/enumall.c 2023-07-08 11:33:02 UTC (rev 7052)
@@ -226,7 +226,7 @@
meetAirEnumAllCheck(void) {
static const char me[] = "meetAirEnumAllCheck";
const airEnum **enm, *ee;
- char err[AIR_STRLEN_LARGE];
+ char err[AIR_STRLEN_LARGE + 1];
unsigned int ei;
airArray *mop;
Modified: teem/trunk/src/meet/meet.h
===================================================================
--- teem/trunk/src/meet/meet.h 2023-07-08 11:27:11 UTC (rev 7051)
+++ teem/trunk/src/meet/meet.h 2023-07-08 11:33:02 UTC (rev 7052)
@@ -163,7 +163,7 @@
MEET_EXPORT int meetPullVolLeechable(const meetPullVol *lchr,
const meetPullVol *orig,
int *can,
- char explain[AIR_STRLEN_HUGE]);
+ char explain[AIR_STRLEN_HUGE + 1]);
MEET_EXPORT meetPullVol *meetPullVolNix(meetPullVol *pvol);
MEET_EXPORT const hestCB *const meetHestPullVol;
MEET_EXPORT int meetPullVolStackBlurParmFinishMulti(meetPullVol **mpv,
Modified: teem/trunk/src/meet/meetGage.c
===================================================================
--- teem/trunk/src/meet/meetGage.c 2023-07-08 11:27:11 UTC (rev 7051)
+++ teem/trunk/src/meet/meetGage.c 2023-07-08 11:33:02 UTC (rev 7052)
@@ -67,7 +67,7 @@
** which isn't const
*/
static int
-_meetHestConstGageKindParse(void *ptr, const char *str, char err[AIR_STRLEN_HUGE]) {
+_meetHestConstGageKindParse(void *ptr, const char *str, char err[AIR_STRLEN_HUGE + 1]) {
static const char me[] = "_meetHestGageConstKindParse";
const gageKind **kindP;
@@ -89,7 +89,7 @@
}
static int
-_meetHestGageKindParse(void *ptr, const char *str, char err[AIR_STRLEN_HUGE]) {
+_meetHestGageKindParse(void *ptr, const char *str, char err[AIR_STRLEN_HUGE + 1]) {
static const char me[] = "_meetHestGageKindParse";
gageKind **kindP;
Modified: teem/trunk/src/meet/meetPull.c
===================================================================
--- teem/trunk/src/meet/meetPull.c 2023-07-08 11:27:11 UTC (rev 7051)
+++ teem/trunk/src/meet/meetPull.c 2023-07-08 11:33:02 UTC (rev 7052)
@@ -235,7 +235,7 @@
}
static int
-meetHestPullVolParse(void *ptr, const char *str, char err[AIR_STRLEN_HUGE]) {
+meetHestPullVolParse(void *ptr, const char *str, char err[AIR_STRLEN_HUGE + 1]) {
static const char me[] = "meetHestPullVolParse";
meetPullVol *mpv, **mpvP;
airArray *mop;
@@ -252,7 +252,7 @@
if (meetPullVolParse(mpv, str)) {
char *ler;
airMopAdd(mop, ler = biffGetDone(MEET), airFree, airMopOnError);
- airStrcpy(err, AIR_STRLEN_HUGE, ler);
+ airStrcpy(err, AIR_STRLEN_HUGE + 1, ler);
airMopError(mop);
return 1;
}
@@ -306,15 +306,15 @@
******** meetPullVolLeechable
**
** indicates whether lchr can leech from orig (saved in *can), and if not,
-** explanation is saved in explain (if non-NULL). explain is size AIR_STRLEN_HUGE
+** explanation is saved in explain (if non-NULL). explain is size AIR_STRLEN_HUGE+1
** because it has to contain the subexplain from gageStackBlurParmCompare, which
-** is size AIR_STRLEN_LARGE (noted thanks to a gcc warning)
+** is size AIR_STRLEN_LARGE+1 (noted thanks to a gcc warning)
*/
int /* Biff: 1 */
meetPullVolLeechable(const meetPullVol *lchr, const meetPullVol *orig, int *can,
- char explain[AIR_STRLEN_HUGE]) {
+ char explain[AIR_STRLEN_HUGE + 1]) {
static const char me[] = "meetPullVolLeechable";
- char subexplain[AIR_STRLEN_LARGE];
+ char subexplain[AIR_STRLEN_LARGE + 1];
if (!(lchr && orig && can)) {
biffAddf(MEET, "%s: got NULL pointer (%p %p %p)", me, (const void *)lchr,
@@ -484,7 +484,7 @@
for (mpvIdx = 0; mpvIdx < mpvNum; mpvIdx++) {
unsigned int pvi;
int leechable;
- char explain[AIR_STRLEN_HUGE];
+ char explain[AIR_STRLEN_HUGE + 1];
vol = mpv[mpvIdx];
for (pvi = 0; pvi < mpvIdx; pvi++) {
if (meetPullVolLeechable(vol, mpv[pvi], &leechable, explain)) {
@@ -521,7 +521,7 @@
return 1;
}
if (vol->sbp) {
- char formatSS[AIR_STRLEN_LARGE];
+ char formatSS[AIR_STRLEN_LARGE + 1];
sprintf(formatSS, "%s/%s-%%03u-%03u.nrrd", cachePath, vol->volName, vol->sbp->num);
if (verbose) {
fprintf(stderr, "%s: managing %s ... \n", me, formatSS);
@@ -730,7 +730,7 @@
}
static int
-meetHestPullInfoParse(void *ptr, const char *str, char err[AIR_STRLEN_HUGE]) {
+meetHestPullInfoParse(void *ptr, const char *str, char err[AIR_STRLEN_HUGE + 1]) {
static const char me[] = "meetHestPullInfoParse";
airArray *mop;
meetPullInfo **minfP, *minf;
@@ -747,7 +747,7 @@
if (meetPullInfoParse(minf, str)) {
char *ler;
airMopAdd(mop, ler = biffGetDone(MEET), airFree, airMopOnError);
- airStrcpy(err, AIR_STRLEN_HUGE, ler);
+ airStrcpy(err, AIR_STRLEN_HUGE + 1, ler);
airMopError(mop);
return 1;
}
Modified: teem/trunk/src/meet/test/strace.c
===================================================================
--- teem/trunk/src/meet/test/strace.c 2023-07-08 11:27:11 UTC (rev 7051)
+++ teem/trunk/src/meet/test/strace.c 2023-07-08 11:33:02 UTC (rev 7052)
@@ -32,16 +32,12 @@
*/
int
-findAndTraceMorePoints(Nrrd *nplot,
- pullContext *pctx, pullVolume *scaleVol,
- int strengthUse,
- int smooth, int flatWght,
- double scaleStep, double scaleHalfLen,
- double orientTestLen,
- unsigned int traceArrIncr,
- pullTraceMulti *mtrc,
+findAndTraceMorePoints(Nrrd *nplot, pullContext *pctx, pullVolume *scaleVol,
+ int strengthUse, int smooth, int flatWght, double scaleStep,
+ double scaleHalfLen, double orientTestLen,
+ unsigned int traceArrIncr, pullTraceMulti *mtrc,
unsigned int pointNum) {
- static const char me[]="findAndTraceMorePoints";
+ static const char me[] = "findAndTraceMorePoints";
unsigned int pointsSoFar, idtagBase, pidx, addedNum;
pullTrace *trace;
pullPoint *point;
@@ -48,29 +44,29 @@
Nrrd *nPosOut;
airArray *mop;
double *pos;
- char doneStr[AIR_STRLEN_SMALL];
+ char doneStr[AIR_STRLEN_SMALL + 1];
mop = airMopNew();
pointsSoFar = pullPointNumber(pctx);
idtagBase = pctx->idtagNext;
point = NULL;
- printf("%s: adding %u new points (to %u; %s) . . . ",
- me, pointNum, pointsSoFar,
+ printf("%s: adding %u new points (to %u; %s) . . . ", me, pointNum, pointsSoFar,
airPrettySprintSize_t(doneStr, pullTraceMultiSizeof(mtrc)));
- for (pidx=0; pidx<pointNum; pidx++) {
- printf("%s", airDoneStr(0, pidx, pointNum, doneStr)); fflush(stdout);
+ for (pidx = 0; pidx < pointNum; pidx++) {
+ printf("%s", airDoneStr(0, pidx, pointNum, doneStr));
+ fflush(stdout);
if (!point) {
point = pullPointNew(pctx);
}
- if (pullPointInitializeRandomOrHalton(pctx, pidx + pointsSoFar,
- point, scaleVol)) {
- biffAddf(PULL, "%s: trouble trying point %u (id %u)", me,
- pidx, point->idtag);
- airMopError(mop); return 1;
+ if (pullPointInitializeRandomOrHalton(pctx, pidx + pointsSoFar, point, scaleVol)) {
+ biffAddf(PULL, "%s: trouble trying point %u (id %u)", me, pidx, point->idtag);
+ airMopError(mop);
+ return 1;
}
if (pullBinsPointAdd(pctx, point, NULL)) {
biffAddf(PULL, "%s: trouble binning point %u", me, point->idtag);
- airMopError(mop); return 1;
+ airMopError(mop);
+ return 1;
}
point = NULL;
}
@@ -84,28 +80,27 @@
nPosOut = nrrdNew();
airMopAdd(mop, nPosOut, (airMopper)nrrdNuke, airMopAlways);
- if (pullOutputGetFilter(nPosOut, NULL, NULL, NULL, 0.0,
- pctx, idtagBase, 0)) {
+ if (pullOutputGetFilter(nPosOut, NULL, NULL, NULL, 0.0, pctx, idtagBase, 0)) {
biffAddf(PULL, "%s: trouble A", me);
- airMopError(mop); return 1;
+ airMopError(mop);
+ return 1;
}
pos = AIR_CAST(double *, nPosOut->data);
addedNum = nPosOut->axis[1].size;
printf("%s: tracing . . . ", me);
- for (pidx=0; pidx<addedNum; pidx++) {
+ for (pidx = 0; pidx < addedNum; pidx++) {
double seedPos[4];
int added;
- printf("%s", airDoneStr(0, pidx, addedNum, doneStr)); fflush(stdout);
+ printf("%s", airDoneStr(0, pidx, addedNum, doneStr));
+ fflush(stdout);
trace = pullTraceNew();
- ELL_4V_COPY(seedPos, pos + 4*pidx);
- if (pullTraceSet(pctx, trace,
- AIR_TRUE /* recordStrength */,
- scaleStep, scaleHalfLen,
- orientTestLen,
- traceArrIncr, seedPos)
+ ELL_4V_COPY(seedPos, pos + 4 * pidx);
+ if (pullTraceSet(pctx, trace, AIR_TRUE /* recordStrength */, scaleStep, scaleHalfLen,
+ orientTestLen, traceArrIncr, seedPos)
|| pullTraceMultiAdd(mtrc, trace, &added)) {
biffAddf(PULL, "%s: trouble on point %u", me, pidx);
- airMopError(mop); return 1;
+ airMopError(mop);
+ return 1;
}
if (!added) {
trace = pullTraceNix(trace);
@@ -113,13 +108,11 @@
}
printf("%s\n", airDoneStr(0, pidx, pointNum, doneStr));
- if (pullTraceMultiPlotAdd(nplot, mtrc, NULL,
- strengthUse,
- smooth, flatWght,
- 0, 0,
- NULL, NULL)) {
+ if (pullTraceMultiPlotAdd(nplot, mtrc, NULL, strengthUse, smooth, flatWght, 0, 0, NULL,
+ NULL)) {
biffAddf(PULL, "%s: trouble w/ PlotAdd (A)", me);
- airMopError(mop); return 1;
+ airMopError(mop);
+ return 1;
}
airMopOkay(mop);
@@ -130,7 +123,7 @@
int
resamplePlot(Nrrd *nprob, const Nrrd *nplot) {
- static const char me[]="resamplePlot";
+ static const char me[] = "resamplePlot";
unsigned int ii, nn, sx, sy;
double scls[2] = {0.2, 0.2}, kparm[2] = {1.0, 0.0};
@@ -149,20 +142,20 @@
prob = AIR_CAST(double *, nprob->data);
sx = AIR_UINT(nprob->axis[0].size);
sy = AIR_UINT(nprob->axis[1].size);
- for (ii=0; ii<sx; ii++) {
+ for (ii = 0; ii < sx; ii++) {
/* zero out bottom line, useless crap piles up there */
- prob[ii + sx*(sy-1)] = 0;
+ prob[ii + sx * (sy - 1)] = 0;
}
sum = 0;
nn = AIR_UINT(nrrdElementNumber(nprob));
- for (ii=0; ii<nn; ii++) {
+ for (ii = 0; ii < nn; ii++) {
/* sum += log(LOFF+prob[ii]); why? */
sum += prob[ii];
}
if (sum) {
- for (ii=0; ii<nn; ii++) {
+ for (ii = 0; ii < nn; ii++) {
/* prob[ii] = log(LOFF+prob[ii])/sum; why? */
- prob[ii] = prob[ii]/sum;
+ prob[ii] = prob[ii] / sum;
}
}
return 0;
@@ -170,15 +163,15 @@
double
distanceProb(Nrrd *npp, Nrrd *nqq) {
- double *pp, *qq, dist=0.0;
+ double *pp, *qq, dist = 0.0;
unsigned int ii, nn;
nn = AIR_UINT(nrrdElementNumber(npp));
pp = AIR_CAST(double *, npp->data);
qq = AIR_CAST(double *, nqq->data);
- for (ii=0; ii<nn; ii++) {
+ for (ii = 0; ii < nn; ii++) {
if (qq[ii]) {
- dist += fabs(pp[ii]*log2(0.0000001+pp[ii]/qq[ii]));
+ dist += fabs(pp[ii] * log2(0.0000001 + pp[ii] / qq[ii]));
}
}
return dist;
@@ -186,14 +179,13 @@
void
savePlot(Nrrd *nout) {
- static const char me[]="saveProb";
- static int count=0;
+ static const char me[] = "saveProb";
+ static int count = 0;
char fname[128], *err;
sprintf(fname, "pdf-%03u.nrrd", count);
if (nrrdSave(fname, nout, NULL)) {
err = biffGetDone(NRRD);
- fprintf(stderr, "%s: HEY couldn't save pdf to %s; moving on ...\n",
- me, fname);
+ fprintf(stderr, "%s: HEY couldn't save pdf to %s; moving on ...\n", me, fname);
free(err);
}
count++;
@@ -204,44 +196,36 @@
int
main(int argc, const char **argv) {
- hestOpt *hopt=NULL;
+ hestOpt *hopt = NULL;
hestParm *hparm;
airArray *mop;
const char *me;
-
- char *err, *posOutS, *outS, *extraOutBaseS, *addLogS, *cachePathSS,
- *tracesInS, *tracesOutS, *trcListOutS=NULL, *trcVolOutS=NULL,
- *traceMaskPosOutS=NULL;
+ char *err, *posOutS, *outS, *extraOutBaseS, *addLogS, *cachePathSS, *tracesInS,
+ *tracesOutS, *trcListOutS = NULL, *trcVolOutS = NULL, *traceMaskPosOutS = NULL;
FILE *addLog, *tracesFile;
meetPullVol **vspec;
meetPullInfo **idef;
- Nrrd *nPosIn=NULL, *nPosOut, *nplot, *nplotA, *nplotB, *nfilt, *nTraceMaskIn,
- *nmaskedpos;
+ Nrrd *nPosIn = NULL, *nPosOut, *nplot, *nplotA, *nplotB, *nfilt, *nTraceMaskIn,
+ *nmaskedpos;
pullEnergySpec *enspR, *enspS, *enspWin;
NrrdKernelSpec *k00, *k11, *k22, *kSSrecon, *kSSblur;
NrrdBoundarySpec *bspec;
- pullContext *pctx=NULL;
- pullVolume *scaleVol=NULL;
- pullTraceMulti *mtrc=NULL;
- int ret=0;
+ pullContext *pctx = NULL;
+ pullVolume *scaleVol = NULL;
+ pullTraceMulti *mtrc = NULL;
+ int ret = 0;
unsigned int vspecNum, idefNum;
/* things that used to be set directly inside pullContext */
- int nixAtVolumeEdgeSpace, constraintBeforeSeedThresh,
- binSingle, liveThresholdOnInit, permuteOnRebin,
- noAdd, unequalShapesAllow,
- zeroZ, strnUse;
+ int nixAtVolumeEdgeSpace, constraintBeforeSeedThresh, binSingle, liveThresholdOnInit,
+ permuteOnRebin, noAdd, unequalShapesAllow, zeroZ, strnUse;
int verbose;
- int interType, allowCodimension3Constraints, scaleIsTau,
- smoothPlot, flatWght;
- unsigned int samplesAlongScaleNum, pointNumInitial, pointPerVoxel,
- ppvZRange[2], snap, stuckIterMax, constraintIterMax,
- rngSeed, progressBinMod,
- threadNum, tracePointNum, passNumMax,
- kssOpi, kssFinished, bspOpi, bspFinished;
- double jitter, stepInitial, constraintStepMin, radiusSpace, binWidthSpace,
- radiusScale, orientTestLen,
- backStepScale, opporStepScale, energyDecreaseMin, tpdThresh;
+ int interType, allowCodimension3Constraints, scaleIsTau, smoothPlot, flatWght;
+ unsigned int samplesAlongScaleNum, pointNumInitial, pointPerVoxel, ppvZRange[2], snap,
+ stuckIterMax, constraintIterMax, rngSeed, progressBinMod, threadNum, tracePointNum,
+ passNumMax, kssOpi, kssFinished, bspOpi, bspFinished;
+ double jitter, stepInitial, constraintStepMin, radiusSpace, binWidthSpace, radiusScale,
+ orientTestLen, backStepScale, opporStepScale, energyDecreaseMin, tpdThresh;
double sstep, sswin, ssrange[2];
unsigned int pres[2];
@@ -284,157 +268,125 @@
"always constrain Z=0, to process 2D images");
hestOptAdd(&hopt, "su", "bool", airTypeBool, 1, 1, &strnUse, "false",
"weigh contributions to traces with strength");
- hestOptAdd(&hopt, "nave", "bool", airTypeBool, 1, 1,
- &nixAtVolumeEdgeSpace, "false",
+ hestOptAdd(&hopt, "nave", "bool", airTypeBool, 1, 1, &nixAtVolumeEdgeSpace, "false",
"whether or not to nix points at edge of volume, where gage had "
"to invent values for kernel support");
- hestOptAdd(&hopt, "cbst", "bool", airTypeBool, 1, 1,
- &constraintBeforeSeedThresh, "false",
+ hestOptAdd(&hopt, "cbst", "bool", airTypeBool, 1, 1, &constraintBeforeSeedThresh,
+ "false",
"during initialization, try constraint satisfaction before "
"testing seedThresh");
- hestOptAdd(&hopt, "noadd", NULL, airTypeBool, 0, 0,
- &noAdd, NULL, "turn off adding during population control");
- hestOptAdd(&hopt, "usa", "bool", airTypeBool, 1, 1,
- &unequalShapesAllow, "false",
+ hestOptAdd(&hopt, "noadd", NULL, airTypeBool, 0, 0, &noAdd, NULL,
+ "turn off adding during population control");
+ hestOptAdd(&hopt, "usa", "bool", airTypeBool, 1, 1, &unequalShapesAllow, "false",
"allow volumes to have different shapes (false is safe as "
"different volume sizes are often accidental)");
- hestOptAdd(&hopt, "nobin", NULL, airTypeBool, 0, 0,
- &binSingle, NULL,
+ hestOptAdd(&hopt, "nobin", NULL, airTypeBool, 0, 0, &binSingle, NULL,
"turn off spatial binning (which prevents multi-threading "
"from being useful), for debugging or speed-up measurement");
- hestOptAdd(&hopt, "lti", "bool", airTypeBool, 1, 1,
- &liveThresholdOnInit, "true",
+ hestOptAdd(&hopt, "lti", "bool", airTypeBool, 1, 1, &liveThresholdOnInit, "true",
"impose liveThresh on initialization");
- hestOptAdd(&hopt, "por", "bool", airTypeBool, 1, 1,
- &permuteOnRebin, "true",
+ hestOptAdd(&hopt, "por", "bool", airTypeBool, 1, 1, &permuteOnRebin, "true",
"permute points during rebinning");
hestOptAdd(&hopt, "v", "verbosity", airTypeInt, 1, 1, &verbose, "1",
"verbosity level");
hestOptAdd(&hopt, "vol", "vol0 vol1", airTypeOther, 1, -1, &vspec, NULL,
- "input volumes, in format <filename>:<kind>:<volname>",
- &vspecNum, NULL, meetHestPullVol);
+ "input volumes, in format <filename>:<kind>:<volname>", &vspecNum, NULL,
+ meetHestPullVol);
hestOptAdd(&hopt, "info", "info0 info1", airTypeOther, 1, -1, &idef, NULL,
"info definitions, in format "
"<info>[-c]:<volname>:<item>[:<zero>:<scale>]",
&idefNum, NULL, meetHestPullInfo);
- hestOptAdd(&hopt, "k00", "kern00", airTypeOther, 1, 1, &k00,
- "cubic:1,0", "kernel for gageKernel00",
- NULL, NULL, nrrdHestKernelSpec);
- hestOptAdd(&hopt, "k11", "kern11", airTypeOther, 1, 1, &k11,
- "cubicd:1,0", "kernel for gageKernel11",
- NULL, NULL, nrrdHestKernelSpec);
- hestOptAdd(&hopt, "k22", "kern22", airTypeOther, 1, 1, &k22,
- "cubicdd:1,0", "kernel for gageKernel22",
- NULL, NULL, nrrdHestKernelSpec);
+ hestOptAdd(&hopt, "k00", "kern00", airTypeOther, 1, 1, &k00, "cubic:1,0",
+ "kernel for gageKernel00", NULL, NULL, nrrdHestKernelSpec);
+ hestOptAdd(&hopt, "k11", "kern11", airTypeOther, 1, 1, &k11, "cubicd:1,0",
+ "kernel for gageKernel11", NULL, NULL, nrrdHestKernelSpec);
+ hestOptAdd(&hopt, "k22", "kern22", airTypeOther, 1, 1, &k22, "cubicdd:1,0",
+ "kernel for gageKernel22", NULL, NULL, nrrdHestKernelSpec);
hestOptAdd(&hopt, "sscp", "path", airTypeString, 1, 1, &cachePathSS, "./",
"path (without trailing /) for where to read/write "
"pre-blurred volumes for scale-space");
- kssOpi =
- hestOptAdd(&hopt, "kssb", "kernel", airTypeOther, 1, 1, &kSSblur,
- "ds:1,5", "default blurring kernel, to sample scale space",
- NULL, NULL, nrrdHestKernelSpec);
- bspOpi =
- hestOptAdd(&hopt, "bsp", "boundary", airTypeOther, 1, 1, &bspec,
- "wrap", "default boundary behavior of scale-space blurring",
- NULL, NULL, nrrdHestBoundarySpec);
- hestOptAdd(&hopt, "kssr", "kernel", airTypeOther, 1, 1, &kSSrecon,
- "hermite", "kernel for reconstructing from scale space samples",
- NULL, NULL, nrrdHestKernelSpec);
- hestOptAdd(&hopt, "nss", "# scl smpls", airTypeUInt, 1, 1,
- &samplesAlongScaleNum, "1",
+ kssOpi = hestOptAdd(&hopt, "kssb", "kernel", airTypeOther, 1, 1, &kSSblur, "ds:1,5",
+ "default blurring kernel, to sample scale space", NULL, NULL,
+ nrrdHestKernelSpec);
+ bspOpi = hestOptAdd(&hopt, "bsp", "boundary", airTypeOther, 1, 1, &bspec, "wrap",
+ "default boundary behavior of scale-space blurring", NULL, NULL,
+ nrrdHestBoundarySpec);
+ hestOptAdd(&hopt, "kssr", "kernel", airTypeOther, 1, 1, &kSSrecon, "hermite",
+ "kernel for reconstructing from scale space samples", NULL, NULL,
+ nrrdHestKernelSpec);
+ hestOptAdd(&hopt, "nss", "# scl smpls", airTypeUInt, 1, 1, &samplesAlongScaleNum, "1",
"if using \"-ppv\", number of samples along scale axis "
"for each spatial position");
- hestOptAdd(&hopt, "np", "# points", airTypeUInt, 1, 1,
- &pointNumInitial, "1000",
+ hestOptAdd(&hopt, "np", "# points", airTypeUInt, 1, 1, &pointNumInitial, "1000",
"number of points to initialize with");
- hestOptAdd(&hopt, "tnp", "# points", airTypeUInt, 1, 1,
- &tracePointNum, "1000",
+ hestOptAdd(&hopt, "tnp", "# points", airTypeUInt, 1, 1, &tracePointNum, "1000",
"number of points to add in each iteration of "
"estimation of plot");
- hestOptAdd(&hopt, "pnm", "# passes", airTypeUInt, 1, 1,
- &passNumMax, "10",
+ hestOptAdd(&hopt, "pnm", "# passes", airTypeUInt, 1, 1, &passNumMax, "10",
"max number of passes in plot estimation");
- hestOptAdd(&hopt, "tpdt", "thresh", airTypeDouble, 1, 1,
- &tpdThresh, "1.0", "KL-distance threshold");
- hestOptAdd(&hopt, "ti", "fname", airTypeString, 1, 1,
- &tracesInS, "", "input file of *pre-computed* traces");
- hestOptAdd(&hopt, "to", "fname", airTypeString, 1, 1,
- &tracesOutS, "", "file for saving out *computed* traces");
+ hestOptAdd(&hopt, "tpdt", "thresh", airTypeDouble, 1, 1, &tpdThresh, "1.0",
+ "KL-distance threshold");
+ hestOptAdd(&hopt, "ti", "fname", airTypeString, 1, 1, &tracesInS, "",
+ "input file of *pre-computed* traces");
+ hestOptAdd(&hopt, "to", "fname", airTypeString, 1, 1, &tracesOutS, "",
+ "file for saving out *computed* traces");
- hestOptAdd(&hopt, "ppv", "# pnts/vox", airTypeUInt, 1, 1,
- &pointPerVoxel, "0",
+ hestOptAdd(&hopt, "ppv", "# pnts/vox", airTypeUInt, 1, 1, &pointPerVoxel, "0",
"number of points per voxel to start in simulation "
"(need to have a seed thresh vol, overrides \"-np\")");
- hestOptAdd(&hopt, "ppvzr", "z range", airTypeUInt, 2, 2,
- ppvZRange, "1 0",
+ hestOptAdd(&hopt, "ppvzr", "z range", airTypeUInt, 2, 2, ppvZRange, "1 0",
"range of Z slices (1st num < 2nd num) to do ppv in, or, "
"\"1 0\" for whole volume");
- hestOptAdd(&hopt, "jit", "jitter", airTypeDouble, 1, 1,
- &jitter, "0",
+ hestOptAdd(&hopt, "jit", "jitter", airTypeDouble, 1, 1, &jitter, "0",
"amount of jittering to do with ppv");
hestOptAdd(&hopt, "pi", "npos", airTypeOther, 1, 1, &nPosIn, "",
- "4-by-N array of positions to start at (overrides \"-np\")",
- NULL, NULL, nrrdHestNrrd);
- hestOptAdd(&hopt, "step", "step", airTypeDouble, 1, 1,
- &stepInitial, "1",
+ "4-by-N array of positions to start at (overrides \"-np\")", NULL, NULL,
+ nrrdHestNrrd);
+ hestOptAdd(&hopt, "step", "step", airTypeDouble, 1, 1, &stepInitial, "1",
"initial step size for gradient descent");
- hestOptAdd(&hopt, "csm", "step", airTypeDouble, 1, 1,
- &constraintStepMin, "0.0001",
+ hestOptAdd(&hopt, "csm", "step", airTypeDouble, 1, 1, &constraintStepMin, "0.0001",
"convergence criterion for constraint satisfaction");
- hestOptAdd(&hopt, "snap", "# iters", airTypeUInt, 1, 1,
- &snap, "0",
+ hestOptAdd(&hopt, "snap", "# iters", airTypeUInt, 1, 1, &snap, "0",
"if non-zero, # iters between saved snapshots");
- hestOptAdd(&hopt, "stim", "# iters", airTypeUInt, 1, 1,
- &stuckIterMax, "5",
+ hestOptAdd(&hopt, "stim", "# iters", airTypeUInt, 1, 1, &stuckIterMax, "5",
"if non-zero, max # iterations to allow a particle "
" to be stuck before nixing");
- hestOptAdd(&hopt, "maxci", "# iters", airTypeUInt, 1, 1,
- &constraintIterMax, "15",
+ hestOptAdd(&hopt, "maxci", "# iters", airTypeUInt, 1, 1, &constraintIterMax, "15",
"if non-zero, max # iterations for contraint enforcement");
- hestOptAdd(&hopt, "irad", "scale", airTypeDouble, 1, 1,
- &radiusSpace, "1",
+ hestOptAdd(&hopt, "irad", "scale", airTypeDouble, 1, 1, &radiusSpace, "1",
"particle radius in spatial domain");
- hestOptAdd(&hopt, "srad", "scale", airTypeDouble, 1, 1,
- &radiusScale, "1",
+ hestOptAdd(&hopt, "srad", "scale", airTypeDouble, 1, 1, &radiusScale, "1",
"particle radius in scale domain");
- hestOptAdd(&hopt, "bws", "bin width", airTypeDouble, 1, 1,
- &binWidthSpace, "1.001",
+ hestOptAdd(&hopt, "bws", "bin width", airTypeDouble, 1, 1, &binWidthSpace, "1.001",
"spatial bin width as multiple of spatial radius");
- hestOptAdd(&hopt, "ess", "scl", airTypeDouble, 1, 1,
- &backStepScale, "0.5",
+ hestOptAdd(&hopt, "ess", "scl", airTypeDouble, 1, 1, &backStepScale, "0.5",
"when energy goes up instead of down, scale step "
"size by this");
- hestOptAdd(&hopt, "oss", "scl", airTypeDouble, 1, 1,
- &opporStepScale, "1.0",
+ hestOptAdd(&hopt, "oss", "scl", airTypeDouble, 1, 1, &opporStepScale, "1.0",
"opportunistic scaling (hopefully up, >1) of step size "
"on every iteration");
- hestOptAdd(&hopt, "edmin", "frac", airTypeDouble, 1, 1,
- &energyDecreaseMin, "0.0001",
+ hestOptAdd(&hopt, "edmin", "frac", airTypeDouble, 1, 1, &energyDecreaseMin, "0.0001",
"convergence threshold: stop when fractional improvement "
"(decrease) in energy dips below this");
- hestOptAdd(&hopt, "ac3c", "ac3c", airTypeBool, 1, 1,
- &allowCodimension3Constraints, "false",
- "allow codimensions 3 constraints");
+ hestOptAdd(&hopt, "ac3c", "ac3c", airTypeBool, 1, 1, &allowCodimension3Constraints,
+ "false", "allow codimensions 3 constraints");
hestOptAdd(&hopt, "sit", "sit", airTypeBool, 1, 1, &scaleIsTau, "false",
"scale is tau");
- hestOptAdd(&hopt, "rng", "seed", airTypeUInt, 1, 1,
- &rngSeed, "42",
+ hestOptAdd(&hopt, "rng", "seed", airTypeUInt, 1, 1, &rngSeed, "42",
"base seed value for RNGs (and as a hack, start index for "
"Halton-based sampling)");
- hestOptAdd(&hopt, "pbm", "mod", airTypeUInt, 1, 1,
- &progressBinMod, "50",
+ hestOptAdd(&hopt, "pbm", "mod", airTypeUInt, 1, 1, &progressBinMod, "50",
"progress bin mod");
- hestOptAdd(&hopt, "nt", "# threads", airTypeInt, 1, 1,
- &threadNum, "1",
+ hestOptAdd(&hopt, "nt", "# threads", airTypeInt, 1, 1, &threadNum, "1",
(airThreadCapable
- ? "number of threads to use"
- : "IF threads had beeen enabled in this Teem build (but "
- "they are NOT), this is how you would control the number "
- "of threads to use"));
+ ? "number of threads to use"
+ : "IF threads had beeen enabled in this Teem build (but "
+ "they are NOT), this is how you would control the number "
+ "of threads to use"));
hestOptAdd(&hopt, "addlog", "fname", airTypeString, 1, 1, &addLogS, "",
"name of file in which to log all particle additions");
hestOptAdd(&hopt, "po", "nout", airTypeString, 1, 1, &posOutS, "",
@@ -479,8 +431,8 @@
hestOptAdd(&hopt, "tvo", "fname", airTypeString, 1, 1, &trcVolOutS, "",
"output filename for rasterized trace of scale-space volume");
- hestParseOrDie(hopt, argc-1, argv+1, hparm,
- me, info, AIR_TRUE, AIR_TRUE, AIR_TRUE);
+ hestParseOrDie(hopt, argc - 1, argv + 1, hparm, me, info, AIR_TRUE, AIR_TRUE,
+ AIR_TRUE);
airMopAdd(mop, hopt, (airMopper)hestOptFree, airMopAlways);
airMopAdd(mop, hopt, (airMopper)hestParseFree, airMopAlways);
@@ -491,7 +443,8 @@
if (airStrlen(addLogS)) {
if (!(addLog = airFopen(addLogS, stdout, "w"))) {
fprintf(stderr, "%s: couldn't open %s for writing\n", me, addLogS);
- airMopError(mop); return 1;
+ airMopError(mop);
+ return 1;
}
airMopAdd(mop, addLog, (airMopper)airFclose, airMopAlways);
} else {
@@ -507,8 +460,7 @@
pctx = pullContextNew();
airMopAdd(mop, pctx, (airMopper)pullContextNix, airMopAlways);
- if (pullVerboseSet(pctx, verbose)
- || pullFlagSet(pctx, pullFlagZeroZ, zeroZ)
+ if (pullVerboseSet(pctx, verbose) || pullFlagSet(pctx, pullFlagZeroZ, zeroZ)
|| pullFlagSet(pctx, pullFlagNixAtVolumeEdgeSpace, nixAtVolumeEdgeSpace)
|| pullFlagSet(pctx, pullFlagConstraintBeforeSeedThresh,
constraintBeforeSeedThresh)
@@ -529,12 +481,10 @@
|| pullSysParmSet(pctx, pullSysParmRadiusSpace, radiusSpace)
|| pullSysParmSet(pctx, pullSysParmRadiusScale, radiusScale)
|| pullSysParmSet(pctx, pullSysParmBinWidthSpace, binWidthSpace)
- || pullSysParmSet(pctx, pullSysParmEnergyDecreaseMin,
- energyDecreaseMin)
+ || pullSysParmSet(pctx, pullSysParmEnergyDecreaseMin, energyDecreaseMin)
|| pullSysParmSet(pctx, pullSysParmBackStepScale, backStepScale)
|| pullSysParmSet(pctx, pullSysParmOpporStepScale, opporStepScale)
- || pullRngSeedSet(pctx, rngSeed)
- || pullProgressBinModSet(pctx, progressBinMod)
+ || pullRngSeedSet(pctx, rngSeed) || pullProgressBinModSet(pctx, progressBinMod)
|| pullThreadNumSet(pctx, threadNum)
|| pullInterEnergySet(pctx, interType, enspR, enspS, enspWin)
|| pullInitLiveThreshUseSet(pctx, liveThresholdOnInit)
@@ -541,34 +491,37 @@
|| pullLogAddSet(pctx, addLog)) {
airMopAdd(mop, err = biffGetDone(PULL), airFree, airMopAlways);
fprintf(stderr, "%s: trouble with flags:\n%s", me, err);
- airMopError(mop); return 1;
+ airMopError(mop);
+ return 1;
}
if (pullInitHaltonSet(pctx, pointNumInitial, rngSeed)) {
airMopAdd(mop, err = biffGetDone(PULL), airFree, airMopAlways);
fprintf(stderr, "%s: trouble setting halton:\n%s", me, err);
- airMopError(mop); return 1;
+ airMopError(mop);
+ return 1;
}
- if (meetPullVolStackBlurParmFinishMulti(vspec, vspecNum,
- &kssFinished, &bspFinished,
+ if (meetPullVolStackBlurParmFinishMulti(vspec, vspecNum, &kssFinished, &bspFinished,
kSSblur, bspec)
|| meetPullVolLoadMulti(vspec, vspecNum, cachePathSS, verbose)
- || meetPullVolAddMulti(pctx, vspec, vspecNum,
- k00, k11, k22, kSSrecon)
+ || meetPullVolAddMulti(pctx, vspec, vspecNum, k00, k11, k22, kSSrecon)
|| meetPullInfoAddMulti(pctx, idef, idefNum)) {
airMopAdd(mop, err = biffGetDone(MEET), airFree, airMopAlways);
fprintf(stderr, "%s: trouble with volumes or infos:\n%s", me, err);
- airMopError(mop); return 1;
+ airMopError(mop);
+ return 1;
}
if (!kssFinished && hestSourceUser == hopt[kssOpi].source) {
- fprintf(stderr, "\n\n%s: WARNING! Used the -%s flag, but the "
- "meetPullVol specified blurring kernels\n\n\n", me,
- hopt[kssOpi].flag);
+ fprintf(stderr,
+ "\n\n%s: WARNING! Used the -%s flag, but the "
+ "meetPullVol specified blurring kernels\n\n\n",
+ me, hopt[kssOpi].flag);
}
if (!bspFinished && hestSourceUser == hopt[bspOpi].source) {
- fprintf(stderr, "\n\n%s: WARNING! Used the -%s flag, but the "
- "meetPullVol specified boundary specs\n\n\n", me,
- hopt[bspOpi].flag);
+ fprintf(stderr,
+ "\n\n%s: WARNING! Used the -%s flag, but the "
+ "meetPullVol specified boundary specs\n\n\n",
+ me, hopt[bspOpi].flag);
}
if (airStrlen(tracesInS)) {
@@ -584,25 +537,26 @@
if (pullStart(pctx)) {
airMopAdd(mop, err = biffGetDone(PULL), airFree, airMopAlways);
fprintf(stderr, "%s: trouble starting system:\n%s", me, err);
- airMopError(mop); return 1;
+ airMopError(mop);
+ return 1;
}
- if (nrrdMaybeAlloc_va(nplotA, nrrdTypeDouble, 2,
- AIR_CAST(size_t, pres[0]),
+ if (nrrdMaybeAlloc_va(nplotA, nrrdTypeDouble, 2, AIR_CAST(size_t, pres[0]),
AIR_CAST(size_t, pres[1]))) {
airMopAdd(mop, err = biffGetDone(NRRD), airFree, airMopAlways);
fprintf(stderr, "%s: trouble creating output:\n%s", me, err);
- airMopError(mop); return 1;
+ airMopError(mop);
+ return 1;
}
if (pullConstraintScaleRange(pctx, ssrange)) {
airMopAdd(mop, err = biffGetDone(PULL), airFree, airMopAlways);
fprintf(stderr, "%s: trouble C:\n%s", me, err);
- airMopError(mop); return 1;
+ airMopError(mop);
+ return 1;
}
- fprintf(stderr, "!%s: ================== ssrange %g %g\n", me,
- ssrange[0], ssrange[1]);
+ fprintf(stderr, "!%s: ================== ssrange %g %g\n", me, ssrange[0], ssrange[1]);
if (vspec[0]->sbp) {
- char stmp[AIR_STRLEN_LARGE];
+ char stmp[AIR_STRLEN_LARGE + 1];
gageStackBlurParmSprint(stmp, vspec[0]->sbp, NULL, NULL);
fprintf(stderr, "!%s: ======== %s\n", me, stmp);
}
@@ -614,12 +568,14 @@
if (airStrlen(tracesInS)) {
if (!(tracesFile = airFopen(tracesInS, stdin, "rb"))) {
fprintf(stderr, "%s: couldn't open %s for reading\n", me, tracesInS);
- airMopError(mop); return 1;
+ airMopError(mop);
+ return 1;
}
if (pullTraceMultiRead(mtrc, tracesFile)) {
airMopAdd(mop, err = biffGetDone(PULL), airFree, airMopAlways);
fprintf(stderr, "%s: trouble reading:\n%s", me, err);
- airMopError(mop); return 1;
+ airMopError(mop);
+ return 1;
}
airFclose(tracesFile);
goto plotting;
@@ -628,12 +584,13 @@
if (!pctx->constraint) {
fprintf(stderr, "%s: this programs requires a constraint\n", me);
- airMopError(mop); return 1;
+ airMopError(mop);
+ return 1;
}
scaleVol = NULL;
{
unsigned int ii;
- for (ii=0; ii<pctx->volNum; ii++) {
+ for (ii = 0; ii < pctx->volNum; ii++) {
if (pctx->vol[ii]->ninScale) {
scaleVol = pctx->vol[ii];
break;
@@ -642,13 +599,15 @@
}
if (!scaleVol) {
fprintf(stderr, "%s: this program requires scale-space\n", me);
- airMopError(mop); return 1;
+ airMopError(mop);
+ return 1;
}
if (pullOutputGet(nPosOut, NULL, NULL, NULL, 0.0, pctx)) {
airMopAdd(mop, err = biffGetDone(PULL), airFree, airMopAlways);
fprintf(stderr, "%s: trouble D:\n%s", me, err);
- airMopError(mop); return 1;
+ airMopError(mop);
+ return 1;
}
if (airStrlen(posOutS)) {
nrrdSave(posOutS, nPosOut, NULL);
@@ -655,11 +614,11 @@
}
{
- double *pos, seedPos[4], scaleWin, scaleStep, dist=0;
+ double *pos, seedPos[4], scaleWin, scaleStep, dist = 0;
unsigned int pidx, pnum, passIdx;
pullTrace *pts;
Nrrd *nsplot, *nprogA, *nprogB, *nlsplot;
- char doneStr[AIR_STRLEN_SMALL];
+ char doneStr[AIR_STRLEN_SMALL + 1];
pos = AIR_CAST(double *, nPosOut->data);
nlsplot = nrrdNew();
@@ -670,32 +629,30 @@
airMopAdd(mop, nprogA, (airMopper)nrrdNuke, airMopAlways);
nprogB = nrrdNew();
airMopAdd(mop, nprogB, (airMopper)nrrdNuke, airMopAlways);
- if (nrrdCopy(nprogA, nplotA)
- || nrrdCopy(nprogB, nplotA)) {
+ if (nrrdCopy(nprogA, nplotA) || nrrdCopy(nprogB, nplotA)) {
airMopAdd(mop, err = biffGetDone(NRRD), airFree, airMopAlways);
fprintf(stderr, "%s: trouble creating nprogs:\n%s", me, err);
- airMopError(mop); return 1;
+ airMopError(mop);
+ return 1;
}
- scaleWin = sswin*(ssrange[1]-ssrange[0]);
- scaleStep = sstep*(ssrange[1]-ssrange[0]);
+ scaleWin = sswin * (ssrange[1] - ssrange[0]);
+ scaleStep = sstep * (ssrange[1] - ssrange[0]);
pnum = nPosOut->axis[1].size;
printf("!%s: tracing initial %u points . . . ", me, pnum);
- for (pidx=0; pidx<pnum; pidx++) {
+ for (pidx = 0; pidx < pnum; pidx++) {
int added;
- printf("%s", airDoneStr(0, pidx, pnum, doneStr)); fflush(stdout);
+ printf("%s", airDoneStr(0, pidx, pnum, doneStr));
+ fflush(stdout);
pts = pullTraceNew();
- ELL_4V_COPY(seedPos, pos + 4*pidx);
- if (pullTraceSet(pctx, pts,
- AIR_TRUE /* recordStrength */,
- scaleStep, scaleWin/2,
- orientTestLen,
- AIR_UINT((scaleWin/2)/scaleStep),
- seedPos)
+ ELL_4V_COPY(seedPos, pos + 4 * pidx);
+ if (pullTraceSet(pctx, pts, AIR_TRUE /* recordStrength */, scaleStep, scaleWin / 2,
+ orientTestLen, AIR_UINT((scaleWin / 2) / scaleStep), seedPos)
|| pullTraceMultiAdd(mtrc, pts, &added)) {
airMopAdd(mop, err = biffGetDone(PULL), airFree, airMopAlways);
fprintf(stderr, "%s: trouble on point %u:\n%s", me, pidx, err);
- airMopError(mop); return 1;
+ airMopError(mop);
+ return 1;
}
if (!added) {
/*
@@ -716,36 +673,35 @@
printf("%s\n", airDoneStr(0, pidx, pnum, doneStr));
if (!mtrc->traceNum) {
fprintf(stderr, "%s: %u initial points led to zero traces\n", me, pnum);
- airMopError(mop); return 1;
+ airMopError(mop);
+ return 1;
}
- if (pullTraceMultiPlotAdd(nprogA, mtrc, NULL,
- strnUse, smoothPlot, flatWght,
- 0, 0, NULL, NULL)) {
+ if (pullTraceMultiPlotAdd(nprogA, mtrc, NULL, strnUse, smoothPlot, flatWght, 0, 0,
+ NULL, NULL)) {
airMopAdd(mop, err = biffGetDone(PULL), airFree, airMopAlways);
fprintf(stderr, "%s: trouble PlotAdd'ing (B):\n%s", me, err);
- airMopError(mop); return 1;
+ airMopError(mop);
+ return 1;
}
resamplePlot(nlsplot, nprogA);
/* savePlot(nlsplot); */
- for (passIdx=0; passIdx<passNumMax; passIdx++) {
+ for (passIdx = 0; passIdx < passNumMax; passIdx++) {
double dd;
- fprintf(stderr, "!%s: pass %u/%u ==================\n",
- me, passIdx, passNumMax);
+ fprintf(stderr, "!%s: pass %u/%u ==================\n", me, passIdx, passNumMax);
nrrdZeroSet(nprogB);
- if (findAndTraceMorePoints(nprogB, pctx, scaleVol,
- strnUse, smoothPlot, flatWght,
- scaleStep, scaleWin/2,
- orientTestLen,
- AIR_UINT((scaleWin/2)/scaleStep),
- mtrc, tracePointNum)
+ if (findAndTraceMorePoints(nprogB, pctx, scaleVol, strnUse, smoothPlot, flatWght,
+ scaleStep, scaleWin / 2, orientTestLen,
+ AIR_UINT((scaleWin / 2) / scaleStep), mtrc,
+ tracePointNum)
|| resamplePlot(nsplot, nprogB)) {
airMopAdd(mop, err = biffGetDone(PULL), airFree, airMopAlways);
fprintf(stderr, "%s: trouble on pass %u:\n%s", me, passIdx, err);
- airMopError(mop); return 1;
+ airMopError(mop);
+ return 1;
}
/* savePlot(nsplot); */
- dd = distanceProb(nsplot, nlsplot)/tracePointNum;
+ dd = distanceProb(nsplot, nlsplot) / tracePointNum;
if (!passIdx) {
dist = dd;
} else {
@@ -752,17 +708,16 @@
dist = AIR_LERP(0.9, dist, dd);
}
fprintf(stderr, "%s: dd = %g -> dist = %g (%s %g)\n", me, dd, dist,
- dist < tpdThresh ? "<" : ">=", tpdThresh);
+ dist < tpdThresh ? "<" : ">=", tpdThresh);
nrrdCopy(nlsplot, nsplot);
if (dist < tpdThresh) {
- fprintf(stderr, "%s: converged: dist %g < thresh %g\n",
- me, dist, tpdThresh);
+ fprintf(stderr, "%s: converged: dist %g < thresh %g\n", me, dist, tpdThresh);
break;
}
}
- if (dist >= tpdThresh) {
- fprintf(stderr, "%s: WARNING did NOT converge: dist %g >= thresh %g\n",
- me, dist, tpdThresh);
+ if (dist >= tpdThresh) {
+ fprintf(stderr, "%s: WARNING did NOT converge: dist %g >= thresh %g\n", me, dist,
+ tpdThresh);
}
if (airStrlen(tracesOutS) && !airStrlen(tracesInS)) {
tracesFile = airFopen(tracesOutS, stdout, "wb");
@@ -769,7 +724,8 @@
if (pullTraceMultiWrite(tracesFile, mtrc)) {
airMopAdd(mop, err = biffGetDone(PULL), airFree, airMopAlways);
fprintf(stderr, "%s: trouble writing:\n%s", me, err);
- airMopError(mop); return 1;
+ airMopError(mop);
+ return 1;
}
fclose(tracesFile);
}
@@ -781,11 +737,11 @@
*/
Nrrd *ntlo;
double *tlo;
- size_t sx=9, totn=0, toti=0;
+ size_t sx = 9, totn = 0, toti = 0;
pullTrace *trc;
pullPoint *lpnt;
unsigned int ti;
- for (ti=0; ti<mtrc->traceNum; ti++) {
+ for (ti = 0; ti < mtrc->traceNum; ti++) {
trc = mtrc->trace[ti];
fprintf(stderr, "!%s: ti %u/%u : stab (%d-D) %u %u\n", me, ti, mtrc->traceNum,
trc->nstab->dim, AIR_UINT(trc->nstab->axis[0].size),
@@ -797,11 +753,12 @@
if (nrrdMaybeAlloc_va(ntlo, nrrdTypeDouble, 2, sx, totn)) {
airMopAdd(mop, err = biffGetDone(NRRD), airFree, airMopAlways);
fprintf(stderr, "%s: couldn't alloc output:\n%s", me, err);
- airMopError(mop); return 1;
+ airMopError(mop);
+ return 1;
}
airMopAdd(mop, ntlo, (airMopper)nrrdNuke, airMopAlways);
tlo = AIR_CAST(double *, ntlo->data);
- for (ti=0; ti<mtrc->traceNum; ti++) {
+ for (ti = 0; ti < mtrc->traceNum; ti++) {
unsigned int vi, vn;
double *vert, *stab, *strn, qual;
trc = mtrc->trace[ti];
@@ -808,14 +765,12 @@
vn = AIR_UINT(trc->nstab->axis[0].size);
vert = AIR_CAST(double *, trc->nvert->data);
stab = AIR_CAST(double *, trc->nstab->data);
- strn = AIR_CAST(double *, (trc->nstrn
- ? trc->nstrn->data
- : NULL));
- for (vi=0; vi<vn; vi++) {
- tlo[sx*toti + 0] = AIR_CAST(double, ti);
- tlo[sx*toti + 1] = (vi == trc->seedIdx);
- ELL_4V_COPY(tlo + sx*toti + 2, vert + 4*vi);
- ELL_4V_COPY(lpnt->pos, vert + 4*vi);
+ strn = AIR_CAST(double *, (trc->nstrn ? trc->nstrn->data : NULL));
+ for (vi = 0; vi < vn; vi++) {
+ tlo[sx * toti + 0] = AIR_CAST(double, ti);
+ tlo[sx * toti + 1] = (vi == trc->seedIdx);
+ ELL_4V_COPY(tlo + sx * toti + 2, vert + 4 * vi);
+ ELL_4V_COPY(lpnt->pos, vert + 4 * vi);
if (pctx->ispec[pullInfoQuality]) {
pullProbe(pctx->task[0], lpnt);
qual = pullPointScalar(pctx, lpnt, pullInfoQuality, NULL, NULL);
@@ -822,9 +777,9 @@
} else {
qual = 0.0;
}
- tlo[sx*toti + 6] = stab[vi];
- tlo[sx*toti + 7] = strn ? strn[vi] : 0.0;
- tlo[sx*toti + 8] = qual;
+ tlo[sx * toti + 6] = stab[vi];
+ tlo[sx * toti + 7] = strn ? strn[vi] : 0.0;
+ tlo[sx * toti + 8] = qual;
toti++;
}
}
@@ -831,7 +786,8 @@
if (nrrdSave(trcListOutS, ntlo, NULL)) {
airMopAdd(mop, err = biffGetDone(NRRD), airFree, airMopAlways);
fprintf(stderr, "%s: couldn't save output:\n%s", me, err);
- airMopError(mop); return 1;
+ airMopError(mop);
+ return 1;
}
}
if (airStrlen(trcVolOutS)) {
@@ -846,10 +802,11 @@
(*ins)(void *v, size_t I, double d);
/* HEY this will segfault around here if the mask volume is
first, because of the following line of code */
- if (!( mpv = meetPullVolCopy(vspec[0]) )) {
+ if (!(mpv = meetPullVolCopy(vspec[0]))) {
airMopAdd(mop, err = biffGetDone(MEET), airFree, airMopAlways);
fprintf(stderr, "%s: couldn't copy volume:\n%s", me, err);
- airMopError(mop); return 1;
+ airMopError(mop);
+ return 1;
}
airMopAdd(mop, mpv, (airMopper)meetPullVolNix, airMopAlways);
/* at this point we actually have to hijack the mpv in case its
@@ -859,14 +816,15 @@
Nrrd *nslice;
nslice = nrrdNew();
airMopAdd(mop, nslice, (airMopper)nrrdNuke, airMopAlways);
- fprintf(stderr, "!%s: slicing %u %s vols to %s\n", me,
- mpv->sbp->num, mpv->kind->name, gageKindScl->name);
- for (ni=0; ni<mpv->sbp->num; ni++) {
+ fprintf(stderr, "!%s: slicing %u %s vols to %s\n", me, mpv->sbp->num,
+ mpv->kind->name, gageKindScl->name);
+ for (ni = 0; ni < mpv->sbp->num; ni++) {
if (nrrdSlice(nslice, mpv->ninSS[ni], 0, 0)
|| nrrdCopy(mpv->ninSS[ni], nslice)) {
airMopAdd(mop, err = biffGetDone(NRRD), airFree, airMopAlways);
fprintf(stderr, "%s: couldn't slice volume %u:\n%s", me, ni, err);
- airMopError(mop); return 1;
+ airMopError(mop);
+ return 1;
}
}
/* can we just do this? */
@@ -879,7 +837,7 @@
printf("!%s: size = (%u,%u,%u,%u)\n", me, size[0], size[1], size[2], size[3]);
lpnt = pullPointNew(pctx);
airMopAdd(mop, lpnt, (airMopper)pullPointNix, airMopAlways);
- for (si=0; si<size[3]; si++) {
+ for (si = 0; si < size[3]; si++) {
nrrdZeroSet(mpv->ninSS[si]);
}
lup = nrrdDLookup[mpv->ninSS[0]->type];
@@ -886,7 +844,7 @@
ins = nrrdDInsert[mpv->ninSS[0]->type];
/* HEY here also assuming scale-space volume is first volume */
pnt = &(pctx->task[0]->vol[0]->gctx->point);
- for (ti=0; ti<mtrc->traceNum; ti++) {
+ for (ti = 0; ti < mtrc->traceNum; ti++) {
unsigned int vi, vn, orn, ori;
double *vert, *stab, *strn, *orin, wght;
trc = mtrc->trace[ti];
@@ -894,23 +852,22 @@
vert = AIR_CAST(double *, trc->nvert->data);
stab = AIR_CAST(double *, trc->nstab->data);
orin = AIR_CAST(double *, trc->norin->data);
- strn = AIR_CAST(double *, (strnUse && trc->nstrn
- ? trc->nstrn->data
- : NULL));
+ strn = AIR_CAST(double *, (strnUse && trc->nstrn ? trc->nstrn->data : NULL));
/* orn = (orin ? 20 : 1); */
orn = 1;
- for (vi=0; vi<vn; vi++) {
- for (ori=0; ori < orn; ori++) {
- ELL_4V_COPY(lpnt->pos, vert + 4*vi);
+ for (vi = 0; vi < vn; vi++) {
+ for (ori = 0; ori < orn; ori++) {
+ ELL_4V_COPY(lpnt->pos, vert + 4 * vi);
if (orn > 1) {
/* hack to draw a dotted line along tangent */
- double oscl = AIR_AFFINE(0, ori, orn-1, -100, 100);
- lpnt->pos[0] += oscl*(orin + 3*vi)[0];
- lpnt->pos[1] += oscl*(orin + 3*vi)[1];
+ double oscl = AIR_AFFINE(0, ori, orn - 1, -100, 100);
+ lpnt->pos[0] += oscl * (orin + 3 * vi)[0];
+ lpnt->pos[1] += oscl * (orin + 3 * vi)[1];
}
if (zeroZ && lpnt->pos[2] != 0) {
fprintf(stderr, "%s: zeroZ violated\n", me);
- airMopError(mop); return 1;
+ airMopError(mop);
+ return 1;
}
wght = stab[vi];
if (strn) {
@@ -920,16 +877,17 @@
if (pullProbe(pctx->task[0], lpnt)) {
airMopAdd(mop, err = biffGetDone(PULL), airFree, airMopAlways);
fprintf(stderr, "%s: couldn't probe:\n%s", me, err);
- airMopError(mop); return 1;
+ airMopError(mop);
+ return 1;
}
ELL_4V_ADD2(idxd, pnt->frac, pnt->idx);
/* because of gage subtlety that gagePoint->idx is index
of upper, not lower, corner, idxd is too big by 1 */
- idx[0] = airIndexClamp(-0.5, idxd[0]-1, size[0]-0.5, size[0]);
- idx[1] = airIndexClamp(-0.5, idxd[1]-1, size[1]-0.5, size[1]);
- idx[2] = airIndexClamp(-0.5, idxd[2]-1, size[2]-0.5, size[2]);
- idx[3] = airIndexClamp(0, idxd[3], size[3]-1, size[3]);
- iii = idx[0] + size[0]*(idx[1] + size[1]*idx[2]);
+ idx[0] = airIndexClamp(-0.5, idxd[0] - 1, size[0] - 0.5, size[0]);
+ idx[1] = airIndexClamp(-0.5, idxd[1] - 1, size[1] - 0.5, size[1]);
+ idx[2] = airIndexClamp(-0.5, idxd[2] - 1, size[2] - 0.5, size[2]);
+ idx[3] = airIndexClamp(0, idxd[3], size[3] - 1, size[3]);
+ iii = idx[0] + size[0] * (idx[1] + size[1] * idx[2]);
val = lup(mpv->ninSS[idx[3]]->data, iii);
ins(mpv->ninSS[idx[3]]->data, iii, wght + val);
/*
@@ -943,25 +901,25 @@
}
nout = nrrdNew();
airMopAdd(mop, nout, (airMopper)nrrdNuke, airMopAlways);
- if (nrrdJoin(nout, AIR_CAST(const Nrrd *const *, mpv->ninSS),
- size[3], 3, AIR_FALSE)
+ if (nrrdJoin(nout, AIR_CAST(const Nrrd *const *, mpv->ninSS), size[3], 3,
+ AIR_FALSE)
|| nrrdSave(trcVolOutS, nout, NULL)) {
airMopAdd(mop, err = biffGetDone(NRRD), airFree, airMopAlways);
fprintf(stderr, "%s: couldn't join or save SS output:\n%s", me, err);
- airMopError(mop); return 1;
+ airMopError(mop);
+ return 1;
}
}
- if (pullTraceMultiPlotAdd(nplotA, mtrc, NULL,
- strnUse, smoothPlot, flatWght,
- 0, 0, nmaskedpos, nTraceMaskIn)
+ if (pullTraceMultiPlotAdd(nplotA, mtrc, NULL, strnUse, smoothPlot, flatWght, 0, 0,
+ nmaskedpos, nTraceMaskIn)
/* || pullTraceMultiFilterConcaveDown(nfilt, mtrc, 0.05) */
/* The filter concave down idea didn't really work */
- || pullTraceMultiPlotAdd(nplotB, mtrc, NULL /* nfilt */,
- AIR_TRUE, smoothPlot, flatWght,
- 0, 0, NULL, NULL)) {
+ || pullTraceMultiPlotAdd(nplotB, mtrc, NULL /* nfilt */, AIR_TRUE, smoothPlot,
+ flatWght, 0, 0, NULL, NULL)) {
airMopAdd(mop, err = biffGetDone(PULL), airFree, airMopAlways);
fprintf(stderr, "%s: trouble PlotAdd'ing (C):\n%s", me, err);
- airMopError(mop); return 1;
+ airMopError(mop);
+ return 1;
}
{
const Nrrd *nin[2];
@@ -970,19 +928,22 @@
if (nrrdJoin(nplot, nin, 2, 0, AIR_TRUE)) {
airMopAdd(mop, err = biffGetDone(NRRD), airFree, airMopAlways);
fprintf(stderr, "%s: trouble E:\n%s", me, err);
- airMopError(mop); return 1;
+ airMopError(mop);
+ return 1;
}
}
if (nrrdSave(outS, nplot, NULL)) {
airMopAdd(mop, err = biffGetDone(NRRD), airFree, airMopAlways);
fprintf(stderr, "%s: trouble F:\n%s", me, err);
- airMopError(mop); return 1;
+ airMopError(mop);
+ return 1;
}
if (nmaskedpos && nmaskedpos->data && airStrlen(traceMaskPosOutS)) {
if (nrrdSave(traceMaskPosOutS, nmaskedpos, NULL)) {
airMopAdd(mop, err = biffGetDone(NRRD), airFree, airMopAlways);
fprintf(stderr, "%s: trouble G:\n%s", me, err);
- airMopError(mop); return 1;
+ airMopError(mop);
+ return 1;
}
}
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <kin...@us...> - 2023-07-08 11:27:13
|
Revision: 7051
http://sourceforge.net/p/teem/code/7051
Author: kindlmann
Date: 2023-07-08 11:27:11 +0000 (Sat, 08 Jul 2023)
Log Message:
-----------
Propagating AIR_STRLEN --> AIR_STRLEN+1, with API CHANGE to struct:
miteUser
char shadeStr[AIR_STRLEN_MED + 1], /* how to do shading */
normalStr[AIR_STRLEN_MED + 1]; /* what is the "surface normal" */
Modified Paths:
--------------
teem/trunk/src/mite/mite.h
teem/trunk/src/mite/shade.c
teem/trunk/src/mite/txf.c
Modified: teem/trunk/src/mite/mite.h
===================================================================
--- teem/trunk/src/mite/mite.h 2023-07-08 11:21:19 UTC (rev 7050)
+++ teem/trunk/src/mite/mite.h 2023-07-08 11:27:11 UTC (rev 7051)
@@ -147,8 +147,8 @@
specification, its up to them to verify that the normalStr and the
shadeStr refer to the same vector.
*/
- char shadeStr[AIR_STRLEN_MED], /* how to do shading */
- normalStr[AIR_STRLEN_MED]; /* what is the "surface normal" */
+ char shadeStr[AIR_STRLEN_MED + 1], /* how to do shading */
+ normalStr[AIR_STRLEN_MED + 1]; /* what is the "surface normal" */
/* for each possible element of the txf range, what value should it
start at prior to rendering. Mainly needed to store non-unity values
for the quantities not covered by a transfer function */
Modified: teem/trunk/src/mite/shade.c
===================================================================
--- teem/trunk/src/mite/shade.c 2023-07-08 11:21:19 UTC (rev 7050)
+++ teem/trunk/src/mite/shade.c 2023-07-08 11:27:11 UTC (rev 7051)
@@ -175,7 +175,7 @@
void
miteShadeSpecPrint(char *buff, const miteShadeSpec *shpec) {
static const char me[] = "miteShadeSpecPrint";
- char var[4][AIR_STRLEN_MED];
+ char var[4][AIR_STRLEN_MED + 1];
if (buff && shpec) {
switch (shpec->method) {
Modified: teem/trunk/src/mite/txf.c
===================================================================
--- teem/trunk/src/mite/txf.c 2023-07-08 11:21:19 UTC (rev 7050)
+++ teem/trunk/src/mite/txf.c 2023-07-08 11:27:11 UTC (rev 7051)
@@ -257,10 +257,10 @@
return 1;
}
if (airStrlen(rangeStr) != ntxf->axis[0].size) {
- char stmp1[AIR_STRLEN_SMALL], stmp2[AIR_STRLEN_SMALL];
+ char stmp[2][AIR_STRLEN_SMALL + 1];
biffAddf(MITE, "%s: axis[0]'s size %s, but label specifies %s values", me,
- airSprintSize_t(stmp1, ntxf->axis[0].size),
- airSprintSize_t(stmp2, airStrlen(rangeStr)));
+ airSprintSize_t(stmp[0], ntxf->axis[0].size),
+ airSprintSize_t(stmp[1], airStrlen(rangeStr)));
return 1;
}
for (rii = 0; rii < airStrlen(rangeStr); rii++) {
@@ -300,7 +300,7 @@
/* has to be right length for one of the quantization schemes */
ilog2 = airLog2(ntxf->axis[axi].size);
if (-1 == ilog2) {
- char stmp[AIR_STRLEN_SMALL];
+ char stmp[AIR_STRLEN_SMALL + 1];
biffAddf(MITE, "%s: txf axis size for %s must be power of 2 (not %s)", me,
domStr, airSprintSize_t(stmp, ntxf->axis[axi].size));
return 1;
@@ -592,7 +592,7 @@
if (1 == isp.kind->table[isp.item].answerLength) {
stage->qn = NULL;
} else if (3 == isp.kind->table[isp.item].answerLength) {
- char stmp[AIR_STRLEN_SMALL];
+ char stmp[AIR_STRLEN_SMALL + 1];
ilog2 = AIR_UINT(airLog2(ntxf->axis[di].size));
switch (ilog2) {
case 8:
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <kin...@us...> - 2023-07-08 11:21:21
|
Revision: 7050
http://sourceforge.net/p/teem/code/7050
Author: kindlmann
Date: 2023-07-08 11:21:19 +0000 (Sat, 08 Jul 2023)
Log Message:
-----------
Propagating AIR_STRLEN --> AIR_STRLEN +1, with this API CHANGE to struct:
pushEnergy:
char name[AIR_STRLEN_SMALL + 1];
Modified Paths:
--------------
teem/trunk/src/push/corePush.c
teem/trunk/src/push/forces.c
teem/trunk/src/push/push.h
Modified: teem/trunk/src/push/corePush.c
===================================================================
--- teem/trunk/src/push/corePush.c 2023-07-08 11:18:37 UTC (rev 7049)
+++ teem/trunk/src/push/corePush.c 2023-07-08 11:21:19 UTC (rev 7050)
@@ -305,7 +305,7 @@
int /* Biff: 1 */
pushRun(pushContext *pctx) {
static const char me[] = "pushRun";
- char poutS[AIR_STRLEN_MED], toutS[AIR_STRLEN_MED];
+ char poutS[AIR_STRLEN_MED + 1], toutS[AIR_STRLEN_MED + 1];
Nrrd *npos, *nten;
double time0, time1, enrLast, enrNew = AIR_NAN, enrImprov = AIR_NAN,
enrImprovAvg = AIR_NAN;
Modified: teem/trunk/src/push/forces.c
===================================================================
--- teem/trunk/src/push/forces.c 2023-07-08 11:18:37 UTC (rev 7049)
+++ teem/trunk/src/push/forces.c 2023-07-08 11:21:19 UTC (rev 7050)
@@ -404,7 +404,7 @@
}
static int
-_pushHestEnergyParse(void *ptr, const char *str, char err[AIR_STRLEN_HUGE]) {
+_pushHestEnergyParse(void *ptr, const char *str, char err[AIR_STRLEN_HUGE + 1]) {
pushEnergySpec **enspP;
static const char me[] = "_pushHestForceParse";
char *perr;
@@ -417,7 +417,7 @@
*enspP = pushEnergySpecNew();
if (pushEnergySpecParse(*enspP, str)) {
perr = biffGetDone(PUSH);
- airStrcpy(err, AIR_STRLEN_HUGE, perr);
+ airStrcpy(err, AIR_STRLEN_HUGE + 1, perr);
free(perr);
return 1;
}
Modified: teem/trunk/src/push/push.h
===================================================================
--- teem/trunk/src/push/push.h 2023-07-08 11:18:37 UTC (rev 7049)
+++ teem/trunk/src/push/push.h 2023-07-08 11:21:19 UTC (rev 7050)
@@ -135,7 +135,7 @@
** non-NULL pointers into which to store energy and force
*/
typedef struct {
- char name[AIR_STRLEN_SMALL];
+ char name[AIR_STRLEN_SMALL + 1];
unsigned int parmNum;
void (*eval)(double *energy, double *force, double dist,
const double parm[PUSH_ENERGY_PARM_NUM]);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <kin...@us...> - 2023-07-08 11:18:39
|
Revision: 7049
http://sourceforge.net/p/teem/code/7049
Author: kindlmann
Date: 2023-07-08 11:18:37 +0000 (Sat, 08 Jul 2023)
Log Message:
-----------
Propagating AIR_STRLEN --> AIR_STRLEN+1, with these API CHANGEs to structs:
coilMethod:
char name[AIR_STRLEN_SMALL + 1];
coilKind:
char name[AIR_STRLEN_SMALL + 1]; /* short identifying string for kind */
Modified Paths:
--------------
teem/trunk/src/coil/coil.h
teem/trunk/src/coil/methodsCoil.c
Modified: teem/trunk/src/coil/coil.h
===================================================================
--- teem/trunk/src/coil/coil.h 2023-07-08 11:13:40 UTC (rev 7048)
+++ teem/trunk/src/coil/coil.h 2023-07-08 11:18:37 UTC (rev 7049)
@@ -105,7 +105,7 @@
** running one method, regardless of kind
*/
typedef struct {
- char name[AIR_STRLEN_SMALL];
+ char name[AIR_STRLEN_SMALL + 1];
int type; /* from coilMethodType* enum */
int numParm; /* number of parameters we need */
} coilMethod;
@@ -136,11 +136,11 @@
** at some point in the future where appropriate.
*/
typedef struct {
- char name[AIR_STRLEN_SMALL]; /* short identifying string for kind */
- unsigned int valLen; /* number of scalars per data point
- 1 for plain scalars (baseDim=0),
- or something else (baseDim=1) */
- /* all the available methods */
+ char name[AIR_STRLEN_SMALL + 1]; /* short identifying string for kind */
+ unsigned int valLen; /* number of scalars per data point
+ 1 for plain scalars (baseDim=0),
+ or something else (baseDim=1) */
+ /* all the available methods */
void (*filter[COIL_METHOD_TYPE_MAX + 1])(coil_t *delta, int xi, int yi, int zi,
coil_t **iv3, double spacing[3],
double parm[COIL_PARMS_NUM]);
Modified: teem/trunk/src/coil/methodsCoil.c
===================================================================
--- teem/trunk/src/coil/methodsCoil.c 2023-07-08 11:13:40 UTC (rev 7048)
+++ teem/trunk/src/coil/methodsCoil.c 2023-07-08 11:18:37 UTC (rev 7049)
@@ -127,7 +127,7 @@
sy = nin->axis[1 + baseDim].size;
sz = nin->axis[2 + baseDim].size;
if (sz < numThreads) {
- char stmp[AIR_STRLEN_SMALL];
+ char stmp[AIR_STRLEN_SMALL + 1];
airSprintSize_t(stmp, sz);
fprintf(stderr,
"%s: wanted %d threads but volume only has %s slices, "
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
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.
|
|
From: <kin...@us...> - 2023-07-07 21:53:35
|
Revision: 7047
http://sourceforge.net/p/teem/code/7047
Author: kindlmann
Date: 2023-07-07 21:53:33 +0000 (Fri, 07 Jul 2023)
Log Message:
-----------
Propaging AIR_STRLEN --> AIR_STRLEN+1, with API CHANGEs to these structs:
tenModel:
char name[AIR_STRLEN_SMALL + 1];
char *(*sprint)(char str[AIR_STRLEN_MED + 1], const double *parm);
tenModelParmDesc:
char name[AIR_STRLEN_SMALL + 1]; /* name */
Modified Paths:
--------------
teem/trunk/src/ten/aniso.c
teem/trunk/src/ten/bimod.c
teem/trunk/src/ten/bvec.c
teem/trunk/src/ten/chan.c
teem/trunk/src/ten/epireg.c
teem/trunk/src/ten/estimate.c
teem/trunk/src/ten/experSpec.c
teem/trunk/src/ten/glyph.c
teem/trunk/src/ten/grads.c
teem/trunk/src/ten/miscTen.c
teem/trunk/src/ten/model1Cylinder.c
teem/trunk/src/ten/model1Stick.c
teem/trunk/src/ten/model1Tensor2.c
teem/trunk/src/ten/model1Unit2D.c
teem/trunk/src/ten/model1Vector2D.c
teem/trunk/src/ten/model2Unit2D.c
teem/trunk/src/ten/modelB0.c
teem/trunk/src/ten/modelBall.c
teem/trunk/src/ten/modelBall1Cylinder.c
teem/trunk/src/ten/modelBall1Stick.c
teem/trunk/src/ten/modelBall1StickEMD.c
teem/trunk/src/ten/modelZero.c
teem/trunk/src/ten/path.c
teem/trunk/src/ten/ten.h
teem/trunk/src/ten/tenModel.c
teem/trunk/src/ten/tendAbout.c
teem/trunk/src/ten/tendBfit.c
teem/trunk/src/ten/tendFlotsam.c
teem/trunk/src/ten/tendGlyph.c
teem/trunk/src/ten/tendSatin.c
teem/trunk/src/ten/tensor.c
teem/trunk/src/ten/test/csim.c
teem/trunk/src/ten/test/tensorDotDat.c
teem/trunk/src/ten/triple.c
Modified: teem/trunk/src/ten/aniso.c
===================================================================
--- teem/trunk/src/ten/aniso.c 2023-07-07 21:43:30 UTC (rev 7046)
+++ teem/trunk/src/ten/aniso.c 2023-07-07 21:53:33 UTC (rev 7047)
@@ -1216,12 +1216,12 @@
}
if (nrrdElementNumber(nwght)
!= nrrdElementNumber(nin) / nrrdKindSize(nrrdKind3DMaskedSymMatrix)) {
- char stmp1[AIR_STRLEN_SMALL], stmp2[AIR_STRLEN_SMALL];
+ char stmp[2][AIR_STRLEN_SMALL + 1];
size_t numten;
numten = nrrdElementNumber(nin) / nrrdKindSize(nrrdKind3DMaskedSymMatrix);
biffAddf(TEN, "%s: # elements in weight nrrd (%s) != # tensors (%s)", me,
- airSprintSize_t(stmp1, nrrdElementNumber(nwght)),
- airSprintSize_t(stmp2, numten));
+ airSprintSize_t(stmp[0], nrrdElementNumber(nwght)),
+ airSprintSize_t(stmp[1], numten));
return 1;
}
}
Modified: teem/trunk/src/ten/bimod.c
===================================================================
--- teem/trunk/src/ten/bimod.c 2023-07-07 21:43:30 UTC (rev 7046)
+++ teem/trunk/src/ten/bimod.c 2023-07-07 21:53:33 UTC (rev 7047)
@@ -249,7 +249,7 @@
static void
_tenEMBimodalSaveImage(tenEMBimodalParm *biparm) {
- char name[AIR_STRLEN_MED];
+ char name[AIR_STRLEN_MED + 1];
Nrrd *nh, *nm, *nhi, *nmi, *ni;
NrrdRange *range;
const Nrrd *nhmhi[3];
Modified: teem/trunk/src/ten/bvec.c
===================================================================
--- teem/trunk/src/ten/bvec.c 2023-07-07 21:43:30 UTC (rev 7046)
+++ teem/trunk/src/ten/bvec.c 2023-07-07 21:53:33 UTC (rev 7047)
@@ -102,7 +102,7 @@
int map[NRRD_DIM_MAX], vecSize, iter;
size_t ii, size[NRRD_DIM_MAX], vecI, vecNum;
char *vec;
- double *out, ss[AIR_STRLEN_SMALL], amp, dec, d_amp, d_dec, error, diff,
+ double *out, ss[AIR_STRLEN_SMALL + 1], amp, dec, d_amp, d_dec, error, diff,
(*vecLup)(const void *v, size_t I);
if (!(nout && nin && bb && ww)) {
@@ -114,10 +114,10 @@
biffAddf(TEN, "%s: nin->dim (%d) not >= 2", me, nin->dim);
return 1;
}
- if (!(nin->axis[0].size < AIR_STRLEN_SMALL)) {
- char stmp[AIR_STRLEN_SMALL];
+ if (!(nin->axis[0].size < AIR_STRLEN_SMALL + 1)) {
+ char stmp[AIR_STRLEN_SMALL + 1];
biffAddf(TEN, "%s: sorry need nin->axis[0].size (%s) < %d", me,
- airSprintSize_t(stmp, nin->axis[0].size), AIR_STRLEN_SMALL);
+ airSprintSize_t(stmp, nin->axis[0].size), AIR_STRLEN_SMALL + 1);
return 1;
}
Modified: teem/trunk/src/ten/chan.c
===================================================================
--- teem/trunk/src/ten/chan.c 2023-07-07 21:43:30 UTC (rev 7046)
+++ teem/trunk/src/ten/chan.c 2023-07-07 21:53:33 UTC (rev 7047)
@@ -60,7 +60,7 @@
tenDWMRIKeyValueParse(Nrrd **ngradP, Nrrd **nbmatP, double *bP, unsigned int **skipP,
unsigned int *skipNumP, const Nrrd *ndwi) {
static const char me[] = "tenDWMRIKeyValueParse";
- char tmpKey[AIR_STRLEN_MED], key[AIR_STRLEN_MED], *val;
+ char tmpKey[AIR_STRLEN_MED + 1], key[AIR_STRLEN_MED + 1], *val;
const char *keyFmt;
int dwiAxis;
unsigned int axi, dwiIdx, dwiNum, valNum, valIdx, parsedNum, nexNum, nexIdx, skipIdx,
@@ -638,7 +638,7 @@
double *emat, *bmat, *vbuf;
NrrdRange *range;
float te, d1, d2;
- char stmp[2][AIR_STRLEN_SMALL];
+ char stmp[2][AIR_STRLEN_SMALL + 1];
if (!(nten && ndwi && _nbmat)) {
/* nerrP and _NB0P can be NULL */
@@ -876,7 +876,7 @@
airArray *mop;
double *bmat;
float *dwi, *ten, (*lup)(const void *, size_t I);
- char stmp[6][AIR_STRLEN_SMALL];
+ char stmp[6][AIR_STRLEN_SMALL + 1];
if (!ndwi || !nT2 || !nten || !_nbmat
|| tenTensorCheck(nten, nrrdTypeFloat, AIR_TRUE, AIR_TRUE)
Modified: teem/trunk/src/ten/epireg.c
===================================================================
--- teem/trunk/src/ten/epireg.c 2023-07-07 21:43:30 UTC (rev 7046)
+++ teem/trunk/src/ten/epireg.c 2023-07-07 21:53:33 UTC (rev 7047)
@@ -67,7 +67,7 @@
return 1;
}
if (dwiLen != ngrad->axis[1].size) {
- char stmp[AIR_STRLEN_SMALL];
+ char stmp[AIR_STRLEN_SMALL + 1];
biffAddf(TEN, "%s: got %u DWIs, but %s gradient directions", me, dwiLen,
airSprintSize_t(stmp, ngrad->axis[1].size));
return 1;
@@ -1244,7 +1244,7 @@
}
*/
if (ninLen != _ngrad->axis[1].size) {
- char stmp[AIR_STRLEN_SMALL];
+ char stmp[AIR_STRLEN_SMALL + 1];
biffAddf(TEN, "%s: ninLen %u != # grads %s", me, ninLen,
airSprintSize_t(stmp, _ngrad->axis[1].size));
return 1;
Modified: teem/trunk/src/ten/estimate.c
===================================================================
--- teem/trunk/src/ten/estimate.c 2023-07-07 21:43:30 UTC (rev 7046)
+++ teem/trunk/src/ten/estimate.c 2023-07-07 21:53:33 UTC (rev 7047)
@@ -1043,7 +1043,7 @@
unsigned int tt, allIdx;
int axmap[4], E;
airArray *mop;
- char stmp[3][AIR_STRLEN_SMALL];
+ char stmp[3][AIR_STRLEN_SMALL + 1];
if (!(tec && ndwi && nB0 && nten)) {
biffAddf(TEN, "%s: got NULL pointer", me);
@@ -1126,7 +1126,7 @@
return 1;
}
if (keyValueSet) {
- char keystr[AIR_STRLEN_MED], valstr[AIR_STRLEN_MED];
+ char keystr[AIR_STRLEN_MED + 1], valstr[AIR_STRLEN_MED + 1];
nrrdKeyValueAdd(ndwi, tenDWMRIModalityKey, tenDWMRIModalityVal);
sprintf(valstr, "%g", bValue);
@@ -1811,7 +1811,7 @@
unsigned int dd;
airArray *mop;
int axmap[4];
- char stmp[AIR_STRLEN_SMALL];
+ char stmp[AIR_STRLEN_SMALL + 1];
#if 0
# define NUM 800
Modified: teem/trunk/src/ten/experSpec.c
===================================================================
--- teem/trunk/src/ten/experSpec.c 2023-07-07 21:43:30 UTC (rev 7046)
+++ teem/trunk/src/ten/experSpec.c 2023-07-07 21:53:33 UTC (rev 7047)
@@ -327,7 +327,7 @@
int /* Biff: 1 */
tenDWMRIKeyValueFromExperSpecSet(Nrrd *ndwi, const tenExperSpec *espec) {
static const char me[] = "tenDWMRIKeyValueFromExperSpecSet";
- char keystr[AIR_STRLEN_MED], valstr[AIR_STRLEN_MED];
+ char keystr[AIR_STRLEN_MED + 1], valstr[AIR_STRLEN_MED + 1];
double maxb, bb;
unsigned int ii;
Modified: teem/trunk/src/ten/glyph.c
===================================================================
--- teem/trunk/src/ten/glyph.c 2023-07-07 21:43:30 UTC (rev 7046)
+++ teem/trunk/src/ten/glyph.c 2023-07-07 21:53:33 UTC (rev 7047)
@@ -74,7 +74,7 @@
static const char me[] = "tenGlyphParmCheck";
int duh;
size_t tenSize[3];
- char stmp[5][AIR_STRLEN_SMALL];
+ char stmp[5][AIR_STRLEN_SMALL + 1];
if (!(parm && nten)) {
biffAddf(TEN, "%s: got NULL pointer", me);
@@ -184,7 +184,7 @@
int lookIdx;
echoObject *eglyph, *inst, *list = NULL, *split, *esquare;
echoPos_t eM[16], originOffset[3], edge0[3], edge1[3];
- char stmp[AIR_STRLEN_SMALL];
+ char stmp[AIR_STRLEN_SMALL + 1];
/*
int eret;
double tmp1[3], tmp2[3];
Modified: teem/trunk/src/ten/grads.c
===================================================================
--- teem/trunk/src/ten/grads.c 2023-07-07 21:43:30 UTC (rev 7046)
+++ teem/trunk/src/ten/grads.c 2023-07-07 21:53:33 UTC (rev 7047)
@@ -72,7 +72,7 @@
return 1;
}
if (!(3 == ngrad->axis[0].size && 2 == ngrad->dim)) {
- char stmp[AIR_STRLEN_SMALL];
+ char stmp[AIR_STRLEN_SMALL + 1];
biffAddf(TEN, "%s: need a 3xN 2-D array (not a %sx? %u-D array)", me,
airSprintSize_t(stmp, ngrad->axis[0].size), ngrad->dim);
return 1;
@@ -88,7 +88,7 @@
return 1;
}
if (!(minnum <= ngrad->axis[1].size)) {
- char stmp[AIR_STRLEN_SMALL];
+ char stmp[AIR_STRLEN_SMALL + 1];
biffAddf(TEN, "%s: have only %s gradients, need at least %d", me,
airSprintSize_t(stmp, ngrad->axis[1].size), minnum);
return 1;
@@ -458,7 +458,7 @@
int /* Biff: 1 */
tenGradientDistribute(Nrrd *nout, const Nrrd *nin, tenGradientParm *tgparm) {
static const char me[] = "tenGradientDistribute";
- char filename[AIR_STRLEN_SMALL];
+ char filename[AIR_STRLEN_SMALL + 1];
unsigned int ii, num, iter, oldIdx, newIdx, edgeShrink;
airArray *mop;
Nrrd *npos[2];
Modified: teem/trunk/src/ten/miscTen.c
===================================================================
--- teem/trunk/src/ten/miscTen.c 2023-07-07 21:43:30 UTC (rev 7046)
+++ teem/trunk/src/ten/miscTen.c 2023-07-07 21:53:33 UTC (rev 7047)
@@ -41,7 +41,7 @@
return 1;
}
if (!(2 <= nin->dim && 7 == nin->axis[0].size)) {
- char stmp[AIR_STRLEN_SMALL];
+ char stmp[AIR_STRLEN_SMALL + 1];
biffAddf(TEN,
"%s: need nin->dim >= 2 (not %u), axis[0].size == 7 "
"(not %s)",
@@ -217,7 +217,7 @@
return 1;
}
if (!(6 == nbmat->axis[0].size && 2 == nbmat->dim)) {
- char stmp[AIR_STRLEN_SMALL];
+ char stmp[AIR_STRLEN_SMALL + 1];
biffAddf(TEN, "%s: need a 6xN 2-D array (not a %s x? %d-D array)", me,
airSprintSize_t(stmp, nbmat->axis[0].size), nbmat->dim);
return 1;
Modified: teem/trunk/src/ten/model1Cylinder.c
===================================================================
--- teem/trunk/src/ten/model1Cylinder.c 2023-07-07 21:43:30 UTC (rev 7046)
+++ teem/trunk/src/ten/model1Cylinder.c 2023-07-07 21:53:33 UTC (rev 7047)
@@ -58,7 +58,7 @@
}
static char *
-parmSprint(char str[AIR_STRLEN_MED], const double *parm) {
+parmSprint(char str[AIR_STRLEN_MED+1], const double *parm) {
sprintf(str, "(%g) %gX%g (%g,%g,%g)", parm[0],
parm[1], parm[2], parm[3], parm[4], parm[5]);
return str;
Modified: teem/trunk/src/ten/model1Stick.c
===================================================================
--- teem/trunk/src/ten/model1Stick.c 2023-07-07 21:43:30 UTC (rev 7046)
+++ teem/trunk/src/ten/model1Stick.c 2023-07-07 21:53:33 UTC (rev 7047)
@@ -52,7 +52,7 @@
}
static char *
-parmSprint(char str[AIR_STRLEN_MED], const double *parm) {
+parmSprint(char str[AIR_STRLEN_MED+1], const double *parm) {
sprintf(str, "(%g) %g (%g,%g,%g)", parm[0], parm[1],
parm[2], parm[3], parm[4]);
return str;
Modified: teem/trunk/src/ten/model1Tensor2.c
===================================================================
--- teem/trunk/src/ten/model1Tensor2.c 2023-07-07 21:43:30 UTC (rev 7046)
+++ teem/trunk/src/ten/model1Tensor2.c 2023-07-07 21:53:33 UTC (rev 7047)
@@ -56,7 +56,7 @@
}
static char *
-parmSprint(char str[AIR_STRLEN_MED], const double *parm) {
+parmSprint(char str[AIR_STRLEN_MED+1], const double *parm) {
sprintf(str, "(%g) [%g %g %g; %g %g; %g]", parm[0],
parm[1], parm[2], parm[3],
parm[4], parm[5],
Modified: teem/trunk/src/ten/model1Unit2D.c
===================================================================
--- teem/trunk/src/ten/model1Unit2D.c 2023-07-07 21:43:30 UTC (rev 7046)
+++ teem/trunk/src/ten/model1Unit2D.c 2023-07-07 21:53:33 UTC (rev 7047)
@@ -45,7 +45,7 @@
}
static char *
-parmSprint(char str[AIR_STRLEN_MED], const double *parm) {
+parmSprint(char str[AIR_STRLEN_MED+1], const double *parm) {
sprintf(str, "(%g) th=%g", parm[0], parm[1]);
return str;
}
Modified: teem/trunk/src/ten/model1Vector2D.c
===================================================================
--- teem/trunk/src/ten/model1Vector2D.c 2023-07-07 21:43:30 UTC (rev 7046)
+++ teem/trunk/src/ten/model1Vector2D.c 2023-07-07 21:53:33 UTC (rev 7047)
@@ -47,7 +47,7 @@
}
static char *
-parmSprint(char str[AIR_STRLEN_MED], const double *parm) {
+parmSprint(char str[AIR_STRLEN_MED+1], const double *parm) {
sprintf(str, "(%g) r=%g th=%g", parm[0], parm[1], parm[2]);
return str;
}
Modified: teem/trunk/src/ten/model2Unit2D.c
===================================================================
--- teem/trunk/src/ten/model2Unit2D.c 2023-07-07 21:43:30 UTC (rev 7046)
+++ teem/trunk/src/ten/model2Unit2D.c 2023-07-07 21:53:33 UTC (rev 7047)
@@ -53,7 +53,7 @@
}
static char *
-parmSprint(char str[AIR_STRLEN_MED], const double *parm) {
+parmSprint(char str[AIR_STRLEN_MED+1], const double *parm) {
sprintf(str, "(%g) (1-f)*th0=%g + (f=%g)*th1=%g",
parm[0], parm[1], parm[2], parm[3]);
return str;
Modified: teem/trunk/src/ten/modelB0.c
===================================================================
--- teem/trunk/src/ten/modelB0.c 2023-07-07 21:43:30 UTC (rev 7046)
+++ teem/trunk/src/ten/modelB0.c 2023-07-07 21:53:33 UTC (rev 7047)
@@ -42,7 +42,7 @@
}
static char *
-parmSprint(char str[AIR_STRLEN_MED], const double *parm) {
+parmSprint(char str[AIR_STRLEN_MED+1], const double *parm) {
sprintf(str, "(%g)", parm[0]);
return str;
}
Modified: teem/trunk/src/ten/modelBall.c
===================================================================
--- teem/trunk/src/ten/modelBall.c 2023-07-07 21:43:30 UTC (rev 7046)
+++ teem/trunk/src/ten/modelBall.c 2023-07-07 21:53:33 UTC (rev 7047)
@@ -44,7 +44,7 @@
}
static char *
-parmSprint(char str[AIR_STRLEN_MED], const double *parm) {
+parmSprint(char str[AIR_STRLEN_MED+1], const double *parm) {
sprintf(str, "(%g) %g", parm[0], parm[1]);
return str;
}
Modified: teem/trunk/src/ten/modelBall1Cylinder.c
===================================================================
--- teem/trunk/src/ten/modelBall1Cylinder.c 2023-07-07 21:43:30 UTC (rev 7046)
+++ teem/trunk/src/ten/modelBall1Cylinder.c 2023-07-07 21:53:33 UTC (rev 7047)
@@ -64,7 +64,7 @@
}
static char *
-parmSprint(char str[AIR_STRLEN_MED], const double *parm) {
+parmSprint(char str[AIR_STRLEN_MED+1], const double *parm) {
sprintf(str, "(%g) [(1-f) %g + (f=%g) %gX%g (%g,%g,%g)]", parm[0],
parm[1], parm[2], parm[3], parm[4],
parm[5], parm[6], parm[7]);
Modified: teem/trunk/src/ten/modelBall1Stick.c
===================================================================
--- teem/trunk/src/ten/modelBall1Stick.c 2023-07-07 21:43:30 UTC (rev 7046)
+++ teem/trunk/src/ten/modelBall1Stick.c 2023-07-07 21:53:33 UTC (rev 7047)
@@ -59,7 +59,7 @@
}
static char *
-parmSprint(char str[AIR_STRLEN_MED], const double *parm) {
+parmSprint(char str[AIR_STRLEN_MED+1], const double *parm) {
sprintf(str, "(%g) (1-f)*%g + (f=%g)*(%g @ (%g,%g,%g))", parm[0],
parm[1], parm[2], parm[3], parm[4], parm[5], parm[6]);
return str;
Modified: teem/trunk/src/ten/modelBall1StickEMD.c
===================================================================
--- teem/trunk/src/ten/modelBall1StickEMD.c 2023-07-07 21:43:30 UTC (rev 7046)
+++ teem/trunk/src/ten/modelBall1StickEMD.c 2023-07-07 21:53:33 UTC (rev 7047)
@@ -56,7 +56,7 @@
}
static char *
-parmSprint(char str[AIR_STRLEN_MED], const double *parm) {
+parmSprint(char str[AIR_STRLEN_MED+1], const double *parm) {
sprintf(str, "(%g) %g * (%g + %g*(%g,%g,%g))", parm[0],
parm[1], 1-parm[2], parm[2], parm[3], parm[4], parm[5]);
return str;
Modified: teem/trunk/src/ten/modelZero.c
===================================================================
--- teem/trunk/src/ten/modelZero.c 2023-07-07 21:43:30 UTC (rev 7046)
+++ teem/trunk/src/ten/modelZero.c 2023-07-07 21:53:33 UTC (rev 7047)
@@ -43,7 +43,7 @@
}
static char *
-parmSprint(char str[AIR_STRLEN_MED], const double *parm) {
+parmSprint(char str[AIR_STRLEN_MED+1], const double *parm) {
AIR_UNUSED(parm);
sprintf(str, "constant 0");
Modified: teem/trunk/src/ten/path.c
===================================================================
--- teem/trunk/src/ten/path.c 2023-07-07 21:43:30 UTC (rev 7046)
+++ teem/trunk/src/ten/path.c 2023-07-07 21:53:33 UTC (rev 7047)
@@ -1034,7 +1034,7 @@
}
}
if (tenInterpN_d(tenOut, tbuff, wght, ninLen, ptype, tip)) {
- char stmp[AIR_STRLEN_SMALL];
+ char stmp[AIR_STRLEN_SMALL + 1];
biffAddf(TEN, "%s: trouble on sample %s", me, airSprintSize_t(stmp, II));
airMopError(mop);
return 1;
Modified: teem/trunk/src/ten/ten.h
===================================================================
--- teem/trunk/src/ten/ten.h 2023-07-07 21:43:30 UTC (rev 7046)
+++ teem/trunk/src/ten/ten.h 2023-07-07 21:53:33 UTC (rev 7047)
@@ -1150,13 +1150,13 @@
/* description of *one* parameter in the parameter vector that
defines one instance of a given model */
typedef struct {
- char name[AIR_STRLEN_SMALL]; /* name */
- double min, max; /* bounds */
- int cyclic; /* non-zero if effectively min == max */
- int vec3; /* non-zero if this is a coefficient
- of a UNIT-LENGTH 3-vector */
- unsigned int vecIdx; /* *if* this param is part of vector,
- the index into it, i.e. 0, 1, or 2 */
+ char name[AIR_STRLEN_SMALL + 1]; /* name */
+ double min, max; /* bounds */
+ int cyclic; /* non-zero if effectively min == max */
+ int vec3; /* non-zero if this is a coefficient
+ of a UNIT-LENGTH 3-vector */
+ unsigned int vecIdx; /* *if* this param is part of vector,
+ the index into it, i.e. 0, 1, or 2 */
} tenModelParmDesc;
#define TEN_MODEL_B0_MAX \
@@ -1195,13 +1195,13 @@
** The "parmNum" field below therefore always includes the B0 value
*/
typedef struct tenModel_t {
- char name[AIR_STRLEN_SMALL];
+ char name[AIR_STRLEN_SMALL + 1];
unsigned int parmNum;
const tenModelParmDesc *parmDesc;
/* noise free simulation */
void (*simulate)(double *dwiSim, const double *parm, const tenExperSpec *espec);
/* parameter vector operations */
- char *(*sprint)(char str[AIR_STRLEN_MED], const double *parm);
+ char *(*sprint)(char str[AIR_STRLEN_MED + 1], const double *parm);
double *(*alloc)(void);
void (*rand)(double *parm, airRandMTState *rng, int knownB0);
void (*step)(double *parm1, const double scl, const double *grad, const double *parm0);
Modified: teem/trunk/src/ten/tenModel.c
===================================================================
--- teem/trunk/src/ten/tenModel.c 2023-07-07 21:43:30 UTC (rev 7046)
+++ teem/trunk/src/ten/tenModel.c 2023-07-07 21:53:33 UTC (rev 7047)
@@ -347,7 +347,7 @@
unsigned int iter, subIter;
double step, bak, opp, val, testval, dist, td;
int done;
- char pstr[AIR_STRLEN_MED];
+ char pstr[AIR_STRLEN_MED + 1];
step = 1;
model->copy(parm, parmInit);
Modified: teem/trunk/src/ten/tendAbout.c
===================================================================
--- teem/trunk/src/ten/tendAbout.c 2023-07-07 21:43:30 UTC (rev 7046)
+++ teem/trunk/src/ten/tendAbout.c 2023-07-07 21:53:33 UTC (rev 7047)
@@ -26,7 +26,7 @@
static int
tend_aboutMain(int argc, const char **argv, const char *me, hestParm *hparm) {
- char buff[AIR_STRLEN_LARGE], fmt[AIR_STRLEN_MED];
+ char buff[AIR_STRLEN_LARGE + 1], fmt[AIR_STRLEN_MED + 1];
char par1[] = "\t\t\t\t"
"\"tend\" is a command-line interface to much of the functionality "
"in \"ten\", a C library for diffusion image processing. Ten is one "
Modified: teem/trunk/src/ten/tendBfit.c
===================================================================
--- teem/trunk/src/ten/tendBfit.c 2023-07-07 21:43:30 UTC (rev 7046)
+++ teem/trunk/src/ten/tendBfit.c 2023-07-07 21:53:33 UTC (rev 7047)
@@ -66,7 +66,7 @@
airMopAdd(mop, hopt, (airMopper)hestParseFree, airMopAlways);
if (!(bbLen == nin->axis[0].size)) {
- char stmp[AIR_STRLEN_SMALL];
+ char stmp[AIR_STRLEN_SMALL + 1];
fprintf(stderr, "%s: got %d b-values but axis 0 size is %s\n", me, bbLen,
airSprintSize_t(stmp, nin->axis[0].size));
airMopError(mop);
@@ -74,7 +74,7 @@
}
if (AIR_EXISTS(_ww[0])) {
if (!(_wwLen == nin->axis[0].size)) {
- char stmp[AIR_STRLEN_SMALL];
+ char stmp[AIR_STRLEN_SMALL + 1];
fprintf(stderr, "%s: got %d weights but axis 0 size is %s\n", me, _wwLen,
airSprintSize_t(stmp, nin->axis[0].size));
airMopError(mop);
Modified: teem/trunk/src/ten/tendFlotsam.c
===================================================================
--- teem/trunk/src/ten/tendFlotsam.c 2023-07-07 21:43:30 UTC (rev 7046)
+++ teem/trunk/src/ten/tendFlotsam.c 2023-07-07 21:53:33 UTC (rev 7047)
@@ -43,7 +43,7 @@
** info[2]: 2nd parameter, used occasionally
*/
static int
-fiberStopParse(void *ptr, const char *_str, char err[AIR_STRLEN_HUGE]) {
+fiberStopParse(void *ptr, const char *_str, char err[AIR_STRLEN_HUGE + 1]) {
static const char me[] = "fiberStopParse";
char *str, *opt, *opt2;
double *info;
Modified: teem/trunk/src/ten/tendGlyph.c
===================================================================
--- teem/trunk/src/ten/tendGlyph.c 2023-07-07 21:43:30 UTC (rev 7046)
+++ teem/trunk/src/ten/tendGlyph.c 2023-07-07 21:53:33 UTC (rev 7047)
@@ -41,16 +41,16 @@
_tendGlyphReadCams(int imgSize[2], limnCamera **camP, unsigned int *numCamsP,
FILE *fin) {
static const char me[] = "_tendGlyphReadCams";
- char line[AIR_STRLEN_HUGE];
+ char line[AIR_STRLEN_HUGE + 1];
int ki;
double di, dn, df, fr[3], at[3], up[3], va, dwell;
airArray *mop, *camA;
- if (!(0 < airOneLine(fin, line, AIR_STRLEN_HUGE) && !strcmp(_LIMNMAGIC, line))) {
+ if (!(0 < airOneLine(fin, line, AIR_STRLEN_HUGE + 1) && !strcmp(_LIMNMAGIC, line))) {
biffAddf(TEN, "%s: couldn't read first line or it wasn't \"%s\"", me, _LIMNMAGIC);
return 1;
}
- if (!(0 < airOneLine(fin, line, AIR_STRLEN_HUGE)
+ if (!(0 < airOneLine(fin, line, AIR_STRLEN_HUGE + 1)
&& 2
== (airStrtrans(airStrtrans(line, '{', ' '), '}', ' '),
sscanf(line, "imgSize %d %d", imgSize + 0, imgSize + 1)))) {
@@ -65,7 +65,7 @@
camA = airArrayNew((void **)camP, numCamsP, sizeof(limnCamera), 1);
airMopAdd(mop, camA, (airMopper)airArrayNix, airMopAlways);
- while (0 < airOneLine(fin, line, AIR_STRLEN_HUGE)) {
+ while (0 < airOneLine(fin, line, AIR_STRLEN_HUGE + 1)) {
airStrtrans(airStrtrans(line, '{', ' '), '}', ' ');
ki = airArrayLenIncr(camA, 1);
if (14
@@ -117,7 +117,7 @@
int ires[2], slice[2], nobg, ambocc, concave;
unsigned int hackci, hacknumcam;
size_t hackmin[3] = {0, 0, 0}, hackmax[3] = {2, 0, 0};
- char *hackFN, hackoutFN[AIR_STRLEN_SMALL];
+ char *hackFN, hackoutFN[AIR_STRLEN_SMALL + 1];
FILE *hackF;
Nrrd *hacknpng, *hacknrgb;
NrrdRange *hackrange;
Modified: teem/trunk/src/ten/tendSatin.c
===================================================================
--- teem/trunk/src/ten/tendSatin.c 2023-07-07 21:43:30 UTC (rev 7046)
+++ teem/trunk/src/ten/tendSatin.c 2023-07-07 21:53:33 UTC (rev 7047)
@@ -109,7 +109,7 @@
tend_satinGen(Nrrd *nout, float parm, float mina, float maxa, int wsize, float thick,
float scaling, float bnd, float bndRm, float evsc, int torus) {
static const char me[] = "tend_satinGen";
- char buff[AIR_STRLEN_SMALL];
+ char buff[AIR_STRLEN_SMALL + 1];
Nrrd *nconf, *neval, *nevec;
float *conf, *eval, *evec;
size_t xi, yi, zi, size[3];
Modified: teem/trunk/src/ten/tensor.c
===================================================================
--- teem/trunk/src/ten/tensor.c 2023-07-07 21:43:30 UTC (rev 7046)
+++ teem/trunk/src/ten/tensor.c 2023-07-07 21:53:33 UTC (rev 7047)
@@ -75,7 +75,7 @@
return 1;
}
if (!(7 == nin->axis[0].size)) {
- char stmp[AIR_STRLEN_SMALL];
+ char stmp[AIR_STRLEN_SMALL + 1];
biffMaybeAddf(useBiff, TEN, "%s: axis 0 has size %s, not 7", me,
airSprintSize_t(stmp, nin->axis[0].size));
return 1;
@@ -187,7 +187,7 @@
return 1;
}
if (!(4 == nin->axis[0].size)) {
- char stmp[AIR_STRLEN_SMALL];
+ char stmp[AIR_STRLEN_SMALL + 1];
biffAddf(TEN, "%s: axis 0 has size %s, not 4", me,
airSprintSize_t(stmp, nin->axis[0].size));
return 1;
@@ -298,7 +298,7 @@
return 1;
}
if (!(nrrdTypeFloat == tnine->type && 4 == tnine->dim && 9 == tnine->axis[0].size)) {
- char stmp[AIR_STRLEN_SMALL];
+ char stmp[AIR_STRLEN_SMALL + 1];
biffAddf(TEN,
"%s: type not %s (was %s) or dim not 4 (was %d) "
"or first axis size not 9 (was %s)",
@@ -532,7 +532,7 @@
float *out, *conf, *eval, *evec;
int map[4];
/* float teval[3], tevec[9], tmp1[3], tmp2[3]; */
- char stmp[7][AIR_STRLEN_SMALL];
+ char stmp[7][AIR_STRLEN_SMALL + 1];
if (!(nout && nconf && neval && nevec)) {
biffAddf(TEN, "%s: got NULL pointer", me);
@@ -633,7 +633,7 @@
Nrrd *nslice, **ncoeff = NULL;
int ci[4];
airArray *mop;
- char stmp[2][AIR_STRLEN_SMALL];
+ char stmp[2][AIR_STRLEN_SMALL + 1];
if (!(nout && nten)) {
biffAddf(TEN, "%s: got NULL pointer", me);
Modified: teem/trunk/src/ten/test/csim.c
===================================================================
--- teem/trunk/src/ten/test/csim.c 2023-07-07 21:43:30 UTC (rev 7046)
+++ teem/trunk/src/ten/test/csim.c 2023-07-07 21:53:33 UTC (rev 7047)
@@ -19,30 +19,26 @@
Fifth Floor, Boston, MA 02110-1301 USA
*/
-
#include "../ten.h"
static int
-csimDo(double tm[7], double tcov[21], double rm[3], double rv[3],
- Nrrd *ntbuff, tenEstimateContext *tec, double *dwibuff, double sigma,
- double bvalue, double B0, unsigned int NN, int randrot,
- double _tenOrig[7]) {
- char me[]="csimDo";
+csimDo(double tm[7], double tcov[21], double rm[3], double rv[3], Nrrd *ntbuff,
+ tenEstimateContext *tec, double *dwibuff, double sigma, double bvalue, double B0,
+ unsigned int NN, int randrot, double _tenOrig[7]) {
+ char me[] = "csimDo";
double *tbuff;
unsigned int II, taa, tbb, cc;
- if (!(ntbuff
- && ntbuff->data
- && 2 == ntbuff->dim
- && 7 == ntbuff->axis[0].size
+ if (!(ntbuff && ntbuff->data && 2 == ntbuff->dim && 7 == ntbuff->axis[0].size
&& NN == ntbuff->axis[1].size)) {
- biffAddf(TEN, "%s: ntbuff not allocated for 2-by-%u array of %s", me,
- NN, airEnumStr(nrrdType, nrrdTypeDouble)); return 1;
+ biffAddf(TEN, "%s: ntbuff not allocated for 2-by-%u array of %s", me, NN,
+ airEnumStr(nrrdType, nrrdTypeDouble));
+ return 1;
}
/* find all tensors from simulated DWIs */
tbuff = AIR_CAST(double *, ntbuff->data);
- for (II=0; II<NN; II++) {
+ for (II = 0; II < NN; II++) {
double tenOrig[7], rotf[9], rotb[9], matA[9], matB[9], qq[4], tmp;
ELL_3M_IDENTITY_SET(rotf); /* sssh warnings */
ELL_3M_IDENTITY_SET(rotb); /* sssh warnings */
@@ -52,8 +48,8 @@
double eval[3], evec[9], eps, ma[9], mb[9], rf[9], rb[9];
tenEigensolve_d(eval, evec, _tenOrig);
airNormalRand(&eps, NULL);
- ell_aa_to_3m_d(rf, 0*eps/20, evec + 0);
- TEN_T_SCALE_INCR(_tenOrig, 0*eps/30, _tenOrig);
+ ell_aa_to_3m_d(rf, 0 * eps / 20, evec + 0);
+ TEN_T_SCALE_INCR(_tenOrig, 0 * eps / 30, _tenOrig);
TEN_T2M(ma, _tenOrig);
ELL_3M_TRANSPOSE(rb, rf);
ELL_3M_MUL(mb, ma, rf);
@@ -61,8 +57,8 @@
TEN_M2T(_tenOrig, ma);
}
TEN_T2M(matA, _tenOrig);
- airNormalRand(qq+0, qq+1);
- airNormalRand(qq+2, qq+3);
+ airNormalRand(qq + 0, qq + 1);
+ airNormalRand(qq + 2, qq + 3);
ELL_4V_NORM(qq, qq, tmp);
ell_q_to_3m_d(rotf, qq);
ELL_3M_TRANSPOSE(rotb, rotf);
@@ -72,10 +68,10 @@
} else {
TEN_T_COPY(tenOrig, _tenOrig);
}
- if (tenEstimate1TensorSimulateSingle_d(tec, dwibuff, sigma,
- bvalue, B0, tenOrig)
+ if (tenEstimate1TensorSimulateSingle_d(tec, dwibuff, sigma, bvalue, B0, tenOrig)
|| tenEstimate1TensorSingle_d(tec, tbuff, dwibuff)) {
- biffAddf(TEN, "%s: trouble on exp %u/%u", me, II, NN); return 1;
+ biffAddf(TEN, "%s: trouble on exp %u/%u", me, II, NN);
+ return 1;
}
if (randrot) {
TEN_T2M(matA, tbuff);
@@ -104,7 +100,7 @@
tbuff = AIR_CAST(double *, ntbuff->data);
TEN_T_SET(tm, 0, 0, 0, 0, 0, 0, 0);
ELL_3V_SET(rm, 0, 0, 0);
- for (II=0; II<NN; II++) {
+ for (II = 0; II < NN; II++) {
TEN_T_INCR(tm, tbuff);
rm[0] += sqrt(_tenAnisoTen_d[tenAniso_S](tbuff));
rm[1] += _tenAnisoTen_d[tenAniso_FA](tbuff);
@@ -114,27 +110,27 @@
rm[0] /= NN;
rm[1] /= NN;
rm[2] /= NN;
- TEN_T_SCALE(tm, 1.0/NN, tm);
+ TEN_T_SCALE(tm, 1.0 / NN, tm);
/* accumulate covariance tensor, and R_i variances */
- for (cc=0; cc<21; cc++) {
+ for (cc = 0; cc < 21; cc++) {
tcov[cc] = 0;
}
ELL_3V_SET(rv, 0, 0, 0);
tbuff = AIR_CAST(double *, ntbuff->data);
- for (II=0; II<NN; II++) {
+ for (II = 0; II < NN; II++) {
double r[3];
r[0] = sqrt(_tenAnisoTen_d[tenAniso_S](tbuff));
r[1] = _tenAnisoTen_d[tenAniso_FA](tbuff);
r[2] = _tenAnisoTen_d[tenAniso_Mode](tbuff);
cc = 0;
- rv[0] += (r[0] - rm[0])*(r[0] - rm[0])/(NN-1);
- rv[1] += (r[1] - rm[1])*(r[1] - rm[1])/(NN-1);
- rv[2] += (r[2] - rm[2])*(r[2] - rm[2])/(NN-1);
- for (taa=0; taa<6; taa++) {
- for (tbb=taa; tbb<6; tbb++) {
- tcov[cc] += (10000*(tbuff[taa+1]-tm[taa+1])
- *10000*(tbuff[tbb+1]-tm[tbb+1])/(NN-1));
+ rv[0] += (r[0] - rm[0]) * (r[0] - rm[0]) / (NN - 1);
+ rv[1] += (r[1] - rm[1]) * (r[1] - rm[1]) / (NN - 1);
+ rv[2] += (r[2] - rm[2]) * (r[2] - rm[2]) / (NN - 1);
+ for (taa = 0; taa < 6; taa++) {
+ for (tbb = taa; tbb < 6; tbb++) {
+ tcov[cc] += (10000 * (tbuff[taa + 1] - tm[taa + 1]) * 10000
+ * (tbuff[tbb + 1] - tm[tbb + 1]) / (NN - 1));
cc++;
}
}
@@ -150,14 +146,14 @@
main(int argc, const char *argv[]) {
const char *me;
char *err;
- hestOpt *hopt=NULL;
+ hestOpt *hopt = NULL;
airArray *mop;
char *outTenS, *outCovarS, *outRmvS;
int seed, E;
unsigned int NN;
- Nrrd *_ninTen, *ninTen, *ngrad, *_ninB0, *ninB0, *nmask,
- *noutCovar, *noutTen, *noutRmv, *ntbuff;
+ Nrrd *_ninTen, *ninTen, *ngrad, *_ninB0, *ninB0, *nmask, *noutCovar, *noutTen,
+ *noutRmv, *ntbuff;
float sigma, bval;
size_t sizeX, sizeY, sizeZ;
tenEstimateContext *tec;
@@ -172,25 +168,24 @@
hestOptAdd(&hopt, "seed", "seed", airTypeInt, 1, 1, &seed, "42",
"seed value for RNG which creates noise");
hestOptAdd(&hopt, "r", "reference field", airTypeOther, 1, 1, &_ninB0, NULL,
- "reference anatomical scan, with no diffusion weighting",
- NULL, NULL, nrrdHestNrrd);
+ "reference anatomical scan, with no diffusion weighting", NULL, NULL,
+ nrrdHestNrrd);
hestOptAdd(&hopt, "rr", NULL, airTypeOther, 0, 0, &randrot, NULL,
"randomize gradient set orientation");
hestOptAdd(&hopt, "g", "grad list", airTypeOther, 1, 1, &ngrad, "",
- "gradient list, one row per diffusion-weighted image",
- NULL, NULL, nrrdHestNrrd);
+ "gradient list, one row per diffusion-weighted image", NULL, NULL,
+ nrrdHestNrrd);
hestOptAdd(&hopt, "b", "b", airTypeFloat, 1, 1, &bval, "1000",
"b value for simulated scan");
hestOptAdd(&hopt, "sigma", "sigma", airTypeFloat, 1, 1, &sigma, "0.0",
"Rician noise parameter");
- hestOptAdd(&hopt, "ot", "filename", airTypeString, 1, 1, &outTenS,
- "tout.nrrd", "file to write output tensor nrrd to");
- hestOptAdd(&hopt, "oc", "filename", airTypeString, 1, 1, &outCovarS,
- "cout.nrrd", "file to write output covariance nrrd to");
- hestOptAdd(&hopt, "or", "filename", airTypeString, 1, 1, &outRmvS,
- "rout.nrrd", "file to write output R_i means, variances to");
- hestParseOrDie(hopt, argc-1, argv+1, NULL,
- me, info, AIR_TRUE, AIR_TRUE, AIR_TRUE);
+ hestOptAdd(&hopt, "ot", "filename", airTypeString, 1, 1, &outTenS, "tout.nrrd",
+ "file to write output tensor nrrd to");
+ hestOptAdd(&hopt, "oc", "filename", airTypeString, 1, 1, &outCovarS, "cout.nrrd",
+ "file to write output covariance nrrd to");
+ hestOptAdd(&hopt, "or", "filename", airTypeString, 1, 1, &outRmvS, "rout.nrrd",
+ "file to write output R_i means, variances to");
+ hestParseOrDie(hopt, argc - 1, argv + 1, NULL, me, info, AIR_TRUE, AIR_TRUE, AIR_TRUE);
airMopAdd(mop, hopt, (airMopper)hestOptFree, airMopAlways);
airMopAdd(mop, hopt, (airMopper)hestParseFree, airMopAlways);
@@ -209,14 +204,12 @@
sizeX = _ninTen->axis[1].size;
sizeY = _ninTen->axis[2].size;
sizeZ = _ninTen->axis[3].size;
- if (!(3 == _ninB0->dim &&
- sizeX == _ninB0->axis[0].size &&
- sizeY == _ninB0->axis[1].size &&
- sizeZ == _ninB0->axis[2].size)) {
- char stmp[3][AIR_STRLEN_SMALL];
- fprintf(stderr, "%s: given B0 (%u-D) volume not 3-D %sx%sx%s",
- me, _ninB0->dim, airSprintSize_t(stmp[0], sizeX),
- airSprintSize_t(stmp[1], sizeY), airSprintSize_t(stmp[2], sizeZ));
+ if (!(3 == _ninB0->dim && sizeX == _ninB0->axis[0].size
+ && sizeY == _ninB0->axis[1].size && sizeZ == _ninB0->axis[2].size)) {
+ char stmp[3][AIR_STRLEN_SMALL + 1];
+ fprintf(stderr, "%s: given B0 (%u-D) volume not 3-D %sx%sx%s", me, _ninB0->dim,
+ airSprintSize_t(stmp[0], sizeX), airSprintSize_t(stmp[1], sizeY),
+ airSprintSize_t(stmp[2], sizeZ));
airMopError(mop);
return 1;
}
@@ -236,18 +229,16 @@
ntbuff = nrrdNew();
airMopAdd(mop, ntbuff, (airMopper)nrrdNuke, airMopOnError);
- if (nrrdConvert(ninTen, _ninTen, nrrdTypeDouble)
- || nrrdSlice(nmask, ninTen, 0, 0)
+ if (nrrdConvert(ninTen, _ninTen, nrrdTypeDouble) || nrrdSlice(nmask, ninTen, 0, 0)
|| nrrdConvert(ninB0, _ninB0, nrrdTypeDouble)
- || nrrdMaybeAlloc_va(noutTen, nrrdTypeDouble, 4,
- AIR_CAST(size_t, 7), sizeX, sizeY, sizeZ)
- || nrrdMaybeAlloc_va(noutCovar, nrrdTypeDouble, 4,
- AIR_CAST(size_t, 21), sizeX, sizeY, sizeZ)
- || nrrdMaybeAlloc_va(noutRmv, nrrdTypeDouble, 4,
- AIR_CAST(size_t, 6), sizeX, sizeY, sizeZ)
- || nrrdMaybeAlloc_va(ntbuff, nrrdTypeDouble, 2,
- AIR_CAST(size_t, 7), NN)) {
- airMopAdd(mop, err=biffGetDone(NRRD), airFree, airMopAlways);
+ || nrrdMaybeAlloc_va(noutTen, nrrdTypeDouble, 4, AIR_CAST(size_t, 7), sizeX, sizeY,
+ sizeZ)
+ || nrrdMaybeAlloc_va(noutCovar, nrrdTypeDouble, 4, AIR_CAST(size_t, 21), sizeX,
+ sizeY, sizeZ)
+ || nrrdMaybeAlloc_va(noutRmv, nrrdTypeDouble, 4, AIR_CAST(size_t, 6), sizeX, sizeY,
+ sizeZ)
+ || nrrdMaybeAlloc_va(ntbuff, nrrdTypeDouble, 2, AIR_CAST(size_t, 7), NN)) {
+ airMopAdd(mop, err = biffGetDone(NRRD), airFree, airMopAlways);
fprintf(stderr, "%s: trouble setting up tec:\n%s\n", me, err);
airMopError(mop);
return 1;
@@ -263,7 +254,7 @@
if (!E) E |= tenEstimateThresholdSet(tec, 0, 0);
if (!E) E |= tenEstimateUpdate(tec);
if (E) {
- airMopAdd(mop, err=biffGetDone(TEN), airFree, airMopAlways);
+ airMopAdd(mop, err = biffGetDone(TEN), airFree, airMopAlways);
fprintf(stderr, "%s: trouble setting up tec:\n%s\n", me, err);
airMopError(mop);
return 1;
@@ -275,29 +266,27 @@
if (1) {
unsigned int II;
unsigned int nsamp;
- double *inTen, *outTen, *outCovar, *outRmv,
- *dwibuff, (*lup)(const void *, size_t);
- char doneStr[AIR_STRLEN_SMALL];
+ double *inTen, *outTen, *outCovar, *outRmv, *dwibuff, (*lup)(const void *, size_t);
+ char doneStr[AIR_STRLEN_SMALL + 1];
dwibuff = AIR_CAST(double *, calloc(ngrad->axis[1].size, sizeof(double)));
airMopAdd(mop, dwibuff, airFree, airMopAlways);
- nsamp = AIR_UINT(sizeX*sizeY*sizeZ);
+ nsamp = AIR_UINT(sizeX * sizeY * sizeZ);
inTen = AIR_CAST(double *, ninTen->data);
- lup = nrrdDLookup[nrrdTypeDouble];
+ lup = nrrdDLookup[nrrdTypeDouble];
outTen = AIR_CAST(double *, noutTen->data);
outCovar = AIR_CAST(double *, noutCovar->data);
outRmv = AIR_CAST(double *, noutRmv->data);
fprintf(stderr, "!%s: simulating ... ", me);
fflush(stderr);
- for (II=0; II<nsamp; II++) {
+ for (II = 0; II < nsamp; II++) {
if (!(II % sizeX)) {
fprintf(stderr, "%s", airDoneStr(0, II, nsamp, doneStr));
fflush(stderr);
}
- if (csimDo(outTen, outCovar, outRmv + 0, outRmv + 3, ntbuff,
- tec, dwibuff, sigma,
+ if (csimDo(outTen, outCovar, outRmv + 0, outRmv + 3, ntbuff, tec, dwibuff, sigma,
bval, lup(ninB0->data, II), NN, randrot, inTen)) {
- airMopAdd(mop, err=biffGetDone(TEN), airFree, airMopAlways);
+ airMopAdd(mop, err = biffGetDone(TEN), airFree, airMopAlways);
fprintf(stderr, "%s: trouble:\n%s\n", me, err);
airMopError(mop);
return 1;
@@ -318,14 +307,11 @@
|| nrrdAxisInfoCopy(noutTen, ninTen, axmap, NRRD_AXIS_INFO_SIZE_BIT)
|| nrrdAxisInfoCopy(noutCovar, ninTen, axmap, NRRD_AXIS_INFO_SIZE_BIT)
|| nrrdAxisInfoCopy(noutRmv, ninTen, axmap, NRRD_AXIS_INFO_SIZE_BIT)
- || nrrdBasicInfoCopy(noutTen, ninTen,
- NRRD_BASIC_INFO_ALL ^ NRRD_BASIC_INFO_SPACE)
+ || nrrdBasicInfoCopy(noutTen, ninTen, NRRD_BASIC_INFO_ALL ^ NRRD_BASIC_INFO_SPACE)
|| nrrdBasicInfoCopy(noutCovar, ninTen,
NRRD_BASIC_INFO_ALL ^ NRRD_BASIC_INFO_SPACE)
- || nrrdBasicInfoCopy(noutRmv, ninTen,
- NRRD_BASIC_INFO_ALL ^ NRRD_BASIC_INFO_SPACE)
- || nrrdSave(outTenS, noutTen, NULL)
- || nrrdSave(outCovarS, noutCovar, NULL)
+ || nrrdBasicInfoCopy(noutRmv, ninTen, NRRD_BASIC_INFO_ALL ^ NRRD_BASIC_INFO_SPACE)
+ || nrrdSave(outTenS, noutTen, NULL) || nrrdSave(outCovarS, noutCovar, NULL)
|| nrrdSave(outRmvS, noutRmv, NULL)) {
airMopAdd(mop, err = biffGetDone(NRRD), airFree, airMopAlways);
fprintf(stderr, "%s: trouble saving output:\n%s\n", me, err);
Modified: teem/trunk/src/ten/test/tensorDotDat.c
===================================================================
--- teem/trunk/src/ten/test/tensorDotDat.c 2023-07-07 21:43:30 UTC (rev 7046)
+++ teem/trunk/src/ten/test/tensorDotDat.c 2023-07-07 21:53:33 UTC (rev 7047)
@@ -19,7 +19,6 @@
Fifth Floor, Boston, MA 02110-1301 USA
*/
-
#include "../ten.h"
const char *info = ("Compute the makings of a new tensor.dat file.");
@@ -28,14 +27,14 @@
main(int argc, const char *argv[]) {
const char *me;
char *err;
- hestOpt *hopt=NULL;
+ hestOpt *hopt = NULL;
airArray *mop;
int E, optimizeEdge, workToDo;
unsigned int ii, numRange[2], seedRange[2], seed, seedDone;
double *log, minAngle, minEdge, pot, potNorm, time0, time1;
- char *outStr, logFilename[AIR_STRLEN_MED], gradFilename[AIR_STRLEN_MED],
- keyStr[AIR_STRLEN_MED], valStr[AIR_STRLEN_MED];
+ char *outStr, logFilename[AIR_STRLEN_MED + 1], gradFilename[AIR_STRLEN_MED + 1],
+ keyStr[AIR_STRLEN_MED + 1], valStr[AIR_STRLEN_MED + 1];
tenGradientParm *tgparm;
Nrrd *nlog, *ngrad;
size_t size[2];
@@ -62,16 +61,14 @@
hestOptAdd(&hopt, "p", "exponent", airTypeUInt, 1, 1, &(tgparm->expo), "1",
"the exponent p that defines the 1/r^p potential energy "
"(Coulomb is 1)");
- hestOptAdd(&hopt, "step", "step", airTypeDouble, 1, 1, &(tgparm->initStep),
- "1", "time increment in solver");
- hestOptAdd(&hopt, "miniter", "# iters", airTypeInt, 1, 1,
- &(tgparm->minIteration), "0",
+ hestOptAdd(&hopt, "step", "step", airTypeDouble, 1, 1, &(tgparm->initStep), "1",
+ "time increment in solver");
+ hestOptAdd(&hopt, "miniter", "# iters", airTypeInt, 1, 1, &(tgparm->minIteration), "0",
"required minimum number of simulation iterations");
- hestOptAdd(&hopt, "maxiter", "# iters", airTypeInt, 1, 1,
- &(tgparm->maxIteration), "1000000",
- "max number of simulations iterations");
- hestOptAdd(&hopt, "minvelo", "vel", airTypeDouble, 1, 1,
- &(tgparm->minVelocity), "0.00000000001",
+ hestOptAdd(&hopt, "maxiter", "# iters", airTypeInt, 1, 1, &(tgparm->maxIteration),
+ "1000000", "max number of simulations iterations");
+ hestOptAdd(&hopt, "minvelo", "vel", airTypeDouble, 1, 1, &(tgparm->minVelocity),
+ "0.00000000001",
"low threshold on mean velocity of repelling points, "
"at which point repulsion phase of algorithm terminates.");
hestOptAdd(&hopt, "dp", "potential change", airTypeDouble, 1, 1,
@@ -85,8 +82,7 @@
"the (small) improvement in length of mean gradient "
"which triggers termination (as further improvements "
"are unlikely. ");
- hestOptAdd(&hopt, "minmean", "len", airTypeDouble, 1, 1,
- &(tgparm->minMean), "0.0005",
+ hestOptAdd(&hopt, "minmean", "len", airTypeDouble, 1, 1, &(tgparm->minMean), "0.0005",
"if length of mean gradient falls below this, finish "
"the balancing phase");
hestOptAdd(&hopt, "oe", NULL, airTypeInt, 0, 0, &optimizeEdge, NULL,
@@ -95,20 +91,19 @@
hestOptAdd(&hopt, "odir", "out", airTypeString, 1, 1, &outStr, ".",
"output directory for all grad files and logs, you should "
"leave off the trailing /");
- hestParseOrDie(hopt, argc-1, argv+1, NULL,
- me, info, AIR_TRUE, AIR_TRUE, AIR_TRUE);
+ hestParseOrDie(hopt, argc - 1, argv + 1, NULL, me, info, AIR_TRUE, AIR_TRUE, AIR_TRUE);
airMopAdd(mop, hopt, (airMopper)hestOptFree, airMopAlways);
airMopAdd(mop, hopt, (airMopper)hestParseFree, airMopAlways);
if (0 == seedRange[0]) {
fprintf(stderr, "%s: sorry, initial seed must be non-zero\n", me);
- airMopError(mop); return 1;
+ airMopError(mop);
+ return 1;
}
- if (!( numRange[0] <= numRange[1]
- && numRange[0] >= 6 )) {
- fprintf(stderr, "%s: number range [%u,%u] invalid\n", me,
- numRange[0], numRange[1]);
- airMopError(mop); return 1;
+ if (!(numRange[0] <= numRange[1] && numRange[0] >= 6)) {
+ fprintf(stderr, "%s: number range [%u,%u] invalid\n", me, numRange[0], numRange[1]);
+ airMopError(mop);
+ return 1;
}
/* in master log (per gradient set):
@@ -130,34 +125,32 @@
free(biffGetDone(NRRD));
/* create a log nrrd of the correct size */
size[0] = 9;
- size[1] = numRange[1]+1;
+ size[1] = numRange[1] + 1;
if (nrrdMaybeAlloc_nva(nlog, nrrdTypeDouble, 2, size)) {
- airMopAdd(mop, err=biffGetDone(NRRD), airFree, airMopAlways);
+ airMopAdd(mop, err = biffGetDone(NRRD), airFree, airMopAlways);
fprintf(stderr, "%s: trouble making log:\n%s\n", me, err);
- airMopError(mop); return 1;
+ airMopError(mop);
+ return 1;
}
} else {
/* we could open the log, see if its the right size */
- if (!( nrrdTypeDouble == nlog->type
- && 2 == nlog->dim
- && 9 == nlog->axis[0].size
- && numRange[1]+1 == nlog->axis[1].size )) {
- fprintf(stderr, "%s: given log (%s %u-D %ux%ux?) doesn't match "
- "desired (%s 2-D 9x%u)\n", me,
- airEnumStr(nrrdType, nlog->type),
- nlog->dim,
- AIR_UINT(nlog->axis[0].size),
- AIR_UINT(nlog->axis[1].size),
- airEnumStr(nrrdType, nrrdTypeDouble),
- numRange[1]+1);
- airMopError(mop); return 1;
+ if (!(nrrdTypeDouble == nlog->type && 2 == nlog->dim && 9 == nlog->axis[0].size
+ && numRange[1] + 1 == nlog->axis[1].size)) {
+ fprintf(stderr,
+ "%s: given log (%s %u-D %ux%ux?) doesn't match "
+ "desired (%s 2-D 9x%u)\n",
+ me, airEnumStr(nrrdType, nlog->type), nlog->dim,
+ AIR_UINT(nlog->axis[0].size), AIR_UINT(nlog->axis[1].size),
+ airEnumStr(nrrdType, nrrdTypeDouble), numRange[1] + 1);
+ airMopError(mop);
+ return 1;
}
}
/* nlog is the right size */
/* initialize log's first column and key/value pairs, and (re)save */
log = AIR_CAST(double *, nlog->data);
- for (ii=numRange[0]; ii<=numRange[1]; ii++) {
- log[0 + 9*ii] = ii;
+ for (ii = numRange[0]; ii <= numRange[1]; ii++) {
+ log[0 + 9 * ii] = ii;
}
E = 0;
if (!E) strcpy(keyStr, "maxiter");
@@ -177,9 +170,10 @@
if (!E) E |= nrrdKeyValueAdd(nlog, keyStr, valStr);
if (!E) E |= nrrdSave(logFilename, nlog, NULL);
if (E) {
- airMopAdd(mop, err=biffGetDone(NRRD), airFree, airMopAlways);
+ airMopAdd(mop, err = biffGetDone(NRRD), airFree, airMopAlways);
fprintf(stderr, "%s: trouble writing log:\n%s\n", me, err);
- airMopError(mop); return 1;
+ airMopError(mop);
+ return 1;
}
/* in master log (per gradient set):
@@ -195,11 +189,10 @@
*/
workToDo = AIR_FALSE;
- for (seed=seedRange[0];
- seedRange[1] < seedRange[0] || seed <= seedRange[1];
+ for (seed = seedRange[0]; seedRange[1] < seedRange[0] || seed <= seedRange[1];
seed++) {
- for (ii=numRange[0]; ii<=numRange[1]; ii++) {
- seedDone = AIR_UINT(log[1 + 9*ii]);
+ for (ii = numRange[0]; ii <= numRange[1]; ii++) {
+ seedDone = AIR_UINT(log[1 + 9 * ii]);
/* if no seeds have been tried, seedDone will be zero */
if (seedDone >= seed) {
/* have already tried this seed, move on */
@@ -210,37 +203,39 @@
fprintf(stderr, "%s ================ %u %u\n", me, ii, tgparm->seed);
time0 = airTime();
if (tenGradientGenerate(ngrad, ii, tgparm)) {
- airMopAdd(mop, err=biffGetDone(TEN), airFree, airMopAlways);
+ airMopAdd(mop, err = biffGetDone(TEN), airFree, airMopAlways);
fprintf(stderr, "%s: trouble making distribution:\n%s\n", me, err);
- airMopError(mop); return 1;
+ airMopError(mop);
+ return 1;
}
time1 = airTime();
- tenGradientMeasure(&potNorm, &minAngle, &minEdge,
- ngrad, tgparm, AIR_TRUE);
+ tenGradientMeasure(&potNorm, &minAngle, &minEdge, ngrad, tgparm, AIR_TRUE);
if (!seedDone
- || ((optimizeEdge && minEdge > log[5 + 9*ii])
- || potNorm < log[4 + 9*ii])) {
+ || ((optimizeEdge && minEdge > log[5 + 9 * ii])
+ || potNorm < log[4 + 9 * ii])) {
/* this gradient set is best so far */
tenGradientMeasure(&pot, NULL, NULL, ngrad, tgparm, AIR_FALSE);
- log[2 + 9*ii] = tgparm->seed;
- log[3 + 9*ii] = pot;
- log[4 + 9*ii] = potNorm;
- log[5 + 9*ii] = minEdge;
- log[6 + 9*ii] = tenGradientIdealEdge(ii, AIR_FALSE);
- log[7 + 9*ii] = tgparm->itersUsed;
- log[8 + 9*ii] = time1 - time0;
+ log[2 + 9 * ii] = tgparm->seed;
+ log[3 + 9 * ii] = pot;
+ log[4 + 9 * ii] = potNorm;
+ log[5 + 9 * ii] = minEdge;
+ log[6 + 9 * ii] = tenGradientIdealEdge(ii, AIR_FALSE);
+ log[7 + 9 * ii] = tgparm->itersUsed;
+ log[8 + 9 * ii] = time1 - time0;
sprintf(gradFilename, "%s/%03u-%04u.nrrd", outStr, ii, tgparm->expo);
if (nrrdSave(gradFilename, ngrad, NULL)) {
- airMopAdd(mop, err=biffGetDone(NRRD), airFree, airMopAlways);
+ airMopAdd(mop, err = biffGetDone(NRRD), airFree, airMopAlways);
fprintf(stderr, "%s: trouble writing:\n%s\n", me, err);
- airMopError(mop); return 1;
+ airMopError(mop);
+ return 1;
}
}
- log[1 + 9*ii] = tgparm->seed;
+ log[1 + 9 * ii] = tgparm->seed;
if (nrrdSave(logFilename, nlog, NULL)) {
- airMopAdd(mop, err=biffGetDone(NRRD), airFree, airMopAlways);
+ airMopAdd(mop, err = biffGetDone(NRRD), airFree, airMopAlways);
fprintf(stderr, "%s: trouble writing log:\n%s\n", me, err);
- airMopError(mop); return 1;
+ airMopError(mop);
+ return 1;
}
}
}
Modified: teem/trunk/src/ten/triple.c
===================================================================
--- teem/trunk/src/ten/triple.c 2023-07-07 21:43:30 UTC (rev 7046)
+++ teem/trunk/src/ten/triple.c 2023-07-07 21:53:33 UTC (rev 7047)
@@ -486,7 +486,7 @@
return 1;
}
if (3 != nin->axis[0].size) {
- char stmp[AIR_STRLEN_SMALL];
+ char stmp[AIR_STRLEN_SMALL + 1];
biffAddf(TEN, "%s: need axis[0].size 3, not %s", me,
airSprintSize_t(stmp, nin->axis[0].size));
return 1;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <kin...@us...> - 2023-07-07 21:43:33
|
Revision: 7046
http://sourceforge.net/p/teem/code/7046
Author: kindlmann
Date: 2023-07-07 21:43:30 +0000 (Fri, 07 Jul 2023)
Log Message:
-----------
propagating AIR_STRLEN --> AIR_STRLEN+1 change
Modified Paths:
--------------
teem/trunk/src/seek/extract.c
teem/trunk/src/seek/test/trv.c
teem/trunk/src/seek/updateSeek.c
Modified: teem/trunk/src/seek/extract.c
===================================================================
--- teem/trunk/src/seek/extract.c 2023-07-07 21:40:54 UTC (rev 7045)
+++ teem/trunk/src/seek/extract.c 2023-07-07 21:43:30 UTC (rev 7046)
@@ -876,7 +876,7 @@
static int /* Biff: 1 */
surfaceExtract(seekContext *sctx, limnPolyData *lpld) {
static const char me[] = "surfaceExtract";
- char done[AIR_STRLEN_SMALL];
+ char done[AIR_STRLEN_SMALL + 1];
unsigned int zi, sz;
baggage *bag;
Modified: teem/trunk/src/seek/test/trv.c
===================================================================
--- teem/trunk/src/seek/test/trv.c 2023-07-07 21:40:54 UTC (rev 7045)
+++ teem/trunk/src/seek/test/trv.c 2023-07-07 21:43:30 UTC (rev 7046)
@@ -24,7 +24,7 @@
char *info = ("test crease surface extraction.");
int
-probeParseKind(void *ptr, char *str, char err[AIR_STRLEN_HUGE]) {
+probeParseKind(void *ptr, char *str, char err[AIR_STRLEN_HUGE + 1]) {
char me[] = "probeParseKind";
gageKind **kindP;
@@ -39,8 +39,7 @@
} else if (!strcmp(gageKindVec->name, str)) {
*kindP = gageKindVec;
} else {
- sprintf(err, "%s: not \"%s\" or \"%s\"", me,
- gageKindScl->name, gageKindVec->name);
+ sprintf(err, "%s: not \"%s\" or \"%s\"", me, gageKindScl->name, gageKindVec->name);
return 1;
}
@@ -57,22 +56,18 @@
return NULL;
}
-hestCB probeKindHestCB = {
- sizeof(gageKind *),
- "kind",
- probeParseKind,
- probeParseKindDestroy
-};
+hestCB probeKindHestCB = {sizeof(gageKind *), "kind", probeParseKind,
+ probeParseKindDestroy};
int
main(int argc, const char *argv[]) {
const char *me;
char *err, *outS;
- hestOpt *hopt=NULL;
+ hestOpt *hopt = NULL;
airArray *mop;
limnPolyData *pld, *pldSub;
- gageContext *gctx=NULL;
+ gageContext *gctx = NULL;
gagePerVolume *pvl;
Nrrd *nin, *nmeas;
double kparm[3], strength, scaling[3];
@@ -82,18 +77,16 @@
size_t samples[3];
gageKind *kind;
char *itemGradS; /* , *itemEvalS[2], *itemEvecS[2]; */
- int itemGrad; /* , itemEval[2], itemEvec[2]; */
+ int itemGrad; /* , itemEval[2], itemEvec[2]; */
int E;
me = argv[0];
hestOptAdd(&hopt, "i", "nin", airTypeOther, 1, 1, &nin, NULL,
- "input volume to analyze",
- NULL, NULL, nrrdHestNrrd);
+ "input volume to analyze", NULL, NULL, nrrdHestNrrd);
hestOptAdd(&hopt, "k", "kind", airTypeOther, 1, 1, &kind, NULL,
- "\"kind\" of volume (\"scalar\", \"vector\", \"tensor\")",
- NULL, NULL, &probeKindHestCB);
- hestOptAdd(&hopt, "s", "strength", airTypeDouble, 1, 1, &strength, "0.01",
- "strength");
+ "\"kind\" of volume (\"scalar\", \"vector\", \"tensor\")", NULL, NULL,
+ &probeKindHestCB);
+ hestOptAdd(&hopt, "s", "strength", airTypeDouble, 1, 1, &strength, "0.01", "strength");
hestOptAdd(&hopt, "gi", "grad item", airTypeString, 1, 1, &itemGradS, NULL,
"item for gradient vector");
hestOptAdd(&hopt, "c", "scaling", airTypeDouble, 3, 3, scaling, "1 1 1",
@@ -102,8 +95,7 @@
"if non-zero, number of CC to save");
hestOptAdd(&hopt, "o", "output LMPD", airTypeString, 1, 1, &outS, "out.lmpd",
"output file to save LMPD into");
- hestParseOrDie(hopt, argc-1, argv+1, NULL,
- me, info, AIR_TRUE, AIR_TRUE, AIR_TRUE);
+ hestParseOrDie(hopt, argc - 1, argv + 1, NULL, me, info, AIR_TRUE, AIR_TRUE, AIR_TRUE);
mop = airMopNew();
airMopAdd(mop, hopt, (airMopper)hestOptFree, airMopAlways);
airMopAdd(mop, hopt, (airMopper)hestParseFree, airMopAlways);
@@ -124,8 +116,7 @@
gctx = gageContextNew();
airMopAdd(mop, gctx, (airMopper)gageContextNix, airMopAlways);
ELL_3V_SET(kparm, 1, 1.0, 0.0);
- if (!(pvl = gagePerVolumeNew(gctx, nin, kind))
- || gagePerVolumeAttach(gctx, pvl)
+ if (!(pvl = gagePerVolumeNew(gctx, nin, kind)) || gagePerVolumeAttach(gctx, pvl)
|| gageKernelSet(gctx, gageKernel00, nrrdKernelBCCubic, kparm)
|| gageKernelSet(gctx, gageKernel11, nrrdKernelBCCubicD, kparm)
|| gageKernelSet(gctx, gageKernel22, nrrdKernelBCCubicDD, kparm)
@@ -133,11 +124,11 @@
|| gageQueryItemOn(gctx, pvl, gageSclHessEval)
|| gageQueryItemOn(gctx, pvl, gageSclHessEval2)
|| gageQueryItemOn(gctx, pvl, gageSclHessEvec)
- || gageQueryItemOn(gctx, pvl, gageSclHessEvec2)
- || gageUpdate(gctx)) {
+ || gageQueryItemOn(gctx, pvl, gageSclHessEvec2) || gageUpdate(gctx)) {
airMopAdd(mop, err = biffGetDone(GAGE), airFree, airMopAlways);
fprintf(stderr, "%s: trouble:\n%s\n", me, err);
- airMopError(mop); return 1;
+ airMopError(mop);
+ return 1;
}
seekVerboseSet(sctx, 10);
@@ -145,13 +136,12 @@
E = 0;
if (!E) E |= seekDataSet(sctx, NULL, gctx, 0);
ELL_3V_SET(samples,
- scaling[0]*nin->axis[kind->baseDim + 0].size,
- scaling[1]*nin->axis[kind->baseDim + 1].size,
- scaling[2]*nin->axis[kind->baseDim + 2].size);
+ scaling[0] * nin->axis[kind->baseDim + 0].size,
+ scaling[1] * nin->axis[kind->baseDim + 1].size,
+ scaling[2] * nin->axis[kind->baseDim + 2].size);
if (!E) E |= seekSamplesSet(sctx, samples);
if (!E) E |= seekItemGradientSet(sctx, itemGrad);
- if (!E) E |= seekItemEigensystemSet(sctx, gageSclHessEval,
- gageSclHessEvec);
+ if (!E) E |= seekItemEigensystemSet(sctx, gageSclHessEval, gageSclHessEvec);
if (!E) E |= seekItemNormalSet(sctx, gageSclHessEvec2);
if (!E) E |= seekStrengthUseSet(sctx, AIR_TRUE);
if (!E) E |= seekStrengthSet(sctx, -1, strength);
@@ -163,16 +153,15 @@
if (E) {
airMopAdd(mop, err = biffGetDone(SEEK), airFree, airMopAlways);
fprintf(stderr, "%s: trouble:\n%s\n", me, err);
- airMopError(mop); return 1;
+ airMopError(mop);
+ return 1;
}
fprintf(stderr, "%s: extraction time = %g\n", me, sctx->time);
nmeas = nrrdNew();
airMopAdd(mop, nmeas, (airMopper)nrrdNuke, airMopAlways);
- if (limnPolyDataVertexWindingFix(pld, AIR_TRUE)
- || limnPolyDataVertexWindingFlip(pld)
- || limnPolyDataVertexNormals(pld)
- || limnPolyDataCCFind(pld)
+ if (limnPolyDataVertexWindingFix(pld, AIR_TRUE) || limnPolyDataVertexWindingFlip(pld)
+ || limnPolyDataVertexNormals(pld) || limnPolyDataCCFind(pld)
|| limnPolyDataPrimitiveArea(nmeas, pld)
|| limnPolyDataPrimitiveSort(pld, nmeas)) {
err = biffGetDone(LIMN);
@@ -186,7 +175,7 @@
nrrdSave("meas.nrrd", nmeas, NULL);
ncc = AIR_MIN(ncc, nmeas->axis[0].size);
meas = AIR_CAST(double *, nmeas->data);
- for (ccIdx=ncc; ccIdx<nmeas->axis[0].size; ccIdx++) {
+ for (ccIdx = ncc; ccIdx < nmeas->axis[0].size; ccIdx++) {
meas[ccIdx] = 0.0;
}
if (!E) E |= limnPolyDataPrimitiveSelect(pldSub, pld, nmeas);
@@ -197,7 +186,8 @@
if (E) {
airMopAdd(mop, err = biffGetDone(LIMN), airFree, airMopAlways);
fprintf(stderr, "%s: trouble:\n%s\n", me, err);
- airMopError(mop); return 1;
+ airMopError(mop);
+ return 1;
}
airMopOkay(mop);
Modified: teem/trunk/src/seek/updateSeek.c
===================================================================
--- teem/trunk/src/seek/updateSeek.c 2023-07-07 21:40:54 UTC (rev 7045)
+++ teem/trunk/src/seek/updateSeek.c 2023-07-07 21:43:30 UTC (rev 7046)
@@ -459,7 +459,7 @@
static int /* Biff: 1 */
updateSclDerived(seekContext *sctx) {
static const char me[] = "updateSclDerived";
- char doneStr[AIR_STRLEN_SMALL];
+ char doneStr[AIR_STRLEN_SMALL + 1];
double *scl, idxIn[4], idxOut[4], val;
unsigned int xi, yi, zi;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <kin...@us...> - 2023-07-07 21:41:00
|
Revision: 7045
http://sourceforge.net/p/teem/code/7045
Author: kindlmann
Date: 2023-07-07 21:40:54 +0000 (Fri, 07 Jul 2023)
Log Message:
-----------
propagating AIR_STRLEN --> AIR_STRLEN+1 change
Modified Paths:
--------------
teem/trunk/src/echo/test/glyph.c
Modified: teem/trunk/src/echo/test/glyph.c
===================================================================
--- teem/trunk/src/echo/test/glyph.c 2023-07-07 21:38:52 UTC (rev 7044)
+++ teem/trunk/src/echo/test/glyph.c 2023-07-07 21:40:54 UTC (rev 7045)
@@ -176,7 +176,7 @@
}
int
-echoParseTenNrrd(void *ptr, char *str, char err[AIR_STRLEN_HUGE]) {
+echoParseTenNrrd(void *ptr, char *str, char err[AIR_STRLEN_HUGE + 1]) {
char me[] = "echoParseTenNrrd", *nerr;
Nrrd **nrrdP;
airArray *mop;
@@ -191,7 +191,7 @@
airMopAdd(mop, *nrrdP, (airMopper)nrrdNuke, airMopOnError);
if (nrrdLoad(*nrrdP, str)) {
airMopAdd(mop, nerr = biffGetDone(NRRD), airFree, airMopOnError);
- if (strlen(nerr) > AIR_STRLEN_HUGE - 1) nerr[AIR_STRLEN_HUGE - 1] = '\0';
+ if (strlen(nerr) > AIR_STRLEN_HUGE) nerr[AIR_STRLEN_HUGE] = '\0';
strcpy(err, nerr);
airMopError(mop);
return 1;
@@ -200,7 +200,7 @@
/* why not use the given err[] as a temp buffer */
biffAddf(TEN, "%s: \"%s\" isn't a valid tensor volume", me, str);
airMopAdd(mop, nerr = biffGetDone(TEN), airFree, airMopOnError);
- if (strlen(nerr) > AIR_STRLEN_HUGE - 1) nerr[AIR_STRLEN_HUGE - 1] = '\0';
+ if (strlen(nerr) > AIR_STRLEN_HUGE) nerr[AIR_STRLEN_HUGE] = '\0';
strcpy(err, nerr);
airMopError(mop);
return 1;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <kin...@us...> - 2023-07-07 21:38:55
|
Revision: 7044
http://sourceforge.net/p/teem/code/7044
Author: kindlmann
Date: 2023-07-07 21:38:52 +0000 (Fri, 07 Jul 2023)
Log Message:
-----------
propagating AIR_STRLEN --> AIR_STRLEN+1 change
Modified Paths:
--------------
teem/trunk/src/limn/cam.c
teem/trunk/src/limn/envmap.c
teem/trunk/src/limn/io.c
teem/trunk/src/limn/lpuFlotsam.c
teem/trunk/src/limn/lpu_about.c
teem/trunk/src/limn/splineMethods.c
teem/trunk/src/limn/splineMisc.c
teem/trunk/src/limn/test/plot.c
teem/trunk/src/limn/test/tcamanim.c
Modified: teem/trunk/src/limn/cam.c
===================================================================
--- teem/trunk/src/limn/cam.c 2023-07-07 21:32:07 UTC (rev 7043)
+++ teem/trunk/src/limn/cam.c 2023-07-07 21:38:52 UTC (rev 7044)
@@ -191,7 +191,7 @@
limnSplineTypeSpec *posType, limnSplineTypeSpec *distType,
limnSplineTypeSpec *viewType) {
static const char me[] = "limnCameraPathMake";
- char which[AIR_STRLEN_MED];
+ char which[AIR_STRLEN_MED + 1];
airArray *mop;
Nrrd *nquat, *nfrom, *natpt, *nupvc, *ndist, *nfova, *ntime, *nsample;
double fratVec[3], *quat, *from, *atpt, *upvc, *dist, *fova, W2V[9], N[3], fratDist;
Modified: teem/trunk/src/limn/envmap.c
===================================================================
--- teem/trunk/src/limn/envmap.c 2023-07-07 21:32:07 UTC (rev 7043)
+++ teem/trunk/src/limn/envmap.c 2023-07-07 21:38:52 UTC (rev 7044)
@@ -134,7 +134,7 @@
}
if (!(3 == envMap->axis[0].size && 256 == envMap->axis[1].size
&& 256 == envMap->axis[2].size)) {
- char stmp[3][AIR_STRLEN_SMALL];
+ char stmp[3][AIR_STRLEN_SMALL + 1];
biffAddf(LIMN,
"%s: dimension should be 3x256x256, not "
"%s x %s x %s",
Modified: teem/trunk/src/limn/io.c
===================================================================
--- teem/trunk/src/limn/io.c 2023-07-07 21:32:07 UTC (rev 7043)
+++ teem/trunk/src/limn/io.c 2023-07-07 21:38:52 UTC (rev 7044)
@@ -264,7 +264,7 @@
limnObjectReadOFF(limnObject *obj, FILE *file) {
static const char me[] = "limnObjectReadOFF";
double vert[6];
- char line[AIR_STRLEN_LARGE]; /* HEY: bad Gordon */
+ char line[AIR_STRLEN_LARGE + 1]; /* HEY: bad Gordon */
int lineCount, lookIdx, partIdx, idxTmp, faceNum, faceGot, got;
unsigned int vertGot, vertNum;
unsigned int ibuff[1024]; /* HEY: bad Gordon */
@@ -289,7 +289,7 @@
got = 0;
lineCount = 0;
do {
- if (!airOneLine(file, line, AIR_STRLEN_LARGE)) {
+ if (!airOneLine(file, line, AIR_STRLEN_LARGE + 1)) {
biffAddf(LIMN, "%s: hit EOF before getting #vert #face #edge line", me);
airMopError(mop);
return 1;
@@ -308,7 +308,7 @@
vertBase[partIdx] = vertGot;
while (vertGot < vertNum) {
do {
- lret = airOneLine(file, line, AIR_STRLEN_LARGE);
+ lret = airOneLine(file, line, AIR_STRLEN_LARGE + 1);
lineCount++;
} while (1 == lret);
if (!lret) {
@@ -368,7 +368,7 @@
faceGot = 0;
while (faceGot < faceNum) {
do {
- lret = airOneLine(file, line, AIR_STRLEN_LARGE);
+ lret = airOneLine(file, line, AIR_STRLEN_LARGE + 1);
lineCount++;
} while (1 == lret);
if (!lret) {
@@ -454,7 +454,7 @@
int /* Biff: 1 */
limnPolyDataWriteLMPD(FILE *file, const limnPolyData *pld) {
static const char me[] = "limnPolyDataWriteLMPD";
- char infoS[AIR_STRLEN_MED];
+ char infoS[AIR_STRLEN_MED + 1];
unsigned int primIdx, infoNum, flag, bit;
Nrrd *nrrd;
airArray *mop;
@@ -581,7 +581,7 @@
int /* Biff: 1 */
limnPolyDataReadLMPD(limnPolyData *pld, FILE *file) {
static const char me[] = "limnPolyDataReadLMPD";
- char line[AIR_STRLEN_MED], name[AIR_STRLEN_MED], *tmp;
+ char line[AIR_STRLEN_MED + 1], name[AIR_STRLEN_MED + 1], *tmp;
unsigned int vertNum, indxNum, primNum, primIdx, lineLen, infoNum, infoIdx, info, flag;
Nrrd *nrrd;
airArray *mop;
@@ -593,7 +593,7 @@
}
sprintf(name, "magic");
- lineLen = airOneLine(file, line, AIR_STRLEN_MED);
+ lineLen = airOneLine(file, line, AIR_STRLEN_MED + 1);
if (!lineLen) {
biffAddf(LIMN, "%s: didn't get %s line", me, name);
return 1;
@@ -604,7 +604,7 @@
}
sprintf(name, "nums");
- lineLen = airOneLine(file, line, AIR_STRLEN_MED);
+ lineLen = airOneLine(file, line, AIR_STRLEN_MED + 1);
if (!lineLen) {
biffAddf(LIMN, "%s: didn't get %s line", me, name);
return 1;
@@ -621,7 +621,7 @@
}
sprintf(name, "info");
- lineLen = airOneLine(file, line, AIR_STRLEN_MED);
+ lineLen = airOneLine(file, line, AIR_STRLEN_MED + 1);
if (!lineLen) {
biffAddf(LIMN, "%s: didn't get %s line", me, name);
return 1;
@@ -638,7 +638,7 @@
}
flag = 0;
for (infoIdx = 0; infoIdx < infoNum; infoIdx++) {
- lineLen = airOneLine(file, line, AIR_STRLEN_MED);
+ lineLen = airOneLine(file, line, AIR_STRLEN_MED + 1);
if (!lineLen) {
biffAddf(LIMN, "%s: didn't get %s line %u/%u", me, name, infoIdx, infoNum);
return 1;
@@ -660,7 +660,7 @@
/* actually, caller owns pld, so we don't register it with mop */
sprintf(name, "type");
- lineLen = airOneLine(file, line, AIR_STRLEN_MED);
+ lineLen = airOneLine(file, line, AIR_STRLEN_MED + 1);
if (!lineLen) {
biffAddf(LIMN, "%s: didn't get %s line", me, name);
return 1;
@@ -671,7 +671,7 @@
return 1;
}
for (primIdx = 0; primIdx < primNum; primIdx++) {
- lineLen = airOneLine(file, line, AIR_STRLEN_MED);
+ lineLen = airOneLine(file, line, AIR_STRLEN_MED + 1);
if (!lineLen) {
biffAddf(LIMN, "%s: didn't get %s line %u/%u", me, name, primIdx, primNum);
return 1;
@@ -685,7 +685,7 @@
}
sprintf(name, "icnt");
- lineLen = airOneLine(file, line, AIR_STRLEN_MED);
+ lineLen = airOneLine(file, line, AIR_STRLEN_MED + 1);
if (!lineLen) {
biffAddf(LIMN, "%s: didn't get %s line", me, name);
return 1;
@@ -696,7 +696,7 @@
return 1;
}
for (primIdx = 0; primIdx < primNum; primIdx++) {
- lineLen = airOneLine(file, line, AIR_STRLEN_MED);
+ lineLen = airOneLine(file, line, AIR_STRLEN_MED + 1);
if (!lineLen) {
biffAddf(LIMN, "%s: didn't get %s line %u/%u", me, name, primIdx, primNum);
return 1;
@@ -709,7 +709,7 @@
}
sprintf(name, "indx");
- lineLen = airOneLine(file, line, AIR_STRLEN_MED);
+ lineLen = airOneLine(file, line, AIR_STRLEN_MED + 1);
if (!lineLen) {
biffAddf(LIMN, "%s: didn't get %s line", me, name);
return 1;
@@ -757,7 +757,7 @@
ungetc(tmpChar, file);
sprintf(name, "xyzw");
- lineLen = airOneLine(file, line, AIR_STRLEN_MED);
+ lineLen = airOneLine(file, line, AIR_STRLEN_MED + 1);
if (!lineLen) {
biffAddf(LIMN, "%s: didn't get %s line", me, name);
return 1;
@@ -800,7 +800,7 @@
}
} while (DEMARK_CHAR != tmpChar);
ungetc(tmpChar, file);
- lineLen = airOneLine(file, line, AIR_STRLEN_MED);
+ lineLen = airOneLine(file, line, AIR_STRLEN_MED + 1);
if (!lineLen) {
biffAddf(LIMN, "%s: didn't get %s line %u/%u", me, INFO_STR, infoIdx, infoNum);
return 1;
@@ -872,7 +872,7 @@
}
static int /* Biff: 1 */
-_limnHestPolyDataLMPDParse(void *ptr, const char *str, char err[AIR_STRLEN_HUGE]) {
+_limnHestPolyDataLMPDParse(void *ptr, const char *str, char err[AIR_STRLEN_HUGE + 1]) {
static const char me[] = "_limnHestPolyDataLMPDParse";
char *nerr;
limnPolyData **lpldP;
@@ -902,7 +902,7 @@
airMopAdd(mop, *lpldP, (airMopper)limnPolyDataNix, airMopOnError);
if (limnPolyDataReadLMPD(*lpldP, file)) {
airMopAdd(mop, nerr = biffGetDone(LIMN), airFree, airMopOnError);
- airStrcpy(err, AIR_STRLEN_HUGE, nerr);
+ airStrcpy(err, AIR_STRLEN_HUGE + 1, nerr);
airMopError(mop);
return 1;
}
@@ -917,7 +917,7 @@
const hestCB *const limnHestPolyDataLMPD = &_limnHestPolyDataLMPD;
static int
-_limnHestPolyDataOFFParse(void *ptr, const char *str, char err[AIR_STRLEN_HUGE]) {
+_limnHestPolyDataOFFParse(void *ptr, const char *str, char err[AIR_STRLEN_HUGE + 1]) {
static const char me[] = "_limnHestPolyDataOFFParse";
char *nerr;
limnPolyData **lpldP;
@@ -947,7 +947,7 @@
airMopAdd(mop, *lpldP, (airMopper)limnPolyDataNix, airMopOnError);
if (limnPolyDataReadOFF(*lpldP, file)) {
airMopAdd(mop, nerr = biffGetDone(LIMN), airFree, airMopOnError);
- strncpy(err, nerr, AIR_STRLEN_HUGE - 1);
+ airStrcpy(err, AIR_STRLEN_HUGE + 1, nerr);
airMopError(mop);
return 1;
}
@@ -1054,7 +1054,7 @@
int /* Biff: 1 */
limnPolyDataReadOFF(limnPolyData *pld, FILE *file) {
static const char me[] = "limnPolyDataReadOFF";
- char line[AIR_STRLEN_LARGE]; /* HEY: bad Gordon */
+ char line[AIR_STRLEN_LARGE + 1]; /* HEY: bad Gordon */
unsigned int num[3], xyzwNum, xyzwGot, faceNum, faceGot, lineCount, got, lret;
if (!(pld && file)) {
@@ -1067,7 +1067,7 @@
got = 0;
lineCount = 0;
do {
- if (!airOneLine(file, line, AIR_STRLEN_LARGE)) {
+ if (!airOneLine(file, line, AIR_STRLEN_LARGE + 1)) {
biffAddf(LIMN, "%s: hit EOF before getting #vert #face #edge line", me);
return 1;
}
@@ -1088,7 +1088,7 @@
while (xyzwGot < xyzwNum) {
float *xyzw;
do {
- lret = airOneLine(file, line, AIR_STRLEN_LARGE);
+ lret = airOneLine(file, line, AIR_STRLEN_LARGE + 1);
lineCount++;
} while (1 == lret);
if (!lret) {
@@ -1113,7 +1113,7 @@
while (faceGot < faceNum) {
unsigned int *indx, indxSingle[4], indxNum;
do {
- lret = airOneLine(file, line, AIR_STRLEN_LARGE);
+ lret = airOneLine(file, line, AIR_STRLEN_LARGE + 1);
lineCount++;
} while (1 == lret);
if (!lret) {
Modified: teem/trunk/src/limn/lpuFlotsam.c
===================================================================
--- teem/trunk/src/limn/lpuFlotsam.c 2023-07-07 21:32:07 UTC (rev 7043)
+++ teem/trunk/src/limn/lpuFlotsam.c 2023-07-07 21:38:52 UTC (rev 7044)
@@ -38,7 +38,7 @@
void
limnPuUsage(const char *me, hestParm *hparm) {
unsigned int i, maxlen, len, c;
- char buff[AIR_STRLEN_LARGE], fmt[AIR_STRLEN_LARGE];
+ char buff[AIR_STRLEN_LARGE + 1], fmt[AIR_STRLEN_LARGE + 1];
maxlen = 0;
for (i = 0; limnPuCmdList[i]; i++) {
Modified: teem/trunk/src/limn/lpu_about.c
===================================================================
--- teem/trunk/src/limn/lpu_about.c 2023-07-07 21:32:07 UTC (rev 7043)
+++ teem/trunk/src/limn/lpu_about.c 2023-07-07 21:38:52 UTC (rev 7044)
@@ -25,7 +25,7 @@
static int
limnPu_aboutMain(int argc, const char **argv, const char *me, hestParm *hparm) {
- char buff[AIR_STRLEN_LARGE], fmt[AIR_STRLEN_MED];
+ char buff[AIR_STRLEN_LARGE + 1], fmt[AIR_STRLEN_MED + 1];
char par1[] = "\t\t\t\t"
"\"lpu\" is a complete hack.\n";
char par2[] = "\t\t\t\t"
Modified: teem/trunk/src/limn/splineMethods.c
===================================================================
--- teem/trunk/src/limn/splineMethods.c 2023-07-07 21:32:07 UTC (rev 7043)
+++ teem/trunk/src/limn/splineMethods.c 2023-07-07 21:38:52 UTC (rev 7044)
@@ -128,7 +128,7 @@
unsigned int size;
airArray *mop;
Nrrd *nin;
- char stmp[2][AIR_STRLEN_SMALL];
+ char stmp[2][AIR_STRLEN_SMALL + 1];
if (airEnumValCheck(limnSplineInfo, info)) {
biffAddf(LIMN, "%s: info %d not a valid limnSplineInfo", me, info);
@@ -253,7 +253,7 @@
unsigned int wantSize;
Nrrd *ntmpA, *ntmpB;
airArray *mop;
- char stmp[AIR_STRLEN_SMALL];
+ char stmp[AIR_STRLEN_SMALL + 1];
if (!(nout && nin)) {
biffAddf(LIMN, "%s: got NULL pointer", me);
@@ -422,7 +422,7 @@
limnSplineUpdate(limnSpline *spline, Nrrd *_ncpt) {
static const char me[] = "limnSplineUpdate";
Nrrd *ntmp;
- char stmp[2][AIR_STRLEN_SMALL];
+ char stmp[2][AIR_STRLEN_SMALL + 1];
if (!(spline && _ncpt)) {
biffAddf(LIMN, "%s: got NULL pointer", me);
Modified: teem/trunk/src/limn/splineMisc.c
===================================================================
--- teem/trunk/src/limn/splineMisc.c 2023-07-07 21:32:07 UTC (rev 7043)
+++ teem/trunk/src/limn/splineMisc.c 2023-07-07 21:38:52 UTC (rev 7044)
@@ -365,7 +365,7 @@
** <splineType>[:B,C]
*/
static int
-_limnHestSplineTypeSpecParse(void *ptr, const char *str, char err[AIR_STRLEN_HUGE]) {
+_limnHestSplineTypeSpecParse(void *ptr, const char *str, char err[AIR_STRLEN_HUGE + 1]) {
static const char me[] = "_limnHestSplineTypeSpecParse";
char *err2;
limnSplineTypeSpec **specP;
@@ -379,7 +379,7 @@
if (!(*specP = limnSplineTypeSpecParse(str))) {
err2 = biffGetDone(LIMN);
sprintf(err, "%s: couldn't parse \"%s\":\n", me, str);
- strncat(err, err2, AIR_STRLEN_HUGE - 1 - strlen(err));
+ strncat(err, err2, AIR_STRLEN_HUGE - strlen(err));
free(err2);
return 1;
}
@@ -399,7 +399,7 @@
** <nrrdFileName>:<splineInfo>:<splineType>[:B,C]
*/
static int
-_limnHestSplineParse(void *ptr, const char *str, char err[AIR_STRLEN_HUGE]) {
+_limnHestSplineParse(void *ptr, const char *str, char err[AIR_STRLEN_HUGE + 1]) {
static const char me[] = "_limnHestSplineParse";
char *err2;
limnSpline **splineP;
@@ -419,7 +419,7 @@
if (!(*splineP = limnSplineParse(str))) {
err2 = biffGetDone(LIMN);
sprintf(err, "%s: couldn't parse \"%s\":\n", me, str);
- strncat(err, err2, AIR_STRLEN_HUGE - 1 - strlen(err));
+ strncat(err, err2, AIR_STRLEN_HUGE - strlen(err));
free(err2);
return 1;
}
Modified: teem/trunk/src/limn/test/plot.c
===================================================================
--- teem/trunk/src/limn/test/plot.c 2023-07-07 21:32:07 UTC (rev 7043)
+++ teem/trunk/src/limn/test/plot.c 2023-07-07 21:38:52 UTC (rev 7044)
@@ -19,7 +19,6 @@
Fifth Floor, Boston, MA 02110-1301 USA
*/
-
#include "../limn.h"
const char *info = ("Plot!");
@@ -31,7 +30,7 @@
int nobg;
double bgColor[3];
- double maxX, maxY; /* set by plotPreamble */
+ double maxX, maxY; /* set by plotPreamble */
} plotPS;
typedef struct {
@@ -53,21 +52,19 @@
#define PPS_X(x) AIR_AFFINE(pps->bbox[0], (x), pps->bbox[2], 0, pps->maxX)
#define PPS_Y(y) AIR_AFFINE(pps->bbox[1], (y), pps->bbox[3], 0, pps->maxY)
-#define PPS_S(s) AIR_DELTA(pps->bbox[1], (s), pps->bbox[3], 0, pps->maxY)
+#define PPS_S(s) AIR_DELTA(pps->bbox[1], (s), pps->bbox[3], 0, pps->maxY)
void
plotPreamble(plotPS *pps, plotParm *pparm) {
AIR_UNUSED(pparm);
- pps->maxX = pps->psc*(pps->bbox[2] - pps->bbox[0]);
- pps->maxY = pps->psc*(pps->bbox[3] - pps->bbox[1]);
+ pps->maxX = pps->psc * (pps->bbox[2] - pps->bbox[0]);
+ pps->maxY = pps->psc * (pps->bbox[3] - pps->bbox[1]);
fprintf(pps->file, "%%!PS-Adobe-2.0 EPSF-2.0\n");
fprintf(pps->file, "%%%%Creator: plot\n");
fprintf(pps->file, "%%%%Pages: 1\n");
- fprintf(pps->file, "%%%%BoundingBox: 0 0 %d %d\n",
- (int)(pps->maxX),
- (int)(pps->maxY));
+ fprintf(pps->file, "%%%%BoundingBox: 0 0 %d %d\n", (int)(pps->maxX), (int)(pps->maxY));
fprintf(pps->file, "%%%%EndComments\n");
fprintf(pps->file, "%%%%EndProlog\n");
fprintf(pps->file, "%%%%Page: 1 1\n");
@@ -78,8 +75,8 @@
fprintf(pps->file, "0 %g lineto\n", pps->maxY);
fprintf(pps->file, "closepath\n");
if (!pps->nobg) {
- fprintf(pps->file, "gsave %g %g %g setrgbcolor fill grestore\n",
- pps->bgColor[0], pps->bgColor[1], pps->bgColor[2]);
+ fprintf(pps->file, "gsave %g %g %g setrgbcolor fill grestore\n", pps->bgColor[0],
+ pps->bgColor[1], pps->bgColor[2]);
}
fprintf(pps->file, "clip\n");
fprintf(pps->file, "gsave newpath\n");
@@ -102,7 +99,7 @@
plotWidth(plotPS *pps, plotParm *pparm, double width) {
AIR_UNUSED(pparm);
- fprintf(pps->file, "%g W\n", pps->psc*width);
+ fprintf(pps->file, "%g W\n", pps->psc * width);
return;
}
@@ -115,8 +112,7 @@
}
void
-plotLine(plotPS *pps, plotParm *pparm,
- double x0, double y0, double x1, double y1) {
+plotLine(plotPS *pps, plotParm *pparm, double x0, double y0, double x1, double y1) {
AIR_UNUSED(pparm);
fprintf(pps->file, "%g %g M\n", PPS_X(x0), PPS_Y(y0));
@@ -125,8 +121,7 @@
}
void
-plotLabel(plotPS *pps, plotParm *pparm, int centered,
- double x, double y, char *str) {
+plotLabel(plotPS *pps, plotParm *pparm, int centered, double x, double y, char *str) {
fprintf(pps->file, "gsave\n");
plotWidth(pps, pparm, 0);
@@ -133,11 +128,11 @@
if (centered) {
fprintf(pps->file,
"0 0 M (%s) false charpath pathbbox\n"
- "exch 4 1 roll sub 2 div 3 1 roll sub -2 div\n" /* don't ask */
+ "exch 4 1 roll sub 2 div 3 1 roll sub -2 div\n" /* don't ask */
"newpath %g add exch %g add M (%s) show\n",
str, PPS_X(x), PPS_Y(y), str);
} else {
- fprintf(pps->file, "%g %g M (%s) show\n", PPS_X(x), PPS_Y(y), str);
+ fprintf(pps->file, "%g %g M (%s) show\n", PPS_X(x), PPS_Y(y), str);
}
fprintf(pps->file, "grestore\n");
return;
@@ -146,39 +141,35 @@
void
plotAxes(plotPS *pps, plotParm *pparm, Nrrd *ndata) {
double axX, axY, xx, yy, toff;
- char buff[AIR_STRLEN_SMALL];
+ char buff[AIR_STRLEN_SMALL + 1];
int ti;
AIR_UNUSED(ndata);
- axX = AIR_AFFINE(pparm->dbox[0], pparm->axisOrig[0], pparm->dbox[2],
- pps->bbox[0], pps->bbox[2]);
- axY = AIR_AFFINE(pparm->dbox[1], pparm->axisOrig[1], pparm->dbox[3],
- pps->bbox[1], pps->bbox[3]);
+ axX = AIR_AFFINE(pparm->dbox[0], pparm->axisOrig[0], pparm->dbox[2], pps->bbox[0],
+ pps->bbox[2]);
+ axY = AIR_AFFINE(pparm->dbox[1], pparm->axisOrig[1], pparm->dbox[3], pps->bbox[1],
+ pps->bbox[3]);
plotGray(pps, pparm, 0);
plotWidth(pps, pparm, pparm->axisThick);
- plotLine(pps, pparm,
- axX, pps->bbox[1], axX, pps->bbox[3]);
- plotLine(pps, pparm,
- pps->bbox[0], axY, pps->bbox[2], axY);
+ plotLine(pps, pparm, axX, pps->bbox[1], axX, pps->bbox[3]);
+ plotLine(pps, pparm, pps->bbox[0], axY, pps->bbox[2], axY);
if (strlen(pparm->axisHorzLabel) || strlen(pparm->axisVertLabel)) {
fprintf(pps->file, "/Helvetica findfont 20 scalefont setfont\n");
if (strlen(pparm->axisHorzLabel)) {
- plotLabel(pps, pparm, AIR_FALSE,
- pps->bbox[2], axY, pparm->axisHorzLabel);
+ plotLabel(pps, pparm, AIR_FALSE, pps->bbox[2], axY, pparm->axisHorzLabel);
}
if (strlen(pparm->axisVertLabel)) {
- plotLabel(pps, pparm, AIR_FALSE,
- axX, pps->bbox[3], pparm->axisVertLabel);
+ plotLabel(pps, pparm, AIR_FALSE, axX, pps->bbox[3], pparm->axisVertLabel);
}
}
if (pparm->numHorzTick) {
if (pparm->tickThick > 0) {
- toff = pparm->tickLength/2;
+ toff = pparm->tickLength / 2;
plotGray(pps, pparm, 0);
plotWidth(pps, pparm, pparm->tickThick);
- for (ti=0; ti<pparm->numHorzTick; ti++) {
+ for (ti = 0; ti < pparm->numHorzTick; ti++) {
xx = AIR_AFFINE(pparm->dbox[0], pparm->horzTick[ti], pparm->dbox[2],
pps->bbox[0], pps->bbox[2]);
plotLine(pps, pparm, xx, axY - toff, xx, axY + toff);
@@ -187,7 +178,7 @@
if (pparm->tickLabelSize) {
fprintf(pps->file, "/Helvetica findfont %g scalefont setfont\n",
pparm->tickLabelSize);
- for (ti=0; ti<pparm->numHorzTick; ti++) {
+ for (ti = 0; ti < pparm->numHorzTick; ti++) {
xx = AIR_AFFINE(pparm->dbox[0], pparm->horzTick[ti], pparm->dbox[2],
pps->bbox[0], pps->bbox[2]);
yy = axY + pparm->horzTickLabelOffset;
@@ -198,10 +189,10 @@
}
if (pparm->numVertTick) {
if (pparm->tickThick > 0) {
- toff = pparm->tickLength/2;
+ toff = pparm->tickLength / 2;
plotGray(pps, pparm, 0);
plotWidth(pps, pparm, pparm->tickThick);
- for (ti=0; ti<pparm->numVertTick; ti++) {
+ for (ti = 0; ti < pparm->numVertTick; ti++) {
yy = AIR_AFFINE(pparm->dbox[1], pparm->vertTick[ti], pparm->dbox[3],
pps->bbox[1], pps->bbox[3]);
plotLine(pps, pparm, axX - toff, yy, axX + toff, yy);
@@ -210,7 +201,7 @@
if (pparm->tickLabelSize) {
fprintf(pps->file, "/Helvetica findfont %g scalefont setfont\n",
pparm->tickLabelSize);
- for (ti=0; ti<pparm->numVertTick; ti++) {
+ for (ti = 0; ti < pparm->numVertTick; ti++) {
yy = AIR_AFFINE(pparm->dbox[1], pparm->vertTick[ti], pparm->dbox[3],
pps->bbox[1], pps->bbox[3]);
xx = axX + pparm->vertTickLabelOffset;
@@ -226,7 +217,7 @@
unsigned int ii, npts;
double xx, yy, *data, val;
- if (!( pparm->graphThick[nidx] > 0 )) {
+ if (!(pparm->graphThick[nidx] > 0)) {
return;
}
@@ -233,17 +224,13 @@
data = (double *)(ndata[nidx]->data);
npts = AIR_UINT(ndata[nidx]->axis[1].size);
plotGray(pps, pparm, pparm->graphGray[nidx]);
- fprintf(pps->file, "%g W\n", pps->psc*pparm->graphThick[nidx]);
- for (ii=0; ii<npts; ii++) {
+ fprintf(pps->file, "%g W\n", pps->psc * pparm->graphThick[nidx]);
+ for (ii = 0; ii < npts; ii++) {
val = data[ii];
- xx = AIR_AFFINE(0, ii, npts-1,
- ndata[nidx]->axis[1].min, ndata[nidx]->axis[1].max);
- xx = AIR_AFFINE(pparm->dbox[0], xx, pparm->dbox[2],
- pps->bbox[0], pps->bbox[2]);
- yy = AIR_AFFINE(pparm->dbox[1], val, pparm->dbox[3],
- pps->bbox[1], pps->bbox[3]);
- fprintf(pps->file, "%g %g %s\n", PPS_X(xx), PPS_Y(yy),
- ii ? "L" : "M");
+ xx = AIR_AFFINE(0, ii, npts - 1, ndata[nidx]->axis[1].min, ndata[nidx]->axis[1].max);
+ xx = AIR_AFFINE(pparm->dbox[0], xx, pparm->dbox[2], pps->bbox[0], pps->bbox[2]);
+ yy = AIR_AFFINE(pparm->dbox[1], val, pparm->dbox[3], pps->bbox[1], pps->bbox[3]);
+ fprintf(pps->file, "%g %g %s\n", PPS_X(xx), PPS_Y(yy), ii ? "L" : "M");
}
fprintf(pps->file, "S\n");
}
@@ -253,7 +240,7 @@
unsigned int ii, npts;
double xx, yy, orad, irad, *data, val;
- if (!( pparm->dotDiameter[nidx] > 0 )) {
+ if (!(pparm->dotDiameter[nidx] > 0)) {
return;
}
@@ -262,23 +249,20 @@
plotWidth(pps, pparm, 0);
data = (double *)(ndata[nidx]->data);
npts = AIR_UINT(ndata[nidx]->axis[1].size);
- orad = pparm->dotDiameter[nidx]/2;
- irad = pparm->dotInnerDiameterFraction*orad;
- for (ii=0; ii<npts; ii++) {
+ orad = pparm->dotDiameter[nidx] / 2;
+ irad = pparm->dotInnerDiameterFraction * orad;
+ for (ii = 0; ii < npts; ii++) {
val = data[ii];
- xx = AIR_AFFINE(0, ii, npts-1,
- ndata[nidx]->axis[1].min, ndata[nidx]->axis[1].max);
- xx = AIR_AFFINE(pparm->dbox[0], xx, pparm->dbox[2],
- pps->bbox[0], pps->bbox[2]);
- yy = AIR_AFFINE(pparm->dbox[1], val, pparm->dbox[3],
- pps->bbox[1], pps->bbox[3]);
+ xx = AIR_AFFINE(0, ii, npts - 1, ndata[nidx]->axis[1].min, ndata[nidx]->axis[1].max);
+ xx = AIR_AFFINE(pparm->dbox[0], xx, pparm->dbox[2], pps->bbox[0], pps->bbox[2]);
+ yy = AIR_AFFINE(pparm->dbox[1], val, pparm->dbox[3], pps->bbox[1], pps->bbox[3]);
plotGray(pps, pparm, pparm->dotGray[nidx]);
- fprintf(pps->file, "%g %g %g 0 360 arc closepath fill\n",
- PPS_X(xx), PPS_Y(yy), PPS_S(orad));
+ fprintf(pps->file, "%g %g %g 0 360 arc closepath fill\n", PPS_X(xx), PPS_Y(yy),
+ PPS_S(orad));
if (irad) {
plotGray(pps, pparm, 1.0);
- fprintf(pps->file, "%g %g %g 0 360 arc closepath fill\n",
- PPS_X(xx), PPS_Y(yy), PPS_S(irad));
+ fprintf(pps->file, "%g %g %g 0 360 arc closepath fill\n", PPS_X(xx), PPS_Y(yy),
+ PPS_S(irad));
}
}
fprintf(pps->file, "grestore\n");
@@ -298,7 +282,7 @@
main(int argc, const char *argv[]) {
const char *me;
char *err, *outS;
- hestOpt *hopt=NULL;
+ hestOpt *hopt = NULL;
airArray *mop;
int numGrth, numDtdi, numGrgr, numDtgr, numNrrd, ni;
@@ -311,126 +295,105 @@
me = argv[0];
hestOptAdd(&hopt, "i", "data", airTypeOther, 1, -1, &_ndata, NULL,
- "input nrrd containing data to plot",
- &numNrrd, NULL, nrrdHestNrrd);
- hestOptAdd(&hopt, "dbox", "minX minY maxX maxY", airTypeDouble,
- 4, 4, pparm.dbox, NULL,
+ "input nrrd containing data to plot", &numNrrd, NULL, nrrdHestNrrd);
+ hestOptAdd(&hopt, "dbox", "minX minY maxX maxY", airTypeDouble, 4, 4, pparm.dbox, NULL,
"bounding box, in data space");
- hestOptAdd(&hopt, "bbox", "minX minY maxX maxY", airTypeDouble,
- 4, 4, pps.bbox, NULL,
+ hestOptAdd(&hopt, "bbox", "minX minY maxX maxY", airTypeDouble, 4, 4, pps.bbox, NULL,
"bounding box, in graph space");
hestOptAdd(&hopt, "psc", "PS scale", airTypeDouble, 1, 1, &(pps.psc), "300",
"scaling from graph space to PostScript points");
hestOptAdd(&hopt, "nobg", NULL, airTypeInt, 0, 0, &(pps.nobg), NULL,
"don't fill with background color");
- hestOptAdd(&hopt, "bg", "background", airTypeDouble, 3, 3,
- &(pps.bgColor), "1 1 1",
+ hestOptAdd(&hopt, "bg", "background", airTypeDouble, 3, 3, &(pps.bgColor), "1 1 1",
"background RGB color; each component in range [0.0,1.0]");
- hestOptAdd(&hopt, "grth", "graph thickness", airTypeDouble,
- 1, -1, &(pparm.graphThick), "0.01",
- "thickness of line for graph, or \"0\" for no graph line",
+ hestOptAdd(&hopt, "grth", "graph thickness", airTypeDouble, 1, -1, &(pparm.graphThick),
+ "0.01", "thickness of line for graph, or \"0\" for no graph line",
&numGrth);
- hestOptAdd(&hopt, "grgr", "graph gray", airTypeDouble,
- 1, -1, &(pparm.graphGray), "0",
+ hestOptAdd(&hopt, "grgr", "graph gray", airTypeDouble, 1, -1, &(pparm.graphGray), "0",
"grayscale to use for graph", &numGrgr);
- hestOptAdd(&hopt, "dtdi", "dot diameter", airTypeDouble,
- 1, -1, &(pparm.dotDiameter), "0.1",
- "radius of dot drawn at data points, or \"0\" for no dots",
+ hestOptAdd(&hopt, "dtdi", "dot diameter", airTypeDouble, 1, -1, &(pparm.dotDiameter),
+ "0.1", "radius of dot drawn at data points, or \"0\" for no dots",
&numDtdi);
- hestOptAdd(&hopt, "dtgr", "dot gray", airTypeDouble,
- 1, -1, &(pparm.dotGray), "0",
+ hestOptAdd(&hopt, "dtgr", "dot gray", airTypeDouble, 1, -1, &(pparm.dotGray), "0",
"grayscale to use for dots", &numDtgr);
- hestOptAdd(&hopt, "dtid", "dot inner diam frac", airTypeDouble,
- 1, 1, &(pparm.dotInnerDiameterFraction), "0.0",
+ hestOptAdd(&hopt, "dtid", "dot inner diam frac", airTypeDouble, 1, 1,
+ &(pparm.dotInnerDiameterFraction), "0.0",
"fractional radius of white dot drawn within dot");
- hestOptAdd(&hopt, "tihz", "pos", airTypeDouble,
- 0, -1, &(pparm.horzTick), "",
- "locations for tickmarks on horizontal axis",
- &(pparm.numHorzTick));
- hestOptAdd(&hopt, "tivt", "pos", airTypeDouble,
- 0, -1, &(pparm.vertTick), "",
- "locations for tickmarks on vertical axis",
- &(pparm.numVertTick));
- hestOptAdd(&hopt, "tiho", "offset", airTypeDouble,
- 1, 1, &(pparm.horzTickLabelOffset), "0",
- "horizontal tick label offset");
- hestOptAdd(&hopt, "tivo", "offset", airTypeDouble,
- 1, 1, &(pparm.vertTickLabelOffset), "0",
- "vertical tick label offset");
- hestOptAdd(&hopt, "tils", "size", airTypeDouble,
- 1, 1, &(pparm.tickLabelSize), "0",
+ hestOptAdd(&hopt, "tihz", "pos", airTypeDouble, 0, -1, &(pparm.horzTick), "",
+ "locations for tickmarks on horizontal axis", &(pparm.numHorzTick));
+ hestOptAdd(&hopt, "tivt", "pos", airTypeDouble, 0, -1, &(pparm.vertTick), "",
+ "locations for tickmarks on vertical axis", &(pparm.numVertTick));
+ hestOptAdd(&hopt, "tiho", "offset", airTypeDouble, 1, 1, &(pparm.horzTickLabelOffset),
+ "0", "horizontal tick label offset");
+ hestOptAdd(&hopt, "tivo", "offset", airTypeDouble, 1, 1, &(pparm.vertTickLabelOffset),
+ "0", "vertical tick label offset");
+ hestOptAdd(&hopt, "tils", "size", airTypeDouble, 1, 1, &(pparm.tickLabelSize), "0",
"font size for labels on tick marks, or \"0\" for no labels");
- hestOptAdd(&hopt, "tith", "tick thickness", airTypeDouble,
- 1, 1, &(pparm.tickThick), "0.01",
- "thickness of lines for tick marks");
- hestOptAdd(&hopt, "tiln", "tick length", airTypeDouble,
- 1, 1, &(pparm.tickLength), "0.08",
- "length of lines for tick marks");
+ hestOptAdd(&hopt, "tith", "tick thickness", airTypeDouble, 1, 1, &(pparm.tickThick),
+ "0.01", "thickness of lines for tick marks");
+ hestOptAdd(&hopt, "tiln", "tick length", airTypeDouble, 1, 1, &(pparm.tickLength),
+ "0.08", "length of lines for tick marks");
- hestOptAdd(&hopt, "axth", "axis thickness", airTypeDouble,
- 1, 1, &(pparm.axisThick), "0.01",
- "thickness of lines for axes");
- hestOptAdd(&hopt, "axor", "axis origin", airTypeDouble,
- 2, 2, &(pparm.axisOrig), "0 0",
+ hestOptAdd(&hopt, "axth", "axis thickness", airTypeDouble, 1, 1, &(pparm.axisThick),
+ "0.01", "thickness of lines for axes");
+ hestOptAdd(&hopt, "axor", "axis origin", airTypeDouble, 2, 2, &(pparm.axisOrig), "0 0",
"origin of lines for axes, in data space");
- hestOptAdd(&hopt, "axhl", "horiz axis label", airTypeString,
- 1, 1, &(pparm.axisHorzLabel), "",
- "label on horizontal axis");
- hestOptAdd(&hopt, "axvl", "vert axis label", airTypeString,
- 1, 1, &(pparm.axisVertLabel), "",
- "label on vertical axis");
+ hestOptAdd(&hopt, "axhl", "horiz axis label", airTypeString, 1, 1,
+ &(pparm.axisHorzLabel), "", "label on horizontal axis");
+ hestOptAdd(&hopt, "axvl", "vert axis label", airTypeString, 1, 1,
+ &(pparm.axisVertLabel), "", "label on vertical axis");
- hestOptAdd(&hopt, "o", "output PS", airTypeString,
- 1, 1, &outS, "out.ps",
+ hestOptAdd(&hopt, "o", "output PS", airTypeString, 1, 1, &outS, "out.ps",
"output file to render postscript into");
- hestParseOrDie(hopt, argc-1, argv+1, NULL,
- me, info, AIR_TRUE, AIR_TRUE, AIR_TRUE);
+ hestParseOrDie(hopt, argc - 1, argv + 1, NULL, me, info, AIR_TRUE, AIR_TRUE, AIR_TRUE);
airMopAdd(mop, hopt, (airMopper)hestOptFree, airMopAlways);
airMopAdd(mop, hopt, (airMopper)hestParseFree, airMopAlways);
- if (!( numGrth == numDtdi
- && numDtdi == numGrgr
- && numGrgr == numDtgr )) {
- fprintf(stderr, "%s: number of arguments given to grth (%d), dtdi (%d), "
- "grgr (%d), dtgr (%d) not all equal\n", me,
- numGrth, numDtdi, numGrgr, numDtgr);
- airMopError(mop); return 1;
+ if (!(numGrth == numDtdi && numDtdi == numGrgr && numGrgr == numDtgr)) {
+ fprintf(stderr,
+ "%s: number of arguments given to grth (%d), dtdi (%d), "
+ "grgr (%d), dtgr (%d) not all equal\n",
+ me, numGrth, numDtdi, numGrgr, numDtgr);
+ airMopError(mop);
+ return 1;
}
- if (!( numNrrd == numGrth )) {
- fprintf(stderr, "%s: number of nrrds (%d) != number graph options (%d)\n",
- me, numNrrd, numGrth);
- airMopError(mop); return 1;
+ if (!(numNrrd == numGrth)) {
+ fprintf(stderr, "%s: number of nrrds (%d) != number graph options (%d)\n", me,
+ numNrrd, numGrth);
+ airMopError(mop);
+ return 1;
}
/* check nrrds */
- for (ni=0; ni<numNrrd; ni++) {
- if (!( (1 == _ndata[ni]->dim || 2 == _ndata[ni]->dim)
- && nrrdTypeBlock != _ndata[ni]->type )) {
- fprintf(stderr, "%s: input nrrd must be 1-D or 2-D array of scalars",
- me);
- airMopError(mop); return 1;
+ for (ni = 0; ni < numNrrd; ni++) {
+ if (!((1 == _ndata[ni]->dim || 2 == _ndata[ni]->dim)
+ && nrrdTypeBlock != _ndata[ni]->type)) {
+ fprintf(stderr, "%s: input nrrd must be 1-D or 2-D array of scalars", me);
+ airMopError(mop);
+ return 1;
}
}
- ndata = (Nrrd**)calloc(numNrrd, sizeof(Nrrd *));
+ ndata = (Nrrd **)calloc(numNrrd, sizeof(Nrrd *));
airMopAdd(mop, ndata, airFree, airMopAlways);
- for (ni=0; ni<numNrrd; ni++) {
+ for (ni = 0; ni < numNrrd; ni++) {
ndata[ni] = nrrdNew();
airMopAdd(mop, ndata[ni], (airMopper)nrrdNuke, airMopAlways);
if (nrrdConvert(ndata[ni], _ndata[ni], nrrdTypeDouble)) {
airMopAdd(mop, err = biffGetDone(NRRD), airFree, airMopAlways);
- fprintf(stderr, "%s: couldn't convert input %d to %s:\n%s\n",
- me, ni, airEnumStr(nrrdType, nrrdTypeDouble), err);
- airMopError(mop); return 1;
+ fprintf(stderr, "%s: couldn't convert input %d to %s:\n%s\n", me, ni,
+ airEnumStr(nrrdType, nrrdTypeDouble), err);
+ airMopError(mop);
+ return 1;
}
if (1 == ndata[ni]->dim) {
if (nrrdAxesInsert(ndata[ni], ndata[ni], 0)) {
airMopAdd(mop, err = biffGetDone(NRRD), airFree, airMopAlways);
- fprintf(stderr, "%s: couldn't insert axis 0 on nrrd %d:\n%s\n",
- me, ni, err);
- airMopError(mop); return 1;
+ fprintf(stderr, "%s: couldn't insert axis 0 on nrrd %d:\n%s\n", me, ni, err);
+ airMopError(mop);
+ return 1;
}
}
/* currently assuming node centering */
@@ -438,19 +401,20 @@
ndata[ni]->axis[1].min = 0;
}
if (!AIR_EXISTS(ndata[ni]->axis[1].max)) {
- ndata[ni]->axis[1].max = ndata[ni]->axis[1].size-1;
+ ndata[ni]->axis[1].max = ndata[ni]->axis[1].size - 1;
}
}
if (!(pps.file = airFopen(outS, stdout, "wb"))) {
fprintf(stderr, "%s: couldn't open output file\n", me);
- airMopError(mop); return 1;
+ airMopError(mop);
+ return 1;
}
airMopAdd(mop, pps.file, (airMopper)airFclose, airMopAlways);
plotPreamble(&pps, &pparm);
plotAxes(&pps, &pparm, ndata[0]);
- for (ni=0; ni<numNrrd; ni++) {
+ for (ni = 0; ni < numNrrd; ni++) {
plotGraph(&pps, &pparm, ndata, ni);
plotDots(&pps, &pparm, ndata, ni);
}
Modified: teem/trunk/src/limn/test/tcamanim.c
===================================================================
--- teem/trunk/src/limn/test/tcamanim.c 2023-07-07 21:32:07 UTC (rev 7043)
+++ teem/trunk/src/limn/test/tcamanim.c 2023-07-07 21:38:52 UTC (rev 7044)
@@ -29,16 +29,16 @@
_limnReadCamanim(int imgSize[2], limnCamera **keycamP, double **timeP,
unsigned int *numKeysP, FILE *fin) {
static const char me[] = "_limnReadCamanim";
- char line[AIR_STRLEN_HUGE];
+ char line[AIR_STRLEN_HUGE + 1];
unsigned int ki;
double *tmp, *dwell, di, dn, df, fr[3], at[3], up[3], va;
airArray *mop, *camA, *dwellA;
- if (!(0 < airOneLine(fin, line, AIR_STRLEN_HUGE) && !strcmp(_LIMNMAGIC, line))) {
+ if (!(0 < airOneLine(fin, line, AIR_STRLEN_HUGE + 1) && !strcmp(_LIMNMAGIC, line))) {
biffAddf(LIMN, "%s: couldn't read first line or it wasn't \"%s\"", me, _LIMNMAGIC);
return 1;
}
- if (!(0 < airOneLine(fin, line, AIR_STRLEN_HUGE)
+ if (!(0 < airOneLine(fin, line, AIR_STRLEN_HUGE + 1)
&& 2
== (airStrtrans(airStrtrans(line, '{', ' '), '}', ' '),
sscanf(line, "imgSize %d %d", imgSize + 0, imgSize + 1)))) {
@@ -54,7 +54,7 @@
airMopAdd(mop, camA, (airMopper)airArrayNix, airMopAlways);
airMopAdd(mop, dwellA, (airMopper)airArrayNuke, airMopAlways);
- while (0 < airOneLine(fin, line, AIR_STRLEN_HUGE)) {
+ while (0 < airOneLine(fin, line, AIR_STRLEN_HUGE + 1)) {
airStrtrans(airStrtrans(line, '{', ' '), '}', ' ');
ki = airArrayLenIncr(camA, 1);
airArrayLenIncr(dwellA, 1);
@@ -103,7 +103,7 @@
int
_limnWriteCamanim(FILE *fout, int imgSize[2], limnCamera *cam, int numFrames) {
- /* char me[]="_limnWriteCamanim", err[AIR_STRLEN_MED]; */
+ /* char me[]="_limnWriteCamanim", err[AIR_STRLEN_MED+1]; */
int fi;
fprintf(fout, "%s\n", _LIMNMAGIC);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <kin...@us...> - 2023-07-07 21:32:10
|
Revision: 7043
http://sourceforge.net/p/teem/code/7043
Author: kindlmann
Date: 2023-07-07 21:32:07 +0000 (Fri, 07 Jul 2023)
Log Message:
-----------
Propagating AIR_STRLEN --> AIR_STRLEN+1 change, with these API CHANGEs
to these functions:
int gageStackBlurParmSprint(char str[AIR_STRLEN_LARGE + 1],
const gageStackBlurParm *sbp,
int extraFlag[256],
char *extraParm);
int gageStackBlurParmCompare(const gageStackBlurParm *sbpA,
const char *nameA,
const gageStackBlurParm *sbpB,
const char *nameB,
int *differ,
char explain[AIR_STRLEN_LARGE + 1]);
and to these struct members:
gageKind_t:
char name[AIR_STRLEN_SMALL + 1]; /* short identifying string for kind */
gageContext:
char errStr[AIR_STRLEN_LARGE + 1];
Modified Paths:
--------------
teem/trunk/src/gage/ctx.c
teem/trunk/src/gage/gage.h
teem/trunk/src/gage/kind.c
teem/trunk/src/gage/optimsig.c
teem/trunk/src/gage/stackBlur.c
Modified: teem/trunk/src/gage/ctx.c
===================================================================
--- teem/trunk/src/gage/ctx.c 2023-07-07 21:24:21 UTC (rev 7042)
+++ teem/trunk/src/gage/ctx.c 2023-07-07 21:32:07 UTC (rev 7043)
@@ -236,7 +236,7 @@
} else {
/* its a derivative, so integral must be near zero */
if (!(AIR_ABS(integral) <= ctx->parm.kernelIntegralNearZero)) {
- char str[AIR_STRLEN_LARGE] = "";
+ char str[AIR_STRLEN_LARGE + 1] = "";
nrrdKernelSprint(str, k, kparm);
biffAddf(GAGE,
"%s: derivative %s kernel (%s) integral %g not within "
Modified: teem/trunk/src/gage/gage.h
===================================================================
--- teem/trunk/src/gage/gage.h 2023-07-07 21:24:21 UTC (rev 7042)
+++ teem/trunk/src/gage/gage.h 2023-07-07 21:32:07 UTC (rev 7043)
@@ -774,7 +774,7 @@
something is actually sprintf'ed into errStr is controlled by
parm.generateErrStr.
NOTE: these variables used to be globals "gageErrStr" and "gageErrNum" */
- char errStr[AIR_STRLEN_LARGE];
+ char errStr[AIR_STRLEN_LARGE + 1];
int errNum; /* takes values from the gageErr enum */
/* what fraction of the values in the kernel support had to be invented
@@ -845,25 +845,25 @@
** and set everything in a single shot).
*/
typedef struct gageKind_t {
- int dynamicAlloc; /* non-zero if this kind struct was
- dynamically allocated */
- char name[AIR_STRLEN_SMALL]; /* short identifying string for kind */
- const airEnum *enm; /* such as gageScl. NB: the "unknown"
- value in the enum *must* be 0. */
- unsigned int baseDim, /* dimension that x,y,z axes start on
- (e.g. 0 for scalars, 1 for vectors) */
- valLen; /* number of scalars per data point,
- -or- 0 to represent "this value will
- be learned later at runtime" */
- int itemMax; /* such as GAGE_SCL_ITEM_MAX */
- gageItemEntry *table; /* array of gageItemEntry's, indexed
- by the item value,
- -or- NULL if the table cannot be
- statically allocated (not because it
- can come in different sizes, but
- because it needs to be a modified
- version of the compile-time table */
- void (*iv3Print)(FILE *, /* such as _gageSclIv3Print() */
+ int dynamicAlloc; /* non-zero if this kind struct was
+ dynamically allocated */
+ char name[AIR_STRLEN_SMALL + 1]; /* short identifying string for kind */
+ const airEnum *enm; /* such as gageScl. NB: the "unknown"
+ value in the enum *must* be 0. */
+ unsigned int baseDim, /* dimension that x,y,z axes start on
+ (e.g. 0 for scalars, 1 for vectors) */
+ valLen; /* number of scalars per data point,
+ -or- 0 to represent "this value will
+ be learned later at runtime" */
+ int itemMax; /* such as GAGE_SCL_ITEM_MAX */
+ gageItemEntry *table; /* array of gageItemEntry's, indexed
+ by the item value,
+ -or- NULL if the table cannot be
+ statically allocated (not because it
+ can come in different sizes, but
+ because it needs to be a modified
+ version of the compile-time table */
+ void (*iv3Print)(FILE *, /* such as _gageSclIv3Print() */
gageContext *,
gagePerVolume *),
(*filter)(gageContext *, /* such as _gageSclFilter() */
@@ -1208,7 +1208,7 @@
const gageStackBlurParm *sbpB,
const char *nameB,
int *differ,
- char explain[AIR_STRLEN_LARGE]);
+ char explain[AIR_STRLEN_LARGE + 1]);
GAGE_EXPORT int gageStackBlurParmScaleSet(gageStackBlurParm *sbp, unsigned int num,
double sigmaMin, double sigmaMax,
int uniformSigma, int optimalL2L2);
@@ -1235,7 +1235,7 @@
char **extraParmsP,
const char *str);
GAGE_EXPORT const hestCB *const gageHestStackBlurParm;
-GAGE_EXPORT int gageStackBlurParmSprint(char str[AIR_STRLEN_LARGE],
+GAGE_EXPORT int gageStackBlurParmSprint(char str[AIR_STRLEN_LARGE + 1],
const gageStackBlurParm *sbp,
int extraFlag[256],
char *extraParm);
Modified: teem/trunk/src/gage/kind.c
===================================================================
--- teem/trunk/src/gage/kind.c 2023-07-07 21:24:21 UTC (rev 7042)
+++ teem/trunk/src/gage/kind.c 2023-07-07 21:32:07 UTC (rev 7043)
@@ -237,7 +237,7 @@
return 1;
}
if (kind->baseDim) {
- char stmp[AIR_STRLEN_SMALL];
+ char stmp[AIR_STRLEN_SMALL + 1];
if (1 == kind->baseDim) {
if (kind->valLen != nrrd->axis[0].size) {
biffAddf(GAGE, "%s: %s kind needs %u axis 0 values, not %s", me, kind->name,
Modified: teem/trunk/src/gage/optimsig.c
===================================================================
--- teem/trunk/src/gage/optimsig.c 2023-07-07 21:24:21 UTC (rev 7042)
+++ teem/trunk/src/gage/optimsig.c 2023-07-07 21:32:07 UTC (rev 7043)
@@ -520,7 +520,7 @@
*/
/*
if (debugging) {
- char fname[AIR_STRLEN_SMALL];
+ char fname[AIR_STRLEN_SMALL+1];
sprintf(fname, "interp-%04u.nrrd", debugii);
nrrdSave(fname, ninterp, NULL);
}
@@ -625,7 +625,7 @@
}
/*
if (debugging) {
- char fname[AIR_STRLEN_SMALL];
+ char fname[AIR_STRLEN_SMALL+1];
sprintf(fname, "interp-%04u.nrrd", debugii);
nrrdSave(fname, oscx->ninterp, NULL);
}
@@ -674,7 +674,7 @@
oscx->trueImgNum, AIR_NAN, AIR_NAN);
/*
if (debugging) {
- char fname[AIR_STRLEN_SMALL];
+ char fname[AIR_STRLEN_SMALL+1];
unsigned int ni;
for (ni=0; ni<oscx->sampleNum; ni++) {
sprintf(fname, "sample-%04u.nrrd", ni);
@@ -684,7 +684,7 @@
*/
if (0) {
static unsigned int call = 0;
- char fname[AIR_STRLEN_SMALL];
+ char fname[AIR_STRLEN_SMALL + 1];
sprintf(fname, "err-%04u.nrrd", call);
nrrdSave(fname, oscx->nerr, NULL);
call++;
@@ -742,7 +742,7 @@
*retP = 1000 * oscx->sampleNum * (mmErr[1] - mmErr[0]) / (rr[1] - rr[0]);
if (0) {
static unsigned int call = 0;
- char fname[AIR_STRLEN_SMALL];
+ char fname[AIR_STRLEN_SMALL + 1];
sprintf(fname, "err-%04u.nrrd", call);
nrrdSave(fname, oscx->nerr, NULL);
call++;
@@ -794,7 +794,7 @@
}
static char *
-_timefmt(char tstr[AIR_STRLEN_MED], double deltim) {
+_timefmt(char tstr[AIR_STRLEN_MED + 1], double deltim) {
if (deltim < 60) {
sprintf(tstr, "%g secs", deltim);
@@ -823,7 +823,7 @@
static int /* Biff: 1 */
_optsigrun(gageOptimSigContext *oscx) {
static const char me[] = "_optsigrun";
- char tstr[AIR_STRLEN_MED];
+ char tstr[AIR_STRLEN_MED + 1];
unsigned int iter, pnt;
double lastErr, newErr, rhoeps, oppor, lastPos, backoff, decavg, time0;
int badStep;
@@ -965,7 +965,7 @@
static int /* Biff: 1 */
_optsigrunLinf(gageOptimSigContext *oscx) {
static const char me[] = "_optsigrunLinf";
- char tstr[AIR_STRLEN_MED];
+ char tstr[AIR_STRLEN_MED + 1];
double *srho, *stmp, time0, lastErr, newErr, decavg, step, oppor, backoff, ceps,
mmErr[2];
unsigned int iter, si, sn, mmIdx[2];
@@ -1165,7 +1165,7 @@
unsigned int sigmaNum, const NrrdKernelSpec *kssSpec,
int imgMeasr) {
static const char me[] = "gageOptimSigErrorPlot";
- char doneStr[AIR_STRLEN_SMALL];
+ char doneStr[AIR_STRLEN_SMALL + 1];
double *out;
unsigned int ii;
@@ -1231,7 +1231,7 @@
/*
if (0) {
static unsigned int call=0;
- char fname[AIR_STRLEN_SMALL];
+ char fname[AIR_STRLEN_SMALL+1];
unsigned int ni;
if (0) {
sprintf(fname, "err-%04u.nrrd", call);
@@ -1256,7 +1256,7 @@
unsigned int sampleNum, const NrrdKernelSpec *kssSpec,
int imgMeasr) {
static const char me[] = "gageOptimSigErrorPlotSliding";
- char doneStr[AIR_STRLEN_SMALL];
+ char doneStr[AIR_STRLEN_SMALL + 1];
unsigned int ii;
double *out;
char hackKeyStr[] = "TEEM_OPTSIG_RECONERR";
Modified: teem/trunk/src/gage/stackBlur.c
===================================================================
--- teem/trunk/src/gage/stackBlur.c 2023-07-07 21:24:21 UTC (rev 7042)
+++ teem/trunk/src/gage/stackBlur.c 2023-07-07 21:32:07 UTC (rev 7043)
@@ -124,11 +124,11 @@
int /* Biff: 1 */
gageStackBlurParmCompare(const gageStackBlurParm *aa, const char *_nameA,
const gageStackBlurParm *bb, const char *_nameB, int *differ,
- char explain[AIR_STRLEN_LARGE]) {
+ char explain[AIR_STRLEN_LARGE + 1]) {
static const char me[] = "gageStackBlurParmCompare", baseA[] = "A", baseB[] = "B";
const char *nameA, *nameB;
unsigned int si, warnLen = AIR_STRLEN_LARGE / 4;
- char stmp[2][AIR_STRLEN_LARGE], subexplain[AIR_STRLEN_LARGE];
+ char stmp[2][AIR_STRLEN_LARGE + 1], subexplain[AIR_STRLEN_LARGE + 1];
if (!(aa && bb && differ)) {
biffAddf(GAGE, "%s: got NULL pointer (%p %p %p)", me, AIR_CVOIDP(aa), AIR_CVOIDP(bb),
@@ -230,7 +230,7 @@
gageStackBlurParmCopy(gageStackBlurParm *dst, const gageStackBlurParm *src) {
static const char me[] = "gageStackBlurParmCopy";
int differ;
- char explain[AIR_STRLEN_LARGE];
+ char explain[AIR_STRLEN_LARGE + 1];
if (!(dst && src)) {
biffAddf(GAGE, "%s: got NULL pointer", me);
@@ -662,7 +662,7 @@
}
if (parmS) {
unsigned int parmIdx;
- char *pval, xeq[AIR_STRLEN_SMALL];
+ char *pval, xeq[AIR_STRLEN_SMALL + 1];
parmNum = airStrntok(parmS, "/");
for (parmIdx = 0; parmIdx < parmNum; parmIdx++) {
if (!parmIdx) {
@@ -801,12 +801,12 @@
}
int /* Biff: 1 */
-gageStackBlurParmSprint(char str[AIR_STRLEN_LARGE],
+gageStackBlurParmSprint(char str[AIR_STRLEN_LARGE + 1],
const gageStackBlurParm *sbp,
int extraFlag[256],
char *extraParm) {
static const char me[] = "gageStackBlurParmSprint";
- char *out, stmp[AIR_STRLEN_LARGE];
+ char *out, stmp[AIR_STRLEN_LARGE + 1];
int needFlags, hef;
unsigned int fi;
@@ -891,7 +891,7 @@
}
static int
-_gageHestStackBlurParmParse(void *ptr, const char *str, char err[AIR_STRLEN_HUGE]) {
+_gageHestStackBlurParmParse(void *ptr, const char *str, char err[AIR_STRLEN_HUGE + 1]) {
gageStackBlurParm **sbp;
static const char me[] = "_gageHestStackBlurParmParse";
char *nerr;
@@ -912,7 +912,7 @@
/* NOTE: no way to retrieve extraFlags or extraParms from hest */
if (gageStackBlurParmParse(*sbp, NULL, NULL, str)) {
nerr = biffGetDone(GAGE);
- airStrcpy(err, AIR_STRLEN_HUGE, nerr);
+ airStrcpy(err, AIR_STRLEN_HUGE + 1, nerr);
gageStackBlurParmNix(*sbp);
free(nerr);
return 1;
@@ -959,7 +959,7 @@
/* clang-format off */
static const char
-_blurKey[KVP_NUM][AIR_STRLEN_LARGE] = {/* 0 */ "gageStackBlur",
+_blurKey[KVP_NUM][AIR_STRLEN_LARGE+1] = {/* 0 */ "gageStackBlur",
/* 1 */ "cksum",
/* 2 */ "scale",
/* 3 */ "kernel",
@@ -974,7 +974,7 @@
/* clang-format on */
typedef struct {
- char val[KVP_NUM][AIR_STRLEN_LARGE];
+ char val[KVP_NUM][AIR_STRLEN_LARGE + 1];
} blurVal_t;
static blurVal_t * /* Biff: NULL */
@@ -1176,7 +1176,7 @@
}
/*
if (0) {
- char fname[AIR_STRLEN_SMALL];
+ char fname[AIR_STRLEN_SMALL+1];
sprintf(fname, "noutFT-%03u.nrrd", blIdx);
nrrdSave(fname, noutFT, NULL);
sprintf(fname, "noutCd-%03u.nrrd", blIdx);
@@ -1429,7 +1429,7 @@
}
} else {
if (sbp->verbose) {
- char kstr[AIR_STRLEN_LARGE], bstr[AIR_STRLEN_LARGE];
+ char kstr[AIR_STRLEN_LARGE + 1], bstr[AIR_STRLEN_LARGE + 1];
nrrdKernelSpecSprint(kstr, kssb);
nrrdBoundarySpecSprint(bstr, sbp->bspec);
fprintf(stderr,
@@ -1629,7 +1629,7 @@
int firstExists;
FILE *file;
/* do have info about files to load, but may fail in many ways */
- fname = AIR_CALLOC(strlen(format) + AIR_STRLEN_SMALL, char);
+ fname = AIR_CALLOC(strlen(format) + AIR_STRLEN_SMALL + 1, char);
if (!fname) {
biffAddf(GAGE, "%s: couldn't allocate fname", me);
airMopError(mop);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <kin...@us...> - 2023-07-07 21:24:24
|
Revision: 7042
http://sourceforge.net/p/teem/code/7042
Author: kindlmann
Date: 2023-07-07 21:24:21 +0000 (Fri, 07 Jul 2023)
Log Message:
-----------
propagating AIR_STRLEN --> AIR_STRLEN+1 change
Modified Paths:
--------------
teem/trunk/src/alan/coreAlan.c
Modified: teem/trunk/src/alan/coreAlan.c
===================================================================
--- teem/trunk/src/alan/coreAlan.c 2023-07-07 21:23:44 UTC (rev 7041)
+++ teem/trunk/src/alan/coreAlan.c 2023-07-07 21:24:21 UTC (rev 7042)
@@ -175,7 +175,7 @@
static int
_alanPerIteration(alanContext *actx, int iter) {
static const char me[] = "_alanPerIteration";
- char fname[AIR_STRLEN_MED];
+ char fname[AIR_STRLEN_MED + 1];
Nrrd *nslc, *nimg;
if (!(actx->saveInterval || actx->frameInterval)) {
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <kin...@us...> - 2023-07-07 21:23:47
|
Revision: 7041
http://sourceforge.net/p/teem/code/7041
Author: kindlmann
Date: 2023-07-07 21:23:44 +0000 (Fri, 07 Jul 2023)
Log Message:
-----------
propagating AIR_STRLEN --> AIR_STRLEN+1 change
Modified Paths:
--------------
teem/trunk/src/unrrdu/about.c
teem/trunk/src/unrrdu/cksum.c
teem/trunk/src/unrrdu/crop.c
teem/trunk/src/unrrdu/dice.c
teem/trunk/src/unrrdu/diff.c
teem/trunk/src/unrrdu/flotsam.c
teem/trunk/src/unrrdu/ilk.c
teem/trunk/src/unrrdu/lut2.c
teem/trunk/src/unrrdu/make.c
teem/trunk/src/unrrdu/resample.c
teem/trunk/src/unrrdu/save.c
teem/trunk/src/unrrdu/shuffle.c
teem/trunk/src/unrrdu/slice.c
teem/trunk/src/unrrdu/vidicon.c
Modified: teem/trunk/src/unrrdu/about.c
===================================================================
--- teem/trunk/src/unrrdu/about.c 2023-07-07 21:18:10 UTC (rev 7040)
+++ teem/trunk/src/unrrdu/about.c 2023-07-07 21:23:44 UTC (rev 7041)
@@ -26,7 +26,7 @@
static int
unrrdu_aboutMain(int argc, const char **argv, const char *me, hestParm *hparm) {
- char buff[AIR_STRLEN_LARGE], fmt[AIR_STRLEN_MED];
+ char buff[AIR_STRLEN_LARGE + 1], fmt[AIR_STRLEN_MED + 1];
char par1[] = "\t\t\t\t"
"\"unu\" is a command-line interface to much of the functionality "
"in \"nrrd\", a C library for raster data processing. Nrrd is one "
Modified: teem/trunk/src/unrrdu/cksum.c
===================================================================
--- teem/trunk/src/unrrdu/cksum.c 2023-07-07 21:18:10 UTC (rev 7040)
+++ teem/trunk/src/unrrdu/cksum.c 2023-07-07 21:23:44 UTC (rev 7041)
@@ -34,7 +34,7 @@
Nrrd *nrrd;
airArray *mop;
unsigned int crc;
- char stmp[AIR_STRLEN_SMALL], ends[AIR_STRLEN_SMALL];
+ char stmp[AIR_STRLEN_SMALL + 1], ends[AIR_STRLEN_SMALL + 1];
size_t nn;
mop = airMopNew();
Modified: teem/trunk/src/unrrdu/crop.c
===================================================================
--- teem/trunk/src/unrrdu/crop.c 2023-07-07 21:18:10 UTC (rev 7040)
+++ teem/trunk/src/unrrdu/crop.c 2023-07-07 21:23:44 UTC (rev 7041)
@@ -99,18 +99,18 @@
unsigned int axi;
if (!(2 == _nbounds->dim && nin->dim == AIR_UINT(_nbounds->axis[0].size)
&& 2 == _nbounds->axis[1].size)) {
- char stmp1[AIR_STRLEN_SMALL], stmp2[AIR_STRLEN_SMALL];
+ char stmp[2][AIR_STRLEN_SMALL + 1];
if (_nbounds->dim >= 2) {
- airSprintSize_t(stmp1, _nbounds->axis[1].size);
+ airSprintSize_t(stmp[0], _nbounds->axis[1].size);
} else {
- strcpy(stmp1, "");
+ strcpy(stmp[0], "");
}
fprintf(stderr,
"%s: expected 2-D %u-by-2 array of cropping bounds, "
"not %u-D %s%s%s%s\n",
me, nin->dim, _nbounds->dim,
- airSprintSize_t(stmp2, _nbounds->axis[0].size),
- _nbounds->dim >= 2 ? "-by-" : "-long", _nbounds->dim >= 2 ? stmp1 : "",
+ airSprintSize_t(stmp[1], _nbounds->axis[0].size),
+ _nbounds->dim >= 2 ? "-by-" : "-long", _nbounds->dim >= 2 ? stmp[0] : "",
_nbounds->dim > 2 ? "-by-X" : "");
airMopError(mop);
return 1;
Modified: teem/trunk/src/unrrdu/dice.c
===================================================================
--- teem/trunk/src/unrrdu/dice.c 2023-07-07 21:18:10 UTC (rev 7040)
+++ teem/trunk/src/unrrdu/dice.c 2023-07-07 21:23:44 UTC (rev 7041)
@@ -32,9 +32,9 @@
static int
unrrdu_diceMain(int argc, const char **argv, const char *me, hestParm *hparm) {
hestOpt *opt = NULL;
- char *base, *err, fnout[AIR_STRLEN_MED], /* file name out */
- fffname[AIR_STRLEN_MED], /* format for filename */
- *ftmpl; /* format template */
+ char *base, *err, fnout[AIR_STRLEN_MED + 1], /* file name out */
+ fffname[AIR_STRLEN_MED + 1], /* format for filename */
+ *ftmpl; /* format template */
Nrrd *nin, *nout;
int pret, fit;
unsigned int axis, start, pos, top, size, sanity;
@@ -76,7 +76,7 @@
return 1;
}
if (nin->axis[axis].size > sanity) {
- char stmp[AIR_STRLEN_SMALL];
+ char stmp[AIR_STRLEN_SMALL + 1];
fprintf(stderr,
"%s: axis %u size %s > sanity limit %u; "
"increase via \"-l\"\n",
Modified: teem/trunk/src/unrrdu/diff.c
===================================================================
--- teem/trunk/src/unrrdu/diff.c 2023-07-07 21:18:10 UTC (rev 7040)
+++ teem/trunk/src/unrrdu/diff.c 2023-07-07 21:23:44 UTC (rev 7041)
@@ -39,7 +39,7 @@
Nrrd *ninA, *ninB;
int quiet, exitstat, onlyData, differ, ret;
double epsilon;
- char explain[AIR_STRLEN_LARGE];
+ char explain[AIR_STRLEN_LARGE + 1];
mop = airMopNew();
hestOptAdd(&opt, NULL, "ninA", airTypeOther, 1, 1, &ninA, NULL, "First input nrrd.",
Modified: teem/trunk/src/unrrdu/flotsam.c
===================================================================
--- teem/trunk/src/unrrdu/flotsam.c 2023-07-07 21:18:10 UTC (rev 7040)
+++ teem/trunk/src/unrrdu/flotsam.c 2023-07-07 21:23:44 UTC (rev 7041)
@@ -146,7 +146,7 @@
}
/* else, we see if its --version */
if (!strcmp("--version", argv[1])) {
- char vbuff[AIR_STRLEN_LARGE];
+ char vbuff[AIR_STRLEN_LARGE + 1];
airTeemVersionSprint(vbuff);
printf("%s\n", vbuff);
exit(0);
@@ -192,7 +192,7 @@
*/
void
unrrduUsageUnu(const char *me, hestParm *hparm, int alsoHidden) {
- char buff[AIR_STRLEN_LARGE], fmt[AIR_STRLEN_LARGE];
+ char buff[AIR_STRLEN_LARGE + 1], fmt[AIR_STRLEN_LARGE + 1];
unsigned int cmdi, chi, len, maxlen;
maxlen = 0;
@@ -269,7 +269,7 @@
int /* Biff: nope */
unrrduUsage(const char *me, hestParm *hparm, const char *title,
const unrrduCmd *const *cmdList) {
- char buff[AIR_STRLEN_LARGE], fmt[AIR_STRLEN_LARGE];
+ char buff[AIR_STRLEN_LARGE + 1], fmt[AIR_STRLEN_LARGE + 1];
unsigned int cmdi, chi, len, maxlen;
if (!(title && cmdList)) {
@@ -328,7 +328,7 @@
** pos[0] == -1: pos[1] gives the position relative to a "minimum" position
*/
static int
-parsePos(void *ptr, const char *str, char err[AIR_STRLEN_HUGE]) {
+parsePos(void *ptr, const char *str, char err[AIR_STRLEN_HUGE + 1]) {
static const char me[] = "parsePos";
long int *pos;
@@ -402,7 +402,7 @@
** value as nrrdTypeDefault.
*/
static int
-parseMaybeType(void *ptr, const char *str, char err[AIR_STRLEN_HUGE]) {
+parseMaybeType(void *ptr, const char *str, char err[AIR_STRLEN_HUGE + 1]) {
static const char me[] = "parseMaybeType";
int *typeP;
@@ -439,7 +439,7 @@
** for parsing an int that can be 8, 16, or 32
*/
static int
-parseBits(void *ptr, const char *str, char err[AIR_STRLEN_HUGE]) {
+parseBits(void *ptr, const char *str, char err[AIR_STRLEN_HUGE + 1]) {
static const char me[] = "parseBits";
unsigned int *bitsP;
@@ -482,7 +482,7 @@
** s<float> : unrrduScaleSpacingTarget
*/
static int
-parseScale(void *ptr, const char *str, char err[AIR_STRLEN_HUGE]) {
+parseScale(void *ptr, const char *str, char err[AIR_STRLEN_HUGE + 1]) {
static const char me[] = "parseScale";
double *scale;
unsigned int num;
@@ -569,7 +569,7 @@
}
static int
-parseFile(void *ptr, const char *str, char err[AIR_STRLEN_HUGE]) {
+parseFile(void *ptr, const char *str, char err[AIR_STRLEN_HUGE + 1]) {
static const char me[] = "parseFile";
FILE **fileP;
@@ -605,7 +605,7 @@
** enc[2]: for zlib: strategy, from nrrdZlibStrategy* enum
*/
static int
-parseEncoding(void *ptr, const char *_str, char err[AIR_STRLEN_HUGE]) {
+parseEncoding(void *ptr, const char *_str, char err[AIR_STRLEN_HUGE + 1]) {
static const char me[] = "parseEncoding";
char *str, *opt;
int *enc;
@@ -685,7 +685,7 @@
** as indicated by one of: btext, ptext, baretext, plaintext
*/
static int
-parseFormat(void *ptr, const char *str, char err[AIR_STRLEN_HUGE]) {
+parseFormat(void *ptr, const char *str, char err[AIR_STRLEN_HUGE + 1]) {
static const char me[] = "parseFormat";
int *enc;
Modified: teem/trunk/src/unrrdu/ilk.c
===================================================================
--- teem/trunk/src/unrrdu/ilk.c 2023-07-07 21:18:10 UTC (rev 7040)
+++ teem/trunk/src/unrrdu/ilk.c 2023-07-07 21:23:44 UTC (rev 7041)
@@ -317,7 +317,7 @@
if (nrrdBoundaryPad == bound) {
if (_bkgLen != MOSS_CHAN_NUM(nin)) {
- char stmp[AIR_STRLEN_SMALL];
+ char stmp[AIR_STRLEN_SMALL + 1];
fprintf(stderr, "%s: got length %u background, but image has %s channels\n", me,
_bkgLen, airSprintSize_t(stmp, MOSS_CHAN_NUM(nin)));
airMopError(mop);
Modified: teem/trunk/src/unrrdu/lut2.c
===================================================================
--- teem/trunk/src/unrrdu/lut2.c 2023-07-07 21:18:10 UTC (rev 7040)
+++ teem/trunk/src/unrrdu/lut2.c 2023-07-07 21:23:44 UTC (rev 7041)
@@ -83,7 +83,7 @@
airMopAdd(mop, nout, (airMopper)nrrdNuke, airMopAlways);
if (!(nin->dim > 1 && 2 == nin->axis[0].size)) {
- char stmp[AIR_STRLEN_SMALL];
+ char stmp[AIR_STRLEN_SMALL + 1];
fprintf(stderr,
"%s: input nrrd dim must be > 1, and axis[0].size "
"must be 2 (not %s)\n",
Modified: teem/trunk/src/unrrdu/make.c
===================================================================
--- teem/trunk/src/unrrdu/make.c 2023-07-07 21:18:10 UTC (rev 7040)
+++ teem/trunk/src/unrrdu/make.c 2023-07-07 21:23:44 UTC (rev 7041)
@@ -65,7 +65,8 @@
static int
unrrdu_makeMain(int argc, const char **argv, const char *me, hestParm *hparm) {
hestOpt *opt = NULL;
- char *out, *outData, *err, **dataFileNames, **kvp, *content, encInfo[AIR_STRLEN_LARGE];
+ char *out, *outData, *err, **dataFileNames, **kvp, *content,
+ encInfo[AIR_STRLEN_LARGE + 1];
Nrrd *nrrd;
size_t *size, bufLen;
int headerOnly, pret, lineSkip, endian, type, encodingType, gotSpacing, gotThickness,
Modified: teem/trunk/src/unrrdu/resample.c
===================================================================
--- teem/trunk/src/unrrdu/resample.c 2023-07-07 21:18:10 UTC (rev 7040)
+++ teem/trunk/src/unrrdu/resample.c 2023-07-07 21:23:44 UTC (rev 7041)
@@ -310,7 +310,7 @@
}
if (!E) E |= nrrdResampleKernelSet(rsmc, ai, unuk->kernel, unuk->parm);
switch (dowhat) {
- char stmp[AIR_STRLEN_SMALL];
+ char stmp[AIR_STRLEN_SMALL] + 1;
case unrrduScaleMultiply:
samplesOut = AIR_ROUNDUP_UI(nin->axis[ai].size * scale[1 + 2 * ai]);
break;
Modified: teem/trunk/src/unrrdu/save.c
===================================================================
--- teem/trunk/src/unrrdu/save.c 2023-07-07 21:18:10 UTC (rev 7040)
+++ teem/trunk/src/unrrdu/save.c 2023-07-07 21:23:44 UTC (rev 7041)
@@ -35,7 +35,7 @@
static int
unrrdu_saveMain(int argc, const char **argv, const char *me, hestParm *hparm) {
hestOpt *opt = NULL;
- char *out, *err, *outData, encInfo[AIR_STRLEN_HUGE], fmtInfo[AIR_STRLEN_HUGE];
+ char *out, *err, *outData, encInfo[AIR_STRLEN_HUGE + 1], fmtInfo[AIR_STRLEN_HUGE + 1];
Nrrd *nin, *nout;
airArray *mop;
NrrdIoState *nio;
Modified: teem/trunk/src/unrrdu/shuffle.c
===================================================================
--- teem/trunk/src/unrrdu/shuffle.c 2023-07-07 21:18:10 UTC (rev 7040)
+++ teem/trunk/src/unrrdu/shuffle.c 2023-07-07 21:23:44 UTC (rev 7041)
@@ -73,7 +73,7 @@
return 1;
}
if (!(permLen == nin->axis[axis].size)) {
- char stmp[AIR_STRLEN_SMALL];
+ char stmp[AIR_STRLEN_SMALL + 1];
fprintf(stderr, "%s: permutation length (%u) != axis %d's size (%s)\n", me, permLen,
axis, airSprintSize_t(stmp, nin->axis[axis].size));
airMopError(mop);
Modified: teem/trunk/src/unrrdu/slice.c
===================================================================
--- teem/trunk/src/unrrdu/slice.c 2023-07-07 21:18:10 UTC (rev 7040)
+++ teem/trunk/src/unrrdu/slice.c 2023-07-07 21:23:44 UTC (rev 7041)
@@ -78,7 +78,7 @@
return 1;
}
for (axi = 0; axi < axisNum; axi++) {
- char stmp[AIR_STRLEN_SMALL];
+ char stmp[AIR_STRLEN_SMALL + 1];
if (axisNum > 1) {
sprintf(stmp, "[%d]", axi);
} else {
Modified: teem/trunk/src/unrrdu/vidicon.c
===================================================================
--- teem/trunk/src/unrrdu/vidicon.c 2023-07-07 21:18:10 UTC (rev 7040)
+++ teem/trunk/src/unrrdu/vidicon.c 2023-07-07 21:23:44 UTC (rev 7041)
@@ -35,7 +35,7 @@
unsigned int vsize[2], vpadding[2], rpadding[2];
double rescale, rperc;
Nrrd *nin, *nrescale, *npad, *nvbase, *ntmp, *nout;
- char *out, *err, *stpfx, stname[AIR_STRLEN_SMALL];
+ char *out, *err, *stpfx, stname[AIR_STRLEN_SMALL + 1];
int pret;
NrrdResampleContext *rsmc;
NrrdKernelSpec *rescaleKsp, *vdsmp[2];
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <kin...@us...> - 2023-07-07 21:18:12
|
Revision: 7040
http://sourceforge.net/p/teem/code/7040
Author: kindlmann
Date: 2023-07-07 21:18:10 +0000 (Fri, 07 Jul 2023)
Log Message:
-----------
propagating AIR_STRLEN --> AIR_STRLEN+1 change
Modified Paths:
--------------
teem/trunk/src/moss/hestMoss.c
Modified: teem/trunk/src/moss/hestMoss.c
===================================================================
--- teem/trunk/src/moss/hestMoss.c 2023-07-07 21:16:37 UTC (rev 7039)
+++ teem/trunk/src/moss/hestMoss.c 2023-07-07 21:18:10 UTC (rev 7040)
@@ -23,7 +23,7 @@
#include "privateMoss.h"
static int
-_mossHestTransformParse(void *ptr, const char *_str, char err[AIR_STRLEN_HUGE]) {
+_mossHestTransformParse(void *ptr, const char *_str, char err[AIR_STRLEN_HUGE + 1]) {
static const char me[] = "_mossHestTransformParse";
char *str;
double **matP, tx, ty, sx, sy, angle, mat[6], shf, sha;
@@ -94,7 +94,7 @@
** u(x,y): position in unit box [0,1]x[0,1] --> val[3] = (1,x,y)
*/
static int
-_mossHestOriginParse(void *ptr, const char *str, char err[AIR_STRLEN_HUGE]) {
+_mossHestOriginParse(void *ptr, const char *str, char err[AIR_STRLEN_HUGE + 1]) {
static const char me[] = "_mossHestOriginParse";
double **valP;
airArray *mop;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <kin...@us...> - 2023-07-07 21:16:38
|
Revision: 7039
http://sourceforge.net/p/teem/code/7039
Author: kindlmann
Date: 2023-07-07 21:16:37 +0000 (Fri, 07 Jul 2023)
Log Message:
-----------
propagating AIR_STRLEN --> AIR_STRLEN+1 change
Modified Paths:
--------------
teem/trunk/src/ell/genmat.c
teem/trunk/src/ell/test/inter.c
Modified: teem/trunk/src/ell/genmat.c
===================================================================
--- teem/trunk/src/ell/genmat.c 2023-07-07 21:14:40 UTC (rev 7038)
+++ teem/trunk/src/ell/genmat.c 2023-07-07 21:16:37 UTC (rev 7039)
@@ -105,7 +105,7 @@
static const char me[] = "ell_Nm_mul";
double *A, *B, *AB, tmp;
size_t LL, MM, NN, ll, mm, nn;
- char stmp[4][AIR_STRLEN_SMALL];
+ char stmp[4][AIR_STRLEN_SMALL + 1];
if (!(nAB && !ell_Nm_check(nA, AIR_FALSE) && !ell_Nm_check(nB, AIR_FALSE))) {
biffAddf(ELL, "%s: NULL or invalid args", me);
@@ -172,7 +172,7 @@
}
}
if (!big) {
- char stmp[AIR_STRLEN_SMALL];
+ char stmp[AIR_STRLEN_SMALL + 1];
biffAddf(ELL, "%s: singular matrix since column %s all zero", me,
airSprintSize_t(stmp, ii));
/* return 1; (for biff auto-scan) */
@@ -347,7 +347,7 @@
NN = nmat->axis[0].size;
if (!(NN == nmat->axis[1].size)) {
- char stmp[2][AIR_STRLEN_SMALL];
+ char stmp[2][AIR_STRLEN_SMALL + 1];
biffAddf(ELL, "%s: need a square matrix, not %s-by-%s", me,
airSprintSize_t(stmp[0], nmat->axis[1].size), airSprintSize_t(stmp[1], NN));
return 1;
Modified: teem/trunk/src/ell/test/inter.c
===================================================================
--- teem/trunk/src/ell/test/inter.c 2023-07-07 21:14:40 UTC (rev 7038)
+++ teem/trunk/src/ell/test/inter.c 2023-07-07 21:16:37 UTC (rev 7039)
@@ -33,20 +33,18 @@
#define WPS_X(x) AIR_AFFINE(wps->bbox[0], (x), wps->bbox[2], 0, wps->maxX)
#define WPS_Y(y) AIR_AFFINE(wps->bbox[1], (y), wps->bbox[3], 0, wps->maxY)
-#define WPS_S(s) AIR_DELTA(wps->bbox[1], (s), wps->bbox[3], 0, wps->maxY)
+#define WPS_S(s) AIR_DELTA(wps->bbox[1], (s), wps->bbox[3], 0, wps->maxY)
void
wheelPreamble(wheelPS *wps) {
- wps->maxX = wps->psc*(wps->bbox[2] - wps->bbox[0]);
- wps->maxY = wps->psc*(wps->bbox[3] - wps->bbox[1]);
+ wps->maxX = wps->psc * (wps->bbox[2] - wps->bbox[0]);
+ wps->maxY = wps->psc * (wps->bbox[3] - wps->bbox[1]);
fprintf(wps->file, "%%!PS-Adobe-2.0 EPSF-2.0\n");
fprintf(wps->file, "%%%%Creator: limn\n");
fprintf(wps->file, "%%%%Pages: 1\n");
- fprintf(wps->file, "%%%%BoundingBox: 0 0 %d %d\n",
- (int)(wps->maxX),
- (int)(wps->maxY));
+ fprintf(wps->file, "%%%%BoundingBox: 0 0 %d %d\n", (int)(wps->maxX), (int)(wps->maxY));
fprintf(wps->file, "%%%%EndComments\n");
fprintf(wps->file, "%%%%EndProlog\n");
fprintf(wps->file, "%%%%Page: 1 1\n");
@@ -87,8 +85,8 @@
}
void
-wheelArrow(wheelPS *wps, double x0, double y0, double x1, double y1,
- double alen, double awidth) {
+wheelArrow(wheelPS *wps, double x0, double y0, double x1, double y1, double alen,
+ double awidth) {
double len, dir[2], perp[2];
dir[0] = x0 - x1;
@@ -96,21 +94,18 @@
ELL_2V_NORM(dir, dir, len);
ELL_2V_SET(perp, -dir[1], dir[0]);
fprintf(wps->file, "%g %g M\n", WPS_X(x0), WPS_Y(y0));
- fprintf(wps->file, "%g %g L S\n",
- WPS_X(x1 + alen*dir[0]/2),
- WPS_Y(y1 + alen*dir[1]/2));
+ fprintf(wps->file, "%g %g L S\n", WPS_X(x1 + alen * dir[0] / 2),
+ WPS_Y(y1 + alen * dir[1] / 2));
if (alen && awidth) {
if (len < alen) {
- awidth *= len/alen;
+ awidth *= len / alen;
alen = len;
}
- fprintf(wps->file, "%g %g M\n",
- WPS_X(x1 + alen*dir[0] + awidth*perp[0]),
- WPS_Y(y1 + alen*dir[1] + awidth*perp[1]));
+ fprintf(wps->file, "%g %g M\n", WPS_X(x1 + alen * dir[0] + awidth * perp[0]),
+ WPS_Y(y1 + alen * dir[1] + awidth * perp[1]));
fprintf(wps->file, "%g %g L\n", WPS_X(x1), WPS_Y(y1));
- fprintf(wps->file, "%g %g L CP F\n",
- WPS_X(x1 + alen*dir[0] - awidth*perp[0]),
- WPS_Y(y1 + alen*dir[1] - awidth*perp[1]));
+ fprintf(wps->file, "%g %g L CP F\n", WPS_X(x1 + alen * dir[0] - awidth * perp[0]),
+ WPS_Y(y1 + alen * dir[1] - awidth * perp[1]));
}
return;
}
@@ -133,10 +128,9 @@
airArray *mop;
int fidx, aidx, num, frames;
- double psc, width[2], arrowWidth, lineWidth, angle, seglen,
- x0, y0, x1, y1, cc, ss;
+ double psc, width[2], arrowWidth, lineWidth, angle, seglen, x0, y0, x1, y1, cc, ss;
wheelPS wps;
- char filename[AIR_STRLEN_MED];
+ char filename[AIR_STRLEN_MED + 1];
me = argv[0];
mop = airMopNew();
@@ -144,26 +138,25 @@
hparm->elideMultipleNonExistFloatDefault = AIR_TRUE;
hopt = NULL;
airMopAdd(mop, hparm, (airMopper)hestParmFree, airMopAlways);
- hestOptAdd(&hopt, "w", "arrowWidth lineWidth", airTypeDouble, 2, 2, width,
- "1.0 0.2", "widths");
- hestOptAdd(&hopt, "n", "number", airTypeInt, 1, 1, &num, "10",
- "number of arrows");
- hestOptAdd(&hopt, "f", "frames", airTypeInt, 1, 1, &frames, "10",
- "number of frames");
+ hestOptAdd(&hopt, "w", "arrowWidth lineWidth", airTypeDouble, 2, 2, width, "1.0 0.2",
+ "widths");
+ hestOptAdd(&hopt, "n", "number", airTypeInt, 1, 1, &num, "10", "number of arrows");
+ hestOptAdd(&hopt, "f", "frames", airTypeInt, 1, 1, &frames, "10", "number of frames");
hestOptAdd(&hopt, "psc", "scale", airTypeDouble, 1, 1, &psc, "200",
"scaling from world space to PostScript points");
hestOptAdd(&hopt, "o", "prefix", airTypeString, 1, 1, &outS, NULL,
"prefix of file names");
- hestParseOrDie(hopt, argc-1, argv+1, hparm,
- me, interInfo, AIR_TRUE, AIR_TRUE, AIR_TRUE);
+ hestParseOrDie(hopt, argc - 1, argv + 1, hparm, me, interInfo, AIR_TRUE, AIR_TRUE,
+ AIR_TRUE);
airMopAdd(mop, hopt, (airMopper)hestOptFree, airMopAlways);
airMopAdd(mop, hopt, (airMopper)hestParseFree, airMopAlways);
- for (fidx=0; fidx<frames; fidx++) {
+ for (fidx = 0; fidx < frames; fidx++) {
sprintf(filename, "%s%03d.eps", outS, fidx);
if (!(wps.file = airFopen(filename, stdout, "wb"))) {
fprintf(stderr, "%s: couldn't open output file\n", me);
- airMopError(mop); return 1;
+ airMopError(mop);
+ return 1;
}
lineWidth = width[0];
@@ -179,20 +172,20 @@
x0 = 0;
y0 = 0;
- seglen = 1.0/num;
- angle = AIR_AFFINE(0, fidx, frames, 0, 2*AIR_PI);
- for (aidx=1; aidx<=num; aidx++) {
- cc = cos(angle*aidx)*seglen;
- ss = sin(angle*aidx)*seglen;
- x1 = x0 + 0.90*cc;
- y1 = y0 + 0.90*ss;
- wheelArrow(&wps, x0, y0, x1, y1, arrowWidth, arrowWidth*0.4);
+ seglen = 1.0 / num;
+ angle = AIR_AFFINE(0, fidx, frames, 0, 2 * AIR_PI);
+ for (aidx = 1; aidx <= num; aidx++) {
+ cc = cos(angle * aidx) * seglen;
+ ss = sin(angle * aidx) * seglen;
+ x1 = x0 + 0.90 * cc;
+ y1 = y0 + 0.90 * ss;
+ wheelArrow(&wps, x0, y0, x1, y1, arrowWidth, arrowWidth * 0.4);
x0 += cc;
y0 += ss;
}
wheelGray(&wps, 0.0);
- wheelArrow(&wps, 0, 0, x0, y0, arrowWidth, arrowWidth*0.4);
+ wheelArrow(&wps, 0, 0, x0, y0, arrowWidth, arrowWidth * 0.4);
wheelEpilog(&wps);
airFclose(wps.file);
@@ -202,7 +195,6 @@
exit(0);
}
-
/*
mkdir inter04
test/inter -w 4 0.08 -o inter04/ -n 4 -f 300
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <kin...@us...> - 2023-07-07 21:14:43
|
Revision: 7038
http://sourceforge.net/p/teem/code/7038
Author: kindlmann
Date: 2023-07-07 21:14:40 +0000 (Fri, 07 Jul 2023)
Log Message:
-----------
Propagating recent AIR_STRLEN --> AIR_STRLEN+1 change, which leads to API CHANGEs:
In these structs' elements' sizes:
NrrdFormat:
char name[AIR_STRLEN_SMALL + 1]; /* short identifying string */
NrrdEncoding:
char name[AIR_STRLEN_SMALL + 1], /* short identifying string */
suffix[AIR_STRLEN_SMALL + 1]; /* customary filename suffix */
NrrdKernel:
char name[AIR_STRLEN_SMALL + 1];
and in these function parameters:
const char nrrdTypePrintfStr[NRRD_TYPE_MAX + 1][AIR_STRLEN_SMALL + 1];
int nrrdBoundarySpecSprint(char str[AIR_STRLEN_LARGE + 1],
const NrrdBoundarySpec *bspec);
int nrrdBoundarySpecCompare(const NrrdBoundarySpec *bspecA,
const NrrdBoundarySpec *bspecB,
int *differ, char explain[AIR_STRLEN_LARGE + 1]);
int nrrdCompare(const Nrrd *ninA, const Nrrd *ninB, int onlyData,
double epsilon, int *differ,
char explain[AIR_STRLEN_LARGE + 1]);
int nrrdAxisInfoCompare(const NrrdAxisInfo *axisA,
const NrrdAxisInfo *axisB,
int *differ,
char explain[AIR_STRLEN_LARGE + 1]);
int nrrdArrayCompare(int type, const void *valA, const void *valB,
size_t valNum, double epsilon, int *differ,
char explain[AIR_STRLEN_LARGE + 1]);
int nrrdKernelSpecSprint(char str[AIR_STRLEN_LARGE + 1],
const NrrdKernelSpec *ksp);
int nrrdKernelSprint(char str[AIR_STRLEN_LARGE + 1],
const NrrdKernel *kernel,
const double kparm[NRRD_KERNEL_PARMS_NUM]);
int nrrdKernelCompare(const NrrdKernel *kernA,
const double parmA[NRRD_KERNEL_PARMS_NUM],
const NrrdKernel *kernB,
const double parmB[NRRD_KERNEL_PARMS_NUM],
int *differ,
char explain[AIR_STRLEN_LARGE + 1]);
int nrrdKernelSpecCompare(const NrrdKernelSpec *aa,
const NrrdKernelSpec *bb,
int *differ,
char explain[AIR_STRLEN_LARGE + 1]);
Modified Paths:
--------------
teem/trunk/src/nrrd/accessors.c
teem/trunk/src/nrrd/apply1D.c
teem/trunk/src/nrrd/apply2D.c
teem/trunk/src/nrrd/arraysNrrd.c
teem/trunk/src/nrrd/axis.c
teem/trunk/src/nrrd/deringNrrd.c
teem/trunk/src/nrrd/encodingAscii.c
teem/trunk/src/nrrd/encodingBzip2.c
teem/trunk/src/nrrd/encodingGzip.c
teem/trunk/src/nrrd/encodingHex.c
teem/trunk/src/nrrd/encodingRaw.c
teem/trunk/src/nrrd/formatEPS.c
teem/trunk/src/nrrd/formatNRRD.c
teem/trunk/src/nrrd/formatPNG.c
teem/trunk/src/nrrd/formatPNM.c
teem/trunk/src/nrrd/formatText.c
teem/trunk/src/nrrd/formatVTK.c
teem/trunk/src/nrrd/gzio.c
teem/trunk/src/nrrd/hestNrrd.c
teem/trunk/src/nrrd/histogram.c
teem/trunk/src/nrrd/iter.c
teem/trunk/src/nrrd/kernel.c
teem/trunk/src/nrrd/map.c
teem/trunk/src/nrrd/measure.c
teem/trunk/src/nrrd/methodsNrrd.c
teem/trunk/src/nrrd/nrrd.h
teem/trunk/src/nrrd/parseNrrd.c
teem/trunk/src/nrrd/read.c
teem/trunk/src/nrrd/reorder.c
teem/trunk/src/nrrd/resampleContext.c
teem/trunk/src/nrrd/resampleNrrd.c
teem/trunk/src/nrrd/simple.c
teem/trunk/src/nrrd/subset.c
teem/trunk/src/nrrd/superset.c
teem/trunk/src/nrrd/test/convo.c
teem/trunk/src/nrrd/test/tkernel.c
teem/trunk/src/nrrd/test/typestest.c
teem/trunk/src/nrrd/write.c
Modified: teem/trunk/src/nrrd/accessors.c
===================================================================
--- teem/trunk/src/nrrd/accessors.c 2023-07-07 20:29:51 UTC (rev 7037)
+++ teem/trunk/src/nrrd/accessors.c 2023-07-07 21:14:40 UTC (rev 7038)
@@ -516,12 +516,12 @@
int /* Biff: 1 */
nrrdArrayCompare(int type, const void *_valA, const void *_valB,
size_t valNum, double epsilon, int *differ,
- char explain[AIR_STRLEN_LARGE]) {
+ char explain[AIR_STRLEN_LARGE+1]) {
static const char me[] = "nrrdArrayCompare";
const unsigned char *valA, *valB;
int (*compare)(const void *, const void *);
size_t ii, sze;
- char stmp[AIR_STRLEN_SMALL];
+ char stmp[AIR_STRLEN_SMALL+1];
if (!(_valA && _valB && differ)) {
biffAddf(NRRD, "%s: got NULL pointer (%p, %p, or %p)", me,
Modified: teem/trunk/src/nrrd/apply1D.c
===================================================================
--- teem/trunk/src/nrrd/apply1D.c 2023-07-07 20:29:51 UTC (rev 7037)
+++ teem/trunk/src/nrrd/apply1D.c 2023-07-07 21:14:40 UTC (rev 7038)
@@ -87,12 +87,13 @@
int kind, int typeOut, int rescale, int multi) {
static const char me[] = "_nrrdApply1DSetUp";
char *mapcnt;
- char nounStr[][AIR_STRLEN_SMALL] = {"lut", "regular map", "irregular map"};
- char mnounStr[][AIR_STRLEN_SMALL] = {"multi lut", "multi regular map",
- "multi irregular map"};
+ char nounStr[][AIR_STRLEN_SMALL + 1] = {"lut", "regular map", "irregular map"};
+ char mnounStr[][AIR_STRLEN_SMALL + 1] = {"multi lut", "multi regular map",
+ "multi irregular map"};
/* wishful thinking */
- char verbStr[][AIR_STRLEN_SMALL] = {"lut", "rmap", "imap"};
- char mverbStr[][AIR_STRLEN_SMALL] = {"mlut", "mrmap", "mimap"}; /* wishful thinking */
+ char verbStr[][AIR_STRLEN_SMALL + 1] = {"lut", "rmap", "imap"};
+ char mverbStr[][AIR_STRLEN_SMALL + 1] = {"mlut", "mrmap",
+ "mimap"}; /* wishful thinking */
int mapAxis, copyMapAxis0 = AIR_FALSE, axisMap[NRRD_DIM_MAX];
unsigned int ax, dim, entLen;
size_t size[NRRD_DIM_MAX];
@@ -154,13 +155,13 @@
return 1;
}
if (nin->axis[ax].size != nmap->axis[taxi].size) {
- char stmp1[AIR_STRLEN_SMALL], stmp2[AIR_STRLEN_SMALL];
+ char stmp[2][AIR_STRLEN_SMALL + 1];
biffAddf(NRRD,
"%s: input and mmap don't have compatible sizes: "
"nin->axis[%d].size (%s) "
"!= nmap->axis[%d].size (%s): ",
- me, ax, airSprintSize_t(stmp1, nin->axis[ax].size), mapAxis + 1 + ax,
- airSprintSize_t(stmp2, nmap->axis[taxi].size));
+ me, ax, airSprintSize_t(stmp[0], nin->axis[ax].size),
+ mapAxis + 1 + ax, airSprintSize_t(stmp[1], nmap->axis[taxi].size));
return 1;
}
}
@@ -701,10 +702,10 @@
return 1;
}
if (!(nacl->axis[0].size == 2 && nacl->axis[1].size >= 2)) {
- char stmp1[AIR_STRLEN_SMALL], stmp2[AIR_STRLEN_SMALL];
+ char stmp[2][AIR_STRLEN_SMALL + 1];
biffAddf(NRRD, "%s: sizes (%s,%s) not (2,>=2)", me,
- airSprintSize_t(stmp1, nacl->axis[0].size),
- airSprintSize_t(stmp2, nacl->axis[1].size));
+ airSprintSize_t(stmp[0], nacl->axis[0].size),
+ airSprintSize_t(stmp[1], nacl->axis[1].size));
return 1;
}
@@ -824,7 +825,7 @@
return 1;
}
if (!(aclLen >= 2)) {
- char stmp[AIR_STRLEN_SMALL];
+ char stmp[AIR_STRLEN_SMALL + 1];
biffAddf(NRRD, "%s: given acl length (%s) is too small", me,
airSprintSize_t(stmp, aclLen));
return 1;
Modified: teem/trunk/src/nrrd/apply2D.c
===================================================================
--- teem/trunk/src/nrrd/apply2D.c 2023-07-07 20:29:51 UTC (rev 7037)
+++ teem/trunk/src/nrrd/apply2D.c 2023-07-07 21:14:40 UTC (rev 7038)
@@ -46,8 +46,8 @@
int rescale0, int rescale1) {
static const char me[] = "_nrrdApply2DSetUp";
char *mapcnt;
- char nounStr[][AIR_STRLEN_SMALL] = {"2D lut", "2D regular map"};
- char verbStr[][AIR_STRLEN_SMALL] = {"lut2", "rmap2"};
+ char nounStr[][AIR_STRLEN_SMALL + 1] = {"2D lut", "2D regular map"};
+ char verbStr[][AIR_STRLEN_SMALL + 1] = {"lut2", "rmap2"};
int mapAxis, copyMapAxis0 = AIR_FALSE, axisMap[NRRD_DIM_MAX];
unsigned int dim, entLen;
size_t size[NRRD_DIM_MAX];
@@ -67,7 +67,7 @@
return 1;
}
if (!(2 == nin->axis[0].size)) {
- char stmp[AIR_STRLEN_SMALL];
+ char stmp[AIR_STRLEN_SMALL + 1];
biffAddf(NRRD, "%s: input axis[0] must have size 2 (not %s)", me,
airSprintSize_t(stmp, nin->axis[0].size));
return 1;
Modified: teem/trunk/src/nrrd/arraysNrrd.c
===================================================================
--- teem/trunk/src/nrrd/arraysNrrd.c 2023-07-07 20:29:51 UTC (rev 7037)
+++ teem/trunk/src/nrrd/arraysNrrd.c 2023-07-07 21:14:40 UTC (rev 7038)
@@ -26,7 +26,7 @@
const int blah[] array in an object file if it hasn't been declared
as "extern" */
-const char nrrdTypePrintfStr[NRRD_TYPE_MAX + 1][AIR_STRLEN_SMALL] = {
+const char nrrdTypePrintfStr[NRRD_TYPE_MAX + 1][AIR_STRLEN_SMALL + 1] = {
"%*d", /* nrrdTypeUnknown: what else? the effect will be
"skip" for sscanf, and "minimum precision" for printf */
"%d", /* nrrdTypeChar: char */
Modified: teem/trunk/src/nrrd/axis.c
===================================================================
--- teem/trunk/src/nrrd/axis.c 2023-07-07 20:29:51 UTC (rev 7037)
+++ teem/trunk/src/nrrd/axis.c 2023-07-07 21:14:40 UTC (rev 7038)
@@ -927,7 +927,7 @@
*/
int /* Biff: 1 */
nrrdAxisInfoCompare(const NrrdAxisInfo *axisA, const NrrdAxisInfo *axisB, int *differ,
- char explain[AIR_STRLEN_LARGE]) {
+ char explain[AIR_STRLEN_LARGE + 1]) {
static const char me[] = "nrrdAxisInfoCompare";
unsigned int saxi;
@@ -941,12 +941,12 @@
strcpy(explain, "");
}
if (axisA->size != axisB->size) {
- char stmp1[AIR_STRLEN_SMALL], stmp2[AIR_STRLEN_SMALL];
+ char stmp[2][AIR_STRLEN_SMALL + 1];
*differ = axisA->size < axisB->size ? -1 : 1;
if (explain) {
sprintf(explain, "axisA->size=%s %s axisB->size=%s",
- airSprintSize_t(stmp1, axisA->size), *differ < 0 ? "<" : ">",
- airSprintSize_t(stmp2, axisB->size));
+ airSprintSize_t(stmp[0], axisA->size), *differ < 0 ? "<" : ">",
+ airSprintSize_t(stmp[1], axisB->size));
}
return 0;
}
@@ -966,7 +966,7 @@
DOUBLE_COMPARE(min, "min");
DOUBLE_COMPARE(max, "max");
for (saxi = 0; saxi < NRRD_SPACE_DIM_MAX; saxi++) {
- char stmp[AIR_STRLEN_SMALL];
+ char stmp[AIR_STRLEN_SMALL + 1];
sprintf(stmp, "spaceDirection[%u]", saxi);
DOUBLE_COMPARE(spaceDirection[saxi], stmp);
}
@@ -997,7 +997,7 @@
sprintf(explain, "axisA->label %s axisB->label", *differ < 0 ? "<" : ">");
if (strlen(explain) + airStrlen(axisA->label) + airStrlen(axisB->label)
+ 2 * strlen(" \"\" ") + 1
- < AIR_STRLEN_LARGE) {
+ < AIR_STRLEN_LARGE + 1) {
/* ok, we can print them */
sprintf(explain, "axisA->label \"%s\" %s axisB->label \"%s\"",
axisA->label ? axisA->label : "", *differ < 0 ? "<" : ">",
Modified: teem/trunk/src/nrrd/deringNrrd.c
===================================================================
--- teem/trunk/src/nrrd/deringNrrd.c 2023-07-07 20:29:51 UTC (rev 7037)
+++ teem/trunk/src/nrrd/deringNrrd.c 2023-07-07 21:14:40 UTC (rev 7038)
@@ -398,7 +398,7 @@
E = AIR_FALSE;
for (ri = 0; ri < 2; ri++) {
- char kstr[AIR_STRLEN_LARGE];
+ char kstr[AIR_STRLEN_LARGE + 1];
if (0 == ri) {
if (!E) E |= nrrdResampleInputSet(dbg->rsmc[0], dbg->nptxf[ORIG]);
nrrdKernelSprint(kstr, drc->rkernel, drc->rkparm);
@@ -570,7 +570,7 @@
}
}
if (DEBUG) {
- char fname[AIR_STRLEN_SMALL];
+ char fname[AIR_STRLEN_SMALL + 1];
sprintf(fname, "wght-%02u.nrrd", dbg->zi);
nrrdSave(fname, dbg->nptxf[WGHT], NULL);
}
@@ -619,7 +619,7 @@
return 1;
}
if (DEBUG) {
- char fn[AIR_STRLEN_SMALL];
+ char fn[AIR_STRLEN_SMALL + 1];
sprintf(fn, "rshp-%02u.nrrd", dbg->zi);
nrrdSave(fn, dbg->nptxf[RSHP], NULL);
sprintf(fn, "crop-%02u.nrrd", dbg->zi);
@@ -627,7 +627,7 @@
}
}
if (DEBUG) {
- char fn[AIR_STRLEN_SMALL];
+ char fn[AIR_STRLEN_SMALL + 1];
sprintf(fn, "orig-%02u.nrrd", dbg->zi);
nrrdSave(fn, dbg->nptxf[ORIG], NULL);
sprintf(fn, "blrr-%02u.nrrd", dbg->zi);
@@ -695,7 +695,7 @@
}
}
if (DEBUG) {
- char fname[AIR_STRLEN_SMALL];
+ char fname[AIR_STRLEN_SMALL + 1];
sprintf(fname, "ring2-%02u.nrrd", dbg->zi);
nrrdSave(fname, dbg->nptxf[RING], NULL);
sprintf(fname, "drng-%02u.nrrd", dbg->zi);
Modified: teem/trunk/src/nrrd/encodingAscii.c
===================================================================
--- teem/trunk/src/nrrd/encodingAscii.c 2023-07-07 20:29:51 UTC (rev 7037)
+++ teem/trunk/src/nrrd/encodingAscii.c 2023-07-07 21:14:40 UTC (rev 7038)
@@ -37,7 +37,7 @@
_nrrdEncodingAscii_read(FILE *file, void *_data, size_t elNum, Nrrd *nrrd,
NrrdIoState *nio) {
static const char me[] = "_nrrdEncodingAscii_read";
- char numbStr[AIR_STRLEN_HUGE]; /* HEY: fix this */
+ char numbStr[AIR_STRLEN_HUGE + 1]; /* HEY: fix this */
char *nstr;
size_t I;
char *data;
@@ -53,7 +53,7 @@
data = (char *)_data;
I = 0;
while (I < elNum) {
- char stmp1[AIR_STRLEN_SMALL], stmp2[AIR_STRLEN_SMALL];
+ char stmp[2][AIR_STRLEN_SMALL + 1];
/* HEY: we can easily suffer here from a standard buffer overflow problem;
this was a source of a mysterious unu crash:
echo "0 0 0 0 1 0 0 0 0" \
@@ -63,10 +63,12 @@
-spc LPS -orig "(0,0,0)" -dirs "(1,0,0) (0,1,0) (0,0,1)"
This particular case is resolved by changing AIR_STRLEN_HUGE
to AIR_STRLEN_HUGE*100, but the general problem remains. This
- motivated adding the memory corruption test */
+ motivated adding the memory corruption test
+ HEY HEY: 2023 GLK does not know what buffer AIR_STRLEN_HUGE*100
+ could be describing; what was this?? */
if (1 != fscanf(file, "%s", numbStr)) {
biffAddf(NRRD, "%s: couldn't parse element %s of %s", me,
- airSprintSize_t(stmp1, I + 1), airSprintSize_t(stmp2, elNum));
+ airSprintSize_t(stmp[0], I + 1), airSprintSize_t(stmp[1], elNum));
return 1;
}
/*
@@ -89,8 +91,8 @@
!= airSingleSscanf(nstr, nrrdTypePrintfStr[nrrd->type],
(void *)(data + I * nrrdElementSize(nrrd)))) {
biffAddf(NRRD, "%s: couldn't parse %s %s of %s (\"%s\")", me,
- airEnumStr(nrrdType, nrrd->type), airSprintSize_t(stmp1, I + 1),
- airSprintSize_t(stmp2, elNum), nstr);
+ airEnumStr(nrrdType, nrrd->type), airSprintSize_t(stmp[0], I + 1),
+ airSprintSize_t(stmp[1], elNum), nstr);
return 1;
}
} else {
@@ -97,7 +99,7 @@
/* sscanf value into an int first */
if (1 != airSingleSscanf(nstr, "%d", &tmp)) {
biffAddf(NRRD, "%s: couldn't parse element %s of %s (\"%s\")", me,
- airSprintSize_t(stmp1, I + 1), airSprintSize_t(stmp2, elNum), nstr);
+ airSprintSize_t(stmp[0], I + 1), airSprintSize_t(stmp[1], elNum), nstr);
return 1;
}
nrrdIInsert[nrrd->type](data, I, tmp);
@@ -112,7 +114,7 @@
_nrrdEncodingAscii_write(FILE *file, const void *_data, size_t elNum, const Nrrd *nrrd,
NrrdIoState *nio) {
static const char me[] = "_nrrdEncodingAscii_write";
- char buff[AIR_STRLEN_MED];
+ char buff[AIR_STRLEN_MED + 1];
size_t bufflen, linelen;
const char *data;
size_t I;
Modified: teem/trunk/src/nrrd/encodingBzip2.c
===================================================================
--- teem/trunk/src/nrrd/encodingBzip2.c 2023-07-07 20:29:51 UTC (rev 7037)
+++ teem/trunk/src/nrrd/encodingBzip2.c 2023-07-07 21:14:40 UTC (rev 7038)
@@ -117,9 +117,9 @@
/* Check to see if we got out as much as we thought we should. */
if (total_read != bsize) {
- char stmp1[AIR_STRLEN_SMALL], stmp2[AIR_STRLEN_SMALL];
+ char stmp[2][AIR_STRLEN_SMALL + 1];
biffAddf(NRRD, "%s: expected %s bytes but received %s", me,
- airSprintSize_t(stmp1, bsize), airSprintSize_t(stmp2, total_read));
+ airSprintSize_t(stmp[0], bsize), airSprintSize_t(stmp[1], total_read));
return 1;
}
@@ -209,9 +209,9 @@
/* Check to see if we got out as much as we thought we should. */
if (total_written != bsize) {
- char stmp1[AIR_STRLEN_SMALL], stmp2[AIR_STRLEN_SMALL];
+ char stmp[2][AIR_STRLEN_SMALL + 1];
biffAddf(NRRD, "%s: expected to write %s bytes, but only wrote %s", me,
- airSprintSize_t(stmp1, bsize), airSprintSize_t(stmp2, total_written));
+ airSprintSize_t(stmp[0], bsize), airSprintSize_t(stmp[1], total_written));
return 1;
}
Modified: teem/trunk/src/nrrd/encodingGzip.c
===================================================================
--- teem/trunk/src/nrrd/encodingGzip.c 2023-07-07 20:29:51 UTC (rev 7037)
+++ teem/trunk/src/nrrd/encodingGzip.c 2023-07-07 21:14:40 UTC (rev 7038)
@@ -128,10 +128,10 @@
/* backwards is (positive) number of bytes AFTER data that we ignore */
backwards = -nio->byteSkip - 1;
if (sizeRed < sizeData + AIR_CAST(size_t, backwards)) {
- char stmp1[AIR_STRLEN_SMALL], stmp2[AIR_STRLEN_SMALL];
+ char stmp[2][AIR_STRLEN_SMALL + 1];
biffAddf(NRRD, "%s: expected %s bytes but received only %s", me,
- airSprintSize_t(stmp1, sizeData + AIR_CAST(size_t, backwards)),
- airSprintSize_t(stmp2, sizeRed));
+ airSprintSize_t(stmp[0], sizeData + AIR_CAST(size_t, backwards)),
+ airSprintSize_t(stmp[1], sizeRed));
return 1;
}
/* also handles nio->byteSkip == -N-1 signifying extra N bytes at end */
@@ -171,9 +171,9 @@
}
/* Check to see if we got out as much as we thought we should. */
if (sizeRed != sizeData) {
- char stmp1[AIR_STRLEN_SMALL], stmp2[AIR_STRLEN_SMALL];
+ char stmp[2][AIR_STRLEN_SMALL + 1];
biffAddf(NRRD, "%s: expected %s bytes but received %s", me,
- airSprintSize_t(stmp1, sizeData), airSprintSize_t(stmp2, sizeRed));
+ airSprintSize_t(stmp[0], sizeData), airSprintSize_t(stmp[1], sizeRed));
return 1;
}
}
@@ -267,9 +267,9 @@
/* Check to see if we wrote out as much as we thought we should. */
if (sizeWrit != sizeData) {
- char stmp1[AIR_STRLEN_SMALL], stmp2[AIR_STRLEN_SMALL];
+ char stmp[2][AIR_STRLEN_SMALL + 1];
biffAddf(NRRD, "%s: expected to write %s bytes, but only wrote %s", me,
- airSprintSize_t(stmp1, sizeData), airSprintSize_t(stmp2, sizeWrit));
+ airSprintSize_t(stmp[0], sizeData), airSprintSize_t(stmp[1], sizeWrit));
return 1;
}
Modified: teem/trunk/src/nrrd/encodingHex.c
===================================================================
--- teem/trunk/src/nrrd/encodingHex.c 2023-07-07 20:29:51 UTC (rev 7037)
+++ teem/trunk/src/nrrd/encodingHex.c 2023-07-07 21:14:40 UTC (rev 7038)
@@ -93,16 +93,17 @@
nibIdx++;
}
if (nibIdx != nibNum) {
- char stmp1[AIR_STRLEN_SMALL], stmp2[AIR_STRLEN_SMALL];
+ char stmp[2][AIR_STRLEN_SMALL + 1];
if (EOF == car) {
biffAddf(NRRD, "%s: hit EOF getting byte %s of %s", me,
- airSprintSize_t(stmp1, nibIdx / 2), airSprintSize_t(stmp2, nibNum / 2));
+ airSprintSize_t(stmp[0], nibIdx / 2),
+ airSprintSize_t(stmp[1], nibNum / 2));
} else {
biffAddf(NRRD,
"%s: hit invalid character ('%c') getting "
"byte %s of %s",
- me, car, airSprintSize_t(stmp1, nibIdx / 2),
- airSprintSize_t(stmp2, nibNum / 2));
+ me, car, airSprintSize_t(stmp[0], nibIdx / 2),
+ airSprintSize_t(stmp[1], nibNum / 2));
}
return 1;
}
Modified: teem/trunk/src/nrrd/encodingRaw.c
===================================================================
--- teem/trunk/src/nrrd/encodingRaw.c 2023-07-07 20:29:51 UTC (rev 7037)
+++ teem/trunk/src/nrrd/encodingRaw.c 2023-07-07 21:14:40 UTC (rev 7038)
@@ -38,7 +38,7 @@
char *data_c;
size_t elementSize, maxChunkSize, remainderValue, chunkSize;
size_t retTmp;
- char stmp[3][AIR_STRLEN_SMALL];
+ char stmp[3][AIR_STRLEN_SMALL + 1];
bsize = nrrdElementSize(nrrd) * elementNum;
if (nio->format->usesDIO) {
@@ -130,7 +130,7 @@
const char *data_c;
size_t elementSize, maxChunkSize, remainderValue, chunkSize;
size_t retTmp;
- char stmp[3][AIR_STRLEN_SMALL];
+ char stmp[3][AIR_STRLEN_SMALL + 1];
bsize = nrrdElementSize(nrrd) * elementNum;
if (nio->format->usesDIO) {
Modified: teem/trunk/src/nrrd/formatEPS.c
===================================================================
--- teem/trunk/src/nrrd/formatEPS.c 2023-07-07 20:29:51 UTC (rev 7037)
+++ teem/trunk/src/nrrd/formatEPS.c 2023-07-07 21:14:40 UTC (rev 7038)
@@ -66,7 +66,7 @@
ret = 3;
} else {
/* else its no good */
- char stmp[AIR_STRLEN_SMALL];
+ char stmp[AIR_STRLEN_SMALL + 1];
biffMaybeAddf(useBiff, NRRD,
"%s: dim is 3, but 1st axis size is %s, not 1, 3, or 4", me,
airSprintSize_t(stmp, nrrd->axis[0].size));
Modified: teem/trunk/src/nrrd/formatNRRD.c
===================================================================
--- teem/trunk/src/nrrd/formatNRRD.c 2023-07-07 20:29:51 UTC (rev 7037)
+++ teem/trunk/src/nrrd/formatNRRD.c 2023-07-07 21:14:40 UTC (rev 7038)
@@ -599,7 +599,7 @@
static int /* Biff: 1 */
_nrrdFormatNRRD_write(FILE *file, const Nrrd *nrrd, NrrdIoState *nio) {
static const char me[] = "_nrrdFormatNRRD_write";
- char strbuf[AIR_STRLEN_MED], *strptr, *tmp;
+ char strbuf[AIR_STRLEN_MED + 1], *strptr, *tmp;
int ii;
unsigned int jj;
airArray *mop;
Modified: teem/trunk/src/nrrd/formatPNG.c
===================================================================
--- teem/trunk/src/nrrd/formatPNG.c 2023-07-07 20:29:51 UTC (rev 7037)
+++ teem/trunk/src/nrrd/formatPNG.c 2023-07-07 21:14:40 UTC (rev 7038)
@@ -81,7 +81,7 @@
} else if (3 == nrrd->dim) {
if (!(1 == nrrd->axis[0].size || 2 == nrrd->axis[0].size || 3 == nrrd->axis[0].size
|| 4 == nrrd->axis[0].size)) {
- char stmp[AIR_STRLEN_SMALL];
+ char stmp[AIR_STRLEN_SMALL + 1];
biffMaybeAddf(useBiff, NRRD, "%s: 1st axis size is %s, not 1, 2, 3, or 4", me,
airSprintSize_t(stmp, nrrd->axis[0].size));
return AIR_FALSE;
@@ -161,7 +161,7 @@
int depth, type, i, channels, numtxt, ret;
int ntype, ndim;
size_t nsize[3];
- char stmp[6][AIR_STRLEN_SMALL];
+ char stmp[6][AIR_STRLEN_SMALL + 1];
#endif /* TEEM_PNG */
AIR_UNUSED(file);
@@ -474,7 +474,7 @@
/* calculate depth, width, height, and row size */
depth = nrrd->type == nrrdTypeUChar ? 8 : 16;
switch (nrrd->dim) {
- char stmp[AIR_STRLEN_SMALL];
+ char stmp[AIR_STRLEN_SMALL + 1];
case 2: /* g only */
width = AIR_CAST(png_uint_32, nrrd->axis[0].size);
height = AIR_CAST(png_uint_32, nrrd->axis[1].size);
Modified: teem/trunk/src/nrrd/formatPNM.c
===================================================================
--- teem/trunk/src/nrrd/formatPNM.c 2023-07-07 20:29:51 UTC (rev 7037)
+++ teem/trunk/src/nrrd/formatPNM.c 2023-07-07 21:14:40 UTC (rev 7038)
@@ -71,7 +71,7 @@
ret = 3;
} else {
/* else its no good */
- char stmp[AIR_STRLEN_SMALL];
+ char stmp[AIR_STRLEN_SMALL + 1];
biffMaybeAddf(useBiff, NRRD, "%s: dim is 3, but 1st axis size is %s, not 1 or 3",
me, airSprintSize_t(stmp, nrrd->axis[0].size));
return AIR_FALSE;
Modified: teem/trunk/src/nrrd/formatText.c
===================================================================
--- teem/trunk/src/nrrd/formatText.c 2023-07-07 20:29:51 UTC (rev 7037)
+++ teem/trunk/src/nrrd/formatText.c 2023-07-07 21:14:40 UTC (rev 7038)
@@ -184,7 +184,7 @@
For the specific purpose of counting numbers, we assume float type;
but we aren't going to remember these values. */
if (!airParseStrF(&oneFloat, nio->line, _nrrdTextSep, 1)) {
- char stmp[AIR_STRLEN_SMALL];
+ char stmp[AIR_STRLEN_SMALL + 1];
biffAddf(NRRD, "%s: couldn't parse a single number on line %s", me,
airSprintSize_t(stmp, line));
UNSETTWO;
@@ -201,7 +201,7 @@
be parsed from a single finite line of input text */
airArrayLenSet(flArr, AIR_UINT(sx));
if (!flArr->data) {
- char stmp[AIR_STRLEN_SMALL];
+ char stmp[AIR_STRLEN_SMALL + 1];
biffAddf(NRRD, "%s: couldn't alloc space for %s values", me,
airSprintSize_t(stmp, sx));
UNSETTWO;
@@ -217,7 +217,7 @@
}
flArr = airArrayNuke(flArr); /* forget about values parsed on 1st line */
if (1 == nrrd->dim && 1 != sx) {
- char stmp[AIR_STRLEN_SMALL];
+ char stmp[AIR_STRLEN_SMALL + 1];
biffAddf(NRRD, "%s: wanted 1-D nrrd, but got %s values on 1st line", me,
airSprintSize_t(stmp, sx));
UNSETTWO;
@@ -260,7 +260,7 @@
while (llen) {
airArrayLenIncr(dataArr, 1);
if (!dataArr->data) {
- char stmp[AIR_STRLEN_SMALL];
+ char stmp[AIR_STRLEN_SMALL + 1];
biffAddf(NRRD, "%s: couldn't create scanline of %s values", me,
airSprintSize_t(stmp, sx));
UNSETTWO;
@@ -268,10 +268,10 @@
}
plen = parser(data + sy * sx * elsz, nio->line, _nrrdTextSep, sx);
if (sx > plen) {
- char stmp1[AIR_STRLEN_SMALL], stmp2[AIR_STRLEN_SMALL], stmp3[AIR_STRLEN_SMALL];
+ char stmp[3][AIR_STRLEN_SMALL + 1];
biffAddf(NRRD, "%s: could only parse %s values (not %s) on line %s", me,
- airSprintSize_t(stmp1, plen), airSprintSize_t(stmp2, sx),
- airSprintSize_t(stmp3, line));
+ airSprintSize_t(stmp[0], plen), airSprintSize_t(stmp[1], sx),
+ airSprintSize_t(stmp[2], line));
UNSETTWO;
return 1;
}
@@ -317,7 +317,7 @@
static int
_nrrdFormatText_write(FILE *file, const Nrrd *nrrd, NrrdIoState *nio) {
- char cmt[AIR_STRLEN_SMALL], buff[AIR_STRLEN_SMALL];
+ char cmt[AIR_STRLEN_SMALL + 1], buff[AIR_STRLEN_SMALL + 1];
size_t I, dsz;
int i, x, y, sx, sy;
const void *data;
Modified: teem/trunk/src/nrrd/formatVTK.c
===================================================================
--- teem/trunk/src/nrrd/formatVTK.c 2023-07-07 20:29:51 UTC (rev 7037)
+++ teem/trunk/src/nrrd/formatVTK.c 2023-07-07 21:14:40 UTC (rev 7038)
@@ -275,7 +275,7 @@
int i, sax;
unsigned int sx, sy, sz;
double xs, ys, zs, xm, ym, zm;
- char type[AIR_STRLEN_MED], name[AIR_STRLEN_SMALL];
+ char type[AIR_STRLEN_MED + 1], name[AIR_STRLEN_SMALL + 1];
Nrrd *nrrd;
airArray *mop;
Modified: teem/trunk/src/nrrd/gzio.c
===================================================================
--- teem/trunk/src/nrrd/gzio.c 2023-07-07 20:29:51 UTC (rev 7037)
+++ teem/trunk/src/nrrd/gzio.c 2023-07-07 21:14:40 UTC (rev 7038)
@@ -161,7 +161,7 @@
int strategy = Z_DEFAULT_STRATEGY; /* compression strategy */
const char *p = mode;
_NrrdGzStream *s;
- char fmode[AIR_STRLEN_MED]; /* copy of mode, without the compression level */
+ char fmode[AIR_STRLEN_MED + 1]; /* copy of mode, without the compression level */
char *m = fmode;
if (!mode) {
Modified: teem/trunk/src/nrrd/hestNrrd.c
===================================================================
--- teem/trunk/src/nrrd/hestNrrd.c 2023-07-07 20:29:51 UTC (rev 7037)
+++ teem/trunk/src/nrrd/hestNrrd.c 2023-07-07 21:14:40 UTC (rev 7038)
@@ -33,7 +33,7 @@
** that is just fine
*/
static int
-_nrrdHestNrrdParse(void *ptr, const char *str, char err[AIR_STRLEN_HUGE]) {
+_nrrdHestNrrdParse(void *ptr, const char *str, char err[AIR_STRLEN_HUGE + 1]) {
static const char me[] = "_nrrdHestNrrdParse";
char *nerr;
Nrrd **nrrdP;
@@ -50,7 +50,7 @@
airMopAdd(mop, *nrrdP, (airMopper)nrrdNuke, airMopOnError);
if (nrrdLoad(*nrrdP, str, NULL)) {
airMopAdd(mop, nerr = biffGetDone(NRRD), airFree, airMopOnError);
- airStrcpy(err, AIR_STRLEN_HUGE, nerr);
+ airStrcpy(err, AIR_STRLEN_HUGE + 1, nerr);
airMopError(mop);
return (strstr(err, "EOF") ? 2 : 1);
}
@@ -71,7 +71,7 @@
/* ------------------------ NrrdKernelSpec -------------------------- */
static int
-_nrrdHestKernelSpecParse(void *ptr, const char *str, char err[AIR_STRLEN_HUGE]) {
+_nrrdHestKernelSpecParse(void *ptr, const char *str, char err[AIR_STRLEN_HUGE + 1]) {
NrrdKernelSpec **ksP;
static const char me[] = "_nrrdHestKernelSpecParse";
char *nerr;
@@ -84,7 +84,7 @@
*ksP = nrrdKernelSpecNew();
if (nrrdKernelParse(&((*ksP)->kernel), (*ksP)->parm, str)) {
nerr = biffGetDone(NRRD);
- airStrcpy(err, AIR_STRLEN_HUGE, nerr);
+ airStrcpy(err, AIR_STRLEN_HUGE + 1, nerr);
free(nerr);
return 1;
}
@@ -101,7 +101,7 @@
/* ------------------------ NrrdBoundarySpec -------------------------- */
static int
-_nrrdHestBoundarySpecParse(void *ptr, const char *str, char err[AIR_STRLEN_HUGE]) {
+_nrrdHestBoundarySpecParse(void *ptr, const char *str, char err[AIR_STRLEN_HUGE + 1]) {
NrrdBoundarySpec **bsp;
static const char me[] = "_nrrdHestBoundarySpecParse";
char *nerr;
@@ -114,7 +114,7 @@
*bsp = nrrdBoundarySpecNew();
if (nrrdBoundarySpecParse(*bsp, str)) {
nerr = biffGetDone(NRRD);
- airStrcpy(err, AIR_STRLEN_HUGE, nerr);
+ airStrcpy(err, AIR_STRLEN_HUGE + 1, nerr);
/* HEY: why not freeing bsp? */
free(nerr);
return 1;
@@ -183,7 +183,7 @@
}
static int
-_nrrdHestIterParse(void *ptr, const char *str, char err[AIR_STRLEN_HUGE]) {
+_nrrdHestIterParse(void *ptr, const char *str, char err[AIR_STRLEN_HUGE + 1]) {
static const char me[] = "_nrrdHestIterParse";
char *nerr;
Nrrd *nrrd;
@@ -228,7 +228,7 @@
if (2 != ret) {
/* it failed because of something besides the fopen(), so complain */
nerr = biffGetDone(NRRD);
- airStrcpy(err, AIR_STRLEN_HUGE, nerr);
+ airStrcpy(err, AIR_STRLEN_HUGE + 1, nerr);
airMopError(mop);
return 1;
} else {
@@ -253,7 +253,7 @@
we'll let it fail again and pass back the error messages */
if (nrrdLoad(nrrd = nrrdNew(), str, NULL)) {
nerr = biffGetDone(NRRD);
- airStrcpy(err, AIR_STRLEN_HUGE, nerr);
+ airStrcpy(err, AIR_STRLEN_HUGE + 1, nerr);
airMopError(mop);
return 1;
} else {
Modified: teem/trunk/src/nrrd/histogram.c
===================================================================
--- teem/trunk/src/nrrd/histogram.c 2023-07-07 20:29:51 UTC (rev 7037)
+++ teem/trunk/src/nrrd/histogram.c 2023-07-07 21:14:40 UTC (rev 7038)
@@ -55,7 +55,7 @@
return 1;
}
if (!(bins > 0)) {
- char stmp[AIR_STRLEN_SMALL];
+ char stmp[AIR_STRLEN_SMALL + 1];
biffAddf(NRRD, "%s: bins value (%s) invalid", me, airSprintSize_t(stmp, bins));
return 1;
}
@@ -83,7 +83,7 @@
}
if (nrrdMaybeAlloc_va(nout, type, 1, bins)) {
- char stmp[AIR_STRLEN_SMALL];
+ char stmp[AIR_STRLEN_SMALL + 1];
biffAddf(NRRD, "%s: failed to alloc histo array (len %s)", me,
airSprintSize_t(stmp, bins));
return 1;
@@ -188,7 +188,7 @@
int /* Biff: 1 */
nrrdHistoDraw(Nrrd *nout, const Nrrd *nin, size_t sy, int showLog, double max) {
static const char me[] = "nrrdHistoDraw", func[] = "dhisto";
- char cmt[AIR_STRLEN_MED], stmp[AIR_STRLEN_SMALL];
+ char cmt[AIR_STRLEN_MED + 1], stmp[AIR_STRLEN_SMALL + 1];
unsigned int ki, numticks, *linY, *logY, tick, *ticks;
double hits, maxhits, usemaxhits;
unsigned char *pgmData;
@@ -343,7 +343,7 @@
return 1;
}
if (!(bins > 0)) {
- char stmp[AIR_STRLEN_SMALL];
+ char stmp[AIR_STRLEN_SMALL + 1];
biffAddf(NRRD, "%s: bins value (%s) invalid", me, airSprintSize_t(stmp, bins));
return 1;
}
@@ -501,7 +501,7 @@
return 1;
}
if (!(bins[ai] >= 1)) {
- char stmp[AIR_STRLEN_SMALL];
+ char stmp[AIR_STRLEN_SMALL + 1];
biffAddf(NRRD, "%s: need bins[%u] >= 1 (not %s)", me, ai,
airSprintSize_t(stmp, bins[ai]));
return 1;
@@ -514,7 +514,7 @@
/* check nwght */
if (nwght) {
- char stmp1[AIR_STRLEN_SMALL], stmp2[AIR_STRLEN_SMALL];
+ char stmp[2][AIR_STRLEN_SMALL + 1];
if (nout == nwght) {
biffAddf(NRRD, "%s: nout==nwght disallowed", me);
return 1;
@@ -526,8 +526,8 @@
}
if (nrrdElementNumber(nin[0]) != nrrdElementNumber(nwght)) {
biffAddf(NRRD, "%s: element # in nwght %s != nin[0] %s", me,
- airSprintSize_t(stmp2, nrrdElementNumber(nin[0])),
- airSprintSize_t(stmp1, nrrdElementNumber(nwght)));
+ airSprintSize_t(stmp[0], nrrdElementNumber(nin[0])),
+ airSprintSize_t(stmp[1], nrrdElementNumber(nwght)));
return 1;
}
lup = nrrdDLookup[nwght->type];
@@ -558,7 +558,7 @@
nout->axis[ai].label
= AIR_CALLOC(strlen("histo(,)") + strlen(nin[ai]->content) + 11 + 1, char);
if (nout->axis[ai].label) {
- char stmp[AIR_STRLEN_SMALL];
+ char stmp[AIR_STRLEN_SMALL + 1];
sprintf(nout->axis[ai].label, "histo(%s,%s)", nin[ai]->content,
airSprintSize_t(stmp, bins[ai]));
} else {
Modified: teem/trunk/src/nrrd/iter.c
===================================================================
--- teem/trunk/src/nrrd/iter.c 2023-07-07 20:29:51 UTC (rev 7037)
+++ teem/trunk/src/nrrd/iter.c 2023-07-07 21:14:40 UTC (rev 7038)
@@ -125,7 +125,7 @@
*/
char * /* Biff: nope */
nrrdIterContent(NrrdIter *iter) {
- char *ret, buff[AIR_STRLEN_SMALL];
+ char *ret, buff[AIR_STRLEN_SMALL + 1];
ret = NULL;
if (iter) {
Modified: teem/trunk/src/nrrd/kernel.c
===================================================================
--- teem/trunk/src/nrrd/kernel.c 2023-07-07 20:29:51 UTC (rev 7037)
+++ teem/trunk/src/nrrd/kernel.c 2023-07-07 21:14:40 UTC (rev 7038)
@@ -3031,8 +3031,8 @@
int /* Biff: 1 */
nrrdKernelParse(const NrrdKernel **kernelP, double *parm, const char *_str) {
static const char me[] = "nrrdKernelParse";
- char str[AIR_STRLEN_HUGE], kstr[AIR_STRLEN_MED], *_pstr = NULL, *pstr,
- *tmfStr[4] = {NULL, NULL, NULL, NULL};
+ char str[AIR_STRLEN_HUGE + 1], kstr[AIR_STRLEN_MED + 1],
+ *_pstr = NULL, *pstr, *tmfStr[4] = {NULL, NULL, NULL, NULL};
int tmfD, tmfC, tmfA;
unsigned int jj, haveParm, needParm;
airArray *mop;
@@ -3051,7 +3051,7 @@
parm[jj] = 0;
}
- airStrcpy(str, AIR_STRLEN_HUGE, _str);
+ airStrcpy(str, AIR_STRLEN_HUGE + 1, _str);
strcpy(kstr, "");
pstr = NULL;
pstr = strchr(str, ':');
@@ -3231,10 +3231,10 @@
** which is plenty big
*/
int /* Biff: 1 */
-nrrdKernelSpecSprint(char str[AIR_STRLEN_LARGE], const NrrdKernelSpec *ksp) {
+nrrdKernelSpecSprint(char str[AIR_STRLEN_LARGE + 1], const NrrdKernelSpec *ksp) {
static const char me[] = "nrrdKernelSpecSprint";
unsigned int warnLen = AIR_STRLEN_LARGE / 3;
- char stmp[AIR_STRLEN_LARGE];
+ char stmp[AIR_STRLEN_LARGE + 1];
if (!(str && ksp)) {
biffAddf(NRRD, "%s: got NULL pointer", me);
@@ -3286,7 +3286,7 @@
}
int /* Biff: 1 */
-nrrdKernelSprint(char str[AIR_STRLEN_LARGE], const NrrdKernel *kernel,
+nrrdKernelSprint(char str[AIR_STRLEN_LARGE + 1], const NrrdKernel *kernel,
const double kparm[NRRD_KERNEL_PARMS_NUM]) {
static const char me[] = "nrrdKernelSprint";
NrrdKernelSpec ksp;
@@ -3306,7 +3306,7 @@
int /* Biff: 1 */
nrrdKernelCompare(const NrrdKernel *kernA, const double parmA[NRRD_KERNEL_PARMS_NUM],
const NrrdKernel *kernB, const double parmB[NRRD_KERNEL_PARMS_NUM],
- int *differ, char explain[AIR_STRLEN_LARGE]) {
+ int *differ, char explain[AIR_STRLEN_LARGE + 1]) {
static const char me[] = "nrrdKernelCompare";
unsigned int pnum, pidx;
@@ -3354,9 +3354,9 @@
*/
int /* Biff: 1 */
nrrdKernelSpecCompare(const NrrdKernelSpec *aa, const NrrdKernelSpec *bb, int *differ,
- char explain[AIR_STRLEN_LARGE]) {
+ char explain[AIR_STRLEN_LARGE + 1]) {
static const char me[] = "nrrdKernelSpecCompare";
- char subexplain[AIR_STRLEN_LARGE];
+ char subexplain[AIR_STRLEN_LARGE + 1];
if (!(differ)) {
biffAddf(NRRD, "%s: got NULL differ", me);
@@ -3433,8 +3433,9 @@
static const char me[] = "nrrdKernelCheck";
const NrrdKernel *parsedkern, *kernD;
double parsedparm[NRRD_KERNEL_PARMS_NUM], supp, integral;
- char kstr[AIR_STRLEN_LARGE], kspstr[AIR_STRLEN_LARGE], explain[AIR_STRLEN_LARGE],
- stmp[AIR_STRLEN_SMALL], kdstr[AIR_STRLEN_LARGE];
+ char kstr[AIR_STRLEN_LARGE + 1], kspstr[AIR_STRLEN_LARGE + 1],
+ explain[AIR_STRLEN_LARGE + 1], stmp[AIR_STRLEN_SMALL + 1],
+ kdstr[AIR_STRLEN_LARGE + 1];
int differ;
size_t evalIdx;
double *dom_d, *ran_d, wee;
Modified: teem/trunk/src/nrrd/map.c
===================================================================
--- teem/trunk/src/nrrd/map.c 2023-07-07 20:29:51 UTC (rev 7037)
+++ teem/trunk/src/nrrd/map.c 2023-07-07 21:14:40 UTC (rev 7038)
@@ -134,7 +134,7 @@
static int /* Biff: 1 */
clampRoundConvert(Nrrd *nout, const Nrrd *nin, int type, int doClamp, int roundDir) {
static const char me[] = "clampRoundConvert";
- char typeS[AIR_STRLEN_SMALL];
+ char typeS[AIR_STRLEN_SMALL + 1];
size_t num, size[NRRD_DIM_MAX];
if (!(nin && nout && !nrrdCheck(nin) && !airEnumValCheck(nrrdType, type))) {
Modified: teem/trunk/src/nrrd/measure.c
===================================================================
--- teem/trunk/src/nrrd/measure.c 2023-07-07 20:29:51 UTC (rev 7037)
+++ teem/trunk/src/nrrd/measure.c 2023-07-07 21:14:40 UTC (rev 7038)
@@ -1227,9 +1227,9 @@
/* allocate a scanline buffer */
if (!(line = AIR_CALLOC(linLen * iElSz, char))) {
- char stmp1[AIR_STRLEN_SMALL], stmp2[AIR_STRLEN_SMALL];
+ char stmp[2][AIR_STRLEN_SMALL + 1];
biffAddf(NRRD, "%s: couldn't calloc(%s,%s) scanline buffer", me,
- airSprintSize_t(stmp1, linLen), airSprintSize_t(stmp2, iElSz));
+ airSprintSize_t(stmp[0], linLen), airSprintSize_t(stmp[1], iElSz));
airMopError(mop);
return 1;
}
Modified: teem/trunk/src/nrrd/methodsNrrd.c
===================================================================
--- teem/trunk/src/nrrd/methodsNrrd.c 2023-07-07 20:29:51 UTC (rev 7037)
+++ teem/trunk/src/nrrd/methodsNrrd.c 2023-07-07 21:14:40 UTC (rev 7038)
@@ -173,7 +173,7 @@
}
int /* Biff: 1 */
-nrrdBoundarySpecSprint(char str[AIR_STRLEN_LARGE], const NrrdBoundarySpec *bspec) {
+nrrdBoundarySpecSprint(char str[AIR_STRLEN_LARGE + 1], const NrrdBoundarySpec *bspec) {
static const char me[] = "nrrdBoundarySpecSprint";
char *out;
@@ -196,7 +196,7 @@
int /* Biff: 1 */
nrrdBoundarySpecCompare(const NrrdBoundarySpec *aa, const NrrdBoundarySpec *bb,
- int *differ, char explain[AIR_STRLEN_LARGE]) {
+ int *differ, char explain[AIR_STRLEN_LARGE + 1]) {
static const char me[] = "nrrdBoundarySpecCompare";
if (!differ) {
@@ -966,7 +966,7 @@
nrrdAlloc_nva(Nrrd *nrrd, int type, unsigned int dim, const size_t *size) {
static const char me[] = "nrrdAlloc_nva";
size_t num, esize;
- char stmp[2][AIR_STRLEN_SMALL];
+ char stmp[2][AIR_STRLEN_SMALL + 1];
if (!(nrrd && size)) {
biffAddf(NRRD, "%s: got NULL pointer", me);
@@ -1065,7 +1065,7 @@
return 1;
}
if (!(0 < nrrd->blockSize)) {
- char stmp[AIR_STRLEN_SMALL];
+ char stmp[AIR_STRLEN_SMALL + 1];
biffAddf(NRRD, "%s: given nrrd->blockSize %s invalid", me,
airSprintSize_t(stmp, nrrd->blockSize));
return 1;
@@ -1192,7 +1192,7 @@
*/
int /* Biff: 1 */
nrrdCompare(const Nrrd *ninA, const Nrrd *ninB, int onlyData, double epsilon,
- int *differ, char explain[AIR_STRLEN_LARGE]) {
+ int *differ, char explain[AIR_STRLEN_LARGE + 1]) {
static const char me[] = "nrrdCompare";
size_t numA, numB;
unsigned int axi, saxi;
@@ -1227,10 +1227,10 @@
numA = nrrdElementNumber(ninA);
numB = nrrdElementNumber(ninB);
if (numA != numB) {
- char stmp1[AIR_STRLEN_SMALL], stmp2[AIR_STRLEN_SMALL];
+ char stmp[2][AIR_STRLEN_SMALL + 1];
*differ = numA < numB ? -1 : 1;
- sprintf(explain, "element # {A,B} %s %s %s", airSprintSize_t(stmp1, numA),
- *differ < 0 ? "<" : ">", airSprintSize_t(stmp2, numB));
+ sprintf(explain, "element # {A,B} %s %s %s", airSprintSize_t(stmp[0], numA),
+ *differ < 0 ? "<" : ">", airSprintSize_t(stmp[1], numB));
return 0;
}
/* this will always set *differ */
@@ -1255,10 +1255,10 @@
return 1;
}
if (*differ) {
- char tmpexplain[AIR_STRLEN_LARGE];
+ char tmpexplain[AIR_STRLEN_LARGE + 1];
/* the explanation, if wanted, is in "explain", but we add context */
sprintf(tmpexplain, "(axis %u) %s", axi, explain);
- airStrcpy(explain, AIR_STRLEN_LARGE, tmpexplain);
+ airStrcpy(explain, AIR_STRLEN_LARGE + 1, tmpexplain);
return 0;
}
}
@@ -1295,10 +1295,10 @@
if (ninA->blockSize != ninB->blockSize) {
*differ = ninA->blockSize < ninB->blockSize ? -1 : 1;
if (explain) {
- char stmp1[AIR_STRLEN_SMALL], stmp2[AIR_STRLEN_SMALL];
+ char stmp[2][AIR_STRLEN_SMALL + 1];
sprintf(explain, "ninA->blockSize %s %s ninB->blockSize %s",
- airSprintSize_t(stmp1, ninA->blockSize), *differ < 0 ? "<" : ">",
- airSprintSize_t(stmp2, ninB->blockSize));
+ airSprintSize_t(stmp[0], ninA->blockSize), *differ < 0 ? "<" : ">",
+ airSprintSize_t(stmp[1], ninB->blockSize));
}
return 0;
}
@@ -1314,7 +1314,7 @@
}
for (saxi = 0; saxi < NRRD_SPACE_DIM_MAX; saxi++) {
- char stmp[AIR_STRLEN_SMALL];
+ char stmp[AIR_STRLEN_SMALL + 1];
unsigned int saxj;
sprintf(stmp, "spaceOrigin[%u]", saxi);
DOUBLE_COMPARE(spaceOrigin[saxi], stmp);
@@ -1338,7 +1338,7 @@
return 0;
} else {
unsigned int ii;
- char stmp[AIR_STRLEN_SMALL];
+ char stmp[AIR_STRLEN_SMALL + 1];
for (ii = 0; ii < ninA->cmtArr->len; ii++) {
sprintf(stmp, "comment[%u]", ii);
STRING_COMPARE(cmt[ii], stmp);
@@ -1353,7 +1353,7 @@
return 0;
} else {
unsigned int ii;
- char stmp[AIR_STRLEN_SMALL];
+ char stmp[AIR_STRLEN_SMALL + 1];
for (ii = 0; ii < ninA->kvpArr->len; ii++) {
sprintf(stmp, "key/value key[%u]", ii);
STRING_COMPARE(kvp[2 * ii + 0], stmp);
@@ -1379,7 +1379,7 @@
int /* Biff: 1 */
nrrdPPM(Nrrd *ppm, size_t sx, size_t sy) {
static const char me[] = "nrrdPPM";
- char stmp[2][AIR_STRLEN_SMALL];
+ char stmp[2][AIR_STRLEN_SMALL + 1];
if (nrrdMaybeAlloc_va(ppm, nrrdTypeUChar, 3, AIR_CAST(size_t, 3), sx, sy)) {
biffAddf(NRRD, "%s: couldn't allocate %s x %s 24-bit image", me,
@@ -1399,7 +1399,7 @@
int /* Biff: 1 */
nrrdPGM(Nrrd *pgm, size_t sx, size_t sy) {
static const char me[] = "nrrdPGM";
- char stmp[2][AIR_STRLEN_SMALL];
+ char stmp[2][AIR_STRLEN_SMALL + 1];
if (nrrdMaybeAlloc_va(pgm, nrrdTypeUChar, 2, sx, sy)) {
biffAddf(NRRD, "%s: couldn't allocate %s x %s 8-bit image", me,
Modified: teem/trunk/src/nrrd/nrrd.h
===================================================================
--- teem/trunk/src/nrrd/nrrd.h 2023-07-07 20:29:51 UTC (rev 7037)
+++ teem/trunk/src/nrrd/nrrd.h 2023-07-07 21:14:40 UTC (rev 7038)
@@ -226,12 +226,12 @@
** All information and behavior relevent to one datafile format
*/
typedef struct {
- char name[AIR_STRLEN_SMALL]; /* short identifying string */
- int isImage, /* this format is intended solely for "2D" images, which
- controls the invocation of nrrdAxesInsert()
- if nrrdStateGrayscaleImage3D */
- readable, /* we can read as well as write this format */
- usesDIO; /* this format can use Direct IO */
+ char name[AIR_STRLEN_SMALL + 1]; /* short identifying string */
+ int isImage, /* this format is intended solely for "2D" images, which
+ controls the invocation of nrrdAxesInsert()
+ if nrrdStateGrayscaleImage3D */
+ readable, /* we can read as well as write this format */
+ usesDIO; /* this format can use Direct IO */
/* tests if this format is currently available in this build */
int (*available)(void);
@@ -262,8 +262,8 @@
** This is necessitated by the memory restrictions of direct I/O
*/
typedef struct NrrdEncoding_t {
- char name[AIR_STRLEN_SMALL], /* short identifying string */
- suffix[AIR_STRLEN_SMALL]; /* costumary filename suffix */
+ char name[AIR_STRLEN_SMALL + 1], /* short identifying string */
+ suffix[AIR_STRLEN_SMALL + 1]; /* customary filename suffix */
int endianMatters, isCompression;
int (*available)(void);
/* The "data" and "elementNum" values have to be passed explicitly
@@ -498,7 +498,7 @@
typedef struct {
/* terse string representation of kernel function, irrespective of
the parameter vector */
- char name[AIR_STRLEN_SMALL];
+ char name[AIR_STRLEN_SMALL + 1];
/* number of parameters needed (# elements in parm[] used) */
unsigned int numParm; /* HEY: should be "parmNum" in standard convention */
@@ -787,7 +787,7 @@
/******** arrays of things (poor-man's functions/predicates) */
/* arraysNrrd.c */
-NRRD_EXPORT const char nrrdTypePrintfStr[NRRD_TYPE_MAX + 1][AIR_STRLEN_SMALL];
+NRRD_EXPORT const char nrrdTypePrintfStr[NRRD_TYPE_MAX + 1][AIR_STRLEN_SMALL + 1];
NRRD_EXPORT const size_t nrrdTypeSize[NRRD_TYPE_MAX + 1];
NRRD_EXPORT const double nrrdTypeMin[NRRD_TYPE_MAX + 1];
NRRD_EXPORT const double nrrdTypeMax[NRRD_TYPE_MAX + 1];
@@ -803,12 +803,12 @@
NRRD_EXPORT NrrdBoundarySpec *nrrdBoundarySpecCopy(const NrrdBoundarySpec *bsp);
NRRD_EXPORT int nrrdBoundarySpecCheck(const NrrdBoundarySpec *bspec);
NRRD_EXPORT int nrrdBoundarySpecParse(NrrdBoundarySpec *bspec, const char *str);
-NRRD_EXPORT int nrrdBoundarySpecSprint(char str[AIR_STRLEN_LARGE],
+NRRD_EXPORT int nrrdBoundarySpecSprint(char str[AIR_STRLEN_LARGE + 1],
const NrrdBoundarySpec *bspec);
NRRD_EXPORT int nrrdBoundarySpecCompare(const NrrdBoundarySpec *bspecA,
const NrrdBoundarySpec *bspecB,
int *differ,
- char explain[AIR_STRLEN_LARGE]);
+ char explain[AIR_STRLEN_LARGE + 1]);
/* ---- END non-NrrdIO */
NRRD_EXPORT NrrdIoState *nrrdIoStateNew(void);
NRRD_EXPORT void nrrdIoStateInit(NrrdIoState *nio);
@@ -847,7 +847,8 @@
... /* size_t sx, sy, .., ax(dim-1) size */);
/* ---- BEGIN non-NrrdIO */
NRRD_EXPORT int nrrdCompare(const Nrrd *ninA, const Nrrd *ninB, int onlyData,
- double epsilon, int *differ, char explain[AIR_STRLEN_LARGE]);
+ double epsilon, int *differ,
+ char explain[AIR_STRLEN_LARGE + 1]);
NRRD_EXPORT int nrrdPPM(Nrrd *, size_t sx, size_t sy);
NRRD_EXPORT int nrrdPGM(Nrrd *, size_t sx, size_t sy);
/* ---- END non-NrrdIO */
@@ -874,7 +875,7 @@
NRRD_EXPORT int nrrdAxisInfoCompare(const NrrdAxisInfo *axisA,
const NrrdAxisInfo *axisB,
int *differ,
- char explain[AIR_STRLEN_LARGE]);
+ char explain[AIR_STRLEN_LARGE + 1]);
/* ---- END non-NrrdIO */
NRRD_EXPORT unsigned int nrrdDomainAxesGet(const Nrrd *nrrd,
unsigned int axisIdx[NRRD_DIM_MAX]);
@@ -1060,7 +1061,7 @@
const void *);
NRRD_EXPORT int nrrdArrayCompare(int type, const void *valA, const void *valB,
size_t valNum, double epsilon, int *differ,
- char explain[AIR_STRLEN_LARGE]);
+ char explain[AIR_STRLEN_LARGE + 1]);
/* ---- END non-NrrdIO */
/******** permuting, shuffling, and all flavors of reshaping */
@@ -1531,9 +1532,9 @@
double *parm,
const char *str);
NRRD_EXPORT int nrrdKernelSpecParse(NrrdKernelSpec *ksp, const char *str);
-NRRD_EXPORT int nrrdKernelSpecSprint(char str[AIR_STRLEN_LARGE],
+NRRD_EXPORT int nrrdKernelSpecSprint(char str[AIR_STRLEN_LARGE + 1],
const NrrdKernelSpec *ksp);
-NRRD_EXPORT int nrrdKernelSprint(char str[AIR_STRLEN_LARGE],
+NRRD_EXPORT int nrrdKernelSprint(char str[AIR_STRLEN_LARGE + 1],
const NrrdKernel *kernel,
const double kparm[NRRD_KERNEL_PARMS_NUM]);
NRRD_EXPORT int nrrdKernelCompare(const NrrdKernel *kernA,
@@ -1541,11 +1542,11 @@
const NrrdKernel *kernB,
const double parmB[NRRD_KERNEL_PARMS_NUM],
int *differ,
- char explain[AIR_STRLEN_LARGE]);
+ char explain[AIR_STRLEN_LARGE + 1]);
NRRD_EXPORT int nrrdKernelSpecCompare(const NrrdKernelSpec *aa,
const NrrdKernelSpec *bb,
int *differ,
- char explain[AIR_STRLEN_LARGE]);
+ char explain[AIR_STRLEN_LARGE + 1]);
NRRD_EXPORT int nrrdKernelCheck(const NrrdKernel *kern,
const double parm[NRRD_KERNEL_PARMS_NUM], size_t evalNum,
double epsilon, unsigned int diffOkEvalMax,
Modified: teem/trunk/src/nrrd/parseNrrd.c
===================================================================
--- teem/trunk/src/nrrd/parseNrrd.c 2023-07-07 20:29:51 UTC (rev 7037)
+++ teem/trunk/src/nrrd/parseNrrd.c 2023-07-07 21:14:40 UTC (rev 7038)
@@ -1198,7 +1198,7 @@
_nrrdDataFNCheck(NrrdIoState *nio, Nrrd *nrrd, int useBiff) {
static const char me[] = "_nrrdDataFNCheck";
size_t pieceSize, pieceNum;
- char stmp[AIR_STRLEN_SMALL];
+ char stmp[AIR_STRLEN_SMALL + 1];
if (!nio->seen[nrrdField_sizes]) {
biffMaybeAddf(useBiff, NRRD,
Modified: teem/trunk/src/nrrd/read.c
===================================================================
--- teem/trunk/src/nrrd/read.c 2023-07-07 20:29:51 UTC (rev 7037)
+++ teem/trunk/src/nrrd/read.c 2023-07-07 21:14:40 UTC (rev 7038)
@@ -214,10 +214,10 @@
nrrd->data = malloc(needDataSize);
}
if (!nrrd->data) {
- char stmp1[AIR_STRLEN_SMALL], stmp2[AIR_STRLEN_SMALL];
+ char stmp[2][AIR_STRLEN_SMALL + 1];
biffAddf(NRRD, "%s: couldn't allocate %s things of size %s", me,
- airSprintSize_t(stmp1, nrrdElementNumber(nrrd)),
- airSprintSize_t(stmp2, nrrdElementSize(nrrd)));
+ airSprintSize_t(stmp[0], nrrdElementNumber(nrrd)),
+ airSprintSize_t(stmp[1], nrrdElementSize(nrrd)));
return 1;
}
}
@@ -296,7 +296,7 @@
backwards = -byteSkip - 1;
/* HEY what if bsize fits in size_t but not in (signed) long? */
if (fseek(dataFile, -AIR_CAST(long, bsize) - backwards, SEEK_END)) {
- char stmp[AIR_STRLEN_SMALL];
+ char stmp[AIR_STRLEN_SMALL + 1];
biffAddf(NRRD, "%s: failed to fseek(dataFile, %s, SEEK_END)", me,
airSprintSize_t(stmp, bsize));
return 1;
@@ -430,8 +430,8 @@
}
}
if (nrrdFormatUnknown == nio->format) {
- char linestart[AIR_STRLEN_SMALL], stmp[AIR_STRLEN_SMALL];
- airStrcpy(linestart, AIR_STRLEN_SMALL, nio->line);
+ char linestart[AIR_STRLEN_SMALL + 1], stmp[AIR_STRLEN_SMALL + 1];
+ airStrcpy(linestart, AIR_STRLEN_SMALL + 1, nio->line);
if (strlen(linestart) != strlen(nio->line)) {
biffAddf(NRRD,
"%s: couldn't parse (length %s) line starting "
Modified: teem/trunk/src/nrrd/reorder.c
===================================================================
--- teem/trunk/src/nrrd/reorder.c 2023-07-07 20:29:51 UTC (rev 7037)
+++ teem/trunk/src/nrrd/reorder.c 2023-07-07 21:14:40 UTC (rev 7038)
@@ -151,7 +151,7 @@
int /* Biff: 1 */
nrrdAxesPermute(Nrrd *nout, const Nrrd *nin, const unsigned int *axes) {
static const char me[] = "nrrdAxesPermute", func[] = "permute";
- char buff1[NRRD_DIM_MAX * 30], buff2[AIR_STRLEN_SMALL];
+ char buff1[NRRD_DIM_MAX * 30], buff2[AIR_STRLEN_SMALL + 1];
size_t idxOut, idxInA = 0, /* indices for input and output scanlines */
lineSize, /* size of block of memory which can be
moved contiguously from input to output,
@@ -305,7 +305,7 @@
int /* Biff: 1 */
nrrdShuffle(Nrrd *nout, const Nrrd *nin, unsigned int axis, const size_t *perm) {
static const char me[] = "nrrdShuffle", func[] = "shuffle";
- char buff2[AIR_STRLEN_SMALL];
+ char buff2[AIR_STRLEN_SMALL + 1];
/* Sun Feb 8 13:13:58 CST 2009: There was a memory bug here caused
by using the same buff1[NRRD_DIM_MAX*30] declaration that had
worked fine for nrrdAxesPermute and nrrdReshape, but does NOT
@@ -341,7 +341,7 @@
len = AIR_UINT(nin->axis[axis].size);
for (ai = 0; ai < len; ai++) {
if (!(perm[ai] < len)) {
- char stmp[AIR_STRLEN_SMALL];
+ char stmp[AIR_STRLEN_SMALL + 1];
biffAddf(NRRD, "%s: perm[%d] (%s) outside valid range [0,%d]", me, ai,
airSprintSize_t(stmp, perm[ai]), len - 1);
return 1;
@@ -408,7 +408,7 @@
if (len <= LONGEST_INTERESTING_AXIS) {
strcpy(buff1, "");
for (ai = 0; ai < len; ai++) {
- char stmp[AIR_STRLEN_SMALL];
+ char stmp[AIR_STRLEN_SMALL + 1];
sprintf(buff2, "%s%s", (ai ? "," : ""), airSprintSize_t(stmp, perm[ai]));
strcat(buff1, buff2);
}
@@ -576,7 +576,7 @@
Nrrd *ntmpperm, /* axis-permuted version of output */
**ninperm;
airArray *mop;
- char stmp[2][AIR_STRLEN_SMALL];
+ char stmp[2][AIR_STRLEN_SMALL + 1];
/* error checking */
if (!(nout && nin)) {
@@ -831,7 +831,7 @@
return 1;
}
if (!(sizeFast * sizeSlow == nin->axis[saxi].size)) {
- char stmp[4][AIR_STRLEN_SMALL];
+ char stmp[4][AIR_STRLEN_SMALL + 1];
biffAddf(NRRD,
"%s: # samples along axis %d (%s) != "
"product of fast and slow sizes (%s * %s = %s)",
@@ -892,7 +892,7 @@
return 1;
}
if (1 != nin->axis[daxi].size) {
- char stmp[AIR_STRLEN_SMALL];
+ char stmp[AIR_STRLEN_SMALL + 1];
biffAddf(NRRD, "%s: size along axis %d is %s, not 1", me, daxi,
airSprintSize_t(stmp, nin->axis[daxi].size));
return 1;
@@ -978,10 +978,10 @@
int /* Biff: 1 */
nrrdReshape_nva(Nrrd *nout, const Nrrd *nin, unsigned int dim, const size_t *size) {
static const char me[] = "nrrdReshape_nva", func[] = "reshape";
- char buff1[NRRD_DIM_MAX * 30], buff2[AIR_STRLEN_SMALL];
+ char buff1[NRRD_DIM_MAX * 30], buff2[AIR_STRLEN_SMALL + 1];
size_t numOut;
unsigned int ai;
- char stmp[2][AIR_STRLEN_SMALL];
+ char stmp[2][AIR_STRLEN_SMALL + 1];
if (!(nout && nin && size)) {
biffAddf(NRRD, "%s: got NULL pointer", me);
@@ -1157,7 +1157,7 @@
unsigned int dim;
size_t size[NRRD_DIM_MAX], outElSz;
int map[NRRD_DIM_MAX];
- char stmp[2][AIR_STRLEN_SMALL];
+ char stmp[2][AIR_STRLEN_SMALL + 1];
if (!(nout && nin)) {
biffAddf(NRRD, "%s: got NULL pointer", me);
@@ -1370,7 +1370,7 @@
static const char me[] = "nrrdUntile2D";
int E;
unsigned int ii, mapIdx, map[NRRD_DIM_MAX];
- char stmp[2][AIR_STRLEN_SMALL];
+ char stmp[2][AIR_STRLEN_SMALL + 1];
if (!(nout && nin)) {
biffAddf(NRRD, "%s: got NULL pointer", me);
Modified: teem/trunk/src/nrrd/resampleContext.c
===================================================================
--- teem/trunk/src/nrrd/resampleContext.c 2023-07-07 20:29:51 UTC (rev 7037)
+++ teem/trunk/src/nrrd/resampleContext.c 2023-07-07 21:14:40 UTC (rev 7038)
@@ -290,7 +290,7 @@
rsmc->axis[axIdx].kparm[kpIdx] = kparm[kpIdx];
}
if (rsmc->verbose) {
- char kstr[AIR_STRLEN_LARGE];
+ char kstr[AIR_STRLEN_LARGE + 1];
NrrdKernelSpec ksp;
nrrdKernelSpecSet(&ksp, rsmc->axis[axIdx].kernel, rsmc->axis[axIdx].kparm);
nrrdKernelSpecSprint(kstr, &ksp);
@@ -1147,11 +1147,11 @@
}
}
if (rsmc->verbose) {
- char stmp1[AIR_STRLEN_SMALL], stmp2[AIR_STRLEN_SMALL];
+ char stmp[2][AIR_STRLEN_SMALL + 1];
fprintf(stderr, "%s(%u): lineNum = %s\n", me, passIdx,
- airSprintSize_t(stmp1, lineNum));
+ airSprintSize_t(stmp[0], lineNum));
fprintf(stderr, "%s(%u): strideIn = %s, strideOut = %s\n", me, passIdx,
- airSprintSize_t(stmp1, strideIn), airSprintSize_t(stmp2, strideOut));
+ airSprintSize_t(stmp[0], strideIn), airSprintSize_t(stmp[1], strideOut));
}
/* allocate output for this pass */
Modified: teem/trunk/src/nrrd/resampleNrrd.c
===================================================================
--- teem/trunk/src/nrrd/resampleNrrd.c 2023-07-07 20:29:51 UTC (rev 7037)
+++ teem/trunk/src/nrrd/resampleNrrd.c 2023-07-07 21:14:40 UTC (rev 7038)
@@ -129,7 +129,7 @@
const NrrdKernel *k;
int center, p, np;
unsigned int ai, minsmp;
- char stmp[2][AIR_STRLEN_SMALL];
+ char stmp[2][AIR_STRLEN_SMALL + 1];
if (nrrdTypeBlock == nin->type || nrrdTypeBlock == info->type) {
biffAddf(NRRD, "%s: can't resample to or from type %s", me,
@@ -717,7 +717,7 @@
/* allocate output volume */
array[pi + 1] = (nrrdResample_t *)calloc(numOut, sizeof(nrrdResample_t));
if (!array[pi + 1]) {
- char stmp[AIR_STRLEN_SMALL];
+ char stmp[AIR_STRLEN_SMALL + 1];
biffAddf(NRRD,
"%s: couldn't create array of %s nrrdResample_t's for "
"output of pass %d",
Modified: teem/trunk/src/nrrd/simple.c
===================================================================
--- teem/trunk/src/nrrd/simple.c 2023-07-07 20:29:51 UTC (rev 7037)
+++ teem/trunk/src/nrrd/simple.c 2023-07-07 21:14:40 UTC (rev 7038)
@@ -413,7 +413,7 @@
nout->content = (char *)airFree(nout->content);
return 0;
}
- buff = (char *)malloc(128 * AIR_STRLEN_HUGE);
+ buff = (char *)malloc(128 * AIR_STRLEN_HUGE + 1);
if (!buff) {
biffAddf(NRRD, "%s: couln't alloc buffer!", me);
return 1;
@@ -515,7 +515,7 @@
void
nrrdDescribe(FILE *file, const Nrrd *nrrd) {
unsigned int ai;
- char stmp[AIR_STRLEN_SMALL];
+ char stmp[AIR_STRLEN_SMALL + 1];
if (file && nrrd) {
fprintf(file, "Nrrd at 0x%p:\n", AIR_CVOIDP(nrrd));
@@ -730,7 +730,7 @@
static int /* Biff: maybe:2:1 */
_nrrdFieldCheck_block_size(const Nrrd *nrrd, int useBiff) {
static const char me[] = "_nrrdFieldCheck_block_size";
- char stmp[AIR_STRLEN_SMALL];
+ char stmp[AIR_STRLEN_SMALL + 1];
if (nrrdTypeBlock == nrrd->type && (!(0 < nrrd->blockSize))) {
biffMaybeAddf(useBiff, NRRD, "%s: type is %s but nrrd->blockSize (%s) invalid", me,
@@ -920,7 +920,7 @@
}
wantLen = nrrdKindSize(val[ai]);
if (wantLen && wantLen != nrrd->axis[ai].size) {
- char stmp[AIR_STRLEN_SMALL];
+ char stmp[AIR_STRLEN_SMALL + 1];
biffMaybeAddf(useBiff, NRRD, "%s: axis %d kind %s requires size %u, but have %s",
me, ai, airEnumStr(nrrdKind, val[ai]), wantLen,
airSprintSize_t(stmp, nrrd->axis[ai].size));
@@ -1135,7 +1135,7 @@
nrrdSameSize(const Nrrd *n1, const Nrrd *n2, int useBiff) {
static const char me[] = "nrrdSameSize";
unsigned int ai;
- char stmp[2][AIR_STRLEN_SMALL];
+ char stmp[2][AIR_STRLEN_SMALL + 1];
if (!(n1 && n2)) {
biffMaybeAddf(useBiff, NRRD, "%s: got NULL pointer", me);
@@ -1293,7 +1293,7 @@
static int /* Biff: 1 */
_nrrdCheckEnums(void) {
static const char me[] = "_nrrdCheckEnums";
- char which[AIR_STRLEN_SMALL];
+ char which[AIR...
[truncated message content] |
|
From: <kin...@us...> - 2023-07-07 20:29:53
|
Revision: 7037
http://sourceforge.net/p/teem/code/7037
Author: kindlmann
Date: 2023-07-07 20:29:51 +0000 (Fri, 07 Jul 2023)
Log Message:
-----------
propagating spirit of AIR_STRLEN update
Modified Paths:
--------------
teem/trunk/src/biff/biffmsg.c
Modified: teem/trunk/src/biff/biffmsg.c
===================================================================
--- teem/trunk/src/biff/biffmsg.c 2023-07-07 20:26:40 UTC (rev 7036)
+++ teem/trunk/src/biff/biffmsg.c 2023-07-07 20:29:51 UTC (rev 7037)
@@ -118,7 +118,7 @@
void
_biffMsgAddVL(biffMsg *msg, const char *errfmt, va_list args) {
- char errstr[_HACK_STRLEN];
+ char errstr[_HACK_STRLEN + 1];
vsprintf(errstr, errfmt, args);
biffMsgAdd(msg, errstr);
@@ -210,7 +210,7 @@
void
_biffMsgMoveVL(biffMsg *dest, biffMsg *src, const char *errfmt, va_list args) {
- char errstr[_HACK_STRLEN];
+ char errstr[_HACK_STRLEN + 1];
vsprintf(errstr, errfmt, args);
biffMsgMove(dest, src, errstr);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|