Commit Graph

2106 Commits

Author SHA1 Message Date
John Ralls
8ccc6da87e Merge Richard Cohen's 'fix-test-engine-crash' into stable. 2023-05-17 21:20:44 -05:00
John Ralls
26162da450 Merge Richard Cohen's 'cleanup-build' into stable. 2023-05-17 21:16:09 -05:00
John Ralls
46e9fcf037 Merge Richard Cohen's 'cleanup-ui-files' into stable. 2023-05-17 12:18:54 -05:00
Richard Cohen
81fba56bbb Initialise guids in test-engine-kvp-properties.c
Valgrind: Conditional jump or move depends on uninitialised value(s)
2023-05-15 20:03:23 +01:00
Richard Cohen
bed43c7f3b Fix potential crash in test-engine
==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
2023-05-15 20:03:23 +01:00
Richard Cohen
dc62959553 Fix crash in test-engine on Arch
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
2023-05-15 20:03:23 +01:00
Richard Cohen
3c34a61776 Remove #pragma ... "-Wformat-nonliteral"
Seems to have been accidentally left behind when time64_to_string()
was (re)moved
2023-05-15 13:21:30 +01:00
Richard Cohen
1f43bbc798 Remove #pragma ..."-Wstrict-aliasing"
G_LOCK was fixed in glib 2.19.8

See https://bugzilla.gnome.org/show_bug.cgi?id=316221
2023-05-15 13:21:30 +01:00
Richard Cohen
80e9d9c35d scanf supports %lld since C++11, C99 2023-05-15 13:21:30 +01:00
Richard Cohen
7f1ce2b5e5 Remove references to cutecash 2023-05-15 13:21:29 +01:00
Richard Cohen
b3e3eb3166 By default, filter out online_wiggle in test-gnc-quotes
The test relies on a lot of external dependencies
- installed finance-quote-wrapper
- alpha vantage key
- network
- working remote server

Running ./bin/test-gnc-quotes from the command line
will still include online_wiggle
2023-05-14 14:25:01 +01:00
Richard Cohen
1fe097bd5f Update gnc-plugin-example-ui.xml 2023-05-14 14:09:59 +01:00
Richard Cohen
4df662afae Fix the typo in function name "new_query_for_addresss" 2023-05-13 13:08:07 +01:00
Richard Cohen
3957272ef0 Fix some typos in comments 2023-05-13 13:00:25 +01:00
John Ralls
9b95419608 Fix glib include. 2023-05-11 11:56:23 -07:00
John Ralls
d696f0cfcb Bug 798885 - Accented character in folder name on Account Export (bis)
Pass a boost::filesystem's c_str() rv to the ofstream constructor to
keep libstdc++ from transcoding it back to UTF8 and creating a broken
name or failing to match the directory name. Implemented in
gnc-filepath-utils to avoid spreading the boost::filesystem dependency
throughout the code base.

See https://github.com/boostorg/filesystem/issues/181 for why other
approaches don't work.
2023-05-08 13:35:21 -07:00
John Ralls
bb423e4484 Merge CrfzdPQM6's 'b_betterCurrencyBudgetReporting' into stable. 2023-04-29 12:04:45 -07:00
Daniel Johnson
04b0317119 Demonstrate fx handling in budget report 2023-04-29 12:01:36 -07:00
John Ralls
df878c6a3d Merge Maarten Bosmans's 'memleak-fixes' into stable. 2023-04-29 11:54:41 -07:00
Maarten Bosmans
71802b5627 [test] Fix memory leak in test-gnc-quotes
When the commodity table is registered, the current book will get
a default table assigned.  When later setting the table explicitly
using qof_book_set_data() the exisiting table gets overwritten and
is thus leaked.

