From 2b0fa89df615cb4789668014475ae64d99e773b5 Mon Sep 17 00:00:00 2001 From: David Date: Tue, 19 Jun 2007 06:05:55 +0000 Subject: david - got some things compiling on win32 (wine/devc++) --- src/file.cpp | 10 ++++++---- src/file.h | 2 ++ src/tests/fstring.cpp | 10 ++++++++++ 3 files changed, 18 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/file.cpp b/src/file.cpp index 368b788..1a8bd08 100644 --- a/src/file.cpp +++ b/src/file.cpp @@ -134,19 +134,21 @@ void Bu::File::setBlocking( bool bBlocking ) return; } +#ifndef WIN32 void Bu::File::truncate( long nSize ) { ftruncate( fileno( fh ), nSize ); } -void Bu::File::flush() +void Bu::File::chmod( mode_t t ) { - fflush( fh ); + fchmod( fileno( fh ), t ); } +#endif -void Bu::File::chmod( mode_t t ) +void Bu::File::flush() { - fchmod( fileno( fh ), t ); + fflush( fh ); } bool Bu::File::isOpen() diff --git a/src/file.h b/src/file.h index 1a4421b..0f638a7 100644 --- a/src/file.h +++ b/src/file.h @@ -47,6 +47,7 @@ namespace Bu *@param sFlags (const char *) Standard file flags 'rb'... etc.. *@returns (Bu::File) A file object representing your temp file. */ +#ifndef WIN32 inline static Bu::File tempFile( Bu::FString &sName, const char *sFlags ) { int afh_d = mkstemp( sName.getStr() ); @@ -66,6 +67,7 @@ namespace Bu *@param t (mode_t) The new file access permissions. */ void chmod( mode_t t ); +#endif private: FILE *fh; diff --git a/src/tests/fstring.cpp b/src/tests/fstring.cpp index d600be6..48dfc5f 100644 --- a/src/tests/fstring.cpp +++ b/src/tests/fstring.cpp @@ -3,12 +3,22 @@ #include #include +#ifndef WIN32 inline double getTime() { struct timeval tv; gettimeofday( &tv, NULL ); return ((double)tv.tv_sec) + ((double)tv.tv_usec/1000000.0); } +#else +#include "windows.h" +#include "winbase.h" +inline double getTime() +{ + uint32_t t = (uint32_t) GetTickCount(); + return (double) t / 1000.0; +} +#endif Bu::FString genThing() { -- cgit v1.2.3