55
66#include < cstdint>
77#include < cstdlib>
8- #include < limits>
98#include < utility>
109
1110#if defined(_MSC_VER) || (defined(__GNUC__) && defined(_WIN32))
1211#include " win_mkstemp.hpp"
1312#endif
1413
14+ #ifndef _MSC_VER
15+ # include < unistd.h>
16+ #endif
17+
1518TEST_CASE (" Anonymous mapping: simple memory mapping should work" ) {
1619 osmium::MemoryMapping mapping{1000 , osmium::MemoryMapping::mapping_mode::write_private};
1720 REQUIRE (mapping.get_addr () != nullptr );
@@ -142,8 +145,8 @@ TEST_CASE("File-based mapping: writing to a mapped file should work") {
142145 mapping.unmap ();
143146 }
144147
145- REQUIRE (0 == close (fd));
146- REQUIRE (0 == unlink (filename));
148+ REQUIRE (0 == :: close (fd));
149+ REQUIRE (0 == :: unlink (filename));
147150}
148151
149152TEST_CASE (" File-based mapping: Reading from a zero-sized mapped file should work" ) {
@@ -157,8 +160,8 @@ TEST_CASE("File-based mapping: Reading from a zero-sized mapped file should work
157160 mapping.unmap ();
158161 }
159162
160- REQUIRE (0 == close (fd));
161- REQUIRE (0 == unlink (filename));
163+ REQUIRE (0 == :: close (fd));
164+ REQUIRE (0 == :: unlink (filename));
162165}
163166
164167TEST_CASE (" File-based mapping: writing to a privately mapped file should work" ) {
@@ -193,8 +196,8 @@ TEST_CASE("File-based mapping: writing to a privately mapped file should work")
193196 mapping.unmap ();
194197 }
195198
196- REQUIRE (0 == close (fd));
197- REQUIRE (0 == unlink (filename));
199+ REQUIRE (0 == :: close (fd));
200+ REQUIRE (0 == :: unlink (filename));
198201}
199202
200203TEST_CASE (" File-based mapping: remapping to larger size should work" ) {
@@ -218,8 +221,8 @@ TEST_CASE("File-based mapping: remapping to larger size should work") {
218221
219222 mapping.unmap ();
220223
221- REQUIRE (0 == close (fd));
222- REQUIRE (0 == unlink (filename));
224+ REQUIRE (0 == :: close (fd));
225+ REQUIRE (0 == :: unlink (filename));
223226}
224227
225228TEST_CASE (" File-based mapping: remapping to smaller size should work" ) {
@@ -243,8 +246,8 @@ TEST_CASE("File-based mapping: remapping to smaller size should work") {
243246 REQUIRE (*addr2 == 42 );
244247 }
245248
246- REQUIRE (0 == close (fd));
247- REQUIRE (0 == unlink (filename));
249+ REQUIRE (0 == :: close (fd));
250+ REQUIRE (0 == :: unlink (filename));
248251}
249252
250253TEST_CASE (" Typed anonymous mapping: simple memory mapping should work" ) {
@@ -360,8 +363,8 @@ TEST_CASE("Typed file-based mapping: writing to a mapped file should work") {
360363 mapping.unmap ();
361364 }
362365
363- REQUIRE (0 == close (fd));
364- REQUIRE (0 == unlink (filename));
366+ REQUIRE (0 == :: close (fd));
367+ REQUIRE (0 == :: unlink (filename));
365368}
366369
367370TEST_CASE (" Anonymous memory mapping class: simple memory mapping should work" ) {
0 commit comments