diff options
-rw-r--r-- | autoconfig.cpp | 4 | ||||
-rw-r--r-- | src/stable/array.h | 8 | ||||
-rw-r--r-- | src/stable/list.h | 11 | ||||
-rw-r--r-- | src/stable/sharedcore.h | 24 | ||||
-rw-r--r-- | src/stable/string.cpp | 4 | ||||
-rw-r--r-- | src/stable/trace.cpp | 4 | ||||
-rw-r--r-- | src/unstable/myriadfs.cpp | 6 |
7 files changed, 42 insertions, 19 deletions
diff --git a/autoconfig.cpp b/autoconfig.cpp index 96f0eab..6dbb2c5 100644 --- a/autoconfig.cpp +++ b/autoconfig.cpp | |||
@@ -147,8 +147,12 @@ int main( int argc, char *argv[] ) | |||
147 | FILE *psub = popen("git describe --always", "r"); | 147 | FILE *psub = popen("git describe --always", "r"); |
148 | buf[fread( buf, 1, 1024, psub )] = '\0'; | 148 | buf[fread( buf, 1, 1024, psub )] = '\0'; |
149 | for( int j = 0; buf[j]; j++ ) | 149 | for( int j = 0; buf[j]; j++ ) |
150 | { | ||
150 | if( buf[j] == '\n' ) | 151 | if( buf[j] == '\n' ) |
152 | { | ||
151 | buf[j] = '\0'; | 153 | buf[j] = '\0'; |
154 | } | ||
155 | } | ||
152 | fwrite( buf, strlen(buf), 1, fOut ); | 156 | fwrite( buf, strlen(buf), 1, fOut ); |
153 | pclose( psub ); | 157 | pclose( psub ); |
154 | fprintf( fOut, "\"\n\n#endif\n"); | 158 | fprintf( fOut, "\"\n\n#endif\n"); |
diff --git a/src/stable/array.h b/src/stable/array.h index b089bda..ca66213 100644 --- a/src/stable/array.h +++ b/src/stable/array.h | |||
@@ -177,6 +177,14 @@ namespace Bu | |||
177 | return !(*this == src); | 177 | return !(*this == src); |
178 | } | 178 | } |
179 | 179 | ||
180 | MyType &operator=( const MyType &src ) | ||
181 | { | ||
182 | SharedCore<MyType, Core>::_softCopy( src ); | ||
183 | |||
184 | return *this; | ||
185 | } | ||
186 | |||
187 | |||
180 | /** | 188 | /** |
181 | * Clear the array. | 189 | * Clear the array. |
182 | */ | 190 | */ |
diff --git a/src/stable/list.h b/src/stable/list.h index 9381297..c1a5559 100644 --- a/src/stable/list.h +++ b/src/stable/list.h | |||
@@ -269,6 +269,12 @@ namespace Bu | |||
269 | return lNew; | 269 | return lNew; |
270 | } | 270 | } |
271 | 271 | ||
272 | MyType &operator=( const MyType &src ) | ||
273 | { | ||
274 | SharedCore<MyType, Core>::_softCopy( src ); | ||
275 | return *this; | ||
276 | } | ||
277 | |||
272 | bool operator==( const MyType &rhs ) const | 278 | bool operator==( const MyType &rhs ) const |
273 | { | 279 | { |
274 | if( getSize() != rhs.getSize() ) | 280 | if( getSize() != rhs.getSize() ) |
@@ -678,6 +684,11 @@ namespace Bu | |||
678 | pLink( i.pLink ) | 684 | pLink( i.pLink ) |
679 | { | 685 | { |
680 | } | 686 | } |
687 | |||
688 | const_iterator( const const_iterator &i ) : | ||
689 | pLink( i.pLink ) | ||
690 | { | ||
691 | } | ||
681 | 692 | ||
682 | bool operator==( const const_iterator &oth ) const | 693 | bool operator==( const const_iterator &oth ) const |
683 | { | 694 | { |
diff --git a/src/stable/sharedcore.h b/src/stable/sharedcore.h index 90765fc..4e1fcc8 100644 --- a/src/stable/sharedcore.h +++ b/src/stable/sharedcore.h | |||
@@ -89,9 +89,6 @@ namespace Bu | |||
89 | 89 | ||
90 | SharedCore &operator=( const SharedCore &rhs ) | 90 | SharedCore &operator=( const SharedCore &rhs ) |
91 | { | 91 | { |
92 | if( core == rhs.core ) | ||
93 | return *this; | ||
94 | |||
95 | _softCopy( rhs ); | 92 | _softCopy( rhs ); |
96 | return *this; | 93 | return *this; |
97 | } | 94 | } |
@@ -161,6 +158,18 @@ namespace Bu | |||
161 | delete pSrc; | 158 | delete pSrc; |
162 | } | 159 | } |
163 | 160 | ||
161 | void _softCopy( const _SharedType &rSrc ) | ||
162 | { | ||
163 | if( core == rSrc.core ) | ||
164 | return; | ||
165 | |||
166 | if( core ) | ||
167 | _deref(); | ||
168 | core = rSrc.core; | ||
169 | iRefCount = rSrc.iRefCount; | ||
170 | _incRefCount(); | ||
171 | } | ||
172 | |||
164 | private: | 173 | private: |
165 | void _deref() | 174 | void _deref() |
166 | { | 175 | { |
@@ -179,15 +188,6 @@ namespace Bu | |||
179 | ++(*iRefCount); | 188 | ++(*iRefCount); |
180 | } | 189 | } |
181 | 190 | ||
182 | void _softCopy( const _SharedType &rSrc ) | ||
183 | { | ||
184 | if( core ) | ||
185 | _deref(); | ||
186 | core = rSrc.core; | ||
187 | iRefCount = rSrc.iRefCount; | ||
188 | _incRefCount(); | ||
189 | } | ||
190 | |||
191 | int *iRefCount; | 191 | int *iRefCount; |
192 | }; | 192 | }; |
193 | }; | 193 | }; |
diff --git a/src/stable/string.cpp b/src/stable/string.cpp index 59d8147..ed4e58b 100644 --- a/src/stable/string.cpp +++ b/src/stable/string.cpp | |||
@@ -1486,13 +1486,13 @@ int32_t &Bu::operator<<( int32_t &dst, const Bu::String &sIn ) | |||
1486 | 1486 | ||
1487 | uint64_t &Bu::operator<<( uint64_t &dst, const Bu::String &sIn ) | 1487 | uint64_t &Bu::operator<<( uint64_t &dst, const Bu::String &sIn ) |
1488 | { | 1488 | { |
1489 | sscanf( sIn.getStr(), "%llu", &dst ); | 1489 | sscanf( sIn.getStr(), "%lu", &dst ); |
1490 | return dst; | 1490 | return dst; |
1491 | } | 1491 | } |
1492 | 1492 | ||
1493 | int64_t &Bu::operator<<( int64_t &dst, const Bu::String &sIn ) | 1493 | int64_t &Bu::operator<<( int64_t &dst, const Bu::String &sIn ) |
1494 | { | 1494 | { |
1495 | sscanf( sIn.getStr(), "%lld", &dst ); | 1495 | sscanf( sIn.getStr(), "%ld", &dst ); |
1496 | return dst; | 1496 | return dst; |
1497 | } | 1497 | } |
1498 | 1498 | ||
diff --git a/src/stable/trace.cpp b/src/stable/trace.cpp index 7738686..09cb757 100644 --- a/src/stable/trace.cpp +++ b/src/stable/trace.cpp | |||
@@ -24,7 +24,7 @@ template<> void Bu::__tracer_format<double>( const double &v ) | |||
24 | 24 | ||
25 | template<> void Bu::__tracer_format<void *>( void * const &v ) | 25 | template<> void Bu::__tracer_format<void *>( void * const &v ) |
26 | { | 26 | { |
27 | printf("0x%08X", (ptrdiff_t)v ); | 27 | printf("0x%08lX", (ptrdiff_t)v ); |
28 | } | 28 | } |
29 | 29 | ||
30 | template<> void Bu::__tracer_format<char *>( char * const &v ) | 30 | template<> void Bu::__tracer_format<char *>( char * const &v ) |
@@ -46,7 +46,7 @@ template<> void Bu::__tracer_format<char **>( char ** const &v ) | |||
46 | 46 | ||
47 | template<> void Bu::__tracer_format<void const *>( void const * const &v ) | 47 | template<> void Bu::__tracer_format<void const *>( void const * const &v ) |
48 | { | 48 | { |
49 | printf("0x%08X", (ptrdiff_t)v ); | 49 | printf("0x%08lX", (ptrdiff_t)v ); |
50 | } | 50 | } |
51 | 51 | ||
52 | template<> void Bu::__tracer_format<char const *>( char const * const &v ) | 52 | template<> void Bu::__tracer_format<char const *>( char const * const &v ) |
diff --git a/src/unstable/myriadfs.cpp b/src/unstable/myriadfs.cpp index 6b51195..a0e6864 100644 --- a/src/unstable/myriadfs.cpp +++ b/src/unstable/myriadfs.cpp | |||
@@ -160,10 +160,10 @@ void Bu::MyriadFs::create( const Bu::String &sPath, uint16_t iPerms, | |||
160 | uint32_t uSpecial ) | 160 | uint32_t uSpecial ) |
161 | { | 161 | { |
162 | int32_t iParent = -1; | 162 | int32_t iParent = -1; |
163 | int32_t iNode; | 163 | // int32_t iNode; |
164 | try | 164 | try |
165 | { | 165 | { |
166 | iNode = lookupInode( sPath, iParent ); | 166 | /*iNode =*/ lookupInode( sPath, iParent ); |
167 | // sio << "File found." << sio.nl; | 167 | // sio << "File found." << sio.nl; |
168 | } | 168 | } |
169 | catch( Bu::MyriadFsException &e ) | 169 | catch( Bu::MyriadFsException &e ) |
@@ -180,7 +180,7 @@ void Bu::MyriadFs::create( const Bu::String &sPath, uint16_t iPerms, | |||
180 | Bu::String sName = filePart( sPath ); | 180 | Bu::String sName = filePart( sPath ); |
181 | // sio << "End filename: " << sName << sio.nl; | 181 | // sio << "End filename: " << sName << sio.nl; |
182 | // sio << "Parent inode: " << iParent << sio.nl; | 182 | // sio << "Parent inode: " << iParent << sio.nl; |
183 | iNode = create( iParent, sName, iPerms, uSpecial ); | 183 | /*iNode =*/ create( iParent, sName, iPerms, uSpecial ); |
184 | // sio << "New iNode: " << iNode << sio.nl; | 184 | // sio << "New iNode: " << iNode << sio.nl; |
185 | } | 185 | } |
186 | // The file was found | 186 | // The file was found |