gnucash maint: Bug 796772 - Receivable Ageing Report invalid URL for Totals column
Geert Janssens
gjanssens at code.gnucash.org
Mon Oct 1 07:18:35 EDT 2018
Updated via https://github.com/Gnucash/gnucash/commit/e0683662 (commit)
from https://github.com/Gnucash/gnucash/commit/65c8357f (commit)
commit e068366277356b7bf9acd58ddb121fca15306cca
Author: Geert Janssens <geert at kobaltwit.be>
Date: Mon Oct 1 13:18:25 2018 +0200
Bug 796772 - Receivable Ageing Report invalid URL for Totals column
Use some pointer arithmetic to split the owner guid into a separate
string before handing it over to boost::uuid for interpretation
diff --git a/gnucash/gnome/business-urls.c b/gnucash/gnome/business-urls.c
index 280cafc..3070b73 100644
--- a/gnucash/gnome/business-urls.c
+++ b/gnucash/gnome/business-urls.c
@@ -175,7 +175,7 @@ static gboolean
ownerreportCB (const char *location, const char *label,
gboolean new_window, GNCURLResult * result)
{
- const char *ownerptr;
+ char *ownerptr;
const char *acctptr;
GncGUID guid;
GncOwner owner;
@@ -190,10 +190,6 @@ ownerreportCB (const char *location, const char *label,
/* href="...:owner=<owner-type>:guid=<guid>[&acct=<guid>]" */
- acctptr = strchr (location, '&');
- if (acctptr)
- acctptr++;
-
if (strncmp ("owner=", location, 6) != 0)
{
result->error_message = g_strdup_printf (_("Badly formed URL %s"),
@@ -201,9 +197,17 @@ ownerreportCB (const char *location, const char *label,
return FALSE;
}
+ acctptr = strchr (location, '&');
+ if (acctptr)
+ {
+ ownerptr = g_strndup (location + 6, acctptr - location - 6);
+ acctptr++;
+ }
+ else
+ ownerptr = g_strdup (location + 6);
+
memset (&owner, 0, sizeof (owner));
- ownerptr = location + 6;
switch (*ownerptr)
{
case 'c':
@@ -220,15 +224,18 @@ ownerreportCB (const char *location, const char *label,
break;
default:
result->error_message = g_strdup_printf (_("Bad URL: %s"), location);
+ g_free (ownerptr);
return FALSE;
}
if (!string_to_guid (ownerptr + 2, &guid))
{
result->error_message = g_strdup_printf (_("Bad URL: %s"), location);
+ g_free (ownerptr);
return FALSE;
}
+ g_free (ownerptr);
switch (type)
{
Summary of changes:
gnucash/gnome/business-urls.c | 19 +++++++++++++------
1 file changed, 13 insertions(+), 6 deletions(-)
More information about the gnucash-changes
mailing list