gnucash maint: Multiple changes pushed
John Ralls
jralls at code.gnucash.org
Mon Mar 8 21:39:37 EST 2021
Updated via https://github.com/Gnucash/gnucash/commit/228f145b (commit)
via https://github.com/Gnucash/gnucash/commit/0f86f29d (commit)
via https://github.com/Gnucash/gnucash/commit/df579c25 (commit)
from https://github.com/Gnucash/gnucash/commit/9a6aaacc (commit)
commit 228f145bba8f5e7b8647173d3d634de95b03c4bf
Author: John Ralls <jralls at ceridwen.us>
Date: Mon Mar 8 18:37:33 2021 -0800
Work around new clang warning void-pointer-to-enum-cast.
Not really a fix, just shuts up the warning. The fix is to not use
void* to hold integers, but that requires replacing all of the GLib
containers.
diff --git a/gnucash/gnome-search/search-reconciled.c b/gnucash/gnome-search/search-reconciled.c
index 280b7f858..641206a44 100644
--- a/gnucash/gnome-search/search-reconciled.c
+++ b/gnucash/gnome-search/search-reconciled.c
@@ -159,7 +159,7 @@ toggle_changed (GtkToggleButton *button, GNCSearchReconciled *fe)
{
gboolean is_on = gtk_toggle_button_get_active (button);
cleared_match_t value =
- (cleared_match_t) g_object_get_data (G_OBJECT (button), "button-value");
+ (cleared_match_t) ((uint64_t)g_object_get_data (G_OBJECT (button), "button-value") & 0xffffffff); // Binary mask to silence void-pointer-to-enum-cast warning.
if (is_on)
fe->value |= value;
commit 0f86f29dd8abd49159fb50edbadbb36018ccdd99
Merge: 9a6aaaccf df579c257
Author: John Ralls <jralls at ceridwen.us>
Date: Mon Mar 8 18:07:47 2021 -0800
Merge Sumit Bhadarwaj's g_mempdup into maint.
commit df579c257bd272264fc9de4d7c0777abb2540414
Author: Sumit Bhardwaj <bhardwajs at outlook.com>
Date: Sun Mar 7 20:51:02 2021 -0800
Replace g_memdup by memcpy
GLib is deprecating g_memdup. Since older versions of GLib
wouldn't have g_memdup2, this PR replaces occurrences of
g_memdup by memcpy.
diff --git a/gnucash/register/register-gnome/gnucash-style.c b/gnucash/register/register-gnome/gnucash-style.c
index 09dd59e49..4f2f38d2f 100644
--- a/gnucash/register/register-gnome/gnucash-style.c
+++ b/gnucash/register/register-gnome/gnucash-style.c
@@ -57,10 +57,13 @@ static gpointer
style_create_key (SheetBlockStyle *style)
{
static gint key;
+ gpointer new_key;
key = style->cursor->num_rows;
+ new_key = g_malloc(sizeof(key));
+ new_key = memcpy(new_key, &key, sizeof(key));
- return g_memdup(&key, sizeof(key));
+ return new_key;
}
static void
diff --git a/libgnucash/app-utils/gnc-ui-balances.c b/libgnucash/app-utils/gnc-ui-balances.c
index 86b747cbc..a948ecc79 100644
--- a/libgnucash/app-utils/gnc-ui-balances.c
+++ b/libgnucash/app-utils/gnc-ui-balances.c
@@ -372,9 +372,10 @@ static void sack_foreach_func(gpointer key, gpointer value, gpointer user_data)
sack_foreach_data_t data = (sack_foreach_data_t) user_data;
gnc_numeric thisvalue = *(gnc_numeric *) key;
gnc_numeric reachable_value = gnc_numeric_add_fixed (thisvalue, data->split_value);
+ gpointer new_value = g_malloc(sizeof(gnc_numeric));
- data->reachable_list = g_list_prepend
- (data->reachable_list, g_memdup (&reachable_value, sizeof (gnc_numeric)));
+ memcpy(new_value, &reachable_value, sizeof(gnc_numeric));
+ data->reachable_list = g_list_prepend(data->reachable_list, new_value);
}
GList *
@@ -418,6 +419,7 @@ gnc_account_get_autoclear_splits (Account *account, gnc_numeric toclear_value,
{
Split *split = (Split *)node->data;
gnc_numeric split_value = xaccSplitGetAmount (split);
+ gpointer new_value = g_malloc(sizeof(gnc_numeric));
struct _sack_foreach_data_t s_data[1];
s_data->split_value = split_value;
@@ -427,8 +429,9 @@ gnc_account_get_autoclear_splits (Account *account, gnc_numeric toclear_value,
g_hash_table_foreach (sack, sack_foreach_func, s_data);
/* Add the value of the split itself to the reachable_list */
+ memcpy(new_value, &split_value, sizeof(gnc_numeric));
s_data->reachable_list = g_list_prepend
- (s_data->reachable_list, g_memdup (&split_value, sizeof (gnc_numeric)));
+ (s_data->reachable_list, new_value);
/* Add everything to the sack, looking out for duplicates */
for (GList *s_node = s_data->reachable_list; s_node; s_node = s_node->next)
diff --git a/libgnucash/engine/SchedXaction.c b/libgnucash/engine/SchedXaction.c
index 9b678bacb..af7b9c5d0 100644
--- a/libgnucash/engine/SchedXaction.c
+++ b/libgnucash/engine/SchedXaction.c
@@ -1118,8 +1118,14 @@ gnc_sx_destroy_temporal_state (SXTmpStateData *tsd)
SXTmpStateData*
gnc_sx_clone_temporal_state (SXTmpStateData *tsd)
{
- SXTmpStateData *toRet;
- toRet = g_memdup (tsd, sizeof (SXTmpStateData));
+ SXTmpStateData *toRet = NULL;
+
+ if(tsd)
+ {
+ toRet = g_malloc(sizeof(SXTmpStateData));
+ toRet = memcpy (toRet, tsd, sizeof (SXTmpStateData));
+ }
+
return toRet;
}
Summary of changes:
gnucash/gnome-search/search-reconciled.c | 2 +-
gnucash/register/register-gnome/gnucash-style.c | 5 ++++-
libgnucash/app-utils/gnc-ui-balances.c | 9 ++++++---
libgnucash/engine/SchedXaction.c | 10 ++++++++--
4 files changed, 19 insertions(+), 7 deletions(-)
More information about the gnucash-changes
mailing list