On 2008-06-25 10:40+0200 Werner Smekal wrote:

> Hi,
>
> I made some changes to the CBS in order to be able to use save string
> functions.


> [...] Anyway, the solution to
> this problem is to use save string functions, like snprintf and the
> like. But that's not so easy, since these functions are C99 standard and
> might not be known at all (although all modern compilers should know
> them). And as usual since Microsoft decided to implement this function
> before they became standard, they used a different naming convention
> (_snprintf, _snscanf) and we need to take care of these "special" naming
> guidelines as well. What I did now is checking if snprintf is available
> during the cmake configuring stage in plplot.cmake. If snprintf is not
> found we are looking for _snprintf. If either of these functions is
> found I assume that snscanf exist as well to speed up the configure
> stage. Then in plplotP.h I rename functions (_snprintf to snprintf) if
> necessary or declare dummy functions which are defined in plctrl.c,
> which just call the unsafe functions ignoring the size of the buffer.
>
> This should be tested on all available platforms and compilers.

HAVE_SNPRINTF is a heavily used name so on Debian testing I am getting a
fair number of warnings about a nameclash with other headers that use it.
I tried checking whether it was already defined in config.h, but that only
solved some of the issues because not all the system headers on Linux follow
the convention about checking whether HAVE_SNPRINTF is already defined
before defining it themselves.

To avoid these nameclashes I have just committed a fix to use
PL_HAVE_SNPRINTF (and _PL_HAVE_SNPRINTF) instead.

Because I forgot to change HAVE_SNPRINTF to PL_HAVE_SNPRINTF in plctrl.c in
an intermediate version of this fix, I inadvertently compiled plsnprintf and
plsnscanf which showed the following compilation errors.

[ 41%] /home/software/plplot_cvs/HEAD/plplot_cmake/src/plctrl.c: In function
‘plsnprintf’:
/home/software/plplot_cvs/HEAD/plplot_cmake/src/plctrl.c:2121: error: ‘fmt’
undeclared (first use in this function)
/home/software/plplot_cvs/HEAD/plplot_cmake/src/plctrl.c:2121: error: (Each
undeclared identifier is reported only once
/home/software/plplot_cvs/HEAD/plplot_cmake/src/plctrl.c:2121: error: for
each function it appears in.)
/home/software/plplot_cvs/HEAD/plplot_cmake/src/plctrl.c:2122: error:
‘argptr’ undeclared (first use in this function)
/home/software/plplot_cvs/HEAD/plplot_cmake/src/plctrl.c: In function
‘plsnscanf’:
/home/software/plplot_cvs/HEAD/plplot_cmake/src/plctrl.c:2142: error: ‘fmt’
undeclared (first use in this function)
/home/software/plplot_cvs/HEAD/plplot_cmake/src/plctrl.c:2142: error:
‘args’ undeclared (first use in this function)
make[2]: *** [src/CMakeFiles/plplotd.dir/plctrl.o] Error 1

Werner, the fact that nobody else has spotted these errors indicates your
assumption that these functions will almost always remain unused is a good
one.  Nevertheless, they should be fixed.  I am not sure exactly how to do
that so could you please do it (and also test they actually work at
run-time)?

My committed changes (revision 8504) means these functions will remain
uncompiled (as before) on most users systems.  In addition, all the warnings
about nameclashes with other uses of HAVE_SNPRINTF on Linux system headers
are now gone.

Alan
__________________________
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
(lbproject.sf.net).
__________________________

Linux-powered Science
__________________________

-------------------------------------------------------------------------
Sponsored by: SourceForge.net Community Choice Awards: VOTE NOW!
Studies have shown that voting for your favorite open source project,
along with a healthy diet, reduces your potential for chronic lameness
and boredom. Vote Now at http://www.sourceforge.net/community/cca08
_______________________________________________
Plplot-devel mailing list
Plplot-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/plplot-devel

Reply via email to