#ifndef __Q_SHARED_H
#define __Q_SHARED_H
+#include "globaldefs.h"
+
// q_shared.h -- included first by ALL program modules.
// these are the definitions that have no dependance on
// central system services, and can be used by any part
#define ALIGN_ON
#define ALIGN_OFF
-#ifdef _WIN32
+#if GDEF_COMPILER_MSVC
#pragma warning(disable : 4018) // signed/unsigned mismatch
#pragma warning(disable : 4032)
#include <stdlib.h>
#include <time.h>
#include <ctype.h>
-#ifdef WIN32 // mac doesn't have malloc.h
+#include <cstddef>
+
+#if GDEF_OS_WINDOWS // mac doesn't have malloc.h
#include <malloc.h> // for _alloca()
#endif
-#ifdef _WIN32
+#if GDEF_COMPILER_MSVC
//#pragma intrinsic( memset, memcpy )
// this is the define for determining if we have an asm version of a C function
-#if ( defined _M_IX86 || defined __i386__ ) && !defined __sun__ && !defined __LCC__
+#if GDEF_ARCH_BITS_32 && !defined __sun__ && !defined __LCC__
#define id386 1
#else
#define id386 0
//======================= WIN32 DEFINES =================================
-#ifdef WIN32
+#if GDEF_OS_WINDOWS
#define MAC_STATIC
// buildstring will be incorporated into the version string
#ifdef NDEBUG
-#ifdef _M_IX86
+#if GDEF_ARCH_BITS_32
#define CPUSTRING "win-x86"
#elif defined _M_ALPHA
#define CPUSTRING "win-AXP"
#endif
#else
-#ifdef _M_IX86
+#if GDEF_ARCH_BITS_32
#define CPUSTRING "win-x86-debug"
#elif defined _M_ALPHA
#define CPUSTRING "win-AXP-debug"
//======================= MAC OS X SERVER DEFINES =====================
-#if defined( __MACH__ ) && defined( __APPLE__ )
+#if GDEF_OS_MACOS && defined( __MACH__ )
#define MAC_STATIC
#ifdef __ppc__
#define CPUSTRING "MacOSXS-ppc"
-#elif defined __i386__
+#elif GDEF_ARCH_BITS_32
#define CPUSTRING "MacOSXS-i386"
#else
#define CPUSTRING "MacOSXS-other"
#undef ALIGN_ON
#undef ALIGN_OFF
-#define ALIGN_ON # pragma align( 16 )
-#define ALIGN_OFF # pragma align()
+#define ALIGN_ON #pragma align( 16 )
+#define ALIGN_OFF #pragma align()
#ifdef __cplusplus
extern "C" {
// the mac compiler can't handle >32k of locals, so we
// just waste space and make big arrays static...
-#ifdef __linux__
+#if GDEF_OS_LINUX
#define MAC_STATIC
-#ifdef __i386__
+#if GDEF_ARCH_BITS_32
#define CPUSTRING "linux-i386"
#elif defined __axp__
#define CPUSTRING "linux-alpha"
extern "C" {
#endif
-void QDECL Com_sprintf( char *dest, int size, const char *fmt, ... );
+void QDECL Com_sprintf( char *dest, std::size_t size, const char *fmt, ... );
// mode parm for FS_FOpenFile
char *Q_strrchr( const char* string, int c );
// buffer size safe library replacements
-void Q_strncpyz( char *dest, const char *src, int destsize );
-void Q_strcat( char *dest, int size, const char *src );
+void Q_strncpyz( char *dest, const char *src, std::size_t destsize );
+void Q_strcat( char *dest, std::size_t size, const char *src );
// strlen that discounts Quake color sequences
int Q_PrintStrlen( const char *string );