diff options
author | Mike Buland <eichlan@xagasoft.com> | 2008-10-01 21:48:33 +0000 |
---|---|---|
committer | Mike Buland <eichlan@xagasoft.com> | 2008-10-01 21:48:33 +0000 |
commit | b6f57560fb7fae00f0854ca19158bd5512e5405b (patch) | |
tree | aa3c7012ee2b1ee9b97b1ba136217cbf6a84d587 /src/unit/file.cpp | |
parent | d872f7e07c5367f251cf5ebb70a03916251f5306 (diff) | |
download | libbu++-b6f57560fb7fae00f0854ca19158bd5512e5405b.tar.gz libbu++-b6f57560fb7fae00f0854ca19158bd5512e5405b.tar.bz2 libbu++-b6f57560fb7fae00f0854ca19158bd5512e5405b.tar.xz libbu++-b6f57560fb7fae00f0854ca19158bd5512e5405b.zip |
This commit is sure to break things. This should be a very, very minor change.
What changed API-Wise:
- I deleted a constructor in Bu::File that shouldn't have been used anyway.
- I changed it from using fopen style mode strings to using libbu++ style
mode flags. Check the docs for the complete list, but basically instead of
"wb" you do Bu::File::Write, and so on, you can or any of the libbu++ flags
together. There is no binary/text mode, it just writes whatever you tell it
to verbatim (binary mode). Lots of extras are supported. Nothing else
should have changed (except now the file stream is unbuffered, like all the
other streams).
Sorry if this breaks anything, if it's too annoying, use the last revision for
a while longer.
Diffstat (limited to '')
-rw-r--r-- | src/unit/file.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/unit/file.cpp b/src/unit/file.cpp index a22239d..cc19fac 100644 --- a/src/unit/file.cpp +++ b/src/unit/file.cpp | |||
@@ -31,7 +31,7 @@ public: | |||
31 | // | 31 | // |
32 | void writeFull() | 32 | void writeFull() |
33 | { | 33 | { |
34 | Bu::File sf("testfile1", "wb"); | 34 | Bu::File sf("testfile1", Bu::File::Write ); |
35 | for( int c = 0; c < 256; c++ ) | 35 | for( int c = 0; c < 256; c++ ) |
36 | { | 36 | { |
37 | unsigned char ch = (unsigned char)c; | 37 | unsigned char ch = (unsigned char)c; |
@@ -49,7 +49,7 @@ public: | |||
49 | 49 | ||
50 | void readBlocks() | 50 | void readBlocks() |
51 | { | 51 | { |
52 | Bu::File sf("testfile1", "rb"); | 52 | Bu::File sf("testfile1", Bu::File::Read ); |
53 | unsigned char buf[50]; | 53 | unsigned char buf[50]; |
54 | size_t total = 0; | 54 | size_t total = 0; |
55 | for(;;) | 55 | for(;;) |
@@ -74,7 +74,7 @@ public: | |||
74 | { | 74 | { |
75 | try | 75 | try |
76 | { | 76 | { |
77 | Bu::File sf("doesn'texist", "rb"); | 77 | Bu::File sf("doesn'texist", Bu::File::Read ); |
78 | unitFailed("No exception thrown"); | 78 | unitFailed("No exception thrown"); |
79 | } | 79 | } |
80 | catch( Bu::FileException &e ) | 80 | catch( Bu::FileException &e ) |
@@ -85,7 +85,7 @@ public: | |||
85 | 85 | ||
86 | void readError2() | 86 | void readError2() |
87 | { | 87 | { |
88 | Bu::File sf("testfile1", "rb"); | 88 | Bu::File sf("testfile1", Bu::File::Read ); |
89 | char buf[256]; | 89 | char buf[256]; |
90 | int r = sf.read( buf, 256 ); | 90 | int r = sf.read( buf, 256 ); |
91 | unitTest( r == 256 ); | 91 | unitTest( r == 256 ); |