aboutsummaryrefslogtreecommitdiff
path: root/src/stable
diff options
context:
space:
mode:
authorMike Buland <eichlan@xagasoft.com>2021-08-18 22:11:41 -0700
committerMike Buland <eichlan@xagasoft.com>2021-08-18 22:11:41 -0700
commit345926296f748db5ff283ce69c0ed4d563fcc8ff (patch)
tree3aa50962107cb903bbf30bb2540c19d25bda5adf /src/stable
parent52833d24ba86c3e0fe90a12d65f6dc529e9280b7 (diff)
downloadlibbu++-345926296f748db5ff283ce69c0ed4d563fcc8ff.tar.gz
libbu++-345926296f748db5ff283ce69c0ed4d563fcc8ff.tar.bz2
libbu++-345926296f748db5ff283ce69c0ed4d563fcc8ff.tar.xz
libbu++-345926296f748db5ff283ce69c0ed4d563fcc8ff.zip
Updating issues discovered using g++ 10
Diffstat (limited to 'src/stable')
-rw-r--r--src/stable/array.h8
-rw-r--r--src/stable/list.h11
-rw-r--r--src/stable/sharedcore.h24
-rw-r--r--src/stable/string.cpp4
-rw-r--r--src/stable/trace.cpp4
5 files changed, 35 insertions, 16 deletions
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
1487uint64_t &Bu::operator<<( uint64_t &dst, const Bu::String &sIn ) 1487uint64_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
1493int64_t &Bu::operator<<( int64_t &dst, const Bu::String &sIn ) 1493int64_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
25template<> void Bu::__tracer_format<void *>( void * const &v ) 25template<> 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
30template<> void Bu::__tracer_format<char *>( char * const &v ) 30template<> void Bu::__tracer_format<char *>( char * const &v )
@@ -46,7 +46,7 @@ template<> void Bu::__tracer_format<char **>( char ** const &v )
46 46
47template<> void Bu::__tracer_format<void const *>( void const * const &v ) 47template<> 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
52template<> void Bu::__tracer_format<char const *>( char const * const &v ) 52template<> void Bu::__tracer_format<char const *>( char const * const &v )