aboutsummaryrefslogtreecommitdiff
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
parent52833d24ba86c3e0fe90a12d65f6dc529e9280b7 (diff)
downloadlibbu++-345926296f748db5ff283ce69c0ed4d563fcc8ff.tar.gz
libbu++-345926296f748db5ff283ce69c0ed4d563fcc8ff.tar.bz2
libbu++-345926296f748db5ff283ce69c0ed4d563fcc8ff.tar.xz
libbu++-345926296f748db5ff283ce69c0ed4d563fcc8ff.zip
Updating issues discovered using g++ 10
-rw-r--r--autoconfig.cpp4
-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
-rw-r--r--src/unstable/myriadfs.cpp6
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
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 )
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