From 88beb40090cb65bd6a894464cb91d3219500072c Mon Sep 17 00:00:00 2001 From: Erik Hofman Date: Mon, 15 Mar 2021 14:45:52 +0100 Subject: [PATCH] Make simple_mmap and simple_unmmap static private members of SGMMapFile. This should also fix the Windows build error on Jenkins. --- simgear/io/sg_mmap.cxx | 16 ++-------------- simgear/io/sg_mmap.hxx | 11 +++++++++++ 2 files changed, 13 insertions(+), 14 deletions(-) diff --git a/simgear/io/sg_mmap.cxx b/simgear/io/sg_mmap.cxx index 3868c22e..7e346b22 100644 --- a/simgear/io/sg_mmap.cxx +++ b/simgear/io/sg_mmap.cxx @@ -46,18 +46,6 @@ #include "sg_mmap.hxx" - -#ifdef WIN32 -/* - * map 'filename' and return a pointer to it. - */ -static void *simple_mmap(int, size_t, SIMPLE_UNMMAP *); -static void simple_unmmap(void*, size_t, SIMPLE_UNMMAP *); -#else -# define simple_mmap(a, b, c) mmap(0, (b), PROT_READ, MAP_PRIVATE, (a), 0L) -# define simple_unmmap(a, b, c) munmap((a), (b)) -#endif - SGMMapFile::SGMMapFile( ) { set_type( sgFileType ); @@ -304,7 +292,7 @@ bool SGMMapFile::close() { */ void * -simple_mmap(int fd, size_t length, SIMPLE_UNMMAP *un) +SGMMapFile::simple_mmap(int fd, size_t length, SIMPLE_UNMMAP *un) { HANDLE f; HANDLE m; @@ -333,7 +321,7 @@ simple_mmap(int fd, size_t length, SIMPLE_UNMMAP *un) } void -simple_unmmap(void *addr, size_t len, SIMPLE_UNMMAP *un) +SGMMapFile::simple_unmmap(void *addr, size_t len, SIMPLE_UNMMAP *un) { UnmapViewOfFile(un->p); CloseHandle(un->m); diff --git a/simgear/io/sg_mmap.hxx b/simgear/io/sg_mmap.hxx index 810e8f53..aa9e4acc 100644 --- a/simgear/io/sg_mmap.hxx +++ b/simgear/io/sg_mmap.hxx @@ -63,6 +63,17 @@ class SGMMapFile : public SGIOChannel { int un; // referenced but not used #endif +#ifdef WIN32 +/* + * map 'filename' and return a pointer to it. + */ + static void *simple_mmap(int, size_t, SIMPLE_UNMMAP *); + static void simple_unmmap(void*, size_t, IMPLE_UNMMAP *); +#else +# define simple_mmap(a, b, c) mmap(0, (b), PROT_READ, MAP_PRIVATE, (a), 0L) +# define simple_unmmap(a, b, c) munmap((a), (b)) +#endif + public: SGMMapFile();