summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon Howard2008-05-04 16:45:10 +0000
committerSimon Howard2008-05-04 16:45:10 +0000
commit24c3f6943b226b02a2bbadbe72b3731aa2e90803 (patch)
tree5ea45d698391ee33c17c56261e540856735e1085
parent7aa93fbe3f348dc05504ca2d10160b13ddf4cf6a (diff)
downloadchocolate-doom-24c3f6943b226b02a2bbadbe72b3731aa2e90803.tar.gz
chocolate-doom-24c3f6943b226b02a2bbadbe72b3731aa2e90803.tar.bz2
chocolate-doom-24c3f6943b226b02a2bbadbe72b3731aa2e90803.zip
Fix win32 mmap driver and add to build.
Subversion-branch: /trunk/chocolate-doom Subversion-revision: 1138
-rw-r--r--src/Makefile.am1
-rw-r--r--src/w_file.c7
-rw-r--r--src/w_file_win32.c9
3 files changed, 13 insertions, 4 deletions
diff --git a/src/Makefile.am b/src/Makefile.am
index 8757d351..e43cb7f0 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -108,6 +108,7 @@ w_wad.c w_wad.h \
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
diff --git a/src/w_file.c b/src/w_file.c
index eed68230..75c2eae4 100644
--- a/src/w_file.c
+++ b/src/w_file.c
@@ -33,12 +33,19 @@
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
static wad_file_class_t *wad_file_classes[] =
{
+#ifdef _WIN32
+ &win32_wad_file,
+#endif
#ifdef HAVE_MMAP
&posix_wad_file,
#endif
diff --git a/src/w_file_win32.c b/src/w_file_win32.c
index 1e7061ef..40f68973 100644
--- 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 @@ static void MapFile(win32_wad_file_t *wad, char *filename)
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 @@ static wad_file_t *W_Win32_OpenFile(char *path)
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 @@ static void W_Win32_CloseFile(wad_file_t *wad)
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 @@ size_t W_Win32_Read(wad_file_t *wad, unsigned int offset,
// 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)
{