diff --git a/metamod/src/conf_meta.cpp b/metamod/src/conf_meta.cpp index de3ec78..7eda490 100644 --- a/metamod/src/conf_meta.cpp +++ b/metamod/src/conf_meta.cpp @@ -36,7 +36,7 @@ bool MConfig::set(const char* key, const char* value) const bool MConfig::set(option_t* setp, const char* setstr) { - char pathbuf[PATH_MAX]; + char pathbuf[MAX_PATH]; int* optval = (int *)setp->dest; char** optstr = (char **)setp->dest; // cvar_t *optcvar = (cvar_t *) setp->dest; @@ -92,7 +92,7 @@ bool MConfig::set(option_t* setp, const char* setstr) bool MConfig::load(const char* fn) { - char loadfile[PATH_MAX]; + char loadfile[MAX_PATH]; char line[MAX_CONF_LEN]; // Make full pathname (from gamedir if relative, collapse "..", diff --git a/metamod/src/game_support.cpp b/metamod/src/game_support.cpp index 27f8d75..3cea8ad 100644 --- a/metamod/src/game_support.cpp +++ b/metamod/src/game_support.cpp @@ -44,8 +44,8 @@ static const game_modinfo_t *lookup_game(const char *name) bool lookup_game_postfixes(gamedll_t *gamedll) { - char pathname[PATH_MAX]; - static char postfix_path[PATH_MAX] = ""; + char pathname[MAX_PATH]; + static char postfix_path[MAX_PATH] = ""; Q_strlcpy(pathname, gamedll->pathname); diff --git a/metamod/src/metamod.cpp b/metamod/src/metamod.cpp index 88042d5..d5414bc 100644 --- a/metamod/src/metamod.cpp +++ b/metamod/src/metamod.cpp @@ -241,7 +241,7 @@ bool meta_init_gamedll() { Q_memset(&g_GameDLL, 0, sizeof g_GameDLL); - char gamedir[PATH_MAX]; + char gamedir[MAX_PATH]; GET_GAME_DIR(gamedir); normalize_path(gamedir); @@ -269,7 +269,7 @@ bool meta_init_gamedll() else { // New style; GET_GAME_DIR returned game name. Copy this into our // game name, and prepend the current working directory. - char buf[PATH_MAX]; + char buf[MAX_PATH]; if (!_getcwd(buf, sizeof buf)) { META_WARNING("dll: Couldn't get cwd; %s", strerror(errno)); return false; diff --git a/metamod/src/metamod.h b/metamod/src/metamod.h index 6584dd8..508a9ef 100644 --- a/metamod/src/metamod.h +++ b/metamod/src/metamod.h @@ -20,10 +20,10 @@ struct gamedll_t { char name[NAME_MAX]; // ie "cstrike" (from gamedir) char desc[NAME_MAX]; // ie "Counter-Strike" - char gamedir[PATH_MAX]; // ie "/home/willday/half-life/cstrike" - char pathname[PATH_MAX]; // ie "/home/willday/half-life/cstrike/dlls/cs_i386.so" + char gamedir[MAX_PATH]; // ie "/home/willday/half-life/cstrike" + char pathname[MAX_PATH]; // ie "/home/willday/half-life/cstrike/dlls/cs_i386.so" char const* file; // ie "cs_i386.so" - char real_pathname[PATH_MAX]; // in case pathname overridden by bot, etc + char real_pathname[MAX_PATH]; // in case pathname overridden by bot, etc CSysModule sys_module; gamedll_funcs_t funcs; // dllapi_table, newapi_table }; diff --git a/metamod/src/mlist.h b/metamod/src/mlist.h index 0ef823e..f491f9a 100644 --- a/metamod/src/mlist.h +++ b/metamod/src/mlist.h @@ -44,5 +44,5 @@ public: private: size_t m_last_index; plugins_t m_plugins; // array of plugins - char m_inifile[PATH_MAX]; // full pathname + char m_inifile[MAX_PATH]; // full pathname }; diff --git a/metamod/src/mplugin.cpp b/metamod/src/mplugin.cpp index 18a965e..2257478 100644 --- a/metamod/src/mplugin.cpp +++ b/metamod/src/mplugin.cpp @@ -113,7 +113,7 @@ bool MPlugin::ini_parseline(char *line) // Parse a line from console "load" command into a plugin. bool MPlugin::cmd_parseline(const char *line) { - char buf[NAME_MAX + PATH_MAX + MAX_DESC_LEN]; + char buf[NAME_MAX + MAX_PATH + MAX_DESC_LEN]; char *ptr_token; Q_strlcpy(buf, line); diff --git a/metamod/src/mplugin.h b/metamod/src/mplugin.h index b018977..4a8c292 100644 --- a/metamod/src/mplugin.h +++ b/metamod/src/mplugin.h @@ -161,10 +161,10 @@ private: gamedll_funcs_t m_gamedll_funcs; mutil_funcs_t m_mutil_funcs; - char m_filename[PATH_MAX]; // ie "dlls/mm_test_i386.so", from inifile + char m_filename[MAX_PATH]; // ie "dlls/mm_test_i386.so", from inifile char *m_file; // ie "mm_test_i386.so", ptr from filename char m_desc[MAX_DESC_LEN]; // ie "Test metamod plugin", from inifile - char m_pathname[PATH_MAX]; // UNIQUE, ie "/home/willday/half-life/cstrike/dlls/mm_test_i386.so", built with GameDLL.gamedir + char m_pathname[MAX_PATH]; // UNIQUE, ie "/home/willday/half-life/cstrike/dlls/mm_test_i386.so", built with GameDLL.gamedir static const char *s_rPrintLoadTime[][4]; diff --git a/metamod/src/mutil.cpp b/metamod/src/mutil.cpp index d792cc3..a19592b 100644 --- a/metamod/src/mutil.cpp +++ b/metamod/src/mutil.cpp @@ -241,7 +241,7 @@ const char* EXT_FUNC mutil_GetUserMsgName(plid_t plid, int msgid, int* size) // Return the full path of the plugin's loaded dll/so file. const char* EXT_FUNC mutil_GetPluginPath(plid_t plid) { - static char buf[PATH_MAX]; + static char buf[MAX_PATH] = ""; auto plug = g_plugins->find(plid); if (!plug) { diff --git a/metamod/src/osdep.h b/metamod/src/osdep.h index 748a9f5..6d692b0 100644 --- a/metamod/src/osdep.h +++ b/metamod/src/osdep.h @@ -17,7 +17,6 @@ #elif defined(_WIN32) #include #define NAME_MAX _MAX_FNAME - #define PATH_MAX _MAX_PATH #endif // _WIN32 // Various other windows routine differences. diff --git a/metamod/src/utils.cpp b/metamod/src/utils.cpp index ee3bed5..88ece21 100644 --- a/metamod/src/utils.cpp +++ b/metamod/src/utils.cpp @@ -91,8 +91,8 @@ bool is_platform_postfix(const char* pf) #ifdef _WIN32 char* realpath(const char* file_name, char* resolved_name) { - int ret = GetFullPathName(file_name, PATH_MAX, resolved_name, nullptr); - if (ret > PATH_MAX) { + int ret = GetFullPathName(file_name, MAX_PATH, resolved_name, nullptr); + if (ret > MAX_PATH) { errno = ENAMETOOLONG; return nullptr; } @@ -123,7 +123,7 @@ char* realpath(const char* file_name, char* resolved_name) // Special-case-recognize "/dev/null" as a valid file. bool is_file_exists_in_gamedir(const char* path) { - char buf[PATH_MAX]; + char buf[MAX_PATH]; if (!path) return false; @@ -168,10 +168,10 @@ bool is_file_exists_in_gamedir(const char* path) // - calls NormalizePath() to fix backslashes, etc // // Much like realpath, buffer pointed to by fullpath is assumed to be -// able to store a string of PATH_MAX length. -char* full_gamedir_path(const char* path, char (&fullpath)[PATH_MAX]) +// able to store a string of MAX_PATH length. +char* full_gamedir_path(const char* path, char (&fullpath)[MAX_PATH]) { - char buf[PATH_MAX]; + char buf[MAX_PATH]; // Build pathname from filename, plus gamedir if relative path. if (is_abs_path(path)) { diff --git a/metamod/src/utils.h b/metamod/src/utils.h index 085517c..850419b 100644 --- a/metamod/src/utils.h +++ b/metamod/src/utils.h @@ -32,7 +32,7 @@ bool is_abs_path(const char *path); bool is_valid_path(const char *path); bool is_platform_postfix(const char *pf); bool is_file_exists_in_gamedir(const char *path); -char *full_gamedir_path(const char *path, char (&fullpath)[PATH_MAX]); +char *full_gamedir_path(const char *path, char (&fullpath)[MAX_PATH]); bool mem_compare(const char* addr, const char* pattern, size_t len); void NORETURN Sys_Error(const char *error, ...);