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:
Stas Degteff
2011-02-14 00:27:05 +00:00
parent 2202849fb2
commit 76da9f5b0f
7 changed files with 26 additions and 24 deletions

View File

@@ -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;

View File

@@ -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++ = '.';
}