aboutsummaryrefslogtreecommitdiff
path: root/src/unit
diff options
context:
space:
mode:
authorMike Buland <eichlan@xagasoft.com>2008-10-01 21:48:33 +0000
committerMike Buland <eichlan@xagasoft.com>2008-10-01 21:48:33 +0000
commitb6f57560fb7fae00f0854ca19158bd5512e5405b (patch)
treeaa3c7012ee2b1ee9b97b1ba136217cbf6a84d587 /src/unit
parentd872f7e07c5367f251cf5ebb70a03916251f5306 (diff)
downloadlibbu++-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.cpp8
-rw-r--r--src/unit/taf.cpp4
2 files changed, 6 insertions, 6 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 );
diff --git a/src/unit/taf.cpp b/src/unit/taf.cpp
index 4e22ab1..0a97eba 100644
--- a/src/unit/taf.cpp
+++ b/src/unit/taf.cpp
@@ -29,14 +29,14 @@ public:
29 { 29 {
30#define FN_TMP ("/tmp/tmpXXXXXXXX") 30#define FN_TMP ("/tmp/tmpXXXXXXXX")
31 Bu::FString sFnTmp(FN_TMP); 31 Bu::FString sFnTmp(FN_TMP);
32 Bu::File fOut = Bu::File::tempFile( sFnTmp, "wb" ); 32 Bu::File fOut = Bu::File::tempFile( sFnTmp, Bu::File::Write );
33 const char *data = 33 const char *data =
34"{test: name=\"Bob\"}" 34"{test: name=\"Bob\"}"
35; 35;
36 fOut.write(data,strlen(data)); 36 fOut.write(data,strlen(data));
37 fOut.close(); 37 fOut.close();
38 38
39 Bu::File fIn(sFnTmp.getStr(), "rb"); 39 Bu::File fIn(sFnTmp.getStr(), Bu::File::Read );
40 Bu::TafReader tr(fIn); 40 Bu::TafReader tr(fIn);
41 41
42 Bu::TafGroup *tn = tr.readGroup(); 42 Bu::TafGroup *tn = tr.readGroup();