Commit Graph

2210 Commits

Author SHA1 Message Date
John Ralls
8546aa975e Revert "Fix two use-after-free issues found by address sanitizer."
This reverts commit 4dbf803041.

The use-after free errors are caused by the compiler reordering the
steps in xaccSplitFree and Transaction's do_destroy. Unfortunately the
corrections here caused trouble in other places, leading to test failures.
2024-02-19 21:11:54 -08:00
John Ralls
4dbf803041 Fix two use-after-free issues found by address sanitizer. 2024-02-19 14:33:43 -08:00
John Ralls
266ae2a931 Bug 798946 - start/end of current/last quarter have off-by-one error
Calculating the quarter offset when the current month is less than the
beginning month of the fiscal year was inverted.
2024-02-17 12:52:17 -08:00
Vincent Lucarelli
f5b7bf3401 removed old_internal_name from gnc_quote_source_s (deprecated) 2024-02-17 22:52:40 +08:00
Christopher Lam
9035391907 [test-commodities.cpp] add some tests for gnc_quote_sources 2024-02-17 22:43:52 +08:00
Christopher Lam
03c5309666 [gnc-lot.cpp] convert to cpp 2024-02-09 17:23:51 +08:00
Christopher Lam
7d8d8f83be [Recurrence.cpp] convert to cpp 2024-02-09 17:23:51 +08:00
Christopher Lam
783c3df3c0 [Transaction.cpp] convert to cpp 2024-02-09 17:23:51 +08:00
Christopher Lam
fc5d7f872e [Split.cpp] convert to cpp 2024-02-09 17:23:51 +08:00
Christopher Lam
698cc23051 Add #ifdef __cplusplus extern "C" {} wrappers to .h files 2024-02-08 21:26:47 +08:00
Christopher Lam
928f9245e6 [gtest-gnc-numeric] add operator comparisons
with example int64 numbers
2024-01-29 08:55:56 +08:00
Christopher Lam
a301544376 Merge branch 'stock-acct-metadata' into stable #1858 2024-01-27 14:26:13 +08:00
Christopher Lam
688032b590 [app-utils/gnc-ui-balances.cpp] convert to cpp 2024-01-27 03:45:11 +08:00
Christopher Lam
9782918586 [account.cpp] add more account metadata - assoc account
the tag denotes the type of associated account eg. "dividend"
"capgains" "cash" "fees"
2024-01-26 20:54:20 +08:00
Alex Aycinena
54da44b3ca Update Form/Schedule line references for 2023 for the US Income Tax Report 2024-01-16 11:44:10 -08:00
John Ralls
c87d480b0d Move gnc_list_formatter from gnc-date to gnc-ui-util.
It has nothing at all to do with dates.
2024-01-06 18:16:31 -08:00
John Ralls
d52d226e5b Convert gnc-ui-util to C++. 2024-01-06 18:08:39 -08:00
John Ralls
b2fa3ef106 Bug 799210 - Bad encoding of accented chars in account names in...
"Import CSV" wizard

In MSWin the UnicodeString(char*) ctor assumes that the input string
is encoded in the current codepage, but the input to
gnc_list_formatter is encoded in UTF8. Use the static class function
UnicodeString::fromUTF8 instead.
2024-01-06 10:30:14 -08:00
John Ralls
e22a57ad26 Merge John Ralls's 'asan' into stable. 2023-12-08 14:56:29 -08:00
John Ralls
6834cb5025 Implement coverage option
To use pass -DCMAKE_BUILD_TYPE=Debug or Asan -DCOVERAGE=ON and build as
usual, then do ninja lcov-initialize && ninja check && ninja
lcov-collect. The result will be a directory, <Builddir>/Coverage
containing lcov tracefiles, including an aggregate file gnucash.info
which you can use for further processing. It will also report an overall summary.
Note that only C/C++ files are included.

There's one more target, lcov-generate-html, that you can run after
lcov-collect. It will generate a simple website in
<Builddir>/Coverage-HTML showing coverage by source directory (the
directories in <Builddir> have coverage for generated files). Each
directory path is a clickable link to a page that shows coverage for
each source file; the filenames link to a page for each showing which
lines have been exercised.
2023-12-08 14:53:02 -08:00
John Ralls
6bc12898a8 GncDate: Remove now-superfluous base parameter. 2023-12-08 13:49:28 -08:00
John Ralls
1e289cb2b8 GncDate: Remove pointless normalize_month function.
Suggested by Sherlock.
2023-12-08 13:47:24 -08:00
John Ralls
966cef19aa Bug 799156 - normalize_struct_tm() does not normalize seconds,...
minutes, and hours correctly.

