Commit ff9ff49a authored by Morten Welinder's avatar Morten Welinder Committed by Morten Welinder

Make really sure not to return NULL.

2002-12-17  Morten Welinder  <terra@diku.dk>

	* src/format.c (format_get_currency): Make really sure not to
	return NULL.
parent 9b01a5f8
2002-12-17 Morten Welinder <terra@diku.dk>
* src/format.c (format_get_currency): Make really sure not to
return NULL.
* src/xml-io.c (xml_io_conventions): New function.
(xml_parse_ctx_new): Add exprconv member to our context.
(xml_parse_ctx_destroy): Free it.
......
2002-12-17 Morten Welinder <terra@diku.dk>
* src/format.c (format_get_currency): Make really sure not to
return NULL.
* src/xml-io.c (xml_io_conventions): New function.
(xml_parse_ctx_new): Add exprconv member to our context.
(xml_parse_ctx_destroy): Free it.
......
2002-12-17 Morten Welinder <terra@diku.dk>
* src/format.c (format_get_currency): Make really sure not to
return NULL.
* src/xml-io.c (xml_io_conventions): New function.
(xml_parse_ctx_new): Add exprconv member to our context.
(xml_parse_ctx_destroy): Free it.
......
......@@ -118,11 +118,16 @@ format_get_currency (gboolean *precedes, gboolean *space_sep)
*space_sep = (lc->p_sep_by_space == 1);
if (locale_currency == NULL) {
locale_currency = (lc->currency_symbol == NULL ||
*lc->currency_symbol == '\0')
? g_strdup ("$")
: g_locale_to_utf8 (lc->currency_symbol, -1,
NULL, NULL, NULL);
if (lc->currency_symbol && *lc->currency_symbol) {
locale_currency =
g_locale_to_utf8 (lc->currency_symbol, -1,
NULL, NULL, NULL);
if (!locale_currency)
g_warning ("Failed to convert locale currency symbol \"%s\" to UTF-8.",
lc->currency_symbol);
}
if (!locale_currency)
locale_currency = g_strdup ("$");
}
return locale_currency;
}
......
......@@ -218,11 +218,11 @@ currency_date_format_init (void)
post_rep = post = (char *)"";
pre_rep = (char *)"* ";
pre = g_strconcat ("\"", curr,
(space_sep) ? "\" " : "\"", NULL);
(space_sep ? "\" " : "\""), NULL);
} else {
pre_rep = pre = (char *)"";
post_rep = (char *)"* ";
post = g_strconcat ((space_sep) ? " \"" : "\"",
post = g_strconcat ((space_sep ? " \"" : "\""),
curr, "\"", NULL);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment