From 345926296f748db5ff283ce69c0ed4d563fcc8ff Mon Sep 17 00:00:00 2001 From: Mike Buland Date: Wed, 18 Aug 2021 22:11:41 -0700 Subject: Updating issues discovered using g++ 10 --- src/stable/array.h | 8 ++++++++ src/stable/list.h | 11 +++++++++++ src/stable/sharedcore.h | 24 ++++++++++++------------ src/stable/string.cpp | 4 ++-- src/stable/trace.cpp | 4 ++-- 5 files changed, 35 insertions(+), 16 deletions(-) (limited to 'src/stable') 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 return !(*this == src); } + MyType &operator=( const MyType &src ) + { + SharedCore::_softCopy( src ); + + return *this; + } + + /** * Clear the array. */ 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 return lNew; } + MyType &operator=( const MyType &src ) + { + SharedCore::_softCopy( src ); + return *this; + } + bool operator==( const MyType &rhs ) const { if( getSize() != rhs.getSize() ) @@ -678,6 +684,11 @@ namespace Bu pLink( i.pLink ) { } + + const_iterator( const const_iterator &i ) : + pLink( i.pLink ) + { + } bool operator==( const const_iterator &oth ) const { 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 SharedCore &operator=( const SharedCore &rhs ) { - if( core == rhs.core ) - return *this; - _softCopy( rhs ); return *this; } @@ -161,6 +158,18 @@ namespace Bu delete pSrc; } + void _softCopy( const _SharedType &rSrc ) + { + if( core == rSrc.core ) + return; + + if( core ) + _deref(); + core = rSrc.core; + iRefCount = rSrc.iRefCount; + _incRefCount(); + } + private: void _deref() { @@ -179,15 +188,6 @@ namespace Bu ++(*iRefCount); } - void _softCopy( const _SharedType &rSrc ) - { - if( core ) - _deref(); - core = rSrc.core; - iRefCount = rSrc.iRefCount; - _incRefCount(); - } - int *iRefCount; }; }; 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 ) uint64_t &Bu::operator<<( uint64_t &dst, const Bu::String &sIn ) { - sscanf( sIn.getStr(), "%llu", &dst ); + sscanf( sIn.getStr(), "%lu", &dst ); return dst; } int64_t &Bu::operator<<( int64_t &dst, const Bu::String &sIn ) { - sscanf( sIn.getStr(), "%lld", &dst ); + sscanf( sIn.getStr(), "%ld", &dst ); return dst; } 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( const double &v ) template<> void Bu::__tracer_format( void * const &v ) { - printf("0x%08X", (ptrdiff_t)v ); + printf("0x%08lX", (ptrdiff_t)v ); } template<> void Bu::__tracer_format( char * const &v ) @@ -46,7 +46,7 @@ template<> void Bu::__tracer_format( char ** const &v ) template<> void Bu::__tracer_format( void const * const &v ) { - printf("0x%08X", (ptrdiff_t)v ); + printf("0x%08lX", (ptrdiff_t)v ); } template<> void Bu::__tracer_format( char const * const &v ) -- cgit v1.2.3