]> thyrsus.com Git - intercal.git/commitdiff
Change ick_clc_cset_convert() to make some of it's parameters constant.
authorArvid Norlander <anmaster@tele2.se>
Tue, 18 Nov 2008 18:03:35 +0000 (13:03 -0500)
committerEric S. Raymond <esr@thyrsus.com>
Thu, 26 Aug 2010 00:35:19 +0000 (20:35 -0400)
src/cesspool.c
src/clc-cset.c
src/convickt.c

index 33520db1c49a7845bee7733880afc5821d61c2bd..43db0ba2600c70756f101c06f45e47bc0ee8ec05 100644 (file)
@@ -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
index 55295484c3c1a0b6812e7100b11485c71e81ec10..133b595144e1157393e61ce4fbf11334ec8b7289 100644 (file)
@@ -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;
index e9f4e29b0981c82af7eedeb965e6d8c1fe85042d..7c28b036189247e46c057f16ade626d7a96df285 100644 (file)
@@ -28,9 +28,9 @@ LICENSE TERMS
 #include <string.h>
 #include <unistd.h>
 
-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;