From 496c0edbb57b5eecaca45b7fb70359e34150fca2 Mon Sep 17 00:00:00 2001 From: Arvid Norlander Date: Tue, 18 Nov 2008 13:03:35 -0500 Subject: [PATCH] Change ick_clc_cset_convert() to make some of it's parameters constant. --- src/cesspool.c | 14 +++++++------- src/clc-cset.c | 11 ++++++----- src/convickt.c | 6 +++--- 3 files changed, 16 insertions(+), 15 deletions(-) diff --git a/src/cesspool.c b/src/cesspool.c index 33520db..43db0ba 100644 --- a/src/cesspool.c +++ b/src/cesspool.c @@ -357,8 +357,8 @@ void ick_pout(unsigned int val) **********************************************************************/ /* AIS: From clc-cset.c */ -extern int ick_clc_cset_convert(char* in, /*@partial@*/ char* out, char* incset, - char* outcset, int padstyle, size_t outsize, +extern int ick_clc_cset_convert(const char* in, /*@partial@*/ char* out, const char* incset, + const char* outcset, int padstyle, size_t outsize, /*@null@*/ FILE* errsto); static void clcbinin(unsigned int type, ick_array *a, ick_bool forget) @@ -415,7 +415,7 @@ static void clcbinin(unsigned int type, ick_array *a, ick_bool forget) free(buf); } -static void clcbinout(unsigned int type, ick_array* a) +static void clcbinout(unsigned int type, const ick_array* a) { size_t i; int ti; @@ -499,7 +499,7 @@ void ick_binin(unsigned int type, ick_array *a, ick_bool forget) } } -void ick_binout(unsigned int type, ick_array *a) +void ick_binout(unsigned int type, const ick_array *a) { static unsigned int lastout = 0; unsigned int c; @@ -785,9 +785,9 @@ void ick_retrieve(void *to, unsigned int type, unsigned int index, else if (!forget) { if(oo) oo[index]=sp->overloadinfo; /* AIS */ if (type == ick_ONESPOT) - memcpy(to, (char *)&sp->save.onespot, sizeof(ick_type16)); + memcpy(to, (const char *)&sp->save.onespot, sizeof(ick_type16)); else if (type == ick_TWOSPOT) - memcpy(to, (char *)&sp->save.twospot, sizeof(ick_type32)); + memcpy(to, (const char *)&sp->save.twospot, sizeof(ick_type32)); else if (type == ick_TAIL || type == ick_HYBRID) { ick_array *a = (ick_array*)to; /*@-branchstate@*/ /* it's a union, so one valid is correct */ @@ -798,7 +798,7 @@ void ick_retrieve(void *to, unsigned int type, unsigned int index, free(a->data.tail); else free(a->data.hybrid); - memcpy(to, (char*)sp->save.a, sizeof(ick_array)); + memcpy(to, (const char*)sp->save.a, sizeof(ick_array)); } /*@=branchstate@*/ /* AIS: there isn't a memory leak here, because we memcpyd the diff --git a/src/clc-cset.c b/src/clc-cset.c index 5529548..133b595 100644 --- a/src/clc-cset.c +++ b/src/clc-cset.c @@ -97,7 +97,7 @@ static int ick_csetow=0; /* which cset to overwrite ick_next */ /*@-mustfreefresh@*/ /* because Splint doesn't understand how findandfopen works */ -static void ick_clc_cset_load(/*@unique@*/ struct cset* cs, /*@unique@*/ char* fname) +static void ick_clc_cset_load(/*@unique@*/ struct cset* cs, /*@unique@*/ const char* fname) { FILE* in; char buf[13]; /* enough for an 8.3 filename */ @@ -182,7 +182,7 @@ static void ick_clc_cset_load(/*@unique@*/ struct cset* cs, /*@unique@*/ char* f /*@=mustfreefresh@*/ /* Helper function for fixing bit order in output. */ -static void ick_bitencout(char** pop, struct cset* co, +static void ick_bitencout(char** pop, const struct cset* co, unsigned short val, int padstyle) { unsigned short outword=0; @@ -212,15 +212,16 @@ static void ick_bitencout(char** pop, struct cset* co, * outsize-1 characters and a NUL will be written to out. The code is * conservative about this; to be safe, make outsize six times as long * as the in is (including in's terminal NUL), plus 6. */ -int ick_clc_cset_convert(char* in, /*@partial@*/ char* out, char* incset, - char* outcset, int padstyle, size_t outsize, +int ick_clc_cset_convert(const char* in, /*@partial@*/ char* out, const char* incset, + const char* outcset, int padstyle, size_t outsize, /*@null@*/ FILE* errsto) { int ic=-1, oc=-1; int i; int ssi, sso; unsigned short tus, csi; - char* ip, *op; + const char* ip; + char* op; struct cset *csri, *csro; int noconvwarn=0; int substwarn=0; diff --git a/src/convickt.c b/src/convickt.c index e9f4e29..7c28b03 100644 --- a/src/convickt.c +++ b/src/convickt.c @@ -28,9 +28,9 @@ LICENSE TERMS #include #include -int ick_clc_cset_convert(char* in, /*@partial@*/ char* out, char* incset, - char* outcset, int padstyle, size_t outsize, - /*@null@*/ FILE* errsto); +extern int ick_clc_cset_convert(const char* in, /*@partial@*/ char* out, const char* incset, + const char* outcset, int padstyle, size_t outsize, + /*@null@*/ FILE* errsto); /* For communication with clc_cset.c */ /*@observer@*/ char* ick_globalargv0; -- 2.43.0