From: Martin Mares Date: Sun, 20 Jan 2008 22:34:59 +0000 (+0100) Subject: Make sure that in_to_x and x_to_out are NULL if they are not available. X-Git-Tag: holmes-import~467 X-Git-Url: http://mj.ucw.cz/gitweb/?a=commitdiff_plain;h=df7c847391ff2bf5b58893932d998181192713a3;p=libucw.git Make sure that in_to_x and x_to_out are NULL if they are not available. --- diff --git a/charset/charconv.c b/charset/charconv.c index 36796a7b..ce22d1e0 100644 --- a/charset/charconv.c +++ b/charset/charconv.c @@ -409,7 +409,11 @@ conv_set_charset(struct conv_context *c, int src, int dest) c->source_charset = src; c->dest_charset = dest; if (src == dest) - c->convert = conv_none; + { + c->convert = conv_none; + c->in_to_x = NULL; + c->x_to_out = NULL; + } else { static uns lookup[] = { @@ -426,10 +430,8 @@ conv_set_charset(struct conv_context *c, int src, int dest) uns src_idx = ((uns)src < ARRAY_SIZE(lookup)) ? lookup[src] : 0; uns dest_idx = ((uns)dest < ARRAY_SIZE(lookup)) ? lookup[dest] : 0; c->convert = tab[src_idx][dest_idx]; - if (!src_idx) - c->in_to_x = input_to_x[src]; - if (!dest_idx) - c->x_to_out = x_to_output[dest]; + c->in_to_x = src_idx ? NULL : input_to_x[src]; + c->x_to_out = dest_idx ? NULL : x_to_output[dest]; } c->state = 0; }