mirror of
https://github.com/rehlds/metamod-r.git
synced 2024-12-27 07:05:34 +03:00
Use MAX_PATH instead PATH_MAX to use one style
This commit is contained in:
parent
2f1df890bd
commit
e32e4f6d6e
@ -36,7 +36,7 @@ bool MConfig::set(const char* key, const char* value) const
|
|||||||
|
|
||||||
bool MConfig::set(option_t* setp, const char* setstr)
|
bool MConfig::set(option_t* setp, const char* setstr)
|
||||||
{
|
{
|
||||||
char pathbuf[PATH_MAX];
|
char pathbuf[MAX_PATH];
|
||||||
int* optval = (int *)setp->dest;
|
int* optval = (int *)setp->dest;
|
||||||
char** optstr = (char **)setp->dest;
|
char** optstr = (char **)setp->dest;
|
||||||
// cvar_t *optcvar = (cvar_t *) 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)
|
bool MConfig::load(const char* fn)
|
||||||
{
|
{
|
||||||
char loadfile[PATH_MAX];
|
char loadfile[MAX_PATH];
|
||||||
char line[MAX_CONF_LEN];
|
char line[MAX_CONF_LEN];
|
||||||
|
|
||||||
// Make full pathname (from gamedir if relative, collapse "..",
|
// Make full pathname (from gamedir if relative, collapse "..",
|
||||||
|
@ -44,8 +44,8 @@ static const game_modinfo_t *lookup_game(const char *name)
|
|||||||
|
|
||||||
bool lookup_game_postfixes(gamedll_t *gamedll)
|
bool lookup_game_postfixes(gamedll_t *gamedll)
|
||||||
{
|
{
|
||||||
char pathname[PATH_MAX];
|
char pathname[MAX_PATH];
|
||||||
static char postfix_path[PATH_MAX] = "";
|
static char postfix_path[MAX_PATH] = "";
|
||||||
|
|
||||||
Q_strlcpy(pathname, gamedll->pathname);
|
Q_strlcpy(pathname, gamedll->pathname);
|
||||||
|
|
||||||
|
@ -241,7 +241,7 @@ bool meta_init_gamedll()
|
|||||||
{
|
{
|
||||||
Q_memset(&g_GameDLL, 0, sizeof g_GameDLL);
|
Q_memset(&g_GameDLL, 0, sizeof g_GameDLL);
|
||||||
|
|
||||||
char gamedir[PATH_MAX];
|
char gamedir[MAX_PATH];
|
||||||
GET_GAME_DIR(gamedir);
|
GET_GAME_DIR(gamedir);
|
||||||
normalize_path(gamedir);
|
normalize_path(gamedir);
|
||||||
|
|
||||||
@ -269,7 +269,7 @@ bool meta_init_gamedll()
|
|||||||
else {
|
else {
|
||||||
// New style; GET_GAME_DIR returned game name. Copy this into our
|
// New style; GET_GAME_DIR returned game name. Copy this into our
|
||||||
// game name, and prepend the current working directory.
|
// game name, and prepend the current working directory.
|
||||||
char buf[PATH_MAX];
|
char buf[MAX_PATH];
|
||||||
if (!_getcwd(buf, sizeof buf)) {
|
if (!_getcwd(buf, sizeof buf)) {
|
||||||
META_WARNING("dll: Couldn't get cwd; %s", strerror(errno));
|
META_WARNING("dll: Couldn't get cwd; %s", strerror(errno));
|
||||||
return false;
|
return false;
|
||||||
|
@ -20,10 +20,10 @@ struct gamedll_t
|
|||||||
{
|
{
|
||||||
char name[NAME_MAX]; // ie "cstrike" (from gamedir)
|
char name[NAME_MAX]; // ie "cstrike" (from gamedir)
|
||||||
char desc[NAME_MAX]; // ie "Counter-Strike"
|
char desc[NAME_MAX]; // ie "Counter-Strike"
|
||||||
char gamedir[PATH_MAX]; // ie "/home/willday/half-life/cstrike"
|
char gamedir[MAX_PATH]; // ie "/home/willday/half-life/cstrike"
|
||||||
char pathname[PATH_MAX]; // ie "/home/willday/half-life/cstrike/dlls/cs_i386.so"
|
char pathname[MAX_PATH]; // ie "/home/willday/half-life/cstrike/dlls/cs_i386.so"
|
||||||
char const* file; // ie "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;
|
CSysModule sys_module;
|
||||||
gamedll_funcs_t funcs; // dllapi_table, newapi_table
|
gamedll_funcs_t funcs; // dllapi_table, newapi_table
|
||||||
};
|
};
|
||||||
|
@ -44,5 +44,5 @@ public:
|
|||||||
private:
|
private:
|
||||||
size_t m_last_index;
|
size_t m_last_index;
|
||||||
plugins_t m_plugins; // array of plugins
|
plugins_t m_plugins; // array of plugins
|
||||||
char m_inifile[PATH_MAX]; // full pathname
|
char m_inifile[MAX_PATH]; // full pathname
|
||||||
};
|
};
|
||||||
|
@ -113,7 +113,7 @@ bool MPlugin::ini_parseline(char *line)
|
|||||||
// Parse a line from console "load" command into a plugin.
|
// Parse a line from console "load" command into a plugin.
|
||||||
bool MPlugin::cmd_parseline(const char *line)
|
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;
|
char *ptr_token;
|
||||||
|
|
||||||
Q_strlcpy(buf, line);
|
Q_strlcpy(buf, line);
|
||||||
|
@ -161,10 +161,10 @@ private:
|
|||||||
gamedll_funcs_t m_gamedll_funcs;
|
gamedll_funcs_t m_gamedll_funcs;
|
||||||
mutil_funcs_t m_mutil_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_file; // ie "mm_test_i386.so", ptr from filename
|
||||||
char m_desc[MAX_DESC_LEN]; // ie "Test metamod plugin", from inifile
|
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];
|
static const char *s_rPrintLoadTime[][4];
|
||||||
|
|
||||||
|
@ -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.
|
// Return the full path of the plugin's loaded dll/so file.
|
||||||
const char* EXT_FUNC mutil_GetPluginPath(plid_t plid)
|
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);
|
auto plug = g_plugins->find(plid);
|
||||||
if (!plug) {
|
if (!plug) {
|
||||||
|
@ -17,7 +17,6 @@
|
|||||||
#elif defined(_WIN32)
|
#elif defined(_WIN32)
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#define NAME_MAX _MAX_FNAME
|
#define NAME_MAX _MAX_FNAME
|
||||||
#define PATH_MAX _MAX_PATH
|
|
||||||
#endif // _WIN32
|
#endif // _WIN32
|
||||||
|
|
||||||
// Various other windows routine differences.
|
// Various other windows routine differences.
|
||||||
|
@ -91,8 +91,8 @@ bool is_platform_postfix(const char* pf)
|
|||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
char* realpath(const char* file_name, char* resolved_name)
|
char* realpath(const char* file_name, char* resolved_name)
|
||||||
{
|
{
|
||||||
int ret = GetFullPathName(file_name, PATH_MAX, resolved_name, nullptr);
|
int ret = GetFullPathName(file_name, MAX_PATH, resolved_name, nullptr);
|
||||||
if (ret > PATH_MAX) {
|
if (ret > MAX_PATH) {
|
||||||
errno = ENAMETOOLONG;
|
errno = ENAMETOOLONG;
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
@ -123,7 +123,7 @@ char* realpath(const char* file_name, char* resolved_name)
|
|||||||
// Special-case-recognize "/dev/null" as a valid file.
|
// Special-case-recognize "/dev/null" as a valid file.
|
||||||
bool is_file_exists_in_gamedir(const char* path)
|
bool is_file_exists_in_gamedir(const char* path)
|
||||||
{
|
{
|
||||||
char buf[PATH_MAX];
|
char buf[MAX_PATH];
|
||||||
|
|
||||||
if (!path)
|
if (!path)
|
||||||
return false;
|
return false;
|
||||||
@ -168,10 +168,10 @@ bool is_file_exists_in_gamedir(const char* path)
|
|||||||
// - calls NormalizePath() to fix backslashes, etc
|
// - calls NormalizePath() to fix backslashes, etc
|
||||||
//
|
//
|
||||||
// Much like realpath, buffer pointed to by fullpath is assumed to be
|
// Much like realpath, buffer pointed to by fullpath is assumed to be
|
||||||
// able to store a string of PATH_MAX length.
|
// able to store a string of MAX_PATH length.
|
||||||
char* full_gamedir_path(const char* path, char (&fullpath)[PATH_MAX])
|
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.
|
// Build pathname from filename, plus gamedir if relative path.
|
||||||
if (is_abs_path(path)) {
|
if (is_abs_path(path)) {
|
||||||
|
@ -32,7 +32,7 @@ bool is_abs_path(const char *path);
|
|||||||
bool is_valid_path(const char *path);
|
bool is_valid_path(const char *path);
|
||||||
bool is_platform_postfix(const char *pf);
|
bool is_platform_postfix(const char *pf);
|
||||||
bool is_file_exists_in_gamedir(const char *path);
|
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);
|
bool mem_compare(const char* addr, const char* pattern, size_t len);
|
||||||
void NORETURN Sys_Error(const char *error, ...);
|
void NORETURN Sys_Error(const char *error, ...);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user