Boost logo

Boost-Commit :

From: DDeakins_at_[hidden]
Date: 2007-11-25 16:53:27


Author: davedeakins
Date: 2007-11-25 16:53:26 EST (Sun, 25 Nov 2007)
New Revision: 41384
URL: http://svn.boost.org/trac/boost/changeset/41384

Log:
Added a primitive tmpnam function for WinCE (which does not supply any kind of tmpnam in its CRT)
Text files modified:
   trunk/libs/serialization/test/test_tools.hpp | 20 +++++++++++++++++++-
   1 files changed, 19 insertions(+), 1 deletions(-)

Modified: trunk/libs/serialization/test/test_tools.hpp
==============================================================================
--- trunk/libs/serialization/test/test_tools.hpp (original)
+++ trunk/libs/serialization/test/test_tools.hpp 2007-11-25 16:53:26 EST (Sun, 25 Nov 2007)
@@ -19,10 +19,28 @@
 #include <boost/config.hpp>
 #include <cstdio> // remove, tmpnam
 
+#if defined(UNDER_CE)
+
+// Windows CE does not supply the tmpnam function in its CRT.
+// Substitute a primitive implementation here.
+namespace boost {
+namespace archive {
+ char * tmpnam(char * buffer){
+ static char ibuffer [512];
+ if(NULL == buffer)
+ buffer = ibuffer;
+
+ static unsigned short index = 0;
+ std::sprintf(buffer, "\\tmpfile%05X.tmp", index++);
+ return buffer;
+ }
+} // archive
+} // boost
+
+#elif defined(_WIN32) || defined(__WIN32__) || defined(WIN32)
 // win32 has a brain-dead tmpnam implementation.
 // which leaves temp files in root directory
 // regardless of environmental settings
-#if defined(_WIN32) || defined(__WIN32__) || defined(WIN32)
 
 #include <cstdlib>
 #include <cstring>


Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk