summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/msvc.h
diff options
context:
space:
mode:
authorpauldubois <pauldubois@c06c8d41-db1a-0410-9941-cceddc491573>2008-03-10 06:31:01 +0000
committerpauldubois <pauldubois@c06c8d41-db1a-0410-9941-cceddc491573>2008-03-10 06:31:01 +0000
commit8a737d409cea505589f5b67fab49f138265a8174 (patch)
treedf38e20bb1eed6abd6c3603094e109aec11fa96e /crawl-ref/source/msvc.h
parent70b1954c4daae8ee3f364481d0bc245a81720513 (diff)
downloadcrawl-ref-8a737d409cea505589f5b67fab49f138265a8174.tar.gz
crawl-ref-8a737d409cea505589f5b67fab49f138265a8174.zip
Another batch of msvc compile fixes.
Added wrapper implementation for opendir/readdir Other functions left stubbed out. It's a shame that crawl's "direct.h" conflicts with <direct.h>. Fixed up use of AppHdr.h in a couple places (it must be included first); changed project to use precompiled headers. crawl now compiles cleanly but doesn't link. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@3573 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source/msvc.h')
-rw-r--r--crawl-ref/source/msvc.h50
1 files changed, 48 insertions, 2 deletions
diff --git a/crawl-ref/source/msvc.h b/crawl-ref/source/msvc.h
index d1dab39485..ddedb40be8 100644
--- a/crawl-ref/source/msvc.h
+++ b/crawl-ref/source/msvc.h
@@ -1,11 +1,25 @@
-#define snprintf _snprintf
+/*
+ * File: msvc.h
+ * Summary: Header file for MSVC compiles
+ * Written by: Paul Du Bois
+ *
+ * $Author$ on $Date$
+ */
+
+#if defined(_MSC_VER)
+
+
+#define fileno _fileno
#define itoa _itoa
+#define snprintf _snprintf
#define strcasecmp _stricmp
+#define stricmp _stricmp
+#define strlwr _strlwr
#define strncasecmp _strnicmp
#define unlink _unlink
// No va_copy in MSVC
-#if defined(_MSC_VER) || !defined(va_copy)
+#if !defined(va_copy)
#define va_copy(dst, src) \
((void) memcpy(&(dst), &(src), sizeof(va_list)))
#endif
@@ -14,3 +28,35 @@
#pragma warning( disable : 4351 )
// bool -> int
#pragma warning( disable : 4800 )
+
+// struct vs class XXX: fix these some day!
+#pragma warning( disable : 4099 )
+
+// truncating conversions XXX: fix these too!
+#pragma warning( disable : 4244 )
+
+
+// ----------------------------------------------------------------------
+// dirent.h replacement
+// ----------------------------------------------------------------------
+
+#define DT_DIR 4
+#define DT_REG 8
+
+struct DIR;
+struct dirent
+{
+ // ino_t d_ino;
+ unsigned short d_reclen;
+ unsigned char d_type;
+ unsigned short d_namlen;
+ char d_name[255];
+};
+
+DIR* opendir(const char* path);
+dirent* readdir(DIR*);
+int closedir(DIR*);
+int ftruncate(int fp, int size);
+
+
+#endif /* defined(_MSC_VER) */