• R/O
  • SSH
  • HTTPS

eirfs: Commit


Commit MetaInfo

Revision40 (tree)
Time2018-02-03 05:43:18
Authorquiret

Log Message

- fixed some 64bit signedness issues

Change Summary

Incremental Difference

--- include/CFileSystemInterface.h (revision 39)
+++ include/CFileSystemInterface.h (revision 40)
@@ -1547,7 +1547,7 @@
15471547 {
15481548 fsOffsetNumber_t wholeFileSize = fileHandle->GetSizeNative();
15491549
1550- if ( wholeFileSize <= (fsOffsetNumber_t)std::numeric_limits <size_t>::max() )
1550+ if ( wholeFileSize > 0 && (std::make_unsigned <fsOffsetNumber_t>::type)wholeFileSize <= std::numeric_limits <size_t>::max() )
15511551 {
15521552 size_t realFileSize = (size_t)wholeFileSize;
15531553
--- include/CFileSystem.common.stl.h (revision 39)
+++ include/CFileSystem.common.stl.h (revision 40)
@@ -162,7 +162,9 @@
162162 if ( n < 0 )
163163 return -1;
164164
165- if ( n > std::numeric_limits <size_t>::max() )
165+ size_t realSize = (size_t)n;
166+
167+ if ( realSize > std::numeric_limits <size_t>::max() )
166168 return -1;
167169
168170 // We read from the real input offset.
@@ -170,7 +172,7 @@
170172
171173 read_guard <true> guard( this, underlyingStream );
172174
173- size_t readCount = underlyingStream->Read( outBuffer, 1, (size_t)n );
175+ size_t readCount = underlyingStream->Read( outBuffer, 1, realSize );
174176
175177 return (std::streamsize)readCount;
176178 }
@@ -210,7 +212,9 @@
210212 if ( n < 0 )
211213 return -1;
212214
213- if ( n > std::numeric_limits <size_t>::max() )
215+ size_t realSize = (size_t)n;
216+
217+ if ( realSize > std::numeric_limits <size_t>::max() )
214218 return -1;
215219
216220 // Now with the write offset.
@@ -220,7 +224,7 @@
220224
221225 underlyingStream->SeekNative( this->output_off_real, SEEK_SET );
222226
223- size_t writeCount = underlyingStream->Write( inputBuffer, 1, (size_t)n );
227+ size_t writeCount = underlyingStream->Write( inputBuffer, 1, realSize );
224228
225229 return (std::streamsize)writeCount;
226230 }
Show on old repository browser