diff options
author | Mike Buland <eichlan@xagasoft.com> | 2012-11-05 22:41:51 +0000 |
---|---|---|
committer | Mike Buland <eichlan@xagasoft.com> | 2012-11-05 22:41:51 +0000 |
commit | ec05778d5718a7912e506764d443a78d6a6179e3 (patch) | |
tree | 78a9a01532180030c095acefc45763f07c14edb8 /src/tests/base64.cpp | |
parent | b20414ac1fe80a71a90601f4cd1767fa7014a9ba (diff) | |
download | libbu++-ec05778d5718a7912e506764d443a78d6a6179e3.tar.gz libbu++-ec05778d5718a7912e506764d443a78d6a6179e3.tar.bz2 libbu++-ec05778d5718a7912e506764d443a78d6a6179e3.tar.xz libbu++-ec05778d5718a7912e506764d443a78d6a6179e3.zip |
Converted tabs to spaces with tabconv.
Diffstat (limited to '')
-rw-r--r-- | src/tests/base64.cpp | 126 |
1 files changed, 63 insertions, 63 deletions
diff --git a/src/tests/base64.cpp b/src/tests/base64.cpp index 1e1892d..640118a 100644 --- a/src/tests/base64.cpp +++ b/src/tests/base64.cpp | |||
@@ -11,73 +11,73 @@ | |||
11 | 11 | ||
12 | int main( int argc, char *argv[] ) | 12 | int main( int argc, char *argv[] ) |
13 | { | 13 | { |
14 | argc--,argv++; | 14 | argc--,argv++; |
15 | 15 | ||
16 | if( argc < 3 ) | 16 | if( argc < 3 ) |
17 | return 0; | 17 | return 0; |
18 | 18 | ||
19 | if( argv[0][0] == 'e' ) | 19 | if( argv[0][0] == 'e' ) |
20 | { | 20 | { |
21 | argv++; | 21 | argv++; |
22 | Bu::File fIn( argv[0], Bu::File::Read ); | 22 | Bu::File fIn( argv[0], Bu::File::Read ); |
23 | Bu::File fOut( argv[1], Bu::File::WriteNew ); | 23 | Bu::File fOut( argv[1], Bu::File::WriteNew ); |
24 | Bu::Base64 bOut( fOut ); | 24 | Bu::Base64 bOut( fOut ); |
25 | 25 | ||
26 | char buf[900]; | 26 | char buf[900]; |
27 | for(;;) | 27 | for(;;) |
28 | { | 28 | { |
29 | int iRead = fIn.read( buf, 900 ); | 29 | int iRead = fIn.read( buf, 900 ); |
30 | bOut.write( buf, iRead ); | 30 | bOut.write( buf, iRead ); |
31 | if( iRead < 900 ) | 31 | if( iRead < 900 ) |
32 | break; | 32 | break; |
33 | } | 33 | } |
34 | } | 34 | } |
35 | else if( argv[0][0] == 'd' ) | 35 | else if( argv[0][0] == 'd' ) |
36 | { | 36 | { |
37 | argv++; | 37 | argv++; |
38 | Bu::File fIn( argv[0], Bu::File::Read ); | 38 | Bu::File fIn( argv[0], Bu::File::Read ); |
39 | Bu::File fOut( argv[1], Bu::File::WriteNew ); | 39 | Bu::File fOut( argv[1], Bu::File::WriteNew ); |
40 | Bu::Base64 bIn( fIn ); | 40 | Bu::Base64 bIn( fIn ); |
41 | 41 | ||
42 | char buf[1024]; | 42 | char buf[1024]; |
43 | for(;;) | 43 | for(;;) |
44 | { | 44 | { |
45 | int iRead = bIn.read( buf, 1024 ); | 45 | int iRead = bIn.read( buf, 1024 ); |
46 | printf("Read %d bytes.\n", iRead ); | 46 | printf("Read %d bytes.\n", iRead ); |
47 | fOut.write( buf, iRead ); | 47 | fOut.write( buf, iRead ); |
48 | if( iRead == 0 ) | 48 | if( iRead == 0 ) |
49 | break; | 49 | break; |
50 | } | 50 | } |
51 | } | 51 | } |
52 | else if( argv[0][0] == 'D' ) | 52 | else if( argv[0][0] == 'D' ) |
53 | { | 53 | { |
54 | argv++; | 54 | argv++; |
55 | Bu::MemBuf mIn; | 55 | Bu::MemBuf mIn; |
56 | { | 56 | { |
57 | Bu::File fIn( argv[0], Bu::File::Read ); | 57 | Bu::File fIn( argv[0], Bu::File::Read ); |
58 | char buf[1024]; | 58 | char buf[1024]; |
59 | for(;;) | 59 | for(;;) |
60 | { | 60 | { |
61 | int iRead = fIn.read( buf, 1024 ); | 61 | int iRead = fIn.read( buf, 1024 ); |
62 | mIn.write( buf, iRead ); | 62 | mIn.write( buf, iRead ); |
63 | if( iRead < 1024 ) | 63 | if( iRead < 1024 ) |
64 | break; | 64 | break; |
65 | } | 65 | } |
66 | mIn.setPos( 0 ); | 66 | mIn.setPos( 0 ); |
67 | } | 67 | } |
68 | Bu::File fOut( argv[1], Bu::File::WriteNew ); | 68 | Bu::File fOut( argv[1], Bu::File::WriteNew ); |
69 | Bu::Base64 bIn( mIn ); | 69 | Bu::Base64 bIn( mIn ); |
70 | 70 | ||
71 | char buf[1024]; | 71 | char buf[1024]; |
72 | for(;;) | 72 | for(;;) |
73 | { | 73 | { |
74 | int iRead = bIn.read( buf, 1024 ); | 74 | int iRead = bIn.read( buf, 1024 ); |
75 | printf("Read %d bytes.\n", iRead ); | 75 | printf("Read %d bytes.\n", iRead ); |
76 | fOut.write( buf, iRead ); | 76 | fOut.write( buf, iRead ); |
77 | if( iRead == 0 ) | 77 | if( iRead == 0 ) |
78 | break; | 78 | break; |
79 | } | 79 | } |
80 | } | 80 | } |
81 | 81 | ||
82 | return 0; | 82 | return 0; |
83 | } | 83 | } |