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 --- autoconfig.cpp | 4 ++++ 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 ++-- 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[] ) FILE *psub = popen("git describe --always", "r"); buf[fread( buf, 1, 1024, psub )] = '\0'; for( int j = 0; buf[j]; j++ ) + { if( buf[j] == '\n' ) + { buf[j] = '\0'; + } + } fwrite( buf, strlen(buf), 1, fOut ); pclose( psub ); 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 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 ) 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, uint32_t uSpecial ) { int32_t iParent = -1; - int32_t iNode; +// int32_t iNode; try { - iNode = lookupInode( sPath, iParent ); + /*iNode =*/ lookupInode( sPath, iParent ); // sio << "File found." << sio.nl; } catch( Bu::MyriadFsException &e ) @@ -180,7 +180,7 @@ void Bu::MyriadFs::create( const Bu::String &sPath, uint16_t iPerms, Bu::String sName = filePart( sPath ); // sio << "End filename: " << sName << sio.nl; // sio << "Parent inode: " << iParent << sio.nl; - iNode = create( iParent, sName, iPerms, uSpecial ); + /*iNode =*/ create( iParent, sName, iPerms, uSpecial ); // sio << "New iNode: " << iNode << sio.nl; } // The file was found -- cgit v1.2.3