From 90a27e362f631e7b733008d8128db4f9121fafa8 Mon Sep 17 00:00:00 2001 From: Niels-Ole Lambertz Date: Sun, 23 Jul 2023 14:19:48 +0200 Subject: [PATCH] Fixing compilation for windows --- main.go | 2 +- renderer/experimental-renderer-windows.go | 4 ++++ renderer/experimental-renderer.go | 4 ++++ 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/main.go b/main.go index b8fa4cd..4bc9397 100644 --- a/main.go +++ b/main.go @@ -235,7 +235,7 @@ func main() { if err != nil { logFatalf("There was an error memory-mapping temp file: %v", err) } - defer syscall.Munmap(*mmapData) + defer renderer.Munmap(mmapData) defer mmapFile.Close() requestHandler = func(w http.ResponseWriter, r *http.Request) { if *verbose { diff --git a/renderer/experimental-renderer-windows.go b/renderer/experimental-renderer-windows.go index 5e0fd81..3b578db 100644 --- a/renderer/experimental-renderer-windows.go +++ b/renderer/experimental-renderer-windows.go @@ -16,3 +16,7 @@ func Mmap(path string) (*[]byte, *os.File, error) { func HandleRenderRequest(w http.ResponseWriter, r *http.Request, duration time.Duration, data *Data, maxTreeDepth uint32, mmapData *[]byte) { return _, errors.New("not implemented on Windows") } + +func Munmap(data *[]byte) error { + return errors.New("not implemented on Windows") +} diff --git a/renderer/experimental-renderer.go b/renderer/experimental-renderer.go index 17a67ea..01c8283 100644 --- a/renderer/experimental-renderer.go +++ b/renderer/experimental-renderer.go @@ -134,6 +134,10 @@ func Mmap(path string) (*[]byte, *os.File, error) { return &mmapData, file, nil } +func Munmap(data *[]byte) error { + return syscall.Munmap(*data) +} + func HandleRenderRequest(w http.ResponseWriter, r *http.Request, duration time.Duration, data *Data, maxTreeDepth uint32, mmapData *[]byte) { z, x, y, ext, err := utils.ParsePath(r.URL.Path) if ext != "png" {