"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "gnucash/gnome/gnc-plugin-report-system.c" between
gnucash-5.0.tar.bz2 and gnucash-5.1.tar.bz2

About: GnuCash is personal and small-business financial-accounting software.

gnc-plugin-report-system.c  (gnucash-5.0.tar.bz2):gnc-plugin-report-system.c  (gnucash-5.1.tar.bz2)
skipping to change at line 138 skipping to change at line 138
* Html url and stream handlers * * Html url and stream handlers *
************************************************************/ ************************************************************/
static gboolean static gboolean
gnc_report_system_file_stream_cb (const char *location, char ** data, int *len) gnc_report_system_file_stream_cb (const char *location, char ** data, int *len)
{ {
*len = gncReadFile (location, data); *len = gncReadFile (location, data);
return (*len > 0); return (*len > 0);
} }
static char *
html_sanitize (const char *str)
{
g_return_val_if_fail (str, NULL);
GString *gs = g_string_sized_new (strlen (str));
for (const char *c = str; *c; c++)
{
if (*c == '&')
gs = g_string_append (gs, "&");
else if (*c == '<')
gs = g_string_append (gs, "&lt;");
else if (*c == '>')
gs = g_string_append (gs, "&gt;");
else
gs = g_string_append_c (gs, *c);
}
return g_string_free (gs, FALSE);
}
static gboolean static gboolean
gnc_report_system_report_stream_cb (const char *location, char ** data, int *len ) gnc_report_system_report_stream_cb (const char *location, char ** data, int *len )
{ {
gchar *captured_str = NULL; gchar *captured_str = NULL;
gboolean ok = gboolean ok =
gnc_run_report_id_string_with_error_handling (location, data, gnc_run_report_id_string_with_error_handling (location, data,
&captured_str); &captured_str);
if (!ok) if (!ok)
{ {
char *sanitized = html_sanitize (captured_str);
*data = g_strdup_printf ("<html><body><h3>%s</h3>" *data = g_strdup_printf ("<html><body><h3>%s</h3>"
"<p>%s</p><pre>%s</pre></body></html>", "<p>%s</p><pre>%s</pre></body></html>",
_("Report error"), _("Report error"),
_("An error occurred while running the report." ), _("An error occurred while running the report." ),
captured_str); sanitized);
g_free (sanitized);
g_free(captured_str); g_free(captured_str);
/* Make sure the progress bar is finished, which will also /* Make sure the progress bar is finished, which will also
* make the GUI sensitive again. Easier to do this via guile * make the GUI sensitive again. Easier to do this via guile
* because otherwise we would need to link against gnome-utils * because otherwise we would need to link against gnome-utils
* and a lot more. */ * and a lot more. */
scm_c_eval_string("(gnc:report-finished)"); scm_c_eval_string("(gnc:report-finished)");
} }
*len = strlen(*data); *len = strlen(*data);
 End of changes. 4 change blocks. 
1 lines changed or deleted 22 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)