ref: 24c3f6943b226b02a2bbadbe72b3731aa2e90803
parent: 7aa93fbe3f348dc05504ca2d10160b13ddf4cf6a
author: Simon Howard <[email protected]>
date: Sun May 4 12:45:10 EDT 2008
Fix win32 mmap driver and add to build. Subversion-branch: /trunk/chocolate-doom Subversion-revision: 1138
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -108,6 +108,7 @@
w_file.c w_file.h \
w_file_stdc.c \
w_file_posix.c \
+w_file_win32.c \
z_zone.c z_zone.h
# source files needed for FEATURE_DEHACKED
--- a/src/w_file.c
+++ b/src/w_file.c
@@ -33,6 +33,10 @@
extern wad_file_class_t stdc_wad_file;
+#ifdef _WIN32
+extern wad_file_class_t win32_wad_file;
+#endif
+
#ifdef HAVE_MMAP
extern wad_file_class_t posix_wad_file;
#endif
@@ -39,6 +43,9 @@
static wad_file_class_t *wad_file_classes[] =
{
+#ifdef _WIN32
+ &win32_wad_file,
+#endif
#ifdef HAVE_MMAP
&posix_wad_file,
#endif
--- a/src/w_file_win32.c
+++ b/src/w_file_win32.c
@@ -31,6 +31,7 @@
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
+#include "i_system.h"
#include "w_file.h"
#include "z_zone.h"
@@ -55,7 +56,7 @@
if (wad->handle_map == NULL)
{
fprintf(stderr, "W_Win32_OpenFile: Unable to CreateFileMapping() "
- "for %s\n" filename);
+ "for %s\n", filename);
return;
}
@@ -88,7 +89,7 @@
HANDLE handle;
OFSTRUCT fileinfo;
- handle = OpenFile(path, &fileinfo, OF_READ);
+ handle = (HANDLE) OpenFile(path, &fileinfo, OF_READ);
if (handle == (HANDLE) HFILE_ERROR)
{
@@ -119,7 +120,7 @@
if (win32_wad->wad.mapped != NULL)
{
- UnmapViewOfFile(win32->wad.mapped);
+ UnmapViewOfFile(win32_wad->wad.mapped);
}
if (win32_wad->handle_map != NULL)
@@ -151,7 +152,7 @@
// Jump to the specified position in the file.
- result = SetFilePointer(win32_wad->handle, offset, NULL, FILE_START);
+ result = SetFilePointer(win32_wad->handle, offset, NULL, FILE_BEGIN);
if (result == INVALID_SET_FILE_POINTER)
{