ACCT_TYPE_NONE is -1 but it should always be masked out by compat;
explicitly check for this instead of relying on that.
Add parenthesis to be clear that the default precedence is what's intended.
==4031== Invalid read of size 8
==4031== at 0x4E58C09: gncVendorGetAddr (gncVendor.c:677)
==4031== by 0x10A7E3: test_vendor (test-vendor.c:97)
...
==4031== Address 0x7e0c4e8 is 168 bytes inside a block of size 232 free'd
==4031== at 0x484620F: free (in /usr/libexec/valgrind/vgpreload_memcheck-amd64-linux.so)
==4031== by 0x51526C3: g_type_free_instance (in /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0.7600.1)
==4031== by 0x4E58616: gncVendorFree (gncVendor.c:511)
==4031== by 0x4E58EFF: vendor_free (gncVendor.c:782)
==4031== by 0x4E8611E: qof_commit_edit_part2 (qofinstance.cpp:1034)
==4031== by 0x4E58F59: gncVendorCommitEdit (gncVendor.c:788)
==4031== by 0x4E584EF: gncVendorDestroy (gncVendor.c:483)
==4031== by 0x10A729: test_vendor (test-vendor.c:80)
...
==4031== Block was alloc'd at
==4031== at 0x4848A13: calloc (in /usr/libexec/valgrind/vgpreload_memcheck-amd64-linux.so)
==4031== by 0x5033550: g_malloc0 (in /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0.7600.1)
==4031== by 0x5157CBC: g_type_create_instance (in /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0.7600.1)
==4031== by 0x513F20F: ??? (in /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0.7600.1)
==4031== by 0x51407B7: g_object_new_with_properties (in /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0.7600.1)
==4031== by 0x5141560: g_object_new (in /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0.7600.1)
==4031== by 0x4E583CF: gncVendorCreate (gncVendor.c:459)
==4031== by 0x10A6A5: test_vendor (test-vendor.c:74)
...
==4029== Invalid read of size 8
==4029== at 0x4E41F15: gncEmployeeGetAddr (gncEmployee.c:642)
==4029== by 0x10A8A5: test_employee (test-employee.c:97)
...
==4029== Address 0x7e0c208 is 152 bytes inside a block of size 248 free'd
==4029== at 0x484620F: free (in /usr/libexec/valgrind/vgpreload_memcheck-amd64-linux.so)
==4029== by 0x51526C3: g_type_free_instance (in /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0.7600.1)
==4029== by 0x4E418D5: gncEmployeeFree (gncEmployee.c:477)
==4029== by 0x4E42144: emp_free (gncEmployee.c:714)
==4029== by 0x4E8611E: qof_commit_edit_part2 (qofinstance.cpp:1034)
==4029== by 0x4E4219E: gncEmployeeCommitEdit (gncEmployee.c:721)
==4029== by 0x4E41823: gncEmployeeDestroy (gncEmployee.c:459)
==4029== by 0x10A77F: test_employee (test-employee.c:79)
...
==4029== Block was alloc'd at
==4029== at 0x4848A13: calloc (in /usr/libexec/valgrind/vgpreload_memcheck-amd64-linux.so)
==4029== by 0x5033550: g_malloc0 (in /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0.7600.1)
==4029== by 0x5157CBC: g_type_create_instance (in /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0.7600.1)
==4029== by 0x513F20F: ??? (in /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0.7600.1)
==4029== by 0x51407B7: g_object_new_with_properties (in /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0.7600.1)
==4029== by 0x5141560: g_object_new (in /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0.7600.1)
==4029== by 0x4E416DA: gncEmployeeCreate (gncEmployee.c:434)
==4029== by 0x10A6FB: test_employee (test-employee.c:73)
...
==4028== Invalid read of size 8
==4028== at 0x4E3F641: gncCustomerGetAddr (gncCustomer.c:579)
==4028== by 0x10A8EE: test_customer (test-customer.c:90)
...
==4028== Address 0x7e861b8 is 168 bytes inside a block of size 272 free'd
==4028== at 0x484620F: free (in /usr/libexec/valgrind/vgpreload_memcheck-amd64-linux.so)
==4028== by 0x51526C3: g_type_free_instance (in /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0.7600.1)
==4028== by 0x4E3EDD6: gncCustomerFree (gncCustomer.c:368)
==4028== by 0x4E3F57B: cust_free (gncCustomer.c:551)
==4028== by 0x4E8611E: qof_commit_edit_part2 (qofinstance.cpp:1034)
==4028== by 0x4E3F5D5: gncCustomerCommitEdit (gncCustomer.c:557)
==4028== by 0x4E3EC89: gncCustomerDestroy (gncCustomer.c:338)
==4028== by 0x10A7EC: test_customer (test-customer.c:71)
...
==4028== Block was alloc'd at
==4028== at 0x4848A13: calloc (in /usr/libexec/valgrind/vgpreload_memcheck-amd64-linux.so)
==4028== by 0x5033550: g_malloc0 (in /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0.7600.1)
==4028== by 0x5157CBC: g_type_create_instance (in /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0.7600.1)
==4028== by 0x513F20F: ??? (in /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0.7600.1)
==4028== by 0x51407B7: g_object_new_with_properties (in /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0.7600.1)
==4028== by 0x5141560: g_object_new (in /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0.7600.1)
==4028== by 0x4E3EB0D: gncCustomerCreate (gncCustomer.c:309)
==4028== by 0x10A768: test_customer (test-customer.c:66)
...
==4028== Invalid read of size 8
==4028== at 0x4E3F796: gncCustomerGetShipAddr (gncCustomer.c:633)
==4028== by 0x10A91D: test_customer (test-customer.c:91)
...
==4028== Address 0x7e86210 is 256 bytes inside a block of size 272 free'd
==4028== at 0x484620F: free (in /usr/libexec/valgrind/vgpreload_memcheck-amd64-linux.so)
==4028== by 0x51526C3: g_type_free_instance (in /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0.7600.1)
==4028== by 0x4E3EDD6: gncCustomerFree (gncCustomer.c:368)
==4028== by 0x4E3F57B: cust_free (gncCustomer.c:551)
==4028== by 0x4E8611E: qof_commit_edit_part2 (qofinstance.cpp:1034)
==4028== by 0x4E3F5D5: gncCustomerCommitEdit (gncCustomer.c:557)
==4028== by 0x4E3EC89: gncCustomerDestroy (gncCustomer.c:338)
==4028== by 0x10A7EC: test_customer (test-customer.c:71)
...
==4028== Block was alloc'd at
==4028== at 0x4848A13: calloc (in /usr/libexec/valgrind/vgpreload_memcheck-amd64-linux.so)
==4028== by 0x5033550: g_malloc0 (in /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0.7600.1)
==4028== by 0x5157CBC: g_type_create_instance (in /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0.7600.1)
==4028== by 0x513F20F: ??? (in /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0.7600.1)
==4028== by 0x51407B7: g_object_new_with_properties (in /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0.7600.1)
==4028== by 0x5141560: g_object_new (in /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0.7600.1)
==4028== by 0x4E3EB0D: gncCustomerCreate (gncCustomer.c:309)
==4028== by 0x10A768: test_customer (test-customer.c:66)
...
==7520== Invalid read of size 8
==7520== at 0x4E36DCC: guid_copy (guid.cpp:123)
==7520== by 0x1E3E62: KvpValueImpl::duplicate(KvpValueImpl const&) (kvp-value.cpp:378)
==7520== by 0x1E31CC: KvpValueImpl::KvpValueImpl(KvpValueImpl const&) (kvp-value.cpp:36)
==7520== by 0x1FF6C3: KvpValueTest_Copy_Test::TestBody() (test-kvp-value.cpp:74)
...
==7520== Address 0x7e10f48 is 8 bytes inside a block of size 16 free'd
==7520== at 0x4846AFF: operator delete(void*, unsigned long) (in /usr/libexec/valgrind/vgpreload_memcheck-amd64-linux.so)
==7520== by 0x4E36D98: guid_free (guid.cpp:115)
==7520== by 0x1E3D04: void delete_visitor::operator()<_gncGuid*>(_gncGuid*&) (kvp-value.cpp:358)
...
==7520== Block was alloc'd at
==7520== at 0x4843FA3: operator new(unsigned long) (in /usr/libexec/valgrind/vgpreload_memcheck-amd64-linux.so)
==7520== by 0x4E36D5C: guid_malloc (guid.cpp:105)
==7520== by 0x4E36DC3: guid_copy (guid.cpp:122)
==7520== by 0x4E36EB0: guid_new (guid.cpp:153)
==7520== by 0x1FF4DB: KvpValueTest_Copy_Test::TestBody() (test-kvp-value.cpp:68)
Report options need to be saved when they're different from the
defaults, book options need to be saved when their value changes
regardless of whether it's the default value. That's dirty. Implement
it.
Make counters explicitly integer type and adjust the kvp load and save functions
to recognize that and behave accordingly so that other range options like day
threshold aren't affected.
- Also, remove unnecessary "static" in gnucash-style.c
The second one in guid.cpp is UB:
libgnucash/engine/guid.cpp:137:5: warning: undefined behavior, source object type 'const gnc::GUID' is not TriviallyCopyable [bugprone-undefined-memory-manipulation]
memcpy (&target, &source, sizeof (GncGUID));
^
A TXN_TYPE_PAYMENT will have non-APAR splits; a TXN_TYPE_LINK will not
have non-APAR splits. This bug manifests as a regular TXN_TYPE_PAYMENT
transaction being later voided being incorrectly changed to
TXN_TYPE_LINK.
The scrubbing routines are transaction oriented. Instead of
xaccAccountTreeScrubImbalance calling xaccAccountScrubImbalance for
each descendant, refactor so that the transaction list is generated
only once. The scrubbing is faster and progress bar is more accurate.
Bug 798930 caused some counters to be saved as KVP double. If the
correct int64_t value isn't found when reading, or if a double is
encountered when loading the option dialog, get the double value
and cast it to int64_t.
It was failing to produce a correct representation for input with more than
14 digits after the decimal poin. Fixes Bug 798916. The bug was in
powten so this fix may corect other problems too. For example conversion
of GncNumeric back to a string also failed in certain circumsances.
==515314== Invalid read of size 1
==515314== at 0x484AD67: __strcmp_sse42 (in /usr/libexec/valgrind/vgpreload_memcheck-amd64-linux.so)
==515314== by 0x171D36: do_test_list_handler (unittest-support.c:181)
==515314== by 0x171DCE: test_list_handler (unittest-support.c:197)
==515314== by 0x51BD4C1: g_logv (in /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0.7600.1)
==515314== by 0x51BD7A2: g_log (in /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0.7600.1)
==515314== by 0x4D5D0D9: xaccSplitEqualCheckBal (Split.c:753)
==515314== by 0x4D5D841: xaccSplitEqual (Split.c:869)
==515314== by 0x4D647A5: xaccTransEqual (Transaction.c:981)
==515314== by 0x15C0E8: test_xaccTransEqual(Fixture*, void const*) (utest-Transaction.cpp:901)
...
==515314== Address 0x8725260 is 0 bytes inside a block of size 59 free'd
==515314== at 0x484620F: free (in /usr/libexec/valgrind/vgpreload_memcheck-amd64-linux.so)
==515314== by 0x15BDB1: test_xaccTransEqual(Fixture*, void const*) (utest-Transaction.cpp:883)
...
==515314== Block was alloc'd at
==515314== at 0x4843828: malloc (in /usr/libexec/valgrind/vgpreload_memcheck-amd64-linux.so)
==515314== by 0x5618677: __vasprintf_internal (vasprintf.c:116)
==515314== by 0x520E8C1: g_vasprintf (in /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0.7600.1)
==515314== by 0x51DBBE0: g_strdup_vprintf (in /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0.7600.1)
==515314== by 0x51DBC9C: g_strdup_printf (in /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0.7600.1)
==515314== by 0x15BBAC: test_xaccTransEqual(Fixture*, void const*) (utest-Transaction.cpp:879)
...
ok 78 /engine/Transaction/xaccTransEqual
Thanks, Valgrind:
==515314== Invalid read of size 8
==515314== at 0x4ED46F3: gncInvoiceRemoveEntries (gncInvoice.c:767)
==515314== by 0x142B35: teardown_with_invoice (utest-Invoice.c:274)
...
==515314== Address 0x8557b98 is 8 bytes inside a block of size 24 free'd
==515314== at 0x484620F: free (in /usr/libexec/valgrind/vgpreload_memcheck-amd64-linux.so)
==515314== by 0x51B565D: g_list_remove (in /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0.7600.1)
==515314== by 0x4ED42EF: gncInvoiceRemoveEntry (gncInvoice.c:688)
==515314== by 0x4ED46A2: gncInvoiceRemoveEntries (gncInvoice.c:781)
==515314== by 0x142B35: teardown_with_invoice (utest-Invoice.c:274)
...
==515314== Block was alloc'd at
==515314== at 0x4843828: malloc (in /usr/libexec/valgrind/vgpreload_memcheck-amd64-linux.so)
==515314== by 0x51BD948: g_malloc (in /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0.7600.1)
==515314== by 0x51B1CB9: ??? (in /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0.7600.1)
==515314== by 0x4ED4271: gncInvoiceAddEntry (gncInvoice.c:676)
==515314== by 0x142401: setup_with_invoice (utest-Invoice.c:142)
...
ok 57 /engine/gncInvoice/post trans - vendor bill