There is no way of removing or freeing a currency table from a book,
so the best we can do here is to set our own table on the book before
calling gnc_commodity_table_register().
2023-04-29 11:52:12 -07:00
Maarten Bosmans
6be682b645 Store allocated temporaries in a variable so they can be freed
If a function that returns an allocated pointer is passed directly into
something that does not take ownership of the pointer, the allocation is
leaked.  This can be fixed by assigning the pointer to a new variable
and freeing it after operation on the memory.
2023-04-29 11:51:43 -07:00
Christopher Lam
1a7fcb69c0 [gnc-features.cpp] remove_if requires <algorithm> 2023-04-29 08:17:22 +08:00
John Ralls
8481f062d4 Create obsolete features list with first member book_currency.
Obsolete features set in the book will be removed from the book's
KVP and ignored. Note the warning in the comment!
2023-04-28 17:08:04 -07:00
John Ralls
0d175dce12 Refactor gnc-features.
* type aliases to gnc-features.h
* string_views to avoid copying (all of the strings are static)
* qof_book_get_unknown_features returns a FeatureSet
2023-04-28 16:31:07 -07:00
John Ralls
e8c80f2f5c Restore existence, but not implementation, of GNC_FEATURE_BOOK_CURRENCY.
At least one user has managed to get it set on their book so even
though it was supposed to be unimplemented it got through somehow.
Restoring it allows books with it set to load.
2023-04-28 14:15:59 -07:00
John Ralls
9ff2362bb0 Merge Muhammadyusuf Kurbanov's 'uz-currency-fix' into stable. 2023-04-28 12:50:48 -07:00
Robert Fewell
fb58959f9a Bug 798885 - Accented character in folder name on Account Export
Changed export_coa to use g_fopen instead of fopen
2023-04-28 09:55:57 +01:00
Muhammadyusuf
02e24ccf96
edit: use &apos; instead of ` symbol 2023-04-24 02:04:35 +05:00
Muhammadyusuf
dca596ac84
edit: Fix local symbol of uzbek sum 2023-04-24 01:49:23 +05:00
Christopher Lam
e26c3d6cf4 [gnc-ui-balances.c] gnc_ui_account_get_balance_limit_explanation
returns a char* explanation, or NULL
2023-04-22 14:22:40 +08:00
Vincent Dawans
761d7f29a5 Bug 765920 - Running balance not accurate when sorted different ways
- Renamed option to "Account Balance" to avoid confusion with running
  total.
- Added helper function to ensure running balance and balance forward
  are only shown when transaction are grouped by account and sorted as
  in register. In that case column heading remains "Running Balance"
  and balance forward is shown. Otherwwise column heading is renamed
  "Account Balance" and balance forward is not shown.
- Also added missing code for Common Currency conversion.
2023-04-21 09:13:16 -07:00
John Ralls
4a5b897d89 Bug 798863 - Crash on clicking Settings button second time
Ensure that dialog resources stored in options are freed when the
dialog is destroyed.

The crash happened when a new dialog replaced the old one on the options
and the old one's destructors tried to access a dangling reference to
a GtkWidget.
2023-04-20 20:08:38 -07:00
John Ralls
f4f481fe38 Bug 798812 - crashes after I open a customer report and select…
Edit/Report Options

As a result of auto instead of auto& in a std::visit call which
resulted in a temporary option whose GncOwner* was destroyed before
we could use it.
2023-04-15 13:29:40 -07:00
Robert Fewell
0d84506a5e Bug 798851 - Account Balance 'include subaccounts' not saved
The defaults for the account were removed by mistake in a previous
commit, added them back.
2023-04-12 11:20:32 +01:00
John Ralls
2f471e65a7 Bug 798802 - Online Price quote - Stocks not working GNU 5.0 Windows Bis
The previous change of the delimiter between namespace and symbol
is needed in both overloads of GncQuoteImpl::query_fq.

Also log the query json string to ease future troubleshooting.
2023-04-09 15:24:53 -07:00
Maarten Bosmans
0d86be6d2a [test] Properly destroy resources on end of tests
This fixes memory leaks that are only present in testing code.
Not very useful on itself, but it does make it easier to fix memory
leaks and other AddressSanitizer problems in actual gnucash code later.
2023-04-02 21:12:50 +02:00
Maarten Bosmans
ed3fe00880 [test] Use test fixture to initialize and destroy resources 2023-04-02 21:12:50 +02:00
Maarten Bosmans
35aeed45ec [engine] Remove two replace functions from KvpValue
These were not used outside a test.

And that test was not leak free, as a result of the functions not doing
what they are supposed to do when the current value is not of the type
that is expected. (NULL is returned, but the value is not replaced)
2023-04-02 21:12:50 +02:00
Maarten Bosmans
bd94965d9b [backend/xml] Remove unused string copy 2023-04-02 21:12:50 +02:00
Richard Cohen
6ba5bb326a Fix dereference of expired temporaries.
Reported by clang 15.0.7, which will be in Ubuntu 23.04, -Wdangling-gsl
2023-03-31 11:27:33 -07:00
Richard Cohen
9fa2a48fe1 Fix build on gcc-8 & 9.
See https://lists.gnucash.org/pipermail/gnucash-devel/2023-March/046617.html
2023-03-30 18:25:23 -07:00
John Ralls
0d598d51ed Fix Finance::Quote use on Win32.
By dealing with Win32 \r\n newlines on return from finance-quote-wrapper.
2023-03-30 16:45:01 -07:00
John Ralls
a587dfff2c Bug 798802 - Online Price quote - Stocks not working GNU 5.0 Windows
Change the property-tree path delimiter for constructing paths from
'.' that's commonly used in stock symbols, to '|' that isn't.
2023-03-29 20:01:10 -07:00
Christopher Lam
bdf79f7721 Merge branch 'master-fileopen-filter' into stable #1576 2023-03-27 12:48:52 +08:00
John Ralls
89f41a305c Merge new potfile reflecting string changes. 2023-03-24 14:28:24 -07:00
John Ralls
576fc9b52c Fix quotes on Windows.
Boost process wchar_t conversion chokes if it's fed an empty string.
This would happen when the user had no alphavantage key. Separate
the process invocation to not present the empty value to boost process.
2023-03-19 10:32:26 -07:00
John Ralls
90e1e2d1c3 Merge Bob Fewell's 'bug798558' into master. 2023-03-19 10:11:42 -07:00
John Ralls
0c3e85404d Avoid crash from trying to free an unallocated char*. 2023-03-19 10:09:01 -07:00
Christopher Lam
97f0653238 [gnc-quotes] g_free a char* from gnc_prefs_get_string
ultimately gets char* from g_settings_get_string and must be freed
2023-03-20 00:40:41 +08:00
Robert Fewell
a576dd87a4 Bug798558 - Irregular line spacing in Account Tree View
When securities are in the list, the rows look twice as high as though
there is a linefeed at the end. This is partly due to commit for bug
797501 which worked at the time but a change in pango 50.4 to do with
wrapping has highlighted this bug.

To fix this only wrap currencies with ltr bidi isolate characters in
gnc_print_amount_with_bidi_ltr_isolate
2023-03-19 13:53:41 +00:00
John Ralls
00c560d8f5 Move operator==(const GncGUID&, const GncGUID&) to guid.[ch]pp. 2023-03-18 13:53:49 -07:00
John Ralls
352ab8a0e5 Merge Richard Cohen's 'minor-options-fixes' into master. 2023-03-18 12:19:50 -07:00
John Ralls
d192be5307 Merge Richard Cohen's 'cleanup-cflags-deprecated' into master. 2023-03-18 10:07:25 -07:00
Richard Cohen
24f52d9b17 Remove incorrect operator!= for GncItem
It's better to use the default std::pair implementation

- spotted by clang-tidy bugprone-suspicious-string-compare
- will always return false, because type is the same

Also,
- remove redundant "using GncItem ..."
2023-03-17 16:50:17 +00:00
Richard Cohen
b5f3f99035 Fix incorrect use of remove_if()
- spotted by clang-tidy bugprone
- probably no visible effects because of uniqueness, and other checks

libgnucash/engine/gnc-optiondb.cpp:149:5: warning: this call will remove at most one item even when multiple items should be removed [bugprone-inaccurate-erase]
    m_options.erase(std::remove_if(m_options.begin(), m_options.end(),
    ^

libgnucash/engine/gnc-optiondb.cpp:358:5: warning: the value returned by this function should be used [bugprone-unused-return-value]
    std::remove_if(m_callbacks.begin(), m_callbacks.end(),
    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
libgnucash/engine/gnc-optiondb.cpp:358:5: note: cast the expression to void to silence this warning
2023-03-17 16:50:11 +00:00
John Ralls
b4b8431984 Bug 798778 - GnuCashquits abruptly when attempting to edit options…
for certain reports.

Those reports being ones using complex options, apparently because
the callbacks weren't protected from Guile's garbage collector.

So replace the anyway ugly hack of a void* with a std::any wrapping
a class holding a std::unique_ptr with a custom deleter. The
constructor calls scm_gc_protect_object on the SCM containing the
callback and the custom deleter calls scm_gc_unprotect_object. The
copy constructor, required for std::any, makes a new std::unique_ptr
and calls scm_gc_protect_object again ensuring that the protect and
unprotect calls are symmetrical.

Meanwhile std::any hides the Guile dependency from all the classes
that don't need to know about it. The only ugliness is that there's
no good place to put a common implementation of SCNCallbackWrapper so it's
repeated in gnc-optiondb.i and dialog-options.cpp.
2023-03-16 17:50:06 -07:00
Christopher Lam
dd0d65d861 [1/2] [gnc-filepath-utils.cpp] gnc_filename_is_backup|datafile
uses std::regex to test filename
2023-03-16 18:01:09 +08:00
Richard Cohen
30586ac3e6 Push -Wno-error=deprecated-declarations from C*_FLAGS down to the target 2023-03-15 10:34:14 +00:00
Geert Janssens
1f0a69a804 Properly parse plus signs while importing numbers
Silly copy/paste error.
2023-03-15 08:58:07 +01:00
John Ralls
a44b3664e2 [c++options] Implement GncOptionGncOwnerValue class.
GncOwners aren't QofInstances and have limited lifetimes so an option
must hold its own, wrapped in std::unique_ptr for memory management.
2023-03-14 16:11:39 -07:00
John Ralls
8db8105850 [c++options] Warn when an option variant type's set_value isn't found. 2023-03-14 16:11:39 -07:00
John Ralls
83829e6513 Merge branch 'maint' 2023-03-14 10:43:45 -07:00
John Ralls
1020bde89c Fix crashes in test-engine on Arch Linux.
Root cause is mutating a list while it's iterating. We're able to
protect it in two cases, have to copy it in xaccTransScrubGainsDate.
2023-03-14 10:33:39 -07:00
Geert Janssens
d75ab275f1 Eliminate gnc-csv-account-map.[ch]
The code is was only used by the csv import assistant and forced
gtk as a dependency on gnc-imp-props-tx

Part has been moved to Account, other bits have
been moved to the importer code where they were
used.
2023-03-13 19:58:10 +01:00
Geert Janssens
13ec4bb594 xaccParseAmount... - some code cleanups
- declare at first use
- compact tests
- reduce use of {}
2023-03-13 19:58:10 +01:00
Geert Janssens
8010d9646c Restore proper indentation
It got mixed up while refactoring the various xaccParseAmountXYZ functions
2023-03-13 19:58:10 +01:00
John Ralls
07d8ebd90c Add JSON::Parse to gnc-fq-update.
Required by finance-quote-wrapper to interpret quoter output.
2023-03-10 12:51:30 -08:00
Richard Cohen
329a2f7d42 Guard against some possible null pointer dereferences
Found by gcc 12 when compiling with "-O2 -Wnull-dereference"
2023-03-08 11:00:56 +00:00
Richard Cohen
3a7464a312 Remove redundant uses of cmake -E env
- In GncAddTest, set_tests_properties() is already setting the env
- In the other uses, there is no change to the environment
2023-03-07 15:44:43 +00:00
John Ralls
cdb674ebf1 [c++options]Really fix the gnc_option_db_lookup_string_value leak
By deleting the function and using GncOptionDbImpl::lookup_string_option
directly. It returns a string that we don't have to worry about
memory-managing.

Also create a new GncOptionDbImpl::set_string_option to replace
gnc_option_db_set_string_value.
2023-03-06 11:43:50 -08:00
John Ralls
92071e8844 [c++options] Fix leak. 2023-03-05 10:14:20 -08:00
John Ralls
f735c64cac Merge Richard Cohen's 'extern-c-part2' into master. 2023-03-04 13:51:07 -08:00
Richard Cohen
7b47c07f8e Don't use extern "C" around #includes
Some I missed the first time. Some are new.
2023-03-03 18:55:42 +00:00
Frank H. Ellenberger
bdb12fd94f I18N: Change TaxTable to "Tax Table" for consistency 2023-03-03 09:58:01 -08:00
John Ralls
bbfa378783 Don't crash and do pass tests. 2023-03-02 17:03:39 -08:00
John Ralls
af02dae286 Fixups for merging into master instead of maint. 2023-03-02 17:02:46 -08:00
John Ralls
1eecb9f5c0 [c++ options] Fix locale dependency in test-gnc-option-scheme-output.
Created by using std::to_string() in GncOptionRangeValue::serialize.
It wraps sprintf that reads the locale. Use ostringstream instead.
2023-03-02 12:22:55 -08:00
Christopher Lam
76014f18a0 [account.cpp] don't cache char* [fails] 2023-03-01 23:58:22 +08:00
Christopher Lam
3d381eb6fd [gnc-lot] don't cache char* 2023-03-01 19:49:33 +08:00
Christopher Lam
50f998fad8 [gncInvoice] don't cache char* 2023-03-01 19:49:27 +08:00
Christopher Lam
c9dc71978b [gnc-commodity] don't cache char* 2023-03-01 19:49:20 +08:00
Christopher Lam
57fcaabd8f [Split.c] don't cache char* 2023-03-01 19:49:04 +08:00
Richard Cohen
be41bde58a Add missing MAKE_LINKS, and the local scm directory to %load-path
Before this change, "make check" would fail after
  rm -rf ${build}/share/guile/site/*/gnucash/
2023-02-28 11:51:23 +00:00
John Ralls
675d894128 Merge Richard Cohen's 'cleanup-options' into master. 2023-02-27 16:33:00 -08:00
John Ralls
ca73b00039 Merge Richard Cohen's 'cleanup-boost' into master. 2023-02-27 16:31:53 -08:00
John Ralls
3d5e27982f Merge branch 'maint' 2023-02-27 16:24:44 -08:00
John Ralls
7f0353adc4 Fix a missed g_value_dup_string and some no longer used variables. 2023-02-27 16:19:50 -08:00
John Ralls
8a7c539258 Bug 798748 - Transaction Notes field's value does not appear in...
reverse transaction.

The proximate cause was that xaccTransBeginEdit put the KVP cache
variable of the new transaction in a state that prevented the value
from being copied. More generally the KVP cache variables didn't
handle any invalidating events.

With the change to GValue usage in qof_instance_get_kvp it's now
a simple memory dereference with no copying except for POD types
so caching is no longer useful. This commit removes caching from
Transaction, eliminating the notes problem.
2023-02-27 14:54:46 -08:00
John Ralls
ddc3f28899 [kvp] Use static strings and boxed in gvalue_from_kvp_value.
Saves allocating and copying complex values, avoiding potential
memory leaks.
2023-02-27 14:54:02 -08:00
Richard Cohen
9f06859390 Remove references to old boost versions
we already require 1.67
2023-02-27 11:48:09 +00:00
Richard Cohen
3d995de2ab Refactor: use default GncOptionValue copy constructor 2023-02-27 11:46:39 +00:00
Richard Cohen
1b0af4246a Refactor: remove extra template parameter from member functions 2023-02-27 11:46:34 +00:00
Richard Cohen
87c52f53fa Update some references to hello-world.scm 2023-02-27 11:36:04 +00:00
Richard Cohen
ec169e6e24 Fix some non-translatable typos 2023-02-27 11:32:12 +00:00
Christopher Lam
47b85d3b2f [gnc-xml-backend.cpp] g_free char* from g_path_get_dirname 2023-02-27 09:18:01 +08:00
Christopher Lam
89e2bef427 Merge branch 'maint' 2023-02-26 13:51:33 +08:00
Christopher Lam
89e63ef672 Bug 798754 - Build fails with gcc 13 and glib > 2.76, ter 2023-02-26 08:30:14 +08:00
John Ralls
6ab7b16d62 [c++options] Restore the ability to set plot sizes in pixels.
Enable and fix the previously untested GtkOptionGtkUIItem::PLOTSIZE.

This has the potentially unfortunate side effect that integer range
options are assumed to be plot sizes. That's correct for now, but
if some report comes along that needs an integer range option for
something else it will have to be differentiated.
2023-02-25 16:25:36 -08:00
Christopher Lam
abcce5000c Bug 798754 - Build fails with gcc 13 and glib > 2.76, bis 2023-02-25 13:12:35 +08:00
Geert Janssens
26482f397b Bug 797033 - The CSV Importer should not obey with the "automatic digital point" setting
Expose variations of xaccParseAmount and
xaccParseAmountExtended that will ignore the
automatic decimal point user preference.
This preference is really only useful for manual number
entering in the register.

The xaccParseAmountImport variant replaces xaccParseAmountPosSign
which was used exclusively by the csv importers.
Like xaccParseAmountPosSign, this replacement has the flag
to ignore or parse the positive number indicator.
2023-02-24 23:02:15 +01:00
Frank H. Ellenberger
fcbda57a6b Merge branch 'maint' 2023-02-24 19:19:12 +01:00
John Ralls
184669f517 Bug 798754 - Build fails with gcc 13 and glib > 2.76
GLib 2.76 introduced a no-discard warning on g_string_free
if the second parameter is FALSE. This revealed a string
leak and a correct usage that didn't use the return value.
2023-02-23 09:47:37 -08:00
Geert Janssens
549c93e005 Fix test for import-backend
Another split function needed mocking
2023-02-23 12:33:31 +01:00
Richard Cohen
bddb4468fa Import GLIB2 as a target, and use it to simplify the CMakeLists 2023-02-21 12:59:42 +00:00
Robert Fewell
ec7cc27d6d Add tests for default invoice report book property 2023-02-21 10:48:34 +00:00
Robert Fewell
76f0e3a97e Add some PWARN messages to the default invoice report
book functions
2023-02-21 10:44:07 +00:00
Geert Janssens
8a23304283 GncGSettings - use bool as return type for static function 2023-02-17 18:10:35 +01:00
Geert Janssens
64329414e9 GncGSettings - cosmetic: NULL->nullptr 2023-02-17 14:08:20 +01:00
Geert Janssens
32ae47980c GncGSettings - some minor cleanups
- remove unused macros
- avoid manual counters
2023-02-17 14:02:34 +01:00
Geert Janssens
03aff5642a GncGSettings - rework signal handler manipulation
Use ref-counting to manage GSettings object lifecycle
Use g_signal_handler_handlers_[un]block_matched to
block or unblock handlers rather than tracking them in
our own hash table.
2023-02-17 14:02:34 +01:00
Geert Janssens
4761aa414c GncGSettings - reduce code duplication
Most getters and setters are identical with the exception of
the actual function to call into GSettings. Extract
boilerplate in two template functions and make all
getters/setters wrappers of these two functions.
2023-02-17 11:48:41 +01:00
Geert Janssens
edab41f23a GncGSettings - basic c++ cleanups
- declare at first use
- gboolean->bool (TRUE/true, FALSE/false)
2023-02-17 11:48:41 +01:00
Robert Fewell
a1d17518a8 Add a function to dump the schema entries when in debug
mode.
2023-02-17 10:15:23 +00:00
Robert Fewell
2306ef8ca6 On a new install, the gnc_gsettings_version_upgrade
would not run

When doing a new install, set the GNC_PREF_VERSION to the current
version.
2023-02-17 10:14:42 +00:00
Robert Fewell
57f874bd3f Change the behaviour of the gseettings migration
function

In the pref_transformations.xml file, when the release version is
greater than the current GnuCash version, do not process those changes.
2023-02-17 10:14:09 +00:00
Robert Fewell
ac0532bf5c Change the alignment of a function in gnc_gsettings.cpp 2023-02-16 14:23:52 +00:00
Robert Fewell
308c609904 Fix comment typo in gnc-gsettings.cpp 2023-02-16 14:23:51 +00:00
Geert Janssens
286e1afa41 Bug 798749 - Fails to read gsettings on startup
Only cache GSettings objects we need to keep
track of callback functions.
This means a bit more overhead per GSettings
interaction, but as typical interactions are
only a few objects at once at best, this
overhead is unnoticeable.
2023-02-16 22:40:36 +01:00
Richard Cohen
9c6ad222a9 [-Wunused-function] - remove 2023-02-16 09:20:59 +00:00
Richard Cohen
4eb022c7a2 [-Wunused-variable] - remove 2023-02-16 09:20:59 +00:00
Richard Cohen
8a20bcadb0 [-Wunused-variable] - remove unused translatable string 2023-02-16 09:20:59 +00:00
Richard Cohen
0dd406de10 [-Wunused-lambda-capture] (clang) - remove 2023-02-16 09:20:59 +00:00
Richard Cohen
0f3813e0fd [-Wunused-private-field] (clang) - remove
In file included from gnucash/gnome-utils/dialog-options.cpp:34:
gnucash/gnome-utils/dialog-options.hpp:55:10: warning: private field 'toplevel' is not used [-Wunused-private-field]
    bool toplevel;
         ^

In file included from gnucash/import-export/csv-imp/gnc-imp-props-price.cpp:42:
gnucash/import-export/csv-imp/gnc-imp-props-price.hpp:113:10: warning: private field 'created' is not used [-Wunused-private-field]
    bool created = false;
         ^

libgnucash/backend/dbi/gnc-dbisqlconnection.cpp:53:29: warning: private field 'm_conn' is not used [-Wunused-private-field]
    const GncSqlConnection* m_conn = nullptr;
                            ^
libgnucash/backend/sql/test/utest-gnc-backend-sql.cpp:81:33: warning: private field 'm_conn' is not used [-Wunused-private-field]
    const GncMockSqlConnection* m_conn;
                                ^
2023-02-16 09:20:18 +00:00
Richard Cohen
d4dfe4e279 [-Wunused-local-typedef] - remove
libgnucash/engine/test/utest-Account.cpp:2414:11: warning: typedef ‘using AcctTypeType = struct std::underlying_type<GNCAccountType>’ locally defined but not used [-Wunused-local-typedefs]
 2414 |     using AcctTypeType = std::underlying_type<GNCAccountType>;
      |           ^~~~~~~~~~~~
2023-02-16 09:19:19 +00:00
Richard Cohen
0798bce2a6 [-Wunused-value] - remove
borrowed/jenny/jenny.c: In function ‘next_builder’:
borrowed/jenny/jenny.c:1164:5: warning: statement with no effect [-Wunused-value]
 1164 |     for (i; i<n-1; ++i) {            /* reset all less significant positions */
      |     ^~~
borrowed/jenny/jenny.c:1172:5: warning: statement with no effect [-Wunused-value]
 1172 |     for (i; i<n-1; ++i) {            /* reset all less significant positions */
      |     ^~~
borrowed/jenny/jenny.c: In function ‘confirm’:
borrowed/jenny/jenny.c:1797:7: warning: statement with no effect [-Wunused-value]
 1797 |       for (i; i<n-1; ++i) {          /* reset all less significant positions */
      |       ^~~
borrowed/jenny/jenny.c:1805:7: warning: statement with no effect [-Wunused-value]
 1805 |       for (i; i<n-1; ++i) {          /* reset all less significant positions */
      |       ^~~

libgnucash/backend/xml/io-gncxml-v2.cpp: In function ‘gboolean qof_session_load_from_xml_file_v2_full(GncXmlBackend*, QofBook*, sixtp_push_handler, gpointer, QofBookFileType)’:
libgnucash/backend/xml/io-gncxml-v2.cpp:806:40: warning: value computed is not used [-Wunused-value]
  806 |                 g_thread_join (thread) != nullptr;
      |                 ~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~

libgnucash/engine/Account.cpp: In function ‘void xaccFreeAccount(Account*)’:
libgnucash/engine/Account.cpp:1428:17: warning: statement has no effect [-Wunused-value]
 1428 |     priv->color == nullptr;
      |     ~~~~~~~~~~~~^~~~~~~~~~
libgnucash/engine/Account.cpp:1429:22: warning: statement has no effect [-Wunused-value]
 1429 |     priv->sort_order == nullptr;
      |     ~~~~~~~~~~~~~~~~~^~~~~~~~~~
libgnucash/engine/Account.cpp:1430:17: warning: statement has no effect [-Wunused-value]
 1430 |     priv->notes == nullptr;
      |     ~~~~~~~~~~~~^~~~~~~~~~
libgnucash/engine/Account.cpp:1431:18: warning: statement has no effect [-Wunused-value]
 1431 |     priv->filter == nullptr;
      |     ~~~~~~~~~~~~~^~~~~~~~~~

libgnucash/engine/gnc-int128.cpp: In function ‘void decimal_from_binary(uint64_t*, uint64_t, uint64_t)’:
libgnucash/engine/gnc-int128.cpp:898:36: warning: right operand of comma operator has no effect [-Wunused-value]
  898 |     d[3] = (hi >> 32) & bin_mask, 0;
      |                                    ^
2023-02-16 09:19:19 +00:00
Richard Cohen
bd8e81f35c Move an unused variable into an #ifdef where it is used 2023-02-06 14:20:31 +00:00
Richard Cohen
1c6679720b Use some unused variables 2023-02-06 14:20:31 +00:00
Richard Cohen
78ec20515b Remove some unused variables - and the initialization
- checked that any side effects were irrelevant
2023-02-06 14:20:28 +00:00
Richard Cohen
c819b03a17 Remove some unused variables - leave the side effect 2023-02-06 14:19:29 +00:00
Richard Cohen
ea2d3be217 Remove some unused variables with obviously no side effects 2023-02-06 14:19:22 +00:00
Richard Cohen
4e25bbfc43 Mark some QofLogModules as potentially unused
- __attribute__((unused)) for C
- [[maybe_unused]] for cpp
2023-02-06 14:12:31 +00:00
Robert Fewell
45a07463fb Change max timeout to 20 seconds for default invoice report 2023-02-05 10:21:56 +00:00
Christopher Lam
85c2491664 Merge branch 'maint' 2023-02-05 12:09:38 +08:00
Geert Janssens
60209a766f Merge branch 'csv_import' 2023-02-04 19:13:16 +01:00
Geert Janssens
2d8bb6f62f Bug 796955 - Import CSV - Single-line two-currency transactions can't be imported
Behaviour is as follows:
If
  single line provides a price
And
  at some point in the import process we get into a
  situation where the base account and transfer
  account have a different commodity
Then
  transfer_acct amount = base_acct amount * price

If on the other hand base_acct and transfer_acct turn
out to have the same commodity, price is ignored.
2023-02-04 18:56:02 +01:00
Geert Janssens
99506d331a Reduce GncImportMatchMap to just the account
There is no added value in storing the book and account together
The book is easily retrieved from the account (as was
illustrated in the gnc_account_imap_new function).

I looked through the commit history to understand why this struct
was originally created and a long time ago it also had
a reference to a kvp frame.
2023-02-04 16:53:20 +01:00
Geert Janssens
51706f289c Minor corrections in comments 2023-02-04 16:43:46 +01:00
John Ralls
7bb14b9caa Merge Richard Cohen's 'use-reference-for-loop' into master 2023-02-02 14:32:14 -08:00
Robert Fewell
07f3f536cc Allow to select saved report on print invoice button
This change was inspired by mildred's #PR1247 and uses the new
GncReportCombo to allow selection of 'Saved Invoice reports' when the
invoice print button is used or when printing multiple invoices.

This change presents a dialog with the default for the report combo set
to the properties setting. This dialog has a timeout which is
adjustable under properties and will stop if a key is pressed or combo
popped so that a different report template can be selected and used.
There is also an 'OK' button that stops the time out and prints and a
'Cancel' button which cancels the print.
2023-02-02 14:05:53 +00:00
Robert Fewell
019214f1c2 Bug753307 - Custom Report be selectable as default Report for Printing
This commit changes the preference in Business->'Report for Printing'
to be saved as a book property and allow the selection of any Invoice
Report to be used as the default.
2023-02-01 16:29:11 +00:00
Richard Cohen
d8f45f2443 Use const references for for-loops to avoid unnecessary copies
Found by clazy - clazy-range-loop-reference
2023-01-31 14:44:57 +00:00
John Ralls
ce3447e6ea Bug 798740 - Build fails with gcc 13
Protect against passing an lseek failure rv to read().
2023-01-30 16:48:16 -08:00
Christopher Lam
119356752f Merge branch 'maint' 2023-01-30 09:56:13 +08:00
Geert Janssens
894f8241e1 Revisit invoice payment in multi-currency context
- Show proper amount in dialog when applying or editing an existing transaction as payment
- Be more careful not to waste the existing payment split
- If the user changed the payment amount while starting from an existing transaction
  unreconcile the changed payment split
- Avoid needlessly changing transaction currency (only do so if the user chose
  a new transfer account and the old currency is neither the new transfer account's
  currency nor the post account's currency)
2023-01-29 23:09:06 +01:00
John Ralls
44f4b55927 Merge Richard Cohen's 'fix-memleaks' into master. 2023-01-26 12:52:21 -08:00
Richard Cohen
846e75146a Fix some typos so that the correct tests are run
- test_gnc_txn_to_float_txn_cut_semantics
- test_dbi_business_store_and_reload
2023-01-26 15:42:13 +00:00
Richard Cohen
a2ffc7fe75 Fix memory leak in binreloc function _br_find_exe()
Ironically, it seems to be in a code path that
is only followed when using valgrind
2023-01-26 14:36:43 +00:00
luzpaz
67ab9e90d2 Fix some typos 2023-01-26 13:48:58 +01:00
Christopher Lam
17820ec261 Merge branch 'maint' 2023-01-26 18:40:44 +08:00
John Ralls
f4c6d65395 Merge Bob Fewell's 'nofree' into maint. 2023-01-24 13:25:02 -08:00