From b6f57560fb7fae00f0854ca19158bd5512e5405b Mon Sep 17 00:00:00 2001 From: Mike Buland Date: Wed, 1 Oct 2008 21:48:33 +0000 Subject: 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. --- src/tests/archive.cpp | 2 +- src/tests/archive2.cpp | 2 +- src/tests/bzip2.cpp | 4 ++-- src/tests/nids.cpp | 11 +++++------ src/tests/taf.cpp | 8 ++++---- 5 files changed, 13 insertions(+), 14 deletions(-) (limited to 'src/tests') diff --git a/src/tests/archive.cpp b/src/tests/archive.cpp index 698d37c..131d4de 100644 --- a/src/tests/archive.cpp +++ b/src/tests/archive.cpp @@ -12,7 +12,7 @@ using namespace Bu; int main() { - File f("test.dat", "wb"); + File f("test.dat", File::Write ); Archive ar( f, Archive::save ); std::string s("Hello there"); diff --git a/src/tests/archive2.cpp b/src/tests/archive2.cpp index 6d3c2c1..ab02d04 100644 --- a/src/tests/archive2.cpp +++ b/src/tests/archive2.cpp @@ -82,7 +82,7 @@ void write() { C *c = new C; - Bu::File f( "test.archive", "wb"); + Bu::File f( "test.archive", Bu::File::Write ); Bu::Archive ar( f, Bu::Archive::save ); ar << c; } diff --git a/src/tests/bzip2.cpp b/src/tests/bzip2.cpp index de7c034..77dc064 100644 --- a/src/tests/bzip2.cpp +++ b/src/tests/bzip2.cpp @@ -19,10 +19,10 @@ int main( int argc, char *argv[] ) char buf[1024]; size_t nRead; - Bu::File f( argv[0], "wb" ); + Bu::File f( argv[0], Bu::File::Write ); Bu::BZip2 bz2( f ); - Bu::File fin( argv[1], "rb"); + Bu::File fin( argv[1], Bu::File::Read ); for(;;) { diff --git a/src/tests/nids.cpp b/src/tests/nids.cpp index 4856883..f50fde5 100644 --- a/src/tests/nids.cpp +++ b/src/tests/nids.cpp @@ -10,17 +10,16 @@ int main( int argc, char *argv[] ) return 1; } - Bu::File fOut( argv[1], "wb+"); + Bu::File fOut( argv[1], Bu::File::ReadWrite ); Bu::Nids n( fOut ); // n.initialize( 120, 5 ); Bu::NidsStream s = n.openStream( n.createStream() ); -/* - Bu::FString sBuf( 350 ); - memset( sBuf.getStr(), 'a', 350 ); - s.write( sBuf ); - */ + +// Bu::FString sBuf( 350 ); +// memset( sBuf.getStr(), 'a', 350 ); +// s.write( sBuf ); return 0; } diff --git a/src/tests/taf.cpp b/src/tests/taf.cpp index 281b9c4..859ecfc 100644 --- a/src/tests/taf.cpp +++ b/src/tests/taf.cpp @@ -13,13 +13,13 @@ int main( int argc, char *argv[] ) { if( argc == 1 ) { - Bu::File f("test.taf", "rb"); + Bu::File f("test.taf", Bu::File::Read ); Bu::TafReader tr( f ); Bu::TafGroup *pGroup = tr.readGroup(); { - Bu::File fo("out.taf", "wb"); + Bu::File fo("out.taf", Bu::File::Write ); Bu::TafWriter tw( fo ); tw.writeGroup( pGroup ); } @@ -28,13 +28,13 @@ int main( int argc, char *argv[] ) } else if( argc == 3 ) { - Bu::File f( argv[1], "rb"); + Bu::File f( argv[1], Bu::File::Read ); Bu::TafReader tr( f ); Bu::TafGroup *pGroup = tr.readGroup(); { - Bu::File fo( argv[2], "wb"); + Bu::File fo( argv[2], Bu::File::Write ); Bu::TafWriter tw( fo ); tw.writeGroup( pGroup ); } -- cgit v1.2.3