To be able to compile with -Wwrite-strings, a few obvious ones are needed:
@@ -5034,7 +5040,7 @@
{
SyBlob *pWorker = &pVm->sWorker;
SyString *pFile;
- char *zErr;
+ const char *zErr;
sxi32 rc;
if( !pVm->bErrReport ){
/* Don't bother reporting errors */
@@ -5083,7 +5089,7 @@
{
SyBlob *pWorker = &pVm->sWorker;
SyString *pFile;
- char *zErr;
+ const char *zErr;
sxi32 rc;
if( !pVm->bErrReport ){
/* Don't bother reporting errors */
@@ -22083,7 +22092,7 @@
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 */
@@ -22083,7 +22092,7 @@
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 */
@@ -32603,8 +32618,8 @@
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
@@ -32868,7 +32883,7 @@
}
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;
@@ -32883,7 +32898,8 @@
}
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;
@@ -54996,8 +55012,8 @@
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
/*
@@ -55301,7 +55318,7 @@
}
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;
@@ -55316,7 +55333,8 @@
}
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;
There were a couple of more complicated places, which ideally should be handled by having a separate "char" and a "const char". Many of these are quite similar, so perhaps they can be refactored into something common? For now, this also works to get the compiler to shut up:
In Solaris, MAP_FILE doesn't exist, so I added this:
The function flock() doesn't seem to exist there. The best solution would be to use some other mechanism, but for now I simply disabled it:
Gcc doesn't like large constants without a suffix:
These are related to the previous, to avoid duplication:
To be able to compile with -Wwrite-strings, a few obvious ones are needed:
There were a couple of more complicated places, which ideally should be handled by having a separate "char" and a "const char". Many of these are quite similar, so perhaps they can be refactored into something common? For now, this also works to get the compiler to shut up:
Also, sizeof() is unsigned, while ph7_int64 is signed, so these two are needed (the second one is nicer, I think):