From 9c6ad222a907e86121cdfc4e48800b5da69bd810 Mon Sep 17 00:00:00 2001 From: Richard Cohen Date: Sat, 28 Jan 2023 16:22:16 +0000 Subject: [PATCH] [-Wunused-function] - remove --- gnucash/gnome-utils/dialog-account.c | 10 -- gnucash/gnome-utils/dialog-options.cpp | 11 -- gnucash/gnome-utils/gnc-cell-view.c | 2 - gnucash/gnome-utils/gnc-option-gtk-ui.cpp | 28 --- gnucash/gnome/dialog-imap-editor.c | 18 -- gnucash/gnome/dialog-payment.c | 7 - gnucash/gnome/gnc-plugin-budget.c | 2 - gnucash/gnome/gnc-plugin-page-invoice.c | 29 ---- gnucash/gnome/gnc-plugin-page-register.c | 20 --- .../csv-imp/gnc-imp-settings-csv-price.cpp | 22 --- .../import-export/import-account-matcher.c | 11 -- gnucash/import-export/import-backend.cpp | 58 ------- gnucash/import-export/import-main-matcher.c | 27 --- .../ledger-core/split-register-model.c | 11 -- .../register-gnome/gnucash-sheet-private.c | 24 --- .../register/register-gnome/gnucash-sheet.c | 13 -- libgnucash/app-utils/gfec.c | 6 - .../backend/dbi/test/test-dbi-stuff.cpp | 5 - libgnucash/backend/sql/gnc-slots-sql.cpp | 37 ---- .../backend/sql/gnc-transaction-sql.cpp | 162 ------------------ .../backend/xml/gnc-transaction-xml-v2.cpp | 10 -- libgnucash/engine/Transaction.c | 19 -- libgnucash/engine/gnc-optiondb.cpp | 49 ------ libgnucash/engine/policy.c | 37 ---- libgnucash/engine/qofobject.cpp | 6 - .../engine/test-core/test-engine-stuff.cpp | 40 ----- .../engine/test-core/test-engine-stuff.h | 1 - libgnucash/engine/test/test-gnc-date.c | 49 ------ libgnucash/engine/test/test-qofinstance.cpp | 9 - libgnucash/engine/test/test-qofsession.cpp | 7 - 30 files changed, 730 deletions(-) diff --git a/gnucash/gnome-utils/dialog-account.c b/gnucash/gnome-utils/dialog-account.c index 242d6734ac..4b0a598b31 100644 --- a/gnucash/gnome-utils/dialog-account.c +++ b/gnucash/gnome-utils/dialog-account.c @@ -1524,16 +1524,6 @@ opening_equity_cb (GtkWidget *w, gpointer data) gtk_widget_set_sensitive (aw->transfer_account_scroll, !use_equity); } -static void -gnc_name_entry_realize (GtkWidget *widget, gpointer user_data) -{ - GtkWidget *commodity_box = user_data; - GtkAllocation alloc; - - gtk_widget_get_allocation (widget, &alloc); - gtk_widget_set_size_request (commodity_box, -1, alloc.height); -} - /********************************************************************\ * gnc_account_window_create * * creates a window to create a new account. * diff --git a/gnucash/gnome-utils/dialog-options.cpp b/gnucash/gnome-utils/dialog-options.cpp index 20da225b33..cec82663f1 100644 --- a/gnucash/gnome-utils/dialog-options.cpp +++ b/gnucash/gnome-utils/dialog-options.cpp @@ -75,11 +75,6 @@ static void dialog_reset_cb(GtkWidget * w, gpointer data); static void dialog_list_select_cb (GtkTreeSelection *selection, gpointer data); static void component_close_handler (gpointer data); -static void -section_reset_widgets(GncOptionSection* section) -{ -} - static inline GtkWidget* const option_get_gtk_widget (const GncOption* option) { @@ -649,12 +644,6 @@ GncOptionsDialog::set_book_help_cb() noexcept set_help_cb((GncOptionsDialogCallback)gnc_book_options_help_cb, nullptr); } -static void -gnc_global_options_help_cb (GncOptionsDialog *win, gpointer dat) -{ - gnc_gnome_help (GTK_WINDOW(win->get_widget()), DF_MANUAL, DL_GLOBPREFS); -} - static void gnc_style_sheet_options_help_cb (GncOptionsDialog *win, gpointer dat) { diff --git a/gnucash/gnome-utils/gnc-cell-view.c b/gnucash/gnome-utils/gnc-cell-view.c index f81e8a2174..47ffa503dc 100644 --- a/gnucash/gnome-utils/gnc-cell-view.c +++ b/gnucash/gnome-utils/gnc-cell-view.c @@ -30,8 +30,6 @@ static void gnc_cell_view_init (GncCellView *cv); static void gnc_cell_view_class_init (GncCellViewClass *klass); static void gnc_cell_view_editable_init (GtkCellEditableIface *iface); -static gboolean gcv_key_press_event (GtkWidget *box, - GdkEventKey *key_event); static void gnc_cell_view_set_property (GObject *object, guint param_id, diff --git a/gnucash/gnome-utils/gnc-option-gtk-ui.cpp b/gnucash/gnome-utils/gnc-option-gtk-ui.cpp index eebc9a1062..a9fb30b301 100644 --- a/gnucash/gnome-utils/gnc-option-gtk-ui.cpp +++ b/gnucash/gnome-utils/gnc-option-gtk-ui.cpp @@ -1699,34 +1699,6 @@ create_option_widget (GncOption& option, grid_attach_widget(page_box, enclosing, row); } -static void -gnc_plot_size_option_set_select_method(GncOption& option, bool set_buttons) -{ - GList* widget_list; - GtkWidget *px_widget, *p_widget; - GtkWidget *widget; - - widget = option_get_gtk_widget(&option); - - widget_list = gtk_container_get_children(GTK_CONTAINER(widget)); - // px_button item 0 - px_widget = static_cast(g_list_nth_data(widget_list, 1)); - // p_button item 2 - p_widget = static_cast(g_list_nth_data(widget_list, 3)); - g_list_free(widget_list); - - if (set_buttons) - { - gtk_widget_set_sensitive(px_widget, TRUE); - gtk_widget_set_sensitive(p_widget, FALSE); - } - else - { - gtk_widget_set_sensitive(p_widget, TRUE); - gtk_widget_set_sensitive(px_widget, FALSE); - } -} - static void gnc_rd_option_px_set_cb(GtkWidget *widget, GncOption* option) { diff --git a/gnucash/gnome/dialog-imap-editor.c b/gnucash/gnome/dialog-imap-editor.c index 6fa624a514..8c9d31025e 100644 --- a/gnucash/gnome/dialog-imap-editor.c +++ b/gnucash/gnome/dialog-imap-editor.c @@ -391,24 +391,6 @@ gnc_imap_invalid_maps_dialog (ImapDialog *imap_dialog) } } -static void -gnc_imap_invalid_maps (ImapDialog *imap_dialog) -{ - gboolean inv_dialog_shown = FALSE; - - if ((imap_dialog->type == BAYES) && (imap_dialog->inv_dialog_shown.inv_dialog_shown_bayes)) - inv_dialog_shown = TRUE; - - if ((imap_dialog->type == NBAYES) && (imap_dialog->inv_dialog_shown.inv_dialog_shown_nbayes)) - inv_dialog_shown = TRUE; - - if ((imap_dialog->type == ONLINE) && (imap_dialog->inv_dialog_shown.inv_dialog_shown_online)) - inv_dialog_shown = TRUE; - - if (!inv_dialog_shown) - gnc_imap_invalid_maps_dialog (imap_dialog); -} - void gnc_imap_dialog_response_cb (GtkDialog *dialog, gint response_id, gpointer user_data) { diff --git a/gnucash/gnome/dialog-payment.c b/gnucash/gnome/dialog-payment.c index 7703298d2b..6c7c1cc548 100644 --- a/gnucash/gnome/dialog-payment.c +++ b/gnucash/gnome/dialog-payment.c @@ -730,13 +730,6 @@ gnc_payment_dialog_remember_account (PaymentWindow *pw, Account *acc) } -static void -gnc_payment_set_owner (PaymentWindow *pw, GncOwner *owner) -{ - gnc_owner_set_owner (pw->owner_choice, owner); - gnc_payment_dialog_owner_changed(pw); -} - static void gnc_payment_update_style_classes (PaymentWindow *pw) { diff --git a/gnucash/gnome/gnc-plugin-budget.c b/gnucash/gnome/gnc-plugin-budget.c index a251c3a497..03b0e9878b 100644 --- a/gnucash/gnome/gnc-plugin-budget.c +++ b/gnucash/gnome/gnc-plugin-budget.c @@ -45,8 +45,6 @@ static QofLogModule log_module = GNC_MOD_GUI; static void gnc_plugin_budget_class_init (GncPluginBudgetClass *klass); static void gnc_plugin_budget_init (GncPluginBudget *plugin); static void gnc_plugin_budget_finalize (GObject *object); -static void gnc_plugin_budget_add_to_window (GncPlugin *plugin, - GncMainWindow *window, GQuark type); /* Command Callbacks */ static void gnc_plugin_budget_cmd_new_budget (GSimpleAction *simple, GVariant *parameter, gpointer user_data); diff --git a/gnucash/gnome/gnc-plugin-page-invoice.c b/gnucash/gnome/gnc-plugin-page-invoice.c index f89569c8e5..a9caf9e877 100644 --- a/gnucash/gnome/gnc-plugin-page-invoice.c +++ b/gnucash/gnome/gnc-plugin-page-invoice.c @@ -87,7 +87,6 @@ static void gnc_plugin_page_invoice_cmd_pay_invoice (GSimpleAction *simple, GVar static void gnc_plugin_page_invoice_cmd_save_layout (GSimpleAction *simple, GVariant *paramter, gpointer user_data); static void gnc_plugin_page_invoice_cmd_reset_layout (GSimpleAction *simple, GVariant *paramter, gpointer user_data); static void gnc_plugin_page_invoice_cmd_link (GSimpleAction *simple, GVariant *paramter, gpointer user_data); -static void gnc_plugin_page_invoice_cmd_link_remove (GSimpleAction *simple, GVariant *paramter, gpointer user_data); static void gnc_plugin_page_invoice_cmd_link_open (GSimpleAction *simple, GVariant *paramter, gpointer user_data); static void gnc_plugin_page_invoice_cmd_company_report (GSimpleAction *simple, GVariant *paramter, gpointer user_data); static void gnc_plugin_page_invoice_cmd_entryUp (GSimpleAction *simple, GVariant *paramter, gpointer user_data); @@ -1311,34 +1310,6 @@ gnc_plugin_page_invoice_cmd_link (GSimpleAction *simple, LEAVE(" "); } -static void -gnc_plugin_page_invoice_cmd_link_remove (GSimpleAction *simple, - GVariant *paramter, - gpointer user_data) -{ - GncPluginPageInvoice *plugin_page = user_data; - GncPluginPageInvoicePrivate *priv; - GncInvoice *invoice; - GtkWidget *doclink_button; - - g_return_if_fail (GNC_IS_PLUGIN_PAGE_INVOICE(plugin_page)); - ENTER("(action %p, plugin_page %p)", simple, plugin_page); - priv = GNC_PLUGIN_PAGE_INVOICE_GET_PRIVATE(plugin_page); - - invoice = gnc_invoice_window_get_invoice (priv->iw); - gncInvoiceSetDocLink (invoice, ""); - - doclink_button = gnc_invoice_window_get_doclink_button (priv->iw); - - if (doclink_button) - gtk_widget_hide (GTK_WIDGET(doclink_button)); - - // update the menu actions - update_doclink_actions (GNC_PLUGIN_PAGE(plugin_page), FALSE); - - LEAVE(" "); -} - static void gnc_plugin_page_invoice_cmd_link_open (GSimpleAction *simple, GVariant *paramter, diff --git a/gnucash/gnome/gnc-plugin-page-register.c b/gnucash/gnome/gnc-plugin-page-register.c index 637ee6c7d6..be69e5fd1b 100644 --- a/gnucash/gnome/gnc-plugin-page-register.c +++ b/gnucash/gnome/gnc-plugin-page-register.c @@ -222,7 +222,6 @@ static void gnc_plugin_page_register_cmd_account_report (GSimpleAction *simple, static void gnc_plugin_page_register_cmd_transaction_report (GSimpleAction *simple, GVariant *paramter, gpointer user_data); static void gnc_plugin_page_register_cmd_linked_transaction (GSimpleAction *simple, GVariant *paramter, gpointer user_data); static void gnc_plugin_page_register_cmd_linked_transaction_open (GSimpleAction *simple, GVariant *paramter, gpointer user_data); -static void gnc_plugin_page_register_cmd_linked_transaction_remove (GSimpleAction *simple, GVariant *paramter, gpointer user_data); static void gnc_plugin_page_register_cmd_jump_linked_invoice (GSimpleAction *simple, GVariant *paramter, gpointer user_data); static void gnc_plugin_page_help_changed_cb (GNCSplitReg* gsr, @@ -4535,25 +4534,6 @@ gnc_plugin_page_register_cmd_linked_transaction_open (GSimpleAction *simple, LEAVE (" "); } -static void -gnc_plugin_page_register_cmd_linked_transaction_remove (GSimpleAction *simple, - GVariant *paramter, - gpointer user_data) -{ - GncPluginPageRegister* page = user_data; - GncPluginPageRegisterPrivate* priv; - - ENTER ("(action %p, page %p)", simple, page); - - g_return_if_fail (GNC_IS_PLUGIN_PAGE_REGISTER (page)); - - priv = GNC_PLUGIN_PAGE_REGISTER_GET_PRIVATE (page); - gsr_default_doclink_remove_handler (priv->gsr); - gnc_plugin_page_register_ui_update (NULL, page); - LEAVE (" "); - -} - static GncInvoice* invoice_from_split (Split* split) { GncInvoice* invoice; diff --git a/gnucash/import-export/csv-imp/gnc-imp-settings-csv-price.cpp b/gnucash/import-export/csv-imp/gnc-imp-settings-csv-price.cpp index fe2e5296bc..c1ebcff745 100644 --- a/gnucash/import-export/csv-imp/gnc-imp-settings-csv-price.cpp +++ b/gnucash/import-export/csv-imp/gnc-imp-settings-csv-price.cpp @@ -62,28 +62,6 @@ static std::shared_ptr create_int_no_preset(void) return preset; } -static std::shared_ptr create_int_gnc_exp_preset(void) -{ - auto preset = std::make_shared(); - preset->m_name = get_gnc_exp(); - preset->m_skip_start_lines = 1; - - /* FIXME date and currency format should still be aligned with export format! - * That's currently hard to do, because the export uses whatever the user - * had set as global preference. - preset->date_active = 0; - preset->currency_active = 0; - */ - preset->m_column_types_price = { - GncPricePropType::DATE, - GncPricePropType::AMOUNT, - GncPricePropType::FROM_SYMBOL, - GncPricePropType::FROM_NAMESPACE, - GncPricePropType::TO_CURRENCY - }; - return preset; -} - /************************************************** * find * diff --git a/gnucash/import-export/import-account-matcher.c b/gnucash/import-export/import-account-matcher.c index 9add090ba5..0795d52944 100644 --- a/gnucash/import-export/import-account-matcher.c +++ b/gnucash/import-export/import-account-matcher.c @@ -57,17 +57,6 @@ typedef struct const char* online_id; } AccountOnlineMatch; -static Account* -partial_match_if_valid (AccountOnlineMatch *match) -{ - if (match->partial_match && match->count == 1) - return match->partial_match; - else - PERR("Online ID %s partially matches %d accounts and fully matches none", - match->online_id, match->count); - return NULL; -} - /*-******************************************************************\ * Functions needed by gnc_import_select_account * diff --git a/gnucash/import-export/import-backend.cpp b/gnucash/import-export/import-backend.cpp index c94f337f63..23df1f6012 100644 --- a/gnucash/import-export/import-backend.cpp +++ b/gnucash/import-export/import-backend.cpp @@ -742,26 +742,6 @@ void split_find_match (GNCImportTransInfo * trans_info, /*********************************************************************** */ -/* append the imported transaction description to the matched transaction description */ -static void -desc_append (Transaction* selected_match_trans, gchar *new_desc) -{ - auto curr_desc = xaccTransGetDescription (selected_match_trans); - auto tmp = g_strconcat(curr_desc, "|", new_desc, nullptr); - xaccTransSetDescription (selected_match_trans, tmp); - g_free (tmp); -} - -/* append the imported transaction notes to the matched transaction notes */ -static void -notes_append (Transaction* selected_match_trans, gchar* new_notes) -{ - auto curr_notes = xaccTransGetNotes (selected_match_trans); - auto tmp = g_strconcat (curr_notes, "|", new_notes, nullptr); - xaccTransSetNotes (selected_match_trans, tmp ); - g_free (tmp); -} - static char* maybe_append_string (const char* match_string, const char* imp_string) { @@ -1005,44 +985,6 @@ gnc_import_process_trans_item (Account *base_acc, return false; } -/********************************************************************\ - * check_trans_online_id() Callback function used by - * gnc_import_exists_online_id. Takes pointers to transaction and split, - * returns 0 if their online_ids do NOT match, or if the split - * belongs to the transaction -\********************************************************************/ -static gint check_trans_online_id(Transaction *trans1, void *user_data) -{ - gchar *online_id1, *online_id2; - gint retval; - - auto split2 = static_cast(user_data); - auto account = xaccSplitGetAccount(split2); - auto split1 = xaccTransFindSplitByAccount(trans1, account); - if (split1 == split2) - return 0; - - /* hack - we really want to iterate over the _splits_ of the account - instead of the transactions */ - g_assert(split1); - - online_id1 = gnc_import_get_split_online_id (split1); - - if (!online_id1 || !*online_id1) - { - g_free (online_id1); - online_id1 = gnc_import_get_trans_online_id (trans1); - } - - online_id2 = gnc_import_get_split_online_id(split2); - - retval = (!online_id1 || !online_id2 || strcmp (online_id1, online_id2)) ? 0 : 1; - - g_free (online_id1); - g_free (online_id2); - return retval; -} - static GHashTable* hash_account_online_ids (Account *account) { diff --git a/gnucash/import-export/import-main-matcher.c b/gnucash/import-export/import-main-matcher.c index f261c0a3a1..99047aaef0 100644 --- a/gnucash/import-export/import-main-matcher.c +++ b/gnucash/import-export/import-main-matcher.c @@ -650,33 +650,6 @@ on_matcher_help_clicked (GtkButton *button, gpointer user_data) gtk_widget_show (help_dialog); } -static void -run_account_picker_dialog (GNCImportMainMatcher *info, - GtkTreeModel *model, - GtkTreeIter *iter, - GNCImportTransInfo *trans_info) -{ - g_assert (trans_info); - - Account *old_acc = gnc_import_TransInfo_get_destacc (trans_info); - - gboolean ok_pressed; - Account *new_acc = gnc_import_select_account ( - info->main_widget, - NULL, - true, - _("Destination account for the auto-balance split."), - xaccTransGetCurrency (gnc_import_TransInfo_get_trans (trans_info)), - ACCT_TYPE_NONE, - old_acc, - &ok_pressed); - if (ok_pressed) - { - gnc_import_TransInfo_set_destacc (trans_info, new_acc, true); - defer_bal_computation (info, new_acc); - } -} - static void run_match_dialog (GNCImportMainMatcher *info, GNCImportTransInfo *trans_info) diff --git a/gnucash/register/ledger-core/split-register-model.c b/gnucash/register/ledger-core/split-register-model.c index bc5565118f..52645684b4 100644 --- a/gnucash/register/ledger-core/split-register-model.c +++ b/gnucash/register/ledger-core/split-register-model.c @@ -507,15 +507,6 @@ gnc_split_register_get_fcredit_label (VirtualLocation virt_loc, } -static char* -gnc_split_register_get_default_tooltip (VirtualLocation virt_loc, - gpointer user_data) -{ - SplitRegister* reg = user_data; - const char* tooltip = gnc_table_get_entry (reg->table, virt_loc); - - return g_strdup (tooltip); -} static char* gnc_split_register_get_recn_tooltip (VirtualLocation virt_loc, @@ -2706,8 +2697,6 @@ gnc_split_register_model_new (void) RBALN_CELL); // tooltip handlers -// gnc_table_model_set_default_tooltip_handler( -// model, gnc_split_register_get_default_tooltip); gnc_table_model_set_tooltip_handler (model, gnc_split_register_get_recn_tooltip, diff --git a/gnucash/register/register-gnome/gnucash-sheet-private.c b/gnucash/register/register-gnome/gnucash-sheet-private.c index 9db0258697..e9d977c7cd 100644 --- a/gnucash/register/register-gnome/gnucash-sheet-private.c +++ b/gnucash/register/register-gnome/gnucash-sheet-private.c @@ -257,30 +257,6 @@ static guint32 inc_intensity_10percent (guint32 argb) } #endif -/** For a given byte value, multiply the value by a rational number, -specified by numerator and denominator. This is some simple integer arithmetics -for the case when we don't even need a conversion to floating point and -backwards. */ -static guint8 dec_intensity_byte (guint8 input, int numerator, int denominator) -{ - guint8 result; - result = (input * numerator) / denominator; - return result; -} - -/** For a given RGB value, decrease the color intensity for each of the three -colors identically by 10 percent and return this changed RGB value. */ -static guint32 dec_intensity_10percent (guint32 argb) -{ - // Multiply each single byte by 9/10 i.e. by 0.9 which decreases the - // intensity by 10 percent. - guint32 result = - (dec_intensity_byte ((argb & 0x00FF0000) >> 16, 9, 10) << 16) - + (dec_intensity_byte ((argb & 0x0000FF00) >> 8, 9, 10) << 8) - + (dec_intensity_byte (argb & 0x000000FF, 9, 10)); - return result; -} - /* Actual drawing routines */ static inline void diff --git a/gnucash/register/register-gnome/gnucash-sheet.c b/gnucash/register/register-gnome/gnucash-sheet.c index 0222e96eec..d2ef3ce62b 100644 --- a/gnucash/register/register-gnome/gnucash-sheet.c +++ b/gnucash/register/register-gnome/gnucash-sheet.c @@ -145,19 +145,6 @@ gnucash_sheet_set_position (GnucashSheet* sheet, int pos) gnucash_sheet_set_position_and_selection (sheet, pos, pos, pos); } -static inline void -gnucash_sheet_get_selection (GnucashSheet *sheet, int *start, int *end) -{ - *start = sheet->pos; - *end = sheet->bound; -} - -static inline void -gnucash_sheet_clear_selection (GnucashSheet *sheet) -{ - gnucash_sheet_set_selection (sheet, sheet->pos, sheet->pos); -} - static inline void gnucash_sheet_set_entry_value (GnucashSheet *sheet, const char* value) { diff --git a/libgnucash/app-utils/gfec.c b/libgnucash/app-utils/gfec.c index 0491633765..f53dd00fa1 100644 --- a/libgnucash/app-utils/gfec.c +++ b/libgnucash/app-utils/gfec.c @@ -35,12 +35,6 @@ gfec_string_from_locale(void *data) return scm_from_locale_string(str); } -static SCM -gfec_string_outer_handler(void *data, SCM key, SCM args) -{ - return SCM_UNDEFINED; -} - static SCM gfec_string_inner_handler(void *data, SCM key, SCM args) { diff --git a/libgnucash/backend/dbi/test/test-dbi-stuff.cpp b/libgnucash/backend/dbi/test/test-dbi-stuff.cpp index 24f8a91c79..6e66688965 100644 --- a/libgnucash/backend/dbi/test/test-dbi-stuff.cpp +++ b/libgnucash/backend/dbi/test/test-dbi-stuff.cpp @@ -40,11 +40,6 @@ G_GNUC_UNUSED static QofLogModule log_module = "test-dbi"; -/* Placeholder for some old functions that need to be re-written and enabled */ -static void do_test (G_GNUC_UNUSED gboolean foo, G_GNUC_UNUSED gchar* bar) -{ -} - void do_compare (QofBook* book_1, QofBook* book_2, const gchar* id, QofInstanceForeachCB cb, const gchar* msg) diff --git a/libgnucash/backend/sql/gnc-slots-sql.cpp b/libgnucash/backend/sql/gnc-slots-sql.cpp index 0d8d0470aa..0e9fc17a84 100644 --- a/libgnucash/backend/sql/gnc-slots-sql.cpp +++ b/libgnucash/backend/sql/gnc-slots-sql.cpp @@ -183,18 +183,6 @@ GncSqlSlotsBackend::GncSqlSlotsBackend() : /* ================================================================= */ -inline static std::string::size_type -get_final_delim(std::string& path) -{ - auto idx = path.rfind('/'); - while (idx == path.length()) - { - path.erase(idx); - idx = path.rfind('/'); - } - return idx; -} - static std::string get_key (slot_info_t* pInfo) { @@ -790,31 +778,6 @@ load_obj_guid (const GncSqlBackend* sql_be, GncSqlRow& row) return &guid; } -static void -load_slot_for_list_item (GncSqlBackend* sql_be, GncSqlRow& row, - QofCollection* coll) -{ - slot_info_t slot_info = { NULL, NULL, TRUE, NULL, KvpValue::Type::INVALID, - NULL, FRAME, NULL, "" }; - const GncGUID* guid; - QofInstance* inst; - - g_return_if_fail (sql_be != NULL); - g_return_if_fail (coll != NULL); - - guid = load_obj_guid (sql_be, row); - g_assert (guid != NULL); - inst = qof_collection_lookup_entity (coll, guid); - - slot_info.be = sql_be; - slot_info.pKvpFrame = qof_instance_get_slots (inst); - slot_info.context = NONE; - - gnc_sql_load_object (sql_be, row, TABLE_NAME, &slot_info, col_table); - - -} - static void load_slot_for_book_object (GncSqlBackend* sql_be, GncSqlRow& row, BookLookupFn lookup_fn) diff --git a/libgnucash/backend/sql/gnc-transaction-sql.cpp b/libgnucash/backend/sql/gnc-transaction-sql.cpp index 54c0aab3b8..c04fc4cdd4 100644 --- a/libgnucash/backend/sql/gnc-transaction-sql.cpp +++ b/libgnucash/backend/sql/gnc-transaction-sql.cpp @@ -723,168 +723,6 @@ GncSqlTransBackend::load_all (GncSqlBackend* sql_be) nullptr); } -static void -convert_query_comparison_to_sql (QofQueryPredData* pPredData, - gboolean isInverted, std::stringstream& sql) -{ - if (pPredData->how == QOF_COMPARE_LT - || (isInverted && pPredData->how == QOF_COMPARE_GTE)) - sql << "<"; - else if (pPredData->how == QOF_COMPARE_LTE - || (isInverted && pPredData->how == QOF_COMPARE_GT)) - sql << "<="; - else if (pPredData->how == QOF_COMPARE_EQUAL - || (isInverted && pPredData->how == QOF_COMPARE_NEQ)) - sql << "="; - else if (pPredData->how == QOF_COMPARE_GT - || (isInverted && pPredData->how == QOF_COMPARE_LTE)) - sql << ">"; - else if (pPredData->how == QOF_COMPARE_GTE - || (isInverted && pPredData->how == QOF_COMPARE_LT)) - sql << ">="; - else if (pPredData->how == QOF_COMPARE_NEQ - || (isInverted && pPredData->how == QOF_COMPARE_EQUAL)) - sql << "~="; - else - { - PERR ("Unknown comparison type\n"); - sql << "??"; - } -} - -static void -convert_query_term_to_sql (const GncSqlBackend* sql_be, const gchar* fieldName, - QofQueryTerm* pTerm, std::stringstream& sql) -{ - QofQueryPredData* pPredData; - gboolean isInverted; - - g_return_if_fail (pTerm != NULL); - - pPredData = qof_query_term_get_pred_data (pTerm); - isInverted = qof_query_term_is_inverted (pTerm); - - if (g_strcmp0 (pPredData->type_name, QOF_TYPE_GUID) == 0) - { - query_guid_t guid_data = (query_guid_t)pPredData; - GList* guid_entry; - sql << "(" << fieldName; - - switch (guid_data->options) - { - case QOF_GUID_MATCH_ANY: - sql << (isInverted ? " NOT IN (" : " IN ("); - break; - - case QOF_GUID_MATCH_NONE: - sql << (isInverted ? " IN (" : " NOT IN ("); - break; - - default: - PERR ("Unexpected GncGUID match type: %d\n", guid_data->options); - } - - for (guid_entry = guid_data->guids; guid_entry != NULL; - guid_entry = guid_entry->next) - { - gchar guid_buf[GUID_ENCODING_LENGTH + 1]; - - if (guid_entry != guid_data->guids) sql << ","; - (void)guid_to_string_buff (static_cast (guid_entry->data), - guid_buf); - sql << guid_buf; - } - sql << "))"; - - } - else if (g_strcmp0 (pPredData->type_name, QOF_TYPE_CHAR) == 0) - { - query_char_t char_data = (query_char_t)pPredData; - int i; - - if (isInverted) sql << "NOT("; - if (char_data->options == QOF_CHAR_MATCH_NONE) sql << "NOT "; - sql << "("; - for (i = 0; char_data->char_list[i] != '\0'; i++) - { - if (i != 0) sql << " OR "; - sql << fieldName << " = '" << char_data->char_list[i] << "'"; - } - sql << ") "; - if (isInverted) sql << ") "; - } - else if (g_strcmp0 (pPredData->type_name, QOF_TYPE_STRING) == 0) - { - query_string_t string_data = (query_string_t)pPredData; - sqlEscape* escape = sqlEscape_new (); - - if (isInverted || pPredData->how == QOF_COMPARE_NEQ) - sql << "NOT("; - sql << fieldName; - if (string_data->is_regex || - string_data->options == QOF_STRING_MATCH_CASEINSENSITIVE) - { - PWARN ("String is_regex || option = QOF_STRING_MATCH_INSENSITIVE\n"); - } -// sql << " ~" ; -// } else { - sql << " ="; -// } -// if( string_data->options == QOF_STRING_MATCH_CASEINSENSITIVE ) { -// sql+= "*"; -// } - sql << "'" << sqlEscapeString (escape, string_data->matchstring) << "'"; - if (pPredData->how == QOF_COMPARE_NEQ) sql << ")"; - if (isInverted) sql << ")"; - sqlEscape_destroy (escape); - - } - else - { - sql << "(" << fieldName; - convert_query_comparison_to_sql (pPredData, isInverted, sql); - - if (strcmp (pPredData->type_name, QOF_TYPE_NUMERIC) == 0) - { - query_numeric_t pData = (query_numeric_t)pPredData; - sql << gnc_numeric_to_double (pData->amount); - } - else if (g_strcmp0 (pPredData->type_name, QOF_TYPE_DATE) == 0) - { - query_date_t date_data = (query_date_t)pPredData; - - GncDateTime time(date_data->date); - sql << time.format_iso8601(); - } - else if (strcmp (pPredData->type_name, QOF_TYPE_INT32) == 0) - { - query_int32_t pData = (query_int32_t)pPredData; - sql << pData->val; - } - else if (strcmp (pPredData->type_name, QOF_TYPE_INT64) == 0) - { - query_int64_t pData = (query_int64_t)pPredData; - sql << pData->val; - } - else if (strcmp (pPredData->type_name, QOF_TYPE_DOUBLE) == 0) - { - query_double_t pData = (query_double_t)pPredData; - sql << pData->val; - } - else if (strcmp (pPredData->type_name, QOF_TYPE_BOOLEAN) == 0) - { - query_boolean_t pData = (query_boolean_t)pPredData; - sql << pData->val; - } - else - { - PERR ("Unknown query predicate type: %s\n", pPredData->type_name); - } - - sql << ")"; - } -} - typedef struct { GncSqlStatementPtr stmt; diff --git a/libgnucash/backend/xml/gnc-transaction-xml-v2.cpp b/libgnucash/backend/xml/gnc-transaction-xml-v2.cpp index cc58b0f0a3..03ac80b017 100644 --- a/libgnucash/backend/xml/gnc-transaction-xml-v2.cpp +++ b/libgnucash/backend/xml/gnc-transaction-xml-v2.cpp @@ -433,16 +433,6 @@ set_tran_time64 (xmlNodePtr node, Transaction * trn, return TRUE; } -static inline gboolean -set_tran_date (xmlNodePtr node, Transaction* trn, - void (*func) (Transaction* trn, const time64 tm)) -{ - time64 time = dom_tree_to_time64 (node); - if (!dom_tree_valid_time64 (time, node->name)) time = 0; - func (trn, time); - return TRUE; -} - static gboolean trn_id_handler (xmlNodePtr node, gpointer trans_pdata) { diff --git a/libgnucash/engine/Transaction.c b/libgnucash/engine/Transaction.c index e7b6ee82ad..d24e966880 100644 --- a/libgnucash/engine/Transaction.c +++ b/libgnucash/engine/Transaction.c @@ -2060,25 +2060,6 @@ xaccTransSetDateEnteredSecs (Transaction *trans, time64 secs) xaccTransSetDateInternal(trans, &trans->date_entered, secs); } -static void -qofTransSetDatePosted (Transaction *trans, time64 time) -{ - if (!trans) return; - if (!qof_begin_edit(&trans->inst)) return; - xaccTransSetDateInternal(trans, &trans->date_posted, time); - set_gains_date_dirty(trans); - qof_commit_edit(&trans->inst); -} - -static void -qofTransSetDateEntered (Transaction *trans, time64 time) -{ - if (!trans) return; - if (!qof_begin_edit(&trans->inst)) return; - xaccTransSetDateInternal(trans, &trans->date_entered, time); - qof_commit_edit(&trans->inst); -} - void xaccTransSetDate (Transaction *trans, int day, int mon, int year) { diff --git a/libgnucash/engine/gnc-optiondb.cpp b/libgnucash/engine/gnc-optiondb.cpp index b62436d162..26d7f9f2c9 100644 --- a/libgnucash/engine/gnc-optiondb.cpp +++ b/libgnucash/engine/gnc-optiondb.cpp @@ -265,55 +265,6 @@ GncOptionDB::make_internal(const char* section, const char* name) db_opt->make_internal(); } -static inline bool constexpr -is_eol(char c) -{ - return c == '\n'; -} - -static inline bool constexpr -is_whitespace(char c) -{ - return c == ' ' || c == '\n' || c == '\t'; -} - -static inline bool constexpr -is_begin_paren(char c) -{ - return c == '('; -} - -static inline bool constexpr -is_end_paren(char c) -{ - return c == ')'; -} - -static inline bool constexpr -is_double_quote(char c) -{ - return c == '"'; -} - -static inline bool constexpr -is_single_quote(char c) -{ - return c == '\''; -} - -static inline bool constexpr -is_semicolon(char c) -{ - return c == ';'; -} - -static inline bool constexpr -is_delim(char c) -{ - return is_begin_paren(c) || is_end_paren(c) || is_whitespace(c) || - is_single_quote(c) || is_double_quote(c) || is_semicolon(c); -} - std::ostream& GncOptionDB::save_option_key_value(std::ostream& oss, const std::string& section, diff --git a/libgnucash/engine/policy.c b/libgnucash/engine/policy.c index fddd7ff576..3e4b05614b 100644 --- a/libgnucash/engine/policy.c +++ b/libgnucash/engine/policy.c @@ -202,42 +202,5 @@ xaccGetFIFOPolicy (void) return pcy; } -static GNCLot * -LIFOPolicyGetLot (GNCPolicy *pcy, Split *split) -{ - if (!split) return NULL; - return xaccAccountFindLatestOpenLot (split->acc, split->amount, - split->parent->common_currency); -} - -static Split * -LIFOPolicyGetSplit (GNCPolicy *pcy, GNCLot *lot) -{ - return DirectionPolicyGetSplit (pcy, lot, 1); -} - -/* This routine is actually identical to FIFO... */ -static void -LIFOPolicyGetLotOpening (GNCPolicy *pcy, - GNCLot *lot, - gnc_numeric *ret_amount, gnc_numeric *ret_value, - gnc_commodity **ret_currency) -{ - Split *opening_split; - opening_split = gnc_lot_get_earliest_split(lot); - - if (ret_amount) *ret_amount = opening_split->amount; - if (ret_value) *ret_value = opening_split->value; - if (ret_currency) *ret_currency = opening_split->parent->common_currency; -} - -/* This routine is actually identical to FIFO... */ -static gboolean -LIFOPolicyIsOpeningSplit (GNCPolicy *pcy, GNCLot *lot, Split *split) -{ - Split *opening_split; - opening_split = gnc_lot_get_earliest_split(lot); - return (split == opening_split); -} /* =========================== END OF FILE ======================= */ diff --git a/libgnucash/engine/qofobject.cpp b/libgnucash/engine/qofobject.cpp index fed5ee58f8..bb74b91554 100644 --- a/libgnucash/engine/qofobject.cpp +++ b/libgnucash/engine/qofobject.cpp @@ -272,12 +272,6 @@ const char * qof_object_get_type_label (QofIdTypeConst type_name) return (obj->type_label); } -static gboolean clear_table (gpointer key, gpointer value, gpointer user_data) -{ - g_hash_table_destroy (static_cast(value)); - return TRUE; -} - /* INITIALIZATION and PRIVATE FUNCTIONS */ void qof_object_initialize (void) diff --git a/libgnucash/engine/test-core/test-engine-stuff.cpp b/libgnucash/engine/test-core/test-engine-stuff.cpp index cc490a035e..05a2528e33 100644 --- a/libgnucash/engine/test-core/test-engine-stuff.cpp +++ b/libgnucash/engine/test-core/test-engine-stuff.cpp @@ -122,20 +122,6 @@ set_max_kvp_frame_elements (gint max_kvp_frame_elements) kvp_frame_max_elements = MAX (max_kvp_frame_elements, 1); } -static void -kvp_exclude_type (KvpValue::Type kvp_type) -{ - gint *key; - - if (!exclude_kvp_types) - exclude_kvp_types = g_hash_table_new (g_int_hash, g_int_equal); - - key = g_new (gint, 1); - *key = kvp_type; - - g_hash_table_insert (exclude_kvp_types, key, exclude_kvp_types); -} - static gboolean kvp_type_excluded (KvpValue::Type kvp_type) { @@ -1565,32 +1551,6 @@ get_random_queryop(void) return op; } -static GSList * -get_random_kvp_path (void) -{ - GSList *path; - gint len; - - path = NULL; - len = get_random_int_in_range (1, kvp_max_depth); - - while (len--) - path = g_slist_prepend (path, get_random_string_without ("\n\\")); - - return g_slist_reverse (path); -} - -static void -free_random_kvp_path (GSList *path) -{ - GSList *node; - - for (node = path; node; node = node->next) - g_free (node->data); - - g_slist_free (path); -} - static QofIdType get_random_id_type (void) { diff --git a/libgnucash/engine/test-core/test-engine-stuff.h b/libgnucash/engine/test-core/test-engine-stuff.h index 54a47a1a4c..b988250455 100644 --- a/libgnucash/engine/test-core/test-engine-stuff.h +++ b/libgnucash/engine/test-core/test-engine-stuff.h @@ -62,7 +62,6 @@ KvpFrame* get_random_kvp_frame(void); gnc_numeric get_random_gnc_numeric(int64_t); GncGUID* get_random_guid(void); -//void kvp_exclude_type (KvpValueType kvp_type); void set_max_kvp_depth (gint max_kvp_depth); void set_max_kvp_frame_elements (gint max_kvp_frame_elements); void set_max_account_tree_depth (gint max_tree_depth); diff --git a/libgnucash/engine/test/test-gnc-date.c b/libgnucash/engine/test/test-gnc-date.c index 4a386b7330..93c379e0ce 100644 --- a/libgnucash/engine/test/test-gnc-date.c +++ b/libgnucash/engine/test/test-gnc-date.c @@ -61,18 +61,6 @@ typedef struct time64 t5; } FixtureA; -static int -offset_secs (TZOffset tz) -{ - return 3600 * tz.hours + 60 * tz.minutes; -} - -static char* -offset_string (TZOffset tz) -{ - return g_strdup_printf("%+02d%02d", tz.hours, tz.minutes); -} - static void setup (FixtureA *f, gconstpointer pData) { f->t0 = gnc_time(NULL); @@ -1348,15 +1336,6 @@ test_gnc_date_timestamp (void) g_free (timestr); } -/* gnc_iso8601_to_time64_gmt -time64 -gnc_iso8601_to_time64_gmt(const char *str)// C: 6 in 3 Local: 0:0:0 -*/ -static gint -get_nanoseconds (GDateTime *gdt) -{ - return g_date_time_get_microsecond (gdt) * 1000; -} static void test_gnc_iso8601_to_time64_gmt (FixtureA *f, gconstpointer pData) @@ -1382,18 +1361,6 @@ test_gnc_iso8601_to_time64_gmt (FixtureA *f, gconstpointer pData) t = gnc_iso8601_to_time64_gmt ("2061-01-25 23:21:19.0 -05:00"); g_assert_cmpint (t, ==, f->t5); } -/* gnc_time64_to_iso8601_buff -char * -gnc_time64_to_iso8601_buff (time64 t, char * buff)// C: 18 in 7 Local: 0:0:0 -*/ -static time64 -g_date_time_to_time64 (GDateTime *gdt) -{ - time64 t; - t = g_date_time_to_unix (gdt); - return t; -} - #define ISO8601_SIZE MAX_DATE_LENGTH + 4 static gchar* format_timestring (time64 t, TZOffset tz) @@ -1536,22 +1503,6 @@ test_gnc_dmy2time64_end (FixtureB *f, gconstpointer pData) g_log_set_default_handler (hdlr, 0); } -static GDateTime* -offset_adjust(GDateTime *gdt) -{ - Testfuncs *tf = gnc_date_load_funcs(); - GTimeZone *zone = tf->timezone_new_local(); - int interval = g_time_zone_find_interval(zone, G_TIME_TYPE_STANDARD, - g_date_time_to_unix(gdt)); - int offset = g_time_zone_get_offset(zone, interval) / 60; - int off_hr = (offset / 60) + (offset % 60 ? (offset < 0 ? -1 : 1) : 0); - int correction = off_hr < -10 ? -10 - off_hr : off_hr > 13 ? 13 - off_hr : 0; - GDateTime* new_gdt = g_date_time_add_hours(gdt, correction); - g_date_time_unref(gdt); - g_slice_free(Testfuncs, tf); - return new_gdt; -} - /*gnc_dmy2time64_neutral*/ static void test_gnc_dmy2time64_neutral (FixtureB *f, gconstpointer pData) diff --git a/libgnucash/engine/test/test-qofinstance.cpp b/libgnucash/engine/test/test-qofinstance.cpp index a40aecc45f..aa5a4031c6 100644 --- a/libgnucash/engine/test/test-qofinstance.cpp +++ b/libgnucash/engine/test/test-qofinstance.cpp @@ -431,15 +431,6 @@ test_instance_display_name( Fixture *fixture, gconstpointer pData ) qof_collection_destroy( col ); } -static void -mock_backend_begin( QofBackend *be, QofInstance *inst ) -{ - g_assert( be ); - g_assert( inst ); - g_assert_cmpstr( inst->e_type, == , "test type" ); - is_called = TRUE; -} - static void test_instance_begin_edit( Fixture *fixture, gconstpointer pData ) { diff --git a/libgnucash/engine/test/test-qofsession.cpp b/libgnucash/engine/test/test-qofsession.cpp index d292fa38b8..30d91e2978 100644 --- a/libgnucash/engine/test/test-qofsession.cpp +++ b/libgnucash/engine/test/test-qofsession.cpp @@ -34,7 +34,6 @@ static QofBook * exported_book {nullptr}; static bool safe_sync_called {false}; static bool sync_called {false}; static bool load_error {true}; -static bool hook_called {false}; static bool data_loaded {false}; class QofSessionMockBackend : public QofBackend @@ -52,12 +51,6 @@ public: void export_coa(QofBook*); }; -static void -example_hook (QofSession & session) -{ - hook_called = true; -} - void QofSessionMockBackend::load (QofBook *book, QofBackendLoadType) { if (load_error)