aboutsummaryrefslogtreecommitdiff
path: root/src/tests/cache.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/tests/cache.cpp')
-rw-r--r--src/tests/cache.cpp19
1 files changed, 6 insertions, 13 deletions
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 }