Fix proposed by Sherlock.
2023-12-08 13:45:04 -08:00
John Ralls
5005c3cac8 Merge Sherlock's 'bug799151' into stable. 2023-12-07 17:31:33 -08:00
Sherlock
ae8492d73a Update test-gnc-date.c 2023-12-07 17:31:19 -08:00
Sherlock
5a7b6e9814 Bug 799151 - gnc_date_get_last_mday () does not account for,,,
leap years correctly.
2023-12-07 17:30:08 -08:00
Sherlock
07e94b4222 Bug 799152 - normalize_reldate_tm() does not handle dates with...
months greater than 11 or less than -11 correctly.
2023-12-07 16:53:05 -08:00
John Ralls
d8dacb86b2 Bug 799143 - FTBFS on 32bit architectures
Fix misuse of GUINT_TO_POINTER in 5e09b66.
2023-11-28 01:47:12 +00:00
John Ralls
92de074e49 Bug 799144 - Date Completion is broken after 5.4 upgrade
strptime will reasonable return false for an incomplete date but it
still fills in the parts of the struct tm that it understands, so bail
out of qof_scan_date_internal when it fails only if all three fields
are present.
2023-11-26 09:23:58 -08:00
John Ralls
ed4921271c Bug 799134 - Fails to build with GCC 14 (‘find_if’ is not a member...
of ‘std’; did you mean ‘find’)
2023-11-21 15:27:04 -08:00
Christopher Lam
1d26d99ddb [gnc-budget] use std::optional<gnc_numeric> instead of bool+gnc_numeric
more expressive
2023-11-18 08:59:32 +08:00
John Ralls
dd0b72cdb5 Fix global array index out of range.
Tests must set the account type to avoid errors in xaccAccountOrder.
2023-11-17 15:20:29 -08:00
Christopher Lam
fdcb8b46bd [sixtp-dom-generators.cpp] char* must be freed 2023-11-11 12:45:57 +08:00
Christopher Lam
8f7eecd3e9 Merge branch 'icu-list-formatter' into stable #1791 2023-11-10 18:58:35 +08:00
Christopher Lam
9e47c297ba Merge branch 'plug-recurrence-to-string' into stable #1812 2023-11-07 06:28:39 +08:00
Christopher Lam
6940488d2d recurrencePeriodTypeToString and recurrenceWeekendAdjustToString g_strdup only when necessary
... for sql use only. xml use assumes they return a const char*.
2023-11-06 14:12:17 -08:00
Christopher Lam
12f4233396 recurrencePeriodTypeToString and recurrenceWeekendAdjustToString g_strdup only when necessary
... for sql use only. xml use assumes they return a const char*.
2023-11-06 17:37:17 +08:00
Adam Wight
fbc183a544 Always return an allocated gchar*
Returning the literal string will cause the caller to free unallocated
memory.
2023-11-05 23:58:01 +01:00
John Ralls
f67b53a440 Xml backend tests: Use libgnc-backend-xml-utils instead of sources.
Every test was rebuilding it except for gnc-backend-xml.cpp from
scratch, no point in that plus the Address Sanitizer needs the
definition of GncBackendXml.
2023-11-02 12:58:55 -07:00
John Ralls
fa119f8d17 Split test other 2023-11-02 12:58:55 -07:00
John Ralls
e17ba3cc00 Fix UAF in xaccFreeSplit.
xaccSplitComputeCapGains creates gains_split pointers in both the Cap Gains Split and its Income split to the original split, but the original's gains_split pointer can point to only one of them, the Cap Gains split. When the original split is freed both the Cap Gains split's and its Income split need their gains_split pointers NULLed or when it's the Income split's turn to be freed it will try to deref the dangling pointer.
2023-11-02 12:58:55 -07:00
John Ralls
2234fa433e Add Asan build type that enables the Address and UB sanitizers.
Uses generator statements instead of CMAKE_<TYPE>_FLAGS_ASAN to support multiconfig generators like Xcode.
2023-11-02 12:58:46 -07:00
Christopher Lam
d617129db8 avoid strlen where possible
if testing emptiness, test *str instead.
2023-11-01 22:43:16 +08:00
Simon Arlott
90c9aaf4cb
Bug 799108 - "Since Last Run" crashes if there are any errors creating a scheduled transaction
Pass a creation_errors list to gnc_sx_instance_model_effect_change() so
that errors creating SX can be stored, and then display them.
2023-10-21 20:39:23 +01:00
John Ralls
4592530318 Bug 799099 - Crash when trying to get quotes
The comment on gnc_pricedb_add_price says that writing to the
GNCPrice* after calling it will produce interesting results, and
calling gnc_price_commit_edit and g_object_unref both qualify, so
remove those calls and the corresponding gnc_price_begin_edit.
2023-10-20 08:46:57 -07:00
Sherlock
52f1076b30
Bug 799104 - "Asset Chart" broken 2023-10-13 16:58:54 -07:00
John Ralls
44c278a82c Fix GncDateEntry date parsing oddities.
The intent was always to default to today if the input string isn't
parsable, but two problems prevented that: First,
qof_scan_date_internal didn't check the return value of strptime and
return FALSE if it failed and second gnc_date_edit_get_date_internal
would unnecessarily munge a valid struct tm from gnc_tm_get_today_neutral.
2023-10-12 15:51:35 -07:00
John Ralls
a389e0a32e Bug 799092 - GnuCash 5.4 leaves background process running on exit
Clear the schema_hash at app shutdown via gnc_prefs_remove_registered
and make that function available to the Python bindings so that
python programs can do so too.
2023-10-02 12:31:59 -07:00
Christopher Lam
ab7ead39ca use icu::ListFormatter to combine a list strings into a string 2023-10-02 17:52:54 +08:00
Christopher Lam
d1b2368f4d Merge Yongun Seong's branch 'utest-gnc-pricedb-types' into stable #1784 2023-09-27 22:16:39 +08:00