• R/O
  • SSH
  • HTTPS

eirrepo: Commit


Commit MetaInfo

Revision105 (tree)
Time2018-08-11 06:02:51
Authorquiret

Log Message

- fixed a flaw in a stream pointer function where I limited it to FileSystem stream pointers

Change Summary

Incremental Difference

--- common/sdk/MemoryUtils.stream.h (revision 104)
+++ common/sdk/MemoryUtils.stream.h (revision 105)
@@ -172,19 +172,22 @@
172172
173173 return readable;
174174 }
175-};
176-
177-// Comparison helper for stream ptr with size integer.
178-AINLINE bool stream_ptr_less( const fsOffsetNumber_t& ptr, const size_t& val )
179-{
180- if ( ptr < 0 )
181- {
182- return true;
183- }
184-
185- std::make_unsigned <fsOffsetNumber_t>::type ptr_unsigned = (std::make_unsigned <fsOffsetNumber_t>::type)ptr;
186-
187- return ( ptr_unsigned < val );
175+};
176+
177+// Comparison helper for stream ptr with size integer.
178+template <typename seekType>
179+AINLINE bool stream_ptr_less( const seekType& ptr, const size_t& val )
180+{
181+ static_assert( std::is_unsigned <seekType>::value == false, "seek number must be signed" );
182+
183+ if ( ptr < 0 )
184+ {
185+ return true;
186+ }
187+
188+ std::make_unsigned <seekType>::type ptr_unsigned = (std::make_unsigned <seekType>::type)ptr;
189+
190+ return ( ptr_unsigned < val );
188191 }
189192
190193 // We need a generic memory-aware bounded buffer device.
@@ -413,4 +416,4 @@
413416 using basicMemoryBufferStream = memoryBufferStream <numberType, basicMemStreamAllocMan <numberType>>;
414417 };
415418
416-#endif //_MEMORY_UTILITIES_STREAM_
419+#endif //_MEMORY_UTILITIES_STREAM_
Show on old repository browser