/* Charset names */
-int find_charset_by_name(char *);
+int find_charset_by_name(const char *);
char *charset_name(int);
#endif
#include <alloca.h>
byte *
-mp_strconv(struct mempool *mp, byte *s, uns in_cs, uns out_cs)
+mp_strconv(struct mempool *mp, const byte *s, uns in_cs, uns out_cs)
{
if (in_cs == out_cs)
return mp_strdup(mp, s);
#include "lib/mempool.h"
#include "charset/charconv.h"
-byte *mp_strconv(struct mempool *mp, byte *s, uns cs_in, uns cs_out);
+byte *mp_strconv(struct mempool *mp, const byte *s, uns cs_in, uns cs_out);
static inline byte *
-mp_strconv_to_utf8(struct mempool *mp, byte *s, uns cs_in)
+mp_strconv_to_utf8(struct mempool *mp, const byte *s, uns cs_in)
{ return mp_strconv(mp, s, cs_in, CONV_CHARSET_UTF8); }
static inline byte *
-mp_strconv_from_utf8(struct mempool *mp, byte *s, uns cs_out)
+mp_strconv_from_utf8(struct mempool *mp, const byte *s, uns cs_out)
{ return mp_strconv(mp, s, CONV_CHARSET_UTF8, cs_out); }
#endif
/* Names according to RFC 1345 (see http://www.iana.org/assignments/character-sets) */
-static char *cs_names[] = {
+static const char *cs_names[] = {
"US-ASCII",
"ISO-8859-1",
"ISO-8859-2",
};
int
-find_charset_by_name(char *c)
+find_charset_by_name(const char *c)
{
unsigned int i;
if (i < 0 || i > CONV_NUM_CHARSETS)
return "x-unknown";
else
- return cs_names[i];
+ return (char *)cs_names[i];
}
#define INITIAL_SCALE 2
uns
-stk_strconv_init(struct conv_context *c, byte *s, uns in_cs, uns out_cs)
+stk_strconv_init(struct conv_context *c, const byte *s, uns in_cs, uns out_cs)
{
uns l = strlen(s);
if (in_cs == out_cs)
/* Internals */
-uns stk_strconv_init(struct conv_context *c, byte *s, uns cs_in, uns cs_out);
+uns stk_strconv_init(struct conv_context *c, const byte *s, uns cs_in, uns cs_out);
uns stk_strconv_step(struct conv_context *c, byte *buf, uns len);
#endif