From: Peter Verthez Date: Sat, 25 Jan 2003 18:37:18 +0000 (+0000) Subject: Generate the correct cast error message. X-Git-Url: https://git.dlugolecki.net.pl/?a=commitdiff_plain;h=2907044621b5be3f7c0eab6b364da6f07e74e6be;p=gedcom-parse.git Generate the correct cast error message. --- diff --git a/gedcom/interface.c b/gedcom/interface.c index ac79bed..24cf4e6 100644 --- a/gedcom/interface.c +++ b/gedcom/interface.c @@ -105,13 +105,23 @@ void end_element(Gedcom_elt elt, Gedcom_ctxt parent, Gedcom_ctxt self, const char* val_type_str[] = { N_("null value"), N_("character string"), N_("date"), + N_("age"), N_("cross-reference") }; void gedcom_cast_error(const char* file, int line, Gedcom_val_type tried_type, Gedcom_val_type real_type) { + int tried_bit=0, real_bit=0; + while (tried_type && tried_type % 2 == 0) { + tried_bit++; + tried_type >>= 1; + } + while (real_type && real_type % 2 == 0) { + real_bit++; + real_type >>= 1; + } gedcom_warning (_("Wrong cast of value in file %s, at line %d: %s instead of %s"), - file, line, _(val_type_str[tried_type]), _(val_type_str[real_type])); + file, line, _(val_type_str[tried_bit]), _(val_type_str[real_bit])); }