*/
int mutt_ch_convert_nonmime_string(char **ps)
{
+ if (!ps)
+ return -1;
+
const char *c1 = NULL;
for (const char *c = C_AssumedCharset; c; c = c1 ? c1 + 1 : 0)
*/
void mutt_ch_canonical_charset(char *buf, size_t buflen, const char *name)
{
+ if (!buf || !name)
+ return;
+
char in[1024], scratch[1024];
mutt_str_strfcpy(in, name, sizeof(in));
*/
int mutt_ch_check(const char *s, size_t slen, const char *from, const char *to)
{
+ if (!s || !from || !to)
+ return -1;
+
int rc = 0;
iconv_t cd = mutt_ch_iconv_open(to, from, 0);
if (cd == (iconv_t) -1)
*/
int mutt_ch_convert_string(char **ps, const char *from, const char *to, int flags)
{
- iconv_t cd;
- const char *repls[] = { "\357\277\275", "?", 0 };
+ if (!ps)
+ return -1;
+
char *s = *ps;
- int rc = 0;
if (!s || !*s)
return 0;
if (!to || !from)
return -1;
- cd = mutt_ch_iconv_open(to, from, flags);
+ const char *repls[] = { "\357\277\275", "?", 0 };
+ int rc = 0;
+
+ iconv_t cd = mutt_ch_iconv_open(to, from, flags);
if (cd == (iconv_t) -1)
return -1;
*/
bool mutt_ch_check_charset(const char *cs, bool strict)
{
+ if (!cs)
+ return false;
+
if (mutt_ch_is_utf8(cs))
return true;
*/
void mutt_ch_fgetconv_close(struct FgetConv **fc)
{
+ if (!fc || !*fc)
+ return;
+
if ((*fc)->cd != (iconv_t) -1)
iconv_close((*fc)->cd);
FREE(fc);
*/
char *mutt_ch_fgetconvs(char *buf, size_t buflen, struct FgetConv *fc)
{
+ if (!buf)
+ return NULL;
+
size_t r;
for (r = 0; (r + 1) < buflen;)
{