Use macroses GOLD_SLASH_CHR GOLD_SLASH_STR GOLD_WRONG_SLASH_CHR GOLD_WRONG_SLASH_STR instead string and char constatnts / and \
This commit is contained in:
parent
2202849fb2
commit
76da9f5b0f
@ -458,10 +458,10 @@ bool CMYSpellLang::Init(const gdirentry *entry)
|
||||
if (entry2)
|
||||
{
|
||||
strcpy(mEngine, entry2->dirname);
|
||||
strcat(mEngine, "/");
|
||||
strcat(mEngine, GOLD_SLASH_STR);
|
||||
strcat(mEngine, entry2->name.c_str());
|
||||
strcpy(mDictionary, entry->dirname);
|
||||
strcat(mDictionary, "/");
|
||||
strcat(mDictionary, GOLD_SLASH_STR);
|
||||
strcat(mDictionary, entry->name.c_str());
|
||||
|
||||
return true;
|
||||
|
@ -105,7 +105,7 @@ int strschg_environ(std::string& s) {
|
||||
}
|
||||
if(pe != NULL) {
|
||||
std::string dirname = pe->pw_dir;
|
||||
dirname += "/";
|
||||
dirname += GOLD_SLASH_CHR;
|
||||
if(isslash(*p))
|
||||
++p;
|
||||
dirname += p;
|
||||
@ -185,7 +185,7 @@ bool maketruepath(std::string &dirname) {
|
||||
ndirname = chdrive;
|
||||
else {
|
||||
ndirname = dwd;
|
||||
ndirname += "/";
|
||||
ndirname += GOLD_SLASH_CHR;
|
||||
}
|
||||
ndirname += dirname.c_str() + inspos;
|
||||
dirname = ndirname;
|
||||
@ -211,7 +211,7 @@ bool maketruepath(std::string &dirname) {
|
||||
struct passwd *pe = getpwnam(ndirname.c_str()); // get home
|
||||
if(pe != NULL) {
|
||||
ndirname = pe->pw_dir;
|
||||
ndirname += "/";
|
||||
ndirname += GOLD_SLASH_CHR;
|
||||
if(isslash(*p))
|
||||
++p;
|
||||
ndirname += p;
|
||||
@ -222,7 +222,7 @@ bool maketruepath(std::string &dirname) {
|
||||
}
|
||||
} else if(not dirname.empty() and not isslash(dirname[0])) {
|
||||
ndirname = cwd;
|
||||
ndirname += "/";
|
||||
ndirname += GOLD_SLASH_CHR;
|
||||
ndirname += dirname;
|
||||
dirname = ndirname;
|
||||
}
|
||||
|
@ -2267,7 +2267,7 @@ static void ShowStackRM( HANDLE hThread, CONTEXT& c, FILE *fLogFile, PREAD_PROCE
|
||||
for ( p = tt + strlen( tt ) - 1; p >= tt; -- p )
|
||||
{
|
||||
// locate the rightmost path separator
|
||||
if ( *p == '\\' || *p == '/' || *p == ':' )
|
||||
if ( *p == GOLD_SLASH_CHR || *p == GOLD_WRONG_SLASH_CHR || *p == ':' )
|
||||
break;
|
||||
}
|
||||
// if we found one, p is pointing at it; if not, tt only contains
|
||||
|
@ -384,7 +384,7 @@ skip_config:;
|
||||
}
|
||||
else
|
||||
{
|
||||
STD_PRINTNL(" * AREAFILE FIDOCONFIG: Can't open file '" << path << '/' << file << ": " << strerror(errno) );
|
||||
STD_PRINTNL(" * AREAFILE FIDOCONFIG: Can't open file '" << path << GOLD_SLASH_STR << file << ": " << strerror(errno) );
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -537,7 +537,7 @@ glob (pattern, flags, errfunc, pglob)
|
||||
else if (filename == pattern)
|
||||
{
|
||||
/* "/pattern". */
|
||||
dirname = "/";
|
||||
dirname = GOLD_SLASH_CHR;
|
||||
dirlen = 1;
|
||||
++filename;
|
||||
}
|
||||
@ -934,9 +934,9 @@ glob (pattern, flags, errfunc, pglob)
|
||||
|
||||
#ifdef HAVE_MEMPCPY
|
||||
mempcpy (mempcpy (mempcpy (pglob->gl_pathv[pglob->gl_pathc],
|
||||
dir, dir_len),
|
||||
"/", 1),
|
||||
filename, filename_len);
|
||||
dir, dir_len),
|
||||
GOLD_SLASH_CHR, 1),
|
||||
filename, filename_len);
|
||||
#else
|
||||
memcpy (pglob->gl_pathv[pglob->gl_pathc], dir, dir_len);
|
||||
pglob->gl_pathv[pglob->gl_pathc][dir_len] = '/';
|
||||
@ -1001,10 +1001,10 @@ glob (pattern, flags, errfunc, pglob)
|
||||
char *new = realloc (pglob->gl_pathv[i], len);
|
||||
if (new == NULL)
|
||||
{
|
||||
globfree (pglob);
|
||||
return GLOB_NOSPACE;
|
||||
globfree (pglob);
|
||||
return GLOB_NOSPACE;
|
||||
}
|
||||
strcpy (&new[len - 2], "/");
|
||||
strcpy (&new[len - 2], GOLD_SLASH_CHR);
|
||||
pglob->gl_pathv[i] = new;
|
||||
}
|
||||
}
|
||||
@ -1214,11 +1214,11 @@ glob_in_dir (pattern, directory, flags, errfunc, pglob)
|
||||
|
||||
# ifdef HAVE_MEMPCPY
|
||||
mempcpy (mempcpy (mempcpy (fullname, directory, dirlen),
|
||||
"/", 1),
|
||||
pattern, patlen + 1);
|
||||
GOLD_SLASH_CHR, 1),
|
||||
pattern, patlen + 1);
|
||||
# else
|
||||
memcpy (fullname, directory, dirlen);
|
||||
fullname[dirlen] = '/';
|
||||
fullname[dirlen] = GOLD_SLASH_CHR;
|
||||
memcpy (&fullname[dirlen + 1], pattern, patlen + 1);
|
||||
# endif
|
||||
if (((flags & GLOB_ALTDIRFUNC)
|
||||
|
@ -51,6 +51,7 @@
|
||||
|
||||
#include <gdefs.h>
|
||||
#include <gctype.h>
|
||||
#include <gfilutil.h>
|
||||
#include <fptools.h>
|
||||
|
||||
#if 0
|
||||
@ -420,9 +421,9 @@ _FP_cutdir (char *filename)
|
||||
if (filename == NULL)
|
||||
return NULL;
|
||||
|
||||
if ((ptr = _FP_strrchr (filename, '/')) != NULL)
|
||||
if ((ptr = _FP_strrchr (filename, GOLD_SLASH_CHR)) != NULL)
|
||||
ptr++;
|
||||
else if ((ptr = _FP_strrchr (filename, '\\')) != NULL)
|
||||
else if ((ptr = _FP_strrchr (filename, GOLD_WRONG_SLASH_CHR)) != NULL)
|
||||
ptr++;
|
||||
else
|
||||
ptr = filename;
|
||||
|
@ -49,6 +49,7 @@
|
||||
#include <fptools.h>
|
||||
#include <uustring.h>
|
||||
#include <gcrcall.h>
|
||||
#include <gfilutil.h>
|
||||
|
||||
/* for braindead systems */
|
||||
#ifndef SEEK_SET
|
||||
@ -1199,8 +1200,8 @@ UUEncodeToFile (FILE *infile, char *infname, int encoding,
|
||||
}
|
||||
|
||||
if (diskname) {
|
||||
if ((ptr = strchr (diskname, '/')) == NULL)
|
||||
ptr = strchr (diskname, '\\');
|
||||
if ((ptr = strchr (diskname, GOLD_SLASH_CHR)) == NULL)
|
||||
ptr = strchr (diskname, GOLD_WRONG_SLASH_CHR);
|
||||
if (ptr) {
|
||||
len = strlen (diskname) + ((uuencodeext)?strlen(uuencodeext):3) + 5;
|
||||
|
||||
@ -1245,11 +1246,11 @@ UUEncodeToFile (FILE *infile, char *infname, int encoding,
|
||||
*/
|
||||
|
||||
optr = _FP_strrchr (oname, '.');
|
||||
if (optr==NULL || strchr (optr, '/')!=NULL || strchr (optr, '\\')!=NULL) {
|
||||
if (optr==NULL || strchr (optr, GOLD_SLASH_CHR)!=NULL || strchr (optr, GOLD_WRONG_SLASH_CHR)!=NULL) {
|
||||
optr = oname + strlen (oname);
|
||||
*optr++ = '.';
|
||||
}
|
||||
else if (optr==oname || *(optr-1)=='/' || *(optr-1)=='\\') {
|
||||
else if (optr==oname || *(optr-1)==GOLD_SLASH_CHR || *(optr-1)==GOLD_WRONG_SLASH_CHR) {
|
||||
optr = oname + strlen (oname);
|
||||
*optr++ = '.';
|
||||
}
|
||||
|
Reference in New Issue
Block a user