@@ -128,7 +128,7 @@ class BufferStream {
128128 this ->bufferPos = offset;
129129 break ;
130130 case std::ios::cur:
131- if (this ->useExceptions && (std::cmp_greater (this ->bufferPos + offset, this ->bufferLen ) || this ->bufferPos + offset < 0 )) {
131+ if (this ->useExceptions && (std::cmp_greater (this ->bufferPos + offset, this ->bufferLen ) || static_cast < int64_t >( this ->bufferPos ) + offset < 0 )) {
132132 throw std::overflow_error{BUFFERSTREAM_OVERFLOW_READ_ERROR_MESSAGE };
133133 }
134134 this ->bufferPos += offset;
@@ -284,7 +284,7 @@ class BufferStream {
284284 std::memcpy (obj, this ->buffer + this ->bufferPos , N);
285285 this ->bufferPos += N;
286286 } else {
287- for (int i = 0 ; i < N; i++) {
287+ for (std:: uint64_t i = 0 ; i < N; i++) {
288288 this ->read (obj[i]);
289289 }
290290 }
@@ -306,7 +306,7 @@ class BufferStream {
306306 std::memcpy (this ->buffer + this ->bufferPos , obj, N);
307307 this ->bufferPos += N;
308308 } else {
309- for (int i = 0 ; i < N; i++) {
309+ for (std:: uint64_t i = 0 ; i < N; i++) {
310310 this ->write (obj[i]);
311311 }
312312 }
@@ -324,8 +324,8 @@ class BufferStream {
324324 throw std::overflow_error{BUFFERSTREAM_OVERFLOW_READ_ERROR_MESSAGE };
325325 }
326326
327- for (int i = 0 ; i < M; i++) {
328- for (int j = 0 ; j < N; j++) {
327+ for (std:: uint64_t i = 0 ; i < M; i++) {
328+ for (std:: uint64_t j = 0 ; j < N; j++) {
329329 this ->read (obj[i][j]);
330330 }
331331 }
@@ -343,8 +343,8 @@ class BufferStream {
343343 throw std::overflow_error{BUFFERSTREAM_OVERFLOW_WRITE_ERROR_MESSAGE };
344344 }
345345
346- for (int i = 0 ; i < M; i++) {
347- for (int j = 0 ; j < N; j++) {
346+ for (std:: uint64_t i = 0 ; i < M; i++) {
347+ for (std:: uint64_t j = 0 ; j < N; j++) {
348348 this ->write (obj[i][j]);
349349 }
350350 }
@@ -366,7 +366,7 @@ class BufferStream {
366366 std::memcpy (obj.data (), this ->buffer + this ->bufferPos , N);
367367 this ->bufferPos += N;
368368 } else {
369- for (int i = 0 ; i < N; i++) {
369+ for (std:: uint64_t i = 0 ; i < N; i++) {
370370 this ->read (obj[i]);
371371 }
372372 }
@@ -388,7 +388,7 @@ class BufferStream {
388388 std::memcpy (this ->buffer + this ->bufferPos , obj.data (), N);
389389 this ->bufferPos += N;
390390 } else {
391- for (int i = 0 ; i < N; i++) {
391+ for (std:: uint64_t i = 0 ; i < N; i++) {
392392 this ->write (obj[i]);
393393 }
394394 }
@@ -422,7 +422,7 @@ class BufferStream {
422422 }) {
423423 obj.reserve (n);
424424 }
425- for (int i = 0 ; i < n; i++) {
425+ for (std:: uint64_t i = 0 ; i < n; i++) {
426426 obj.push_back (this ->read <typename T::value_type>());
427427 }
428428 }
@@ -449,7 +449,7 @@ class BufferStream {
449449 std::memcpy (this ->buffer + this ->bufferPos , obj.data (), obj.size ());
450450 this ->bufferPos += obj.size ();
451451 } else {
452- for (int i = 0 ; i < obj.size (); i++) {
452+ for (decltype (obj. size ()) i = 0 ; i < obj.size (); i++) {
453453 this ->write (obj[i]);
454454 }
455455 }
@@ -517,7 +517,7 @@ class BufferStream {
517517 std::memcpy (obj.data (), this ->buffer + this ->bufferPos , obj.size ());
518518 this ->bufferPos += obj.size ();
519519 } else {
520- for (int i = 0 ; i < obj.size (); i++) {
520+ for (decltype (obj. size ()) i = 0 ; i < obj.size (); i++) {
521521 obj[i] = this ->read <T>();
522522 }
523523 }
@@ -548,7 +548,7 @@ class BufferStream {
548548 std::memcpy (obj.data (), this ->buffer + this ->bufferPos , n);
549549 this ->bufferPos += n;
550550 } else {
551- for (int i = 0 ; i < n; i++) {
551+ for (std:: uint64_t i = 0 ; i < n; i++) {
552552 obj[i] = this ->read <T>();
553553 }
554554 }
@@ -570,7 +570,7 @@ class BufferStream {
570570 std::memcpy (this ->buffer + this ->bufferPos , obj.data (), obj.size ());
571571 this ->bufferPos += obj.size ();
572572 } else {
573- for (int i = 0 ; i < obj.size (); i++) {
573+ for (decltype (obj. size ()) i = 0 ; i < obj.size (); i++) {
574574 this ->write (obj[i]);
575575 }
576576 }
@@ -644,7 +644,7 @@ class BufferStream {
644644 }
645645
646646 obj.reserve (n);
647- for (int i = 0 ; i < n; i++) {
647+ for (std:: uint64_t i = 0 ; i < n; i++) {
648648 char temp = this ->read <char >();
649649 if (temp == ' \0 ' && stopOnNullTerminator) {
650650 // Read the required number of characters and exit
@@ -723,7 +723,7 @@ class BufferStream {
723723 }
724724 return this ->buffer [offset];
725725 case std::ios::cur:
726- if (this ->useExceptions && (std::cmp_greater (this ->bufferPos + offset, this ->bufferLen ) || this ->bufferPos + offset < 0 )) {
726+ if (this ->useExceptions && (std::cmp_greater (this ->bufferPos + offset, this ->bufferLen ) || static_cast < int64_t >( this ->bufferPos ) + offset < 0 )) {
727727 throw std::overflow_error{BUFFERSTREAM_OVERFLOW_READ_ERROR_MESSAGE };
728728 }
729729 return this ->buffer [this ->bufferPos + offset];
@@ -860,7 +860,7 @@ class BufferStream {
860860 dest.bytes [k] = source.bytes [sizeof (T) - k - 1 ];
861861 }
862862 *t = dest.t ;
863- };
863+ }
864864
865865protected:
866866 std::byte* buffer;
0 commit comments