There are also quite a few malloc / realloc calls which explicitly cast
the output as (short *) rather than (int *). To avoid any problems these
also need fixing. I've been through and checked this all. I think the
xfig driver is now ok. I've submitted your patches + my addition fixes
to svn. You beat me to this one...
On Sun, Dec 14, 2008 at 03:07:17PM -0800, Alan Irwin wrote:
> On 2008-12-14 14:02-0800 Alan W. Irwin wrote:
> > [...]This patch is only part of the story.
> --- drivers/xfig.c 2008-12-14 14:40:29.000000000 -0800
> +++ drivers/xfig.c~ 2008-12-14 12:31:45.000000000 -0800
> @@ -414,7 +414,7 @@
> flushbuffer(PLStream *pls)
> PLDev *dev = pls->dev;
> - int i = 0;
> + short i = 0;
> if (count == 0)
> If you put the above patch on top of the previous one, everything now
> works fine with example 27. The resulting file size is reasonable (3.7M)
> and gives reasonable looking results with xfig. However, could some
> C expert here interpret
> *(buffptr + count++) = x1;
> for me, where x1 and count are int. and buffprt is short* ? (x1 just stores
> a value of a short so a short* for buffprt loses no precision.) The above
> statement is an example of several statements like this that appear in
> For the svn trunk version, count is a short (the source of the original
> problem), but I am concerned that if you turn it into an int (as demanded by
> example 27) some implicit casting is going on in statements like above that
> may not work properly for all compilers.
> If you add an int to a pointer to a short is the result always a pointer to
> a short? What is the syntax for doing all casting explicitly with the above
> statement (so I will better understand it in future)?
> Alan W. Irwin
> Astronomical research affiliation with Department of Physics and Astronomy,
> University of Victoria (astrowww.phys.uvic.ca).
> Programming affiliations with the FreeEOS equation-of-state implementation
> for stellar interiors (freeeos.sf.net); PLplot scientific plotting software
> package (plplot.org); the libLASi project (unifont.org/lasi); the Loads of
> Linux Links project (loll.sf.net); and the Linux Brochure Project
> Linux-powered Science
> SF.Net email is Sponsored by MIX09, March 18-20, 2009 in Las Vegas, Nevada.
> The future of the web can't happen without you. Join us at MIX09 to help
> pave the way to the Next Web now. Learn more and register at
> Plplot-devel mailing list