From: <sm...@us...> - 2009-09-15 13:31:21
|
Revision: 10410 http://plplot.svn.sourceforge.net/plplot/?rev=10410&view=rev Author: smekal Date: 2009-09-15 13:31:01 +0000 (Tue, 15 Sep 2009) Log Message: ----------- Added the redefinition macros considering snprintf to plc++demos.h and plcdemos.h, as well as the HAVE_SNPRINTF macros to plConfig.h.cmake. Example 19 (C/C++) compile now again for Visual C++. Modified Paths: -------------- trunk/examples/c/plcdemos.h trunk/examples/c++/plc++demos.h trunk/include/plConfig.h.cmake Modified: trunk/examples/c/plcdemos.h =================================================================== --- trunk/examples/c/plcdemos.h 2009-09-15 01:54:02 UTC (rev 10409) +++ trunk/examples/c/plcdemos.h 2009-09-15 13:31:01 UTC (rev 10410) @@ -39,6 +39,24 @@ #define ROUND(a) (PLINT)((a)<0. ? ((a)-.5) : ((a)+.5)) #endif +/* Declarations for save string functions */ + +#ifdef PL_HAVE_SNPRINTF + /* In case only _snprintf is declared (as for Visual C++ and + Borland compiler toolset) we redefine the function names */ + #ifdef _PL_HAVE_SNPRINTF + #define snprintf _snprintf + #define snscanf _snscanf + #endif /* _PL_HAVE_SNPRINTF */ +#else /* !PL_HAVE_SNPRINTF */ + /* declare dummy functions which just call the unsafe + functions ignoring the size of the string */ + int plsnprintf( char *buffer, int n, const char *format, ... ); + int plsnscanf( const char *buffer, int n, const char *format, ... ); + #define snprintf plsnprintf + #define snscanf plsnscanf +#endif /* PL_HAVE_SNPRINTF */ + /* Add in missing isnan definition if required */ #if defined(PL__HAVE_ISNAN) # define isnan _isnan Modified: trunk/examples/c++/plc++demos.h =================================================================== --- trunk/examples/c++/plc++demos.h 2009-09-15 01:54:02 UTC (rev 10409) +++ trunk/examples/c++/plc++demos.h 2009-09-15 13:31:01 UTC (rev 10410) @@ -28,6 +28,24 @@ #define ROUND(a) (PLINT)((a)<0. ? ((a)-0.5) : ((a)+0.5)) #endif +/* Declarations for save string functions */ + +#ifdef PL_HAVE_SNPRINTF + /* In case only _snprintf is declared (as for Visual C++ and + Borland compiler toolset) we redefine the function names */ + #ifdef _PL_HAVE_SNPRINTF + #define snprintf _snprintf + #define snscanf _snscanf + #endif /* _PL_HAVE_SNPRINTF */ +#else /* !PL_HAVE_SNPRINTF */ + /* declare dummy functions which just call the unsafe + functions ignoring the size of the string */ + int plsnprintf( char *buffer, int n, const char *format, ... ); + int plsnscanf( const char *buffer, int n, const char *format, ... ); + #define snprintf plsnprintf + #define snscanf plsnscanf +#endif /* PL_HAVE_SNPRINTF */ + /* Add in missing isnan definition if required */ #if defined(PL__HAVE_ISNAN) # define isnan _isnan Modified: trunk/include/plConfig.h.cmake =================================================================== --- trunk/include/plConfig.h.cmake 2009-09-15 01:54:02 UTC (rev 10409) +++ trunk/include/plConfig.h.cmake 2009-09-15 13:31:01 UTC (rev 10410) @@ -44,6 +44,16 @@ /* Define if you have c++ accessible stdint.h */ #cmakedefine PL_HAVE_CXX_STDINT_H +/* Define if snprintf is available */ +#ifndef PL_HAVE_SNPRINTF +#cmakedefine PL_HAVE_SNPRINTF +#endif + +/* Define if _snprintf is available */ +#ifndef _PL_HAVE_SNPRINTF +#cmakedefine _PL_HAVE_SNPRINTF +#endif + /* Define if isinf is available */ #cmakedefine PL_HAVE_ISINF This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |