From 96fe73a39f34db59fa0bf218399c8392009056a5 Mon Sep 17 00:00:00 2001 From: belliash Date: Thu, 12 Jul 2018 15:58:29 +0200 Subject: [PATCH] Be able to compile with -Wwrite-strings --- builtin.c | 9 +++++---- lib.c | 9 +++++---- vfs.c | 2 +- vm.c | 4 ++-- 4 files changed, 13 insertions(+), 11 deletions(-) diff --git a/builtin.c b/builtin.c index ca775bb..0dabbe6 100644 --- a/builtin.c +++ b/builtin.c @@ -3855,8 +3855,8 @@ struct ph7_fmt_info sxu8 base; /* The base for radix conversion */ int flags; /* One or more of PH7_FMT_FLAG_ constants below */ sxu8 type; /* Conversion paradigm */ - char *charset; /* The character set for conversion */ - char *prefix; /* Prefix on non-zero values in alt format */ + const char *charset; /* The character set for conversion */ + const char *prefix; /* Prefix on non-zero values in alt format */ }; #ifndef PH7_OMIT_FLOATING_POINT /* @@ -4160,7 +4160,7 @@ PH7_PRIVATE sxi32 PH7_InputFormat( } zBuf = &zWorker[PH7_FMT_BUFSIZ-1]; { - register char *cset; /* Use registers for speed */ + register const char *cset; /* Use registers for speed */ register int base; cset = pInfo->charset; base = pInfo->base; @@ -4175,7 +4175,8 @@ PH7_PRIVATE sxi32 PH7_InputFormat( } if( prefix ) *(--zBuf) = (char)prefix; /* Add sign */ if( flag_alternateform && pInfo->prefix ){ /* Add "0" or "0x" */ - char *pre, x; + const char *pre; + char x; pre = pInfo->prefix; if( *zBuf!=pre[0] ){ for(pre=pInfo->prefix; (x=(*pre))!=0; pre++) *(--zBuf) = x; diff --git a/lib.c b/lib.c index f313140..1fbcc69 100644 --- a/lib.c +++ b/lib.c @@ -2550,8 +2550,8 @@ struct SyFmtInfo sxu8 base; /* The base for radix conversion */ int flags; /* One or more of SXFLAG_ constants below */ sxu8 type; /* Conversion paradigm */ - char *charset; /* The character set for conversion */ - char *prefix; /* Prefix on non-zero values in alt format */ + const char *charset; /* The character set for conversion */ + const char *prefix; /* Prefix on non-zero values in alt format */ }; typedef struct SyFmtConsumer SyFmtConsumer; struct SyFmtConsumer @@ -2815,7 +2815,7 @@ static const SyFmtInfo aFmt[] = { } bufpt = &buf[SXFMT_BUFSIZ-1]; { - register char *cset; /* Use registers for speed */ + register const char *cset; /* Use registers for speed */ register int base; cset = infop->charset; base = infop->base; @@ -2830,7 +2830,8 @@ static const SyFmtInfo aFmt[] = { } if( prefix ) *(--bufpt) = prefix; /* Add sign */ if( flag_alternateform && infop->prefix ){ /* Add "0" or "0x" */ - char *pre, x; + const char *pre; + char x; pre = infop->prefix; if( *bufpt!=pre[0] ){ for(pre=infop->prefix; (x=(*pre))!=0; pre++) *(--bufpt) = x; diff --git a/vfs.c b/vfs.c index 1f9c1a9..5238150 100644 --- a/vfs.c +++ b/vfs.c @@ -4378,7 +4378,7 @@ static int PH7_builtin_fputcsv(ph7_context *pCtx,int nArg,ph7_value **apArg) const ph7_io_stream *pStream; struct csv_data sCsv; io_private *pDev; - char *zEol; + const char *zEol; int eolen; if( nArg < 2 || !ph7_value_is_resource(apArg[0]) || !ph7_value_is_array(apArg[1]) ){ /* Missing/Invalid arguments,return FALSE */ diff --git a/vm.c b/vm.c index 1c3bd6c..07fdd91 100644 --- a/vm.c +++ b/vm.c @@ -2197,7 +2197,7 @@ PH7_PRIVATE sxi32 PH7_VmThrowError( { SyBlob *pWorker = &pVm->sWorker; SyString *pFile; - char *zErr; + const char *zErr; sxi32 rc; if( !pVm->bErrReport ){ /* Don't bother reporting errors */ @@ -2246,7 +2246,7 @@ static sxi32 VmThrowErrorAp( { SyBlob *pWorker = &pVm->sWorker; SyString *pFile; - char *zErr; + const char *zErr; sxi32 rc; if( !pVm->bErrReport ){ /* Don't bother reporting errors */