move MAX_OSPATH definition to q_stdinc.h. define it as PATH_MAX,

or as MAXPATHLEN, _MAX_PATH, or MAX_PATH if either of them is
available, or as 1024 if none are available. this would make us
safer in deep installation directory paths.  darkplaces engine
seems to do the same.


git-svn-id: http://svn.code.sf.net/p/quakespasm/code/trunk/quakespasm@928 af15c1b1-3010-417e-b628-4374ebc0bcbd
This commit is contained in:
sezero 2014-07-01 16:25:00 +00:00
parent 0e8c5e90de
commit a2416ef43e
2 changed files with 46 additions and 23 deletions

View File

@ -32,6 +32,9 @@
#include <sys/types.h>
#include <stddef.h>
#include <limits.h>
#ifndef _WIN32 /* others we support without sys/param.h? */
#include <sys/param.h>
#endif
/* NOTES on TYPE SIZES:
Quake/Hexen II engine relied on 32 bit int type size
@ -145,6 +148,28 @@ typedef int fixed8_t;
typedef int fixed16_t;
/*==========================================================================*/
/* MAX_OSPATH (max length of a filesystem pathname, i.e. PATH_MAX)
* Note: See GNU Hurd and others' notes about brokenness of this:
* http://www.gnu.org/software/hurd/community/gsoc/project_ideas/maxpath.html
* http://insanecoding.blogspot.com/2007/11/pathmax-simply-isnt.html */
#if !defined(PATH_MAX)
/* equivalent values? */
#if defined(MAXPATHLEN)
#define PATH_MAX MAXPATHLEN
#elif defined(_WIN32) && defined(_MAX_PATH)
#define PATH_MAX _MAX_PATH
#elif defined(_WIN32) && defined(MAX_PATH)
#define PATH_MAX MAX_PATH
#else /* fallback */
#define PATH_MAX 1024
#endif
#endif /* PATH_MAX */
#define MAX_OSPATH PATH_MAX
/*==========================================================================*/
#if defined(_MSC_VER)

View File

@ -65,7 +65,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#define MAX_QPATH 64 // max length of a quake game pathname
#define MAX_OSPATH 256 // max length of a filesystem pathname
#define ON_EPSILON 0.1 // point on plane side epsilon
@ -79,7 +78,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
//
// per-level limits
//
#define MIN_EDICTS 256 // johnfitz -- lowest allowed value for max_edicts cvar
#define MAX_EDICTS 32000 // johnfitz -- highest allowed value for max_edicts cvar
// ents past 8192 can't play sounds in the standard protocol
@ -112,7 +110,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#define STAT_MONSTERS 14 // bumped by svc_killedmonster
// stock defines
//
#define IT_SHOTGUN 1
#define IT_SUPER_SHOTGUN 2
#define IT_NAILGUN 4