Skip to content

Commit

Permalink
Fixing compilation for windows
Browse files Browse the repository at this point in the history
  • Loading branch information
nielsole committed Jul 23, 2023
1 parent 4581a49 commit 90a27e3
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 1 deletion.
2 changes: 1 addition & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
4 changes: 4 additions & 0 deletions renderer/experimental-renderer-windows.go
Original file line number Diff line number Diff line change
Expand Up @@ -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")
}
4 changes: 4 additions & 0 deletions renderer/experimental-renderer.go
Original file line number Diff line number Diff line change
Expand Up @@ -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" {
Expand Down

0 comments on commit 90a27e3

Please sign in to comment.