summaryrefslogtreecommitdiff
path: root/src/doomtype.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/doomtype.h')
-rw-r--r--src/doomtype.h35
1 files changed, 35 insertions, 0 deletions
diff --git a/src/doomtype.h b/src/doomtype.h
index 0a5b5e38..b458c1cd 100644
--- a/src/doomtype.h
+++ b/src/doomtype.h
@@ -29,6 +29,41 @@
#ifndef __DOOMTYPE__
#define __DOOMTYPE__
+// #define macros to provide functions missing in Windows.
+// Outside Windows, we use strings.h for str[n]casecmp.
+
+
+#ifdef _WIN32
+
+#define snprintf _snprintf
+#if _MSC_VER < 1400 /* not needed for Visual Studio 2008 */
+#define vsnprintf _vsnprintf
+#endif
+#define strcasecmp stricmp
+#define strncasecmp strnicmp
+
+#else
+
+#include <strings.h>
+
+#endif
+
+
+//
+// The packed attribute forces structures to be packed into the minimum
+// space necessary. If this is not done, the compiler may align structure
+// fields differently to optimize memory access, inflating the overall
+// structure size. It is important to use the packed attribute on certain
+// structures where alignment is important, particularly data read/written
+// to disk.
+//
+
+#ifdef __GNUC__
+#define PACKEDATTR __attribute__((packed))
+#else
+#define PACKEDATTR
+#endif
+
// Windows CE is missing some vital ANSI C functions. We have to
// use our own replacements.