From: <kin...@us...> - 2012-09-26 22:28:55
|
Revision: 5668 http://teem.svn.sourceforge.net/teem/?rev=5668&view=rev Author: kindlmann Date: 2012-09-26 22:28:49 +0000 (Wed, 26 Sep 2012) Log Message: ----------- getting Teem to compile as C++: renaming this to thiz, and not doing the implicit cast of void* to something else Modified Paths: -------------- teem/trunk/src/bin/talkweb.c teem/trunk/src/gage/deconvolve.c teem/trunk/src/gage/multiGage.c teem/trunk/src/gage/stackBlur.c teem/trunk/src/hest/parseHest.c teem/trunk/src/meet/meetPull.c teem/trunk/src/nrrd/accessors.c teem/trunk/src/nrrd/map.c teem/trunk/src/nrrd/write.c teem/trunk/src/pull/infoPull.c teem/trunk/src/pull/taskPull.c teem/trunk/src/pull/volumePull.c teem/trunk/src/seek/methodsSeek.c teem/trunk/src/seek/textract.c teem/trunk/src/ten/experSpec.c teem/trunk/src/ten/path.c teem/trunk/src/ten/tenGage.c teem/trunk/src/ten/tendMsim.c teem/trunk/src/unrrdu/axdelete.c Modified: teem/trunk/src/bin/talkweb.c =================================================================== --- teem/trunk/src/bin/talkweb.c 2012-09-26 22:21:05 UTC (rev 5667) +++ teem/trunk/src/bin/talkweb.c 2012-09-26 22:28:49 UTC (rev 5668) @@ -422,7 +422,8 @@ airMopError(mop); return 1; } - for (numSlides=0; slide[numSlides]; numSlides++); + for (numSlides=0; slide[numSlides]; numSlides++) + ; if (tkwbWriteSlides(slide, numSlides, tmpl, tag, link)) { biffAddf(TKWB, "%s: trouble writing slide pages", me); airMopError(mop); return 1; Modified: teem/trunk/src/gage/deconvolve.c =================================================================== --- teem/trunk/src/gage/deconvolve.c 2012-09-26 22:21:05 UTC (rev 5667) +++ teem/trunk/src/gage/deconvolve.c 2012-09-26 22:28:49 UTC (rev 5668) @@ -37,7 +37,7 @@ const double *ans[2]; Nrrd *nout[2]; airArray *mop; - unsigned int sx, sy, sz, xi, yi, zi, anslen, this=0, last, inIdx, iter; + unsigned int sx, sy, sz, xi, yi, zi, anslen, thiz=0, last, inIdx, iter; int E, valItem; if (!(_nout && lastDiffP && nin && kind && ksp)) { @@ -96,9 +96,9 @@ sz = ctx[0]->shape->size[2]; for (iter=0; iter<maxIter; iter++) { - this = (iter+1) % 2; + thiz = (iter+1) % 2; last = (iter+0) % 2; - val[this] = out[this]; + val[thiz] = out[thiz]; val[last] = out[last]; inIdx = 0; meandiff = 0; @@ -111,10 +111,10 @@ for (ai=0; ai<anslen; ai++) { in = lup(nin->data, ai + anslen*inIdx); aa = ans[last][ai]; - val[this][ai] = val[last][ai] + step*(in - aa)/alpha; + val[thiz][ai] = val[last][ai] + step*(in - aa)/alpha; meandiff += 2*(in - aa)*(in - aa)/(DBL_EPSILON + in*in + aa*aa); } - val[this] += anslen; + val[thiz] += anslen; val[last] += anslen; ++inIdx; } @@ -142,7 +142,7 @@ } } - if (nrrdClampConvert(_nout, nout[this], (nrrdTypeDefault == typeOut + if (nrrdClampConvert(_nout, nout[thiz], (nrrdTypeDefault == typeOut ? nin->type : typeOut))) { biffAddf(GAGE, "%s: couldn't create output", me); Modified: teem/trunk/src/gage/multiGage.c =================================================================== --- teem/trunk/src/gage/multiGage.c 2012-09-26 22:21:05 UTC (rev 5667) +++ teem/trunk/src/gage/multiGage.c 2012-09-26 22:28:49 UTC (rev 5668) @@ -72,7 +72,7 @@ biffAddf(GAGE, "%s: can't set zero items", me); return 1; } - gmi->item = airFree(gmi->item); + gmi->item = AIR_CAST(int *, airFree(gmi->item)); if (!( gmi->item = AIR_CALLOC(itemNum, int) )) { biffAddf(GAGE, "%s: couldn't allocate %u ints for items", me, itemNum); return 1; @@ -156,7 +156,7 @@ airFree(gmq->mitmNum); airFree(gmq->mitm); nrrdNuke(gmq->nidx); - gmq = airFree(gmq); + airFree(gmq); gmq=NULL; } else { /* allocated everything ok */ unsigned int qi; Modified: teem/trunk/src/gage/stackBlur.c =================================================================== --- teem/trunk/src/gage/stackBlur.c 2012-09-26 22:21:05 UTC (rev 5667) +++ teem/trunk/src/gage/stackBlur.c 2012-09-26 22:28:49 UTC (rev 5668) @@ -67,7 +67,8 @@ biffAddf(GAGE, "%s: got NULL pointer", me); return 1; } - sbp->scale = airFree(sbp->scale); + airFree(sbp->scale); + sbp->scale = NULL; if (!( scaleMin < scaleMax )) { biffAddf(GAGE, "%s: scaleMin %g not < scaleMax %g", me, scaleMin, scaleMax); Modified: teem/trunk/src/hest/parseHest.c =================================================================== --- teem/trunk/src/hest/parseHest.c 2012-09-26 22:21:05 UTC (rev 5667) +++ teem/trunk/src/hest/parseHest.c 2012-09-26 22:28:49 UTC (rev 5668) @@ -1219,7 +1219,7 @@ if ( parm->greedySingleString ) { for (i=0; i<numOpts; i++) { param = prms[i]; - param_copy = 0; + param_copy = NULL; if (param && strstr(param, " ")) { start_index = 0; end_index = strlen(param)-1; @@ -1227,7 +1227,7 @@ start_index++; if (param[end_index] == '\"') end_index--; - param_copy = malloc(end_index-start_index+2); + param_copy = AIR_CALLOC(end_index-start_index+2, char); strncpy(param_copy,¶m[start_index],end_index-start_index+1); param_copy[end_index-start_index+1] = '\0'; strcpy(param,param_copy); Modified: teem/trunk/src/meet/meetPull.c =================================================================== --- teem/trunk/src/meet/meetPull.c 2012-09-26 22:21:05 UTC (rev 5667) +++ teem/trunk/src/meet/meetPull.c 2012-09-26 22:28:49 UTC (rev 5668) @@ -492,8 +492,8 @@ meetPullInfoNix(meetPullInfo *minf) { if (minf) { - minf->volName = airFree(minf->volName); - minf->itemStr = airFree(minf->itemStr); + airFree(minf->volName); + airFree(minf->itemStr); free(minf); } return NULL; Modified: teem/trunk/src/nrrd/accessors.c =================================================================== --- teem/trunk/src/nrrd/accessors.c 2012-09-26 22:21:05 UTC (rev 5667) +++ teem/trunk/src/nrrd/accessors.c 2012-09-26 22:28:49 UTC (rev 5668) @@ -558,8 +558,8 @@ } sze = nrrdTypeSize[type]; compare = nrrdValCompare[type]; - valA = _valA; - valB = _valB; + valA = AIR_CAST(const unsigned char *, _valA); + valB = AIR_CAST(const unsigned char *, _valB); for (ii=0; ii<valNum; ii++) { *differ = compare(valA + ii*sze, valB + ii*sze); if (*differ) { Modified: teem/trunk/src/nrrd/map.c =================================================================== --- teem/trunk/src/nrrd/map.c 2012-09-26 22:21:05 UTC (rev 5667) +++ teem/trunk/src/nrrd/map.c 2012-09-26 22:28:49 UTC (rev 5668) @@ -734,8 +734,10 @@ /* lort and hirt will bracket the index of the bad control point with points corresponding either to respected bins or the endpoints of the histogram */ - for (lort=bii; lort>=1 && !respect[lort-1]; lort--); - for (hirt=bii; hirt<bins && !respect[hirt-1]; hirt++); + for (lort=bii; lort>=1 && !respect[lort-1]; lort--) + ; + for (hirt=bii; hirt<bins && !respect[hirt-1]; hirt++) + ; ycoord[bii] = AIR_AFFINE(lort, bii, hirt, ycoord[lort], ycoord[hirt]); } Modified: teem/trunk/src/nrrd/write.c =================================================================== --- teem/trunk/src/nrrd/write.c 2012-09-26 22:21:05 UTC (rev 5667) +++ teem/trunk/src/nrrd/write.c 2012-09-26 22:28:49 UTC (rev 5668) @@ -436,7 +436,7 @@ strtmp = airOneLinify(airStrdup(nrrd->content)); *strP = AIR_CALLOC(fslen + strlen(strtmp), char); sprintf(*strP, "%s%s: %s", prefix, fs, strtmp); - strtmp = airFree(strtmp); + airFree(strtmp); strtmp = NULL; break; case nrrdField_number: *strP = AIR_CALLOC(fslen + size_tStrlen, char); @@ -627,7 +627,7 @@ strtmp = airOneLinify(airStrdup(nrrd->sampleUnits)); *strP = AIR_CALLOC(fslen + strlen(strtmp), char); sprintf(*strP, "%s%s: \"%s\"", prefix, fs, strtmp); - strtmp = airFree(strtmp); + airFree(strtmp); strtmp = NULL; break; case nrrdField_space_units: fdlen = 0; Modified: teem/trunk/src/pull/infoPull.c =================================================================== --- teem/trunk/src/pull/infoPull.c 2012-09-26 22:21:05 UTC (rev 5667) +++ teem/trunk/src/pull/infoPull.c 2012-09-26 22:28:49 UTC (rev 5668) @@ -125,7 +125,7 @@ pullInfoSpecNix(pullInfoSpec *ispec) { if (ispec) { - ispec->volName = airFree(ispec->volName); + airFree(ispec->volName); airFree(ispec); } return NULL; Modified: teem/trunk/src/pull/taskPull.c =================================================================== --- teem/trunk/src/pull/taskPull.c 2012-09-26 22:21:05 UTC (rev 5667) +++ teem/trunk/src/pull/taskPull.c 2012-09-26 22:28:49 UTC (rev 5668) @@ -131,7 +131,7 @@ } task->rng = airRandMTStateNix(task->rng); task->pointBuffer = pullPointNix(task->pointBuffer); - task->neighPoint = airFree(task->neighPoint); + airFree(task->neighPoint); task->addPointArr = airArrayNuke(task->addPointArr); task->nixPointArr = airArrayNuke(task->nixPointArr); airFree(task); @@ -174,6 +174,7 @@ for (tidx=0; tidx<pctx->threadNum; tidx++) { pctx->task[tidx] = _pullTaskNix(pctx->task[tidx]); } - pctx->task = airFree(pctx->task); + airFree(pctx->task); + pctx->task = NULL; return; } Modified: teem/trunk/src/pull/volumePull.c =================================================================== --- teem/trunk/src/pull/volumePull.c 2012-09-26 22:21:05 UTC (rev 5667) +++ teem/trunk/src/pull/volumePull.c 2012-09-26 22:28:49 UTC (rev 5668) @@ -60,7 +60,7 @@ pullVolumeNix(pullVolume *vol) { if (vol) { - vol->name = airFree(vol->name); + airFree(vol->name); airFree(vol->scalePos); vol->ksp00 = nrrdKernelSpecNix(vol->ksp00); vol->ksp11 = nrrdKernelSpecNix(vol->ksp11); Modified: teem/trunk/src/seek/methodsSeek.c =================================================================== --- teem/trunk/src/seek/methodsSeek.c 2012-09-26 22:21:05 UTC (rev 5667) +++ teem/trunk/src/seek/methodsSeek.c 2012-09-26 22:28:49 UTC (rev 5668) @@ -128,7 +128,8 @@ seekContextNix(seekContext *sctx) { if (sctx) { - sctx->flag = airFree(sctx->flag); + airFree(sctx->flag); + sctx->flag = NULL; sctx->_shape = gageShapeNix(sctx->_shape); sctx->nsclDerived = nrrdNuke(sctx->nsclDerived); sctx->nspanHist = nrrdNuke(sctx->nspanHist); Modified: teem/trunk/src/seek/textract.c =================================================================== --- teem/trunk/src/seek/textract.c 2012-09-26 22:21:05 UTC (rev 5667) +++ teem/trunk/src/seek/textract.c 2012-09-26 22:28:49 UTC (rev 5668) @@ -1551,20 +1551,20 @@ /* extract polygon from connections array */ signed char polygon[42]; unsigned char polyct=0; - char this=i; + char thiz=i; char next=connections[2*i]; polygon[polyct++]=i; connections[2*i]=-1; while (next!=-1) { char helpnext; polygon[polyct++]=next; - if (connections[2*next]==this) { + if (connections[2*next]==thiz) { helpnext=connections[2*next+1]; } else { helpnext=connections[2*next]; } connections[2*next]=connections[2*next+1]=-1; - this = next; next = helpnext; + thiz = next; next = helpnext; if (next==polygon[0]) break; /* polygon is closed */ } Modified: teem/trunk/src/ten/experSpec.c =================================================================== --- teem/trunk/src/ten/experSpec.c 2012-09-26 22:21:05 UTC (rev 5667) +++ teem/trunk/src/ten/experSpec.c 2012-09-26 22:28:49 UTC (rev 5668) @@ -28,8 +28,8 @@ _experAlloc(tenExperSpec* espec, unsigned int num) { static char me[]="_experAlloc"; - espec->bval = airFree(espec->bval); - espec->grad = airFree(espec->grad); + airFree(espec->bval); espec->bval = NULL; + airFree(espec->grad); espec->grad = NULL; /* espec->wght = airFree(espec->wght); */ if (!num) { biffAddf(TEN, "%s: need a non-zero number of images", me); @@ -255,8 +255,8 @@ tenExperSpecNix(tenExperSpec *espec) { if (espec) { - espec->bval = airFree(espec->bval); - espec->grad = airFree(espec->grad); + airFree(espec->bval); + airFree(espec->grad); /* espec->wght = airFree(espec->wght); */ airFree(espec); } Modified: teem/trunk/src/ten/path.c =================================================================== --- teem/trunk/src/ten/path.c 2012-09-26 22:21:05 UTC (rev 5667) +++ teem/trunk/src/ten/path.c 2012-09-26 22:28:49 UTC (rev 5668) @@ -71,40 +71,40 @@ if (0 == num) { /* user wants to free buffers for some reason */ - tip->eval = airFree(tip->eval); - tip->evec = airFree(tip->evec); - tip->rtIn = airFree(tip->rtIn); - tip->rtLog = airFree(tip->rtLog); - tip->qIn = airFree(tip->qIn); - tip->qBuff = airFree(tip->qBuff); - tip->qInter = airFree(tip->qInter); + airFree(tip->eval); tip->eval = NULL; + airFree(tip->evec); tip->evec = NULL; + airFree(tip->rtIn); tip->rtIn = NULL; + airFree(tip->rtLog); tip->rtLog = NULL; + airFree(tip->qIn); tip->qIn = NULL; + airFree(tip->qBuff); tip->qBuff = NULL; + airFree(tip->qInter); tip->qInter = NULL; tip->allocLen = 0; } else if (1 == num) { biffAddf(TEN, "%s: need num >= 2 (not %u)", me, num); return 1; } else if (num != tip->allocLen) { - tip->eval = airFree(tip->eval); - tip->evec = airFree(tip->evec); - tip->rtIn = airFree(tip->rtIn); - tip->rtLog = airFree(tip->rtLog); - tip->qIn = airFree(tip->qIn); - tip->qBuff = airFree(tip->qBuff); - tip->qInter = airFree(tip->qInter); - tip->eval = AIR_CAST(double *, calloc(3*num, sizeof(double))); - tip->evec = AIR_CAST(double *, calloc(9*num, sizeof(double))); - tip->rtIn = AIR_CAST(double *, calloc(3*num, sizeof(double))); - tip->rtLog = AIR_CAST(double *, calloc(3*num, sizeof(double))); - tip->qIn = AIR_CAST(double *, calloc(4*num, sizeof(double))); - tip->qBuff = AIR_CAST(double *, calloc(4*num, sizeof(double))); - tip->qInter = AIR_CAST(double *, calloc(num*num, sizeof(double))); + airFree(tip->eval); tip->eval = NULL; + airFree(tip->evec); tip->evec = NULL; + airFree(tip->rtIn); tip->rtIn = NULL; + airFree(tip->rtLog); tip->rtLog = NULL; + airFree(tip->qIn); tip->qIn = NULL; + airFree(tip->qBuff); tip->qBuff = NULL; + airFree(tip->qInter); tip->qInter = NULL; + tip->eval = AIR_CALLOC(3*num, double); + tip->evec = AIR_CALLOC(9*num, double); + tip->rtIn = AIR_CALLOC(3*num, double); + tip->rtLog = AIR_CALLOC(3*num, double); + tip->qIn = AIR_CALLOC(4*num, double); + tip->qBuff = AIR_CALLOC(4*num, double); + tip->qInter = AIR_CALLOC(num*num, double); if (!(tip->eval && tip->evec && tip->rtIn && tip->rtLog && tip->qIn && tip->qBuff && tip->qInter)) { biffAddf(TEN, "%s: didn't alloc buffers (%p,%p,%p %p %p %p %p)", me, - AIR_CAST(void *, tip->eval), AIR_CAST(void *, tip->evec), - AIR_CAST(void *, tip->rtIn), AIR_CAST(void *, tip->rtLog), - AIR_CAST(void *, tip->qIn), AIR_CAST(void *, tip->qBuff), - AIR_CAST(void *, tip->qInter)); + AIR_VOIDP(tip->eval), AIR_VOIDP(tip->evec), + AIR_VOIDP(tip->rtIn), AIR_VOIDP(tip->rtLog), + AIR_VOIDP(tip->qIn), AIR_VOIDP(tip->qBuff), + AIR_VOIDP(tip->qInter)); return 1; } tip->allocLen = num; Modified: teem/trunk/src/ten/tenGage.c =================================================================== --- teem/trunk/src/ten/tenGage.c 2012-09-26 22:21:05 UTC (rev 5667) +++ teem/trunk/src/ten/tenGage.c 2012-09-26 22:28:49 UTC (rev 5668) @@ -2093,8 +2093,10 @@ num = fd*fd*fd; if (num != pvlData->tip->allocLen) { /* HEY: no error checking */ - pvlData->buffTen = airFree(pvlData->buffTen); - pvlData->buffWght = airFree(pvlData->buffWght); + airFree(pvlData->buffTen); + pvlData->buffTen = NULL; + airFree(pvlData->buffWght); + pvlData->buffWght = NULL; pvlData->buffTen = AIR_CALLOC(7*num, double); pvlData->buffWght = AIR_CALLOC(num, double); tenInterpParmBufferAlloc(pvlData->tip, num); Modified: teem/trunk/src/ten/tendMsim.c =================================================================== --- teem/trunk/src/ten/tendMsim.c 2012-09-26 22:21:05 UTC (rev 5667) +++ teem/trunk/src/ten/tendMsim.c 2012-09-26 22:28:49 UTC (rev 5668) @@ -139,8 +139,9 @@ context of simulated DWIs */ E = 0; if (!E) E |= tenGradientCheck(ngrad, nrrdTypeDouble, 1); - if (!E) E |= tenExperSpecGradSingleBValSet(espec, insertB0, - bval, ngrad->data, + if (!E) E |= tenExperSpecGradSingleBValSet(espec, insertB0, bval, + AIR_CAST(const double *, + ngrad->data), ngrad->axis[1].size); if (!E) E |= tenModelSimulate(nout, outType, espec, model, nT2, nin, keyValueSet); Modified: teem/trunk/src/unrrdu/axdelete.c =================================================================== --- teem/trunk/src/unrrdu/axdelete.c 2012-09-26 22:21:05 UTC (rev 5667) +++ teem/trunk/src/unrrdu/axdelete.c 2012-09-26 22:28:49 UTC (rev 5668) @@ -70,7 +70,8 @@ } for (axis=0; axis<nout->dim && nout->axis[axis].size > 1; - axis++); + axis++) + ; while (axis<nout->dim) { if (nrrdAxesDelete(ntmp, nout, axis) || nrrdCopy(nout, ntmp)) { @@ -80,7 +81,8 @@ } for (axis=0; axis<nout->dim && nout->axis[axis].size > 1; - axis++); + axis++) + ; } } else { if (nrrdAxesDelete(nout, nin, _axis)) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |