﻿id	summary	reporter	owner	description	type	status	priority	milestone	component	version	severity	resolution	keywords	cc
583	psVector.nalloc casting errors	eugene	robert.desonia@…	"in several places, a psVector is created to point at an existing block of data.
 Since psVector.nalloc is a const, this value is set with code of the form:

*(type *)&data = value

I have found a number of places in which this technique is used for
psVector.nalloc where 'type' is set to 'int' rather than 'long'.  this causes
nasty errors on 64bit machines where int and long are different sizes:

the following lines have this error:

./imageops/psImagePixelExtract.c:409:        imgVec->n = *(int*)&imgVec->nalloc
= numCols;
./imageops/psImagePixelExtract.c:413:            maskVec->n =
*(int*)&maskVec->nalloc = numCols;
./imageops/psImageStats.c:66:        *(int*)&junkData->nalloc = in->numRows *
in->numCols;
./imageops/psImageStats.c:90:            *(int*)&junkMask->nalloc =
mask->numRows * mask->numCols;
./imageops/psImageStats.c:139:        *(int*)&junkData->nalloc = in->numRows *
in->numCols;
./imageops/psImageStats.c:163:            *(int*)&junkMask->nalloc =
mask->numRows * mask->numCols;
./math/psStats.c:2337:    *(int *)&newHist->bounds->n = newHist->bounds->nalloc;
./math/psStats.c:2386:    *(int *)&newHist->bounds->n = newHist->bounds->nalloc;

Perhaps this concept needs to be converted into a psLib function which would
isolate the change to one location.  I propose something like:

psVector *psVectorAssign (psVector *in, void *data, long nBytes, psElemType type);"	defect	closed	high		mathtypes	0.8.0	normal	fixed		
