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)
|
if (entry2)
|
||||||
{
|
{
|
||||||
strcpy(mEngine, entry2->dirname);
|
strcpy(mEngine, entry2->dirname);
|
||||||
strcat(mEngine, "/");
|
strcat(mEngine, GOLD_SLASH_STR);
|
||||||
strcat(mEngine, entry2->name.c_str());
|
strcat(mEngine, entry2->name.c_str());
|
||||||
strcpy(mDictionary, entry->dirname);
|
strcpy(mDictionary, entry->dirname);
|
||||||
strcat(mDictionary, "/");
|
strcat(mDictionary, GOLD_SLASH_STR);
|
||||||
strcat(mDictionary, entry->name.c_str());
|
strcat(mDictionary, entry->name.c_str());
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
@ -105,7 +105,7 @@ int strschg_environ(std::string& s) {
|
|||||||
}
|
}
|
||||||
if(pe != NULL) {
|
if(pe != NULL) {
|
||||||
std::string dirname = pe->pw_dir;
|
std::string dirname = pe->pw_dir;
|
||||||
dirname += "/";
|
dirname += GOLD_SLASH_CHR;
|
||||||
if(isslash(*p))
|
if(isslash(*p))
|
||||||
++p;
|
++p;
|
||||||
dirname += p;
|
dirname += p;
|
||||||
@ -185,7 +185,7 @@ bool maketruepath(std::string &dirname) {
|
|||||||
ndirname = chdrive;
|
ndirname = chdrive;
|
||||||
else {
|
else {
|
||||||
ndirname = dwd;
|
ndirname = dwd;
|
||||||
ndirname += "/";
|
ndirname += GOLD_SLASH_CHR;
|
||||||
}
|
}
|
||||||
ndirname += dirname.c_str() + inspos;
|
ndirname += dirname.c_str() + inspos;
|
||||||
dirname = ndirname;
|
dirname = ndirname;
|
||||||
@ -211,7 +211,7 @@ bool maketruepath(std::string &dirname) {
|
|||||||
struct passwd *pe = getpwnam(ndirname.c_str()); // get home
|
struct passwd *pe = getpwnam(ndirname.c_str()); // get home
|
||||||
if(pe != NULL) {
|
if(pe != NULL) {
|
||||||
ndirname = pe->pw_dir;
|
ndirname = pe->pw_dir;
|
||||||
ndirname += "/";
|
ndirname += GOLD_SLASH_CHR;
|
||||||
if(isslash(*p))
|
if(isslash(*p))
|
||||||
++p;
|
++p;
|
||||||
ndirname += p;
|
ndirname += p;
|
||||||
@ -222,7 +222,7 @@ bool maketruepath(std::string &dirname) {
|
|||||||
}
|
}
|
||||||
} else if(not dirname.empty() and not isslash(dirname[0])) {
|
} else if(not dirname.empty() and not isslash(dirname[0])) {
|
||||||
ndirname = cwd;
|
ndirname = cwd;
|
||||||
ndirname += "/";
|
ndirname += GOLD_SLASH_CHR;
|
||||||
ndirname += dirname;
|
ndirname += dirname;
|
||||||
dirname = ndirname;
|
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 )
|
for ( p = tt + strlen( tt ) - 1; p >= tt; -- p )
|
||||||
{
|
{
|
||||||
// locate the rightmost path separator
|
// locate the rightmost path separator
|
||||||
if ( *p == '\\' || *p == '/' || *p == ':' )
|
if ( *p == GOLD_SLASH_CHR || *p == GOLD_WRONG_SLASH_CHR || *p == ':' )
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
// if we found one, p is pointing at it; if not, tt only contains
|
// if we found one, p is pointing at it; if not, tt only contains
|
||||||
|
@ -384,7 +384,7 @@ skip_config:;
|
|||||||
}
|
}
|
||||||
else
|
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)
|
else if (filename == pattern)
|
||||||
{
|
{
|
||||||
/* "/pattern". */
|
/* "/pattern". */
|
||||||
dirname = "/";
|
dirname = GOLD_SLASH_CHR;
|
||||||
dirlen = 1;
|
dirlen = 1;
|
||||||
++filename;
|
++filename;
|
||||||
}
|
}
|
||||||
@ -935,7 +935,7 @@ glob (pattern, flags, errfunc, pglob)
|
|||||||
#ifdef HAVE_MEMPCPY
|
#ifdef HAVE_MEMPCPY
|
||||||
mempcpy (mempcpy (mempcpy (pglob->gl_pathv[pglob->gl_pathc],
|
mempcpy (mempcpy (mempcpy (pglob->gl_pathv[pglob->gl_pathc],
|
||||||
dir, dir_len),
|
dir, dir_len),
|
||||||
"/", 1),
|
GOLD_SLASH_CHR, 1),
|
||||||
filename, filename_len);
|
filename, filename_len);
|
||||||
#else
|
#else
|
||||||
memcpy (pglob->gl_pathv[pglob->gl_pathc], dir, dir_len);
|
memcpy (pglob->gl_pathv[pglob->gl_pathc], dir, dir_len);
|
||||||
@ -1004,7 +1004,7 @@ glob (pattern, flags, errfunc, pglob)
|
|||||||
globfree (pglob);
|
globfree (pglob);
|
||||||
return GLOB_NOSPACE;
|
return GLOB_NOSPACE;
|
||||||
}
|
}
|
||||||
strcpy (&new[len - 2], "/");
|
strcpy (&new[len - 2], GOLD_SLASH_CHR);
|
||||||
pglob->gl_pathv[i] = new;
|
pglob->gl_pathv[i] = new;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1214,11 +1214,11 @@ glob_in_dir (pattern, directory, flags, errfunc, pglob)
|
|||||||
|
|
||||||
# ifdef HAVE_MEMPCPY
|
# ifdef HAVE_MEMPCPY
|
||||||
mempcpy (mempcpy (mempcpy (fullname, directory, dirlen),
|
mempcpy (mempcpy (mempcpy (fullname, directory, dirlen),
|
||||||
"/", 1),
|
GOLD_SLASH_CHR, 1),
|
||||||
pattern, patlen + 1);
|
pattern, patlen + 1);
|
||||||
# else
|
# else
|
||||||
memcpy (fullname, directory, dirlen);
|
memcpy (fullname, directory, dirlen);
|
||||||
fullname[dirlen] = '/';
|
fullname[dirlen] = GOLD_SLASH_CHR;
|
||||||
memcpy (&fullname[dirlen + 1], pattern, patlen + 1);
|
memcpy (&fullname[dirlen + 1], pattern, patlen + 1);
|
||||||
# endif
|
# endif
|
||||||
if (((flags & GLOB_ALTDIRFUNC)
|
if (((flags & GLOB_ALTDIRFUNC)
|
||||||
|
@ -51,6 +51,7 @@
|
|||||||
|
|
||||||
#include <gdefs.h>
|
#include <gdefs.h>
|
||||||
#include <gctype.h>
|
#include <gctype.h>
|
||||||
|
#include <gfilutil.h>
|
||||||
#include <fptools.h>
|
#include <fptools.h>
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
@ -420,9 +421,9 @@ _FP_cutdir (char *filename)
|
|||||||
if (filename == NULL)
|
if (filename == NULL)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
if ((ptr = _FP_strrchr (filename, '/')) != NULL)
|
if ((ptr = _FP_strrchr (filename, GOLD_SLASH_CHR)) != NULL)
|
||||||
ptr++;
|
ptr++;
|
||||||
else if ((ptr = _FP_strrchr (filename, '\\')) != NULL)
|
else if ((ptr = _FP_strrchr (filename, GOLD_WRONG_SLASH_CHR)) != NULL)
|
||||||
ptr++;
|
ptr++;
|
||||||
else
|
else
|
||||||
ptr = filename;
|
ptr = filename;
|
||||||
|
@ -49,6 +49,7 @@
|
|||||||
#include <fptools.h>
|
#include <fptools.h>
|
||||||
#include <uustring.h>
|
#include <uustring.h>
|
||||||
#include <gcrcall.h>
|
#include <gcrcall.h>
|
||||||
|
#include <gfilutil.h>
|
||||||
|
|
||||||
/* for braindead systems */
|
/* for braindead systems */
|
||||||
#ifndef SEEK_SET
|
#ifndef SEEK_SET
|
||||||
@ -1199,8 +1200,8 @@ UUEncodeToFile (FILE *infile, char *infname, int encoding,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (diskname) {
|
if (diskname) {
|
||||||
if ((ptr = strchr (diskname, '/')) == NULL)
|
if ((ptr = strchr (diskname, GOLD_SLASH_CHR)) == NULL)
|
||||||
ptr = strchr (diskname, '\\');
|
ptr = strchr (diskname, GOLD_WRONG_SLASH_CHR);
|
||||||
if (ptr) {
|
if (ptr) {
|
||||||
len = strlen (diskname) + ((uuencodeext)?strlen(uuencodeext):3) + 5;
|
len = strlen (diskname) + ((uuencodeext)?strlen(uuencodeext):3) + 5;
|
||||||
|
|
||||||
@ -1245,11 +1246,11 @@ UUEncodeToFile (FILE *infile, char *infname, int encoding,
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
optr = _FP_strrchr (oname, '.');
|
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 = oname + strlen (oname);
|
||||||
*optr++ = '.';
|
*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 = oname + strlen (oname);
|
||||||
*optr++ = '.';
|
*optr++ = '.';
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user