aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/cachestorefiles.h14
-rw-r--r--src/unit/string.unit33
2 files changed, 40 insertions, 7 deletions
diff --git a/src/cachestorefiles.h b/src/cachestorefiles.h
index 426cf83..10b2c1b 100644
--- a/src/cachestorefiles.h
+++ b/src/cachestorefiles.h
@@ -68,19 +68,19 @@ namespace Bu
68 68
69 virtual obtype *load( const keytype &key ) 69 virtual obtype *load( const keytype &key )
70 { 70 {
71 try 71// try
72 { 72// {
73 Bu::MemBuf mb; 73 Bu::MemBuf mb;
74 Bu::Formatter f( mb ); 74 Bu::Formatter f( mb );
75 f << sPrefix << "/" << key; 75 f << sPrefix << "/" << key;
76 Bu::File fIn( mb.getString(), Bu::File::Read ); 76 Bu::File fIn( mb.getString(), Bu::File::Read );
77 obtype *pOb = __cacheStoreFilesLoad<keytype, obtype>( fIn, key ); 77 obtype *pOb = __cacheStoreFilesLoad<keytype, obtype>( fIn, key );
78 return pOb; 78 return pOb;
79 } 79// }
80 catch( std::exception &e ) 80// catch( std::exception &e )
81 { 81// {
82 throw Bu::HashException( e.what() ); 82// throw Bu::HashException( e.what() );
83 } 83// }
84 } 84 }
85 85
86 virtual void unload( obtype *pObj, const keytype & ) 86 virtual void unload( obtype *pObj, const keytype & )
diff --git a/src/unit/string.unit b/src/unit/string.unit
index 872dbed..d38aa54 100644
--- a/src/unit/string.unit
+++ b/src/unit/string.unit
@@ -376,4 +376,37 @@ suite String
376 b = a; 376 b = a;
377 a.clear(); 377 a.clear();
378 } 378 }
379
380 test append
381 {
382 // This is the byte sequence that caused += to die
383 // 03 F0 9C A4 F5 8A C8 CA 0E
384 uint8_t b;
385 Bu::String m1;
386 b = 0x03; m1 += (char)b;
387 b = 0xF0; m1 += (char)b;
388 b = 0x9C; m1 += (char)b;
389 b = 0xA4; m1 += (char)b;
390 b = 0xF5; m1 += (char)b;
391 b = 0x8A; m1 += (char)b;
392 b = 0xC8; m1 += (char)b;
393 b = 0xCA; m1 += (char)b;
394 b = 0x0E; m1 += (char)b;
395
396 Bu::String m2;
397 b = 0x03; m2.append( (const char *)&b, 1 );
398 b = 0xF0; m2.append( (const char *)&b, 1 );
399 b = 0x9C; m2.append( (const char *)&b, 1 );
400 b = 0xA4; m2.append( (const char *)&b, 1 );
401 b = 0xF5; m2.append( (const char *)&b, 1 );
402 b = 0x8A; m2.append( (const char *)&b, 1 );
403 b = 0xC8; m2.append( (const char *)&b, 1 );
404 b = 0xCA; m2.append( (const char *)&b, 1 );
405 b = 0x0E; m2.append( (const char *)&b, 1 );
406
407 unitTest( m1 == m2 );
408 unitTest( m1 == "\x03\xF0\x9C\xA4\xF5\x8A\xC8\xCA\x0E" );
409 }
379} 410}
411// 03F09CA4F58AC8CA0E80F0D9D409D0A60700A192270004BC3A99E91D0001034F544603362E35013103313130019CA4F58AC8CA0E0002830800002C4200008AC200EBF7D9D4090127BB010000E3
412//