diff options
| -rw-r--r-- | src/minimacro.h | 8 | ||||
| -rw-r--r-- | src/tests/cache.cpp | 19 | ||||
| -rw-r--r-- | src/tests/fastcgi.cpp | 8 | ||||
| -rw-r--r-- | src/tests/fstrformat.cpp | 19 | ||||
| -rw-r--r-- | src/tests/heap.cpp | 3 | ||||
| -rw-r--r-- | src/unit/string.unit | 14 | ||||
| -rwxr-xr-x | support/findcaseshift.sh | 3 | 
7 files changed, 30 insertions, 44 deletions
diff --git a/src/minimacro.h b/src/minimacro.h index 582e1b0..b6c7c13 100644 --- a/src/minimacro.h +++ b/src/minimacro.h  | |||
| @@ -105,9 +105,7 @@ namespace Bu | |||
| 105 | virtual Bu::String call( | 105 | virtual Bu::String call( | 
| 106 | const Bu::String &sIn, StrList & ) | 106 | const Bu::String &sIn, StrList & ) | 
| 107 | { | 107 | { | 
| 108 | Bu::String sOut( sIn ); | 108 | return sIn.toUpper(); | 
| 109 | sOut.toUpper(); | ||
| 110 | return sOut; | ||
| 111 | } | 109 | } | 
| 112 | }; | 110 | }; | 
| 113 | 111 | ||
| @@ -119,9 +117,7 @@ namespace Bu | |||
| 119 | virtual Bu::String call( | 117 | virtual Bu::String call( | 
| 120 | const Bu::String &sIn, StrList & ) | 118 | const Bu::String &sIn, StrList & ) | 
| 121 | { | 119 | { | 
| 122 | Bu::String sOut( sIn ); | 120 | return sIn.toLower(); | 
| 123 | sOut.toLower(); | ||
| 124 | return sOut; | ||
| 125 | } | 121 | } | 
| 126 | }; | 122 | }; | 
| 127 | 123 | ||
diff --git a/src/tests/cache.cpp b/src/tests/cache.cpp index 243012d..e9dbd86 100644 --- a/src/tests/cache.cpp +++ b/src/tests/cache.cpp  | |||
| @@ -105,9 +105,7 @@ public: | |||
| 105 | Bu::File f( sFile, | 105 | Bu::File f( sFile, | 
| 106 | Bu::File::Write|Bu::File::Create|Bu::File::Truncate | 106 | Bu::File::Write|Bu::File::Create|Bu::File::Truncate | 
| 107 | ); | 107 | ); | 
| 108 | Bu::String s; | 108 | f.write( Bu::String("%1").arg( num ) ); | 
| 109 | s.format("%d", num ); | ||
| 110 | f.write( s ); | ||
| 111 | } | 109 | } | 
| 112 | 110 | ||
| 113 | virtual void sync( Bob *, const long & ) | 111 | virtual void sync( Bob *, const long & ) | 
| @@ -126,16 +124,14 @@ public: | |||
| 126 | virtual Bob *load( const long &key ) | 124 | virtual Bob *load( const long &key ) | 
| 127 | { | 125 | { | 
| 128 | TRACE( key ); | 126 | TRACE( key ); | 
| 129 | Bu::String sDest; | 127 | Bu::String sDest = Bu::String("bobcache/%1").arg( key ); | 
| 130 | sDest.format("bobcache/%d", key ); | ||
| 131 | return new Bob( readNum( sDest ) ); | 128 | return new Bob( readNum( sDest ) ); | 
| 132 | } | 129 | } | 
| 133 | 130 | ||
| 134 | virtual void unload( Bob *pObj, const long &key ) | 131 | virtual void unload( Bob *pObj, const long &key ) | 
| 135 | { | 132 | { | 
| 136 | TRACE( pObj, key ); | 133 | TRACE( pObj, key ); | 
| 137 | Bu::String sDest; | 134 | Bu::String sDest = Bu::String("bobcache/%1").arg( key ); | 
| 138 | sDest.format("bobcache/%d", key ); | ||
| 139 | writeNum( sDest, pObj->getInt() ); | 135 | writeNum( sDest, pObj->getInt() ); | 
| 140 | delete pObj; | 136 | delete pObj; | 
| 141 | } | 137 | } | 
| @@ -144,8 +140,7 @@ public: | |||
| 144 | { | 140 | { | 
| 145 | TRACE( rSrc ); | 141 | TRACE( rSrc ); | 
| 146 | long id = ++cLastId; | 142 | long id = ++cLastId; | 
| 147 | Bu::String sDest; | 143 | Bu::String sDest = Bu::String("bobcache/%1").arg( id ); | 
| 148 | sDest.format("bobcache/%d", id ); | ||
| 149 | writeNum( sDest, rSrc->getInt() ); | 144 | writeNum( sDest, rSrc->getInt() ); | 
| 150 | return id; | 145 | return id; | 
| 151 | } | 146 | } | 
| @@ -153,8 +148,7 @@ public: | |||
| 153 | virtual void destroy( Bob *pObj, const long &key ) | 148 | virtual void destroy( Bob *pObj, const long &key ) | 
| 154 | { | 149 | { | 
| 155 | TRACE( pObj, key ); | 150 | TRACE( pObj, key ); | 
| 156 | Bu::String sDest; | 151 | Bu::String sDest = Bu::String("bobcache/%1").arg( key ); | 
| 157 | sDest.format("bobcache/%d", key ); | ||
| 158 | if( !access( sDest.getStr(), F_OK ) ) | 152 | if( !access( sDest.getStr(), F_OK ) ) | 
| 159 | unlink( sDest.getStr() ); | 153 | unlink( sDest.getStr() ); | 
| 160 | delete pObj; | 154 | delete pObj; | 
| @@ -163,8 +157,7 @@ public: | |||
| 163 | virtual void destroy( const long &key ) | 157 | virtual void destroy( const long &key ) | 
| 164 | { | 158 | { | 
| 165 | TRACE( pObj, key ); | 159 | TRACE( pObj, key ); | 
| 166 | Bu::String sDest; | 160 | Bu::String sDest = Bu::String("bobcache/%1").arg( key ); | 
| 167 | sDest.format("bobcache/%d", key ); | ||
| 168 | if( !access( sDest.getStr(), F_OK ) ) | 161 | if( !access( sDest.getStr(), F_OK ) ) | 
| 169 | unlink( sDest.getStr() ); | 162 | unlink( sDest.getStr() ); | 
| 170 | } | 163 | } | 
diff --git a/src/tests/fastcgi.cpp b/src/tests/fastcgi.cpp index 7ca4ebc..7447a6f 100644 --- a/src/tests/fastcgi.cpp +++ b/src/tests/fastcgi.cpp  | |||
| @@ -43,17 +43,17 @@ public: | |||
| 43 | sOut += getcwd( buf, 2048 ); | 43 | sOut += getcwd( buf, 2048 ); | 
| 44 | sOut += "</li></ul>"; | 44 | sOut += "</li></ul>"; | 
| 45 | sOut += "<h1>Stdin:</h1>"; | 45 | sOut += "<h1>Stdin:</h1>"; | 
| 46 | sOut.formatAppend("%d bytes<pre>", sStdIn.getSize() ); | 46 | sOut += Bu::String("%1 bytes<pre>").arg( sStdIn.getSize() ); | 
| 47 | Bu::String sL, sR; | 47 | Bu::String sL, sR; | 
| 48 | for( Bu::String::const_iterator i = sStdIn.begin(); | 48 | for( Bu::String::const_iterator i = sStdIn.begin(); | 
| 49 | i; i++ ) | 49 | i; i++ ) | 
| 50 | { | 50 | { | 
| 51 | sL.formatAppend("%02X ", | 51 | sL += Bu::String("%1").arg( | 
| 52 | (unsigned int)((unsigned char)*i) ); | 52 | (unsigned int)((unsigned char)*i), Bu::Fmt::hex().width(2).fill('0') ); | 
| 53 | if( *i < 27 ) | 53 | if( *i < 27 ) | 
| 54 | sR += ". "; | 54 | sR += ". "; | 
| 55 | else | 55 | else | 
| 56 | sR.formatAppend("&#%d; ", | 56 | sR += Bu::String("&#%1; ").arg( | 
| 57 | (unsigned int)((unsigned char)*i) ); | 57 | (unsigned int)((unsigned char)*i) ); | 
| 58 | if( sL.getSize()/3 == 8 ) | 58 | if( sL.getSize()/3 == 8 ) | 
| 59 | { | 59 | { | 
diff --git a/src/tests/fstrformat.cpp b/src/tests/fstrformat.cpp deleted file mode 100644 index a911a8f..0000000 --- a/src/tests/fstrformat.cpp +++ /dev/null  | |||
| @@ -1,19 +0,0 @@ | |||
| 1 | /* | ||
| 2 | * Copyright (C) 2007-2011 Xagasoft, All rights reserved. | ||
| 3 | * | ||
| 4 | * This file is part of the libbu++ library and is released under the | ||
| 5 | * terms of the license contained in the file LICENSE. | ||
| 6 | */ | ||
| 7 | |||
| 8 | #include "bu/string.h" | ||
| 9 | #include <stdio.h> | ||
| 10 | |||
| 11 | int main() | ||
| 12 | { | ||
| 13 | Bu::String s; | ||
| 14 | |||
| 15 | s.format("%d, %f, \'%s\'", 144, 12.5, "bob" ); | ||
| 16 | |||
| 17 | printf("test: %s\n", s.getStr() ); | ||
| 18 | } | ||
| 19 | |||
diff --git a/src/tests/heap.cpp b/src/tests/heap.cpp index 14da55a..520a57f 100644 --- a/src/tests/heap.cpp +++ b/src/tests/heap.cpp  | |||
| @@ -41,8 +41,7 @@ typedef struct num | |||
| 41 | void printHeap( Bu::Heap<Bu::String> &h, int j ) | 41 | void printHeap( Bu::Heap<Bu::String> &h, int j ) | 
| 42 | { | 42 | { | 
| 43 | // return; | 43 | // return; | 
| 44 | Bu::String sFName; | 44 | Bu::String sFName = Bu::String("graph-step-%1.dot").arg( j, Bu::Fmt().width(2).fill('0') ); | 
| 45 | sFName.format("graph-step-%02d.dot", j ); | ||
| 46 | Bu::File fOut( sFName, Bu::File::WriteNew ); | 45 | Bu::File fOut( sFName, Bu::File::WriteNew ); | 
| 47 | Bu::Formatter f( fOut ); | 46 | Bu::Formatter f( fOut ); | 
| 48 | f << "Graph step: " << j << ", total size: " << h.getSize() << f.nl; | 47 | f << "Graph step: " << j << ", total size: " << h.getSize() << f.nl; | 
diff --git a/src/unit/string.unit b/src/unit/string.unit index d38aa54..8f65c70 100644 --- a/src/unit/string.unit +++ b/src/unit/string.unit  | |||
| @@ -407,6 +407,20 @@ suite String | |||
| 407 | unitTest( m1 == m2 ); | 407 | unitTest( m1 == m2 ); | 
| 408 | unitTest( m1 == "\x03\xF0\x9C\xA4\xF5\x8A\xC8\xCA\x0E" ); | 408 | unitTest( m1 == "\x03\xF0\x9C\xA4\xF5\x8A\xC8\xCA\x0E" ); | 
| 409 | } | 409 | } | 
| 410 | |||
| 411 | test toUpper1 | ||
| 412 | { | ||
| 413 | Bu::String s1("HeLlO ThErE, HoW ArE YoU DoInG?"); | ||
| 414 | unitTest( s1.toUpper() == "HELLO THERE, HOW ARE YOU DOING?" ); | ||
| 415 | unitTest( s1 == "HeLlO ThErE, HoW ArE YoU DoInG?" ); | ||
| 416 | } | ||
| 417 | |||
| 418 | test toLower1 | ||
| 419 | { | ||
| 420 | Bu::String s1("HeLlO ThErE, HoW ArE YoU DoInG?"); | ||
| 421 | unitTest( s1.toLower() == "hello there, how are you doing?" ); | ||
| 422 | unitTest( s1 == "HeLlO ThErE, HoW ArE YoU DoInG?" ); | ||
| 423 | } | ||
| 410 | } | 424 | } | 
| 411 | // 03F09CA4F58AC8CA0E80F0D9D409D0A60700A192270004BC3A99E91D0001034F544603362E35013103313130019CA4F58AC8CA0E0002830800002C4200008AC200EBF7D9D4090127BB010000E3 | 425 | // 03F09CA4F58AC8CA0E80F0D9D409D0A60700A192270004BC3A99E91D0001034F544603362E35013103313130019CA4F58AC8CA0E0002830800002C4200008AC200EBF7D9D4090127BB010000E3 | 
| 412 | // | 426 | // | 
diff --git a/support/findcaseshift.sh b/support/findcaseshift.sh new file mode 100755 index 0000000..75646ae --- /dev/null +++ b/support/findcaseshift.sh  | |||
| @@ -0,0 +1,3 @@ | |||
| 1 | #!/bin/bash | ||
| 2 | |||
| 3 | grep 'to\(Lower\|Upper\)' -o $(find -iname *.cpp) $(find -iname *.h) 2>&1 | grep -v '.svn' | sort | uniq | ||
