@@ -1118,7 +1118,7 @@ extern int SystemImpl__removeDirectory(const char *path)
11181118 return retval == 0 ;
11191119}
11201120
1121- extern char * SystemImpl__readFileNoNumeric (const char * filename )
1121+ extern const char * SystemImpl__readFileNoNumeric (const char * filename )
11221122{
11231123 char * buf , * bufRes ;
11241124 int res ,numCount ;
@@ -2229,7 +2229,7 @@ extern int SystemImpl__reopenStandardStream(int id,const char *filename)
22292229 return 1 ;
22302230}
22312231
2232- char * SystemImpl__iconv__ascii (const char * str )
2232+ const char * SystemImpl__iconv__ascii (const char * str )
22332233{
22342234 char * buf = 0 ;
22352235 size_t sz ;
@@ -2247,7 +2247,7 @@ static int isUtf8Encoding(const char *str)
22472247 return strcasecmp (str , "UTF-8" ) || strcasecmp (str , "UTF8" );
22482248}
22492249
2250- extern char * SystemImpl__iconv (const char * str , const char * from , const char * to , int printError )
2250+ extern const char * SystemImpl__iconv (const char * str , const char * from , const char * to , int printError )
22512251{
22522252 char * in_str ,* res = NULL ;
22532253 size_t sz ,out_sz ,buflen ;
@@ -2257,39 +2257,39 @@ extern char* SystemImpl__iconv(const char * str, const char *from, const char *t
22572257 sz = strlen (str );
22582258 if (isUtf8Encoding (from ) && isUtf8Encoding (to ))
22592259 {
2260- is_utf8 (str , sz , & res , & count );
2260+ is_utf8 (( unsigned char * ) str , sz , & res , & count );
22612261 if (res == NULL ) {
22622262 /* Converting from UTF-8 to UTF-8 and the sequence is already UTF-8... */
22632263 return str ;
22642264 }
22652265 /* Converting from UTF-8, but is not valid UTF-8. Just quit early. */
22662266 if (printError ) {
2267- char * ignore = SystemImpl__iconv__ascii (str );
2267+ const char * ignore = SystemImpl__iconv__ascii (str );
22682268 const char * tokens [4 ] = {res ,from ,to ,ignore };
22692269 c_add_message (NULL ,-1 ,ErrorType_scripting ,ErrorLevel_error ,gettext ("iconv(\"%s\",to=\"%s\",from=\"%s\") failed: %s" ),tokens ,4 );
2270- omc_alloc_interface .free_uncollectable (ignore );
2270+ omc_alloc_interface .free_uncollectable (( char * ) ignore );
22712271 }
2272- return (char * ) "" ;
2272+ return (const char * ) "" ;
22732273 }
22742274 buflen = sz * 4 ;
22752275 /* fprintf(stderr,"iconv(%s,to=%s,%s) of size %d, buflen %d\n",str,to,from,sz,buflen); */
22762276 ic = iconv_open (to , from );
22772277 if (ic == (iconv_t ) - 1 ) {
22782278 if (printError ) {
2279- char * ignore = SystemImpl__iconv__ascii (str );
2279+ const char * ignore = SystemImpl__iconv__ascii (str );
22802280 const char * tokens [4 ] = {strerror (errno ),from ,to ,ignore };
22812281 c_add_message (NULL ,-1 ,ErrorType_scripting ,ErrorLevel_error ,gettext ("iconv(\"%s\",to=\"%s\",from=\"%s\") failed: %s" ),tokens ,4 );
2282- omc_alloc_interface .free_uncollectable (ignore );
2282+ omc_alloc_interface .free_uncollectable (( char * ) ignore );
22832283 }
2284- return (char * ) "" ;
2284+ return (const char * ) "" ;
22852285 }
22862286 buf = (char * ) omc_alloc_interface .malloc_atomic (buflen );
22872287 if (0 == buf ) {
22882288 if (printError ) {
22892289 /* Make the error message small so we perhaps have a chance to recover */
22902290 c_add_message (NULL ,-1 ,ErrorType_scripting ,ErrorLevel_error ,gettext ("iconv() ran out of memory" ),NULL ,0 );
22912291 }
2292- return (char * ) "" ;
2292+ return (const char * ) "" ;
22932293 }
22942294 * buf = 0 ;
22952295 in_str = (char * ) str ;
@@ -2299,24 +2299,24 @@ extern char* SystemImpl__iconv(const char * str, const char *from, const char *t
22992299 iconv_close (ic );
23002300 if (count == -1 ) {
23012301 if (printError ) {
2302- char * ignore = SystemImpl__iconv__ascii (str );
2302+ const char * ignore = SystemImpl__iconv__ascii (str );
23032303 const char * tokens [4 ] = {strerror (errno ),from ,to ,ignore };
23042304 c_add_message (NULL ,-1 ,ErrorType_scripting ,ErrorLevel_error ,gettext ("iconv(\"%s\",to=\"%s\",from=\"%s\") failed: %s" ),tokens ,4 );
2305- omc_alloc_interface .free_uncollectable (ignore );
2305+ omc_alloc_interface .free_uncollectable (( char * ) ignore );
23062306 }
23072307 omc_alloc_interface .free_uncollectable (buf );
2308- return (char * ) "" ;
2308+ return (const char * ) "" ;
23092309 }
23102310 buf [(buflen - 1 )- out_sz ] = 0 ;
23112311 if (strlen (buf ) != (buflen - 1 )- out_sz ) {
23122312 if (printError ) c_add_message (NULL ,-1 ,ErrorType_scripting ,ErrorLevel_error ,gettext ("iconv(to=%s) failed because the character set output null bytes in the middle of the string." ),& to ,1 );
23132313 omc_alloc_interface .free_uncollectable (buf );
2314- return (char * ) "" ;
2314+ return (const char * ) "" ;
23152315 }
23162316 if (!strcmp (from , to ) && !strcmp (str , buf ))
23172317 {
23182318 omc_alloc_interface .free_uncollectable (buf );
2319- return (char * )str ;
2319+ return (const char * )str ;
23202320 }
23212321 return buf ;
23222322}
0 commit comments