summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/file.cpp10
-rw-r--r--src/file.h2
-rw-r--r--src/tests/fstring.cpp10
3 files changed, 18 insertions, 4 deletions
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 )
134 return; 134 return;
135} 135}
136 136
137#ifndef WIN32
137void Bu::File::truncate( long nSize ) 138void Bu::File::truncate( long nSize )
138{ 139{
139 ftruncate( fileno( fh ), nSize ); 140 ftruncate( fileno( fh ), nSize );
140} 141}
141 142
142void Bu::File::flush() 143void Bu::File::chmod( mode_t t )
143{ 144{
144 fflush( fh ); 145 fchmod( fileno( fh ), t );
145} 146}
147#endif
146 148
147void Bu::File::chmod( mode_t t ) 149void Bu::File::flush()
148{ 150{
149 fchmod( fileno( fh ), t ); 151 fflush( fh );
150} 152}
151 153
152bool Bu::File::isOpen() 154bool 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
47 *@param sFlags (const char *) Standard file flags 'rb'... etc.. 47 *@param sFlags (const char *) Standard file flags 'rb'... etc..
48 *@returns (Bu::File) A file object representing your temp file. 48 *@returns (Bu::File) A file object representing your temp file.
49 */ 49 */
50#ifndef WIN32
50 inline static Bu::File tempFile( Bu::FString &sName, const char *sFlags ) 51 inline static Bu::File tempFile( Bu::FString &sName, const char *sFlags )
51 { 52 {
52 int afh_d = mkstemp( sName.getStr() ); 53 int afh_d = mkstemp( sName.getStr() );
@@ -66,6 +67,7 @@ namespace Bu
66 *@param t (mode_t) The new file access permissions. 67 *@param t (mode_t) The new file access permissions.
67 */ 68 */
68 void chmod( mode_t t ); 69 void chmod( mode_t t );
70#endif
69 71
70 private: 72 private:
71 FILE *fh; 73 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 @@
3#include <sys/time.h> 3#include <sys/time.h>
4#include <string> 4#include <string>
5 5
6#ifndef WIN32
6inline double getTime() 7inline double getTime()
7{ 8{
8 struct timeval tv; 9 struct timeval tv;
9 gettimeofday( &tv, NULL ); 10 gettimeofday( &tv, NULL );
10 return ((double)tv.tv_sec) + ((double)tv.tv_usec/1000000.0); 11 return ((double)tv.tv_sec) + ((double)tv.tv_usec/1000000.0);
11} 12}
13#else
14#include "windows.h"
15#include "winbase.h"
16inline double getTime()
17{
18 uint32_t t = (uint32_t) GetTickCount();
19 return (double) t / 1000.0;
20}
21#endif
12 22
13Bu::FString genThing() 23Bu::FString genThing()
14{ 24{