From 5d02f1db5f52db283ee305c82ab244e5a5b5c0e8 Mon Sep 17 00:00:00 2001 From: Florent Rougon Date: Sat, 10 Jun 2017 16:58:16 +0200 Subject: [PATCH] CharArrayStream_test.cxx: attempt to fix build errors on Windows --- simgear/io/iostreams/CharArrayStream_test.cxx | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/simgear/io/iostreams/CharArrayStream_test.cxx b/simgear/io/iostreams/CharArrayStream_test.cxx index 1f6870b1..d869613b 100644 --- a/simgear/io/iostreams/CharArrayStream_test.cxx +++ b/simgear/io/iostreams/CharArrayStream_test.cxx @@ -91,16 +91,17 @@ void test_CharArrayStreambuf_basicOperations() // Indirect test of seekpos(): position the write stream pointer a bit further pos = arraySBuf.pubseekpos(43, std::ios_base::out); - SG_CHECK_EQUAL(pos, 43); + SG_CHECK_EQUAL(pos, std::streampos(43)); // Write 7 more chars with sputn() n = arraySBuf.sputn(&text[43], 7); SG_CHECK_EQUAL(n, 7); SG_CHECK_EQUAL(string(&buf[43], 7), "\nGHIJK "); // Indirect test of seekoff(): seek backwards relatively to the current write // pointer position - pos = arraySBuf.pubseekoff(-std::strlen("\nABCDEF\nGHIJK "), + pos = arraySBuf.pubseekoff(-std::streamoff(std::strlen("\nABCDEF\nGHIJK ")), std::ios_base::cur, std::ios_base::out); - SG_CHECK_EQUAL(pos, 36); // 10 + 26, i.e., after the lowercase alphabet + // 10 + 26, i.e., after the lowercase alphabet + SG_CHECK_EQUAL(pos, std::streampos(36)); // Write "\nABCD" to buf in one sputn() call n = arraySBuf.sputn(&text[36], 5); // Now write "EF" in two sputc() calls @@ -189,9 +190,9 @@ void test_CharArrayStreambuf_basicOperations() // Check we can independently set the read and write pointers for arraySBuf pos = arraySBuf.pubseekpos(10, std::ios_base::in); - SG_CHECK_EQUAL(pos, 10); + SG_CHECK_EQUAL(pos, std::streampos(10)); pos = arraySBuf.pubseekpos(13, std::ios_base::out); - SG_CHECK_EQUAL(pos, 13); + SG_CHECK_EQUAL(pos, std::streampos(13)); // Write "DEF" where there is currently "def" in 'buf'. for (int i = 0; i < 3; i++) { @@ -206,7 +207,7 @@ void test_CharArrayStreambuf_basicOperations() // Set both stream pointers at once (read and write) pos = arraySBuf.pubseekpos(10, std::ios_base::in | std::ios_base::out); - SG_VERIFY(pos == 10); + SG_VERIFY(pos == std::streampos(10)); // Write "ABC" to buf in one sputn() call n = arraySBuf.sputn("ABC", 3); @@ -216,7 +217,7 @@ void test_CharArrayStreambuf_basicOperations() // Indirect test of seekoff(): seek backwards relatively to the current read // pointer position pos = arraySBuf.pubseekoff(-3, std::ios_base::cur, std::ios_base::in); - SG_CHECK_EQUAL(pos, 7); + SG_CHECK_EQUAL(pos, std::streampos(7)); n = arraySBuf.sgetn(buf3, 12); SG_CHECK_EQUAL(n, 12);