From df7c847391ff2bf5b58893932d998181192713a3 Mon Sep 17 00:00:00 2001 From: Martin Mares Date: Sun, 20 Jan 2008 23:34:59 +0100 Subject: [PATCH] Make sure that in_to_x and x_to_out are NULL if they are not available. --- charset/charconv.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) 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; } -- 2.39.5