r23288 - gnucash/trunk/src - Clean up a bunch of clang errors
John Ralls
jralls at code.gnucash.org
Wed Oct 9 01:28:02 EDT 2013
Author: jralls
Date: 2013-10-09 01:28:02 -0400 (Wed, 09 Oct 2013)
New Revision: 23288
Trac: http://svn.gnucash.org/trac/changeset/23288
Modified:
gnucash/trunk/src/app-utils/calculation/fin.c
gnucash/trunk/src/app-utils/gnc-accounting-period.h
gnucash/trunk/src/bin/gnucash-bin.c
gnucash/trunk/src/business/business-ledger/gncEntryLedger.c
gnucash/trunk/src/business/business-ledger/gncEntryLedger.h
gnucash/trunk/src/business/business-ledger/gncEntryLedgerLoad.c
gnucash/trunk/src/gnome-search/search-reconciled.c
gnucash/trunk/src/gnome-search/search-reconciled.h
gnucash/trunk/src/gnome-utils/cursors.c
gnucash/trunk/src/gnome-utils/gnc-query-view.c
gnucash/trunk/src/gnome-utils/gnc-tree-view-split-reg.c
gnucash/trunk/src/gnome-utils/gnc-tree-view-split-reg.h
gnucash/trunk/src/gnome/dialog-print-check.c
gnucash/trunk/src/gnome/dialog-print-check2.c
gnucash/trunk/src/gnome/dialog-tax-info.c
gnucash/trunk/src/libqof/qof/qofinstance.c
Log:
Clean up a bunch of clang errors
Mostly unsigned and enum mismatches
Modified: gnucash/trunk/src/app-utils/calculation/fin.c
===================================================================
--- gnucash/trunk/src/app-utils/calculation/fin.c 2013-10-08 20:25:51 UTC (rev 23287)
+++ gnucash/trunk/src/app-utils/calculation/fin.c 2013-10-09 05:28:02 UTC (rev 23288)
@@ -1217,13 +1217,8 @@
double r;
char buf[50]; /* make buffer large enough */
- if (places >= 0)
- {
- sprintf (buf, "%.*f", (int) places, x);
- r = strtod(buf, NULL);
- }
- else
- r = x;
+ sprintf (buf, "%.*f", (int) places, x);
+ r = strtod(buf, NULL);
return r;
} /* rnd */
Modified: gnucash/trunk/src/app-utils/gnc-accounting-period.h
===================================================================
--- gnucash/trunk/src/app-utils/gnc-accounting-period.h 2013-10-08 20:25:51 UTC (rev 23287)
+++ gnucash/trunk/src/app-utils/gnc-accounting-period.h 2013-10-09 05:28:02 UTC (rev 23288)
@@ -52,6 +52,7 @@
*/
typedef enum
{
+ GNC_ACCOUNTING_PERIOD_INVALID = -1, //Force Clang to use a signed enum
GNC_ACCOUNTING_PERIOD_TODAY,
GNC_ACCOUNTING_PERIOD_MONTH,
GNC_ACCOUNTING_PERIOD_MONTH_PREV,
Modified: gnucash/trunk/src/bin/gnucash-bin.c
===================================================================
--- gnucash/trunk/src/bin/gnucash-bin.c 2013-10-08 20:25:51 UTC (rev 23287)
+++ gnucash/trunk/src/bin/gnucash-bin.c 2013-10-09 05:28:02 UTC (rev 23288)
@@ -408,9 +408,9 @@
if ([elements count] > 1) {
if ([[elements objectAtIndex: 0] isEqualToString: @"zh"]) {
if ([[elements objectAtIndex: 1] isEqualToString: @"Hans"])
- this_lang = [NSString stringWithString: @"zh_CN"];
+ this_lang = @"zh_CN";
else
- this_lang = [NSString stringWithString: @"zh_TW"];
+ this_lang = @"zh_TW";
}
else
this_lang = [elements componentsJoinedByString: @"_"];
Modified: gnucash/trunk/src/business/business-ledger/gncEntryLedger.c
===================================================================
--- gnucash/trunk/src/business/business-ledger/gncEntryLedger.c 2013-10-08 20:25:51 UTC (rev 23287)
+++ gnucash/trunk/src/business/business-ledger/gncEntryLedger.c 2013-10-09 05:28:02 UTC (rev 23288)
@@ -46,6 +46,7 @@
#include "gncEntryLedgerModel.h"
#include "gncEntryLedgerControl.h"
+static QofLogModule log_module = "Business Entry Ledger";
/** Static Functions ***************************************************/
@@ -323,6 +324,11 @@
ledger->is_cust_doc = FALSE;
ledger->is_credit_note = TRUE;
break;
+ default:
+ PWARN ("Bad GncEntryLedgerType");
+ g_free (ledger);
+ return NULL;
+ break;
}
ledger->blank_entry_guid = *guid_null();
Modified: gnucash/trunk/src/business/business-ledger/gncEntryLedger.h
===================================================================
--- gnucash/trunk/src/business/business-ledger/gncEntryLedger.h 2013-10-08 20:25:51 UTC (rev 23287)
+++ gnucash/trunk/src/business/business-ledger/gncEntryLedger.h 2013-10-09 05:28:02 UTC (rev 23288)
@@ -31,6 +31,7 @@
typedef enum
{
+ GNC_ENTRY_ORDER_NONE = -1, //Force clang to use int representation of enum.
GNCENTRY_ORDER_ENTRY,
GNCENTRY_ORDER_VIEWER,
GNCENTRY_INVOICE_ENTRY,
Modified: gnucash/trunk/src/business/business-ledger/gncEntryLedgerLoad.c
===================================================================
--- gnucash/trunk/src/business/business-ledger/gncEntryLedgerLoad.c 2013-10-08 20:25:51 UTC (rev 23287)
+++ gnucash/trunk/src/business/business-ledger/gncEntryLedgerLoad.c 2013-10-09 05:28:02 UTC (rev 23288)
@@ -44,6 +44,8 @@
#define GNC_PREF_TAX_INCL "tax-included"
+static const QofLogModule log_module = "Business Entry Ledger";
+
/* XXX: This should go elsewhere */
const char * gnc_entry_ledger_type_string_getter (char flag)
{
@@ -231,6 +233,9 @@
store = gnc_get_shared_account_name_list_store (root, EKEY,
skip_income_acct_cb, NULL);
break;
+ default:
+ PWARN ("Bad GncEntryLedgerType");
+ break;
}
cell = (ComboCell *)
Modified: gnucash/trunk/src/gnome/dialog-print-check.c
===================================================================
--- gnucash/trunk/src/gnome/dialog-print-check.c 2013-10-08 20:25:51 UTC (rev 23287)
+++ gnucash/trunk/src/gnome/dialog-print-check.c 2013-10-09 05:28:02 UTC (rev 23288)
@@ -1756,7 +1756,7 @@
cr = gtk_print_context_get_cairo_context(context);
cairo_save(cr);
cairo_set_line_width(cr, 1.0);
- cairo_set_line_cap(cr, CAIRO_LINE_JOIN_ROUND);
+ cairo_set_line_cap(cr, CAIRO_LINE_CAP_ROUND);
cairo_set_dash(cr, dash_pattern, 2, 0);
/* Draw horizontal lines */
Modified: gnucash/trunk/src/gnome/dialog-print-check2.c
===================================================================
--- gnucash/trunk/src/gnome/dialog-print-check2.c 2013-10-08 20:25:51 UTC (rev 23287)
+++ gnucash/trunk/src/gnome/dialog-print-check2.c 2013-10-09 05:28:02 UTC (rev 23288)
@@ -1756,7 +1756,7 @@
cr = gtk_print_context_get_cairo_context(context);
cairo_save(cr);
cairo_set_line_width(cr, 1.0);
- cairo_set_line_cap(cr, CAIRO_LINE_JOIN_ROUND);
+ cairo_set_line_cap(cr, CAIRO_LINE_CAP_ROUND);
cairo_set_dash(cr, dash_pattern, 2, 0);
/* Draw horizontal lines */
Modified: gnucash/trunk/src/gnome/dialog-tax-info.c
===================================================================
--- gnucash/trunk/src/gnome/dialog-tax-info.c 2013-10-08 20:25:51 UTC (rev 23287)
+++ gnucash/trunk/src/gnome/dialog-tax-info.c 2013-10-09 05:28:02 UTC (rev 23288)
@@ -612,7 +612,7 @@
const char *str;
TXFInfo *info;
GList *infos;
- guint index;
+ gint index = 0;
if (!account)
{
@@ -630,10 +630,9 @@
info = txf_infos_find_code (infos, str);
if (info)
index = g_list_index (infos, info);
- else
- index = 0;
+
if (index < 0)
- index = 0;
+ index = 0;
view = GTK_TREE_VIEW(ti_dialog->txf_category_view);
selection = gtk_tree_view_get_selection(view);
Modified: gnucash/trunk/src/gnome-search/search-reconciled.c
===================================================================
--- gnucash/trunk/src/gnome-search/search-reconciled.c 2013-10-08 20:25:51 UTC (rev 23287)
+++ gnucash/trunk/src/gnome-search/search-reconciled.c 2013-10-09 05:28:02 UTC (rev 23288)
@@ -145,7 +145,7 @@
}
void
-gnc_search_reconciled_set_how (GNCSearchReconciled *fi, QofCharMatch how)
+gnc_search_reconciled_set_how (GNCSearchReconciled *fi, QofQueryCompare how)
{
g_return_if_fail (fi);
g_return_if_fail (IS_GNCSEARCH_RECONCILED (fi));
@@ -195,7 +195,7 @@
}
static GtkWidget *
-make_toggle (GNCSearchReconciled *fi, char *label, QofCharMatch option)
+make_toggle (GNCSearchReconciled *fi, char *label, cleared_match_t option)
{
GtkWidget *toggle;
@@ -248,6 +248,7 @@
char chars[6];
cleared_match_t value;
int i;
+ QofCharMatch cmatch_how = QOF_CHAR_MATCH_NONE;
g_return_val_if_fail (fi, NULL);
g_return_val_if_fail (IS_GNCSEARCH_RECONCILED (fi), NULL);
@@ -269,7 +270,9 @@
chars[i++] = VREC;
chars[i] = '\0';
- return qof_query_char_predicate (fi->how, chars);
+ if (fi->how == QOF_COMPARE_EQUAL)
+ cmatch_how = QOF_CHAR_MATCH_ANY;
+ return qof_query_char_predicate (cmatch_how, chars);
}
static GNCSearchCoreType *gncs_clone(GNCSearchCoreType *fe)
Modified: gnucash/trunk/src/gnome-search/search-reconciled.h
===================================================================
--- gnucash/trunk/src/gnome-search/search-reconciled.h 2013-10-08 20:25:51 UTC (rev 23287)
+++ gnucash/trunk/src/gnome-search/search-reconciled.h 2013-10-09 05:28:02 UTC (rev 23288)
@@ -37,8 +37,8 @@
{
GNCSearchCoreType parent;
- QofCharMatch how;
- cleared_match_t value;
+ QofQueryCompare how;
+ cleared_match_t value;
};
struct _GNCSearchReconciledClass
@@ -55,6 +55,6 @@
/* methods */
void gnc_search_reconciled_set_value(GNCSearchReconciled *fi, cleared_match_t value);
-void gnc_search_reconciled_set_how (GNCSearchReconciled *fi, QofCharMatch how);
+void gnc_search_reconciled_set_how (GNCSearchReconciled *fi, QofQueryCompare how);
#endif /* ! _GNCSEARCH_RECONCILED_H */
Modified: gnucash/trunk/src/gnome-utils/cursors.c
===================================================================
--- gnucash/trunk/src/gnome-utils/cursors.c 2013-10-08 20:25:51 UTC (rev 23287)
+++ gnucash/trunk/src/gnome-utils/cursors.c 2013-10-09 05:28:02 UTC (rev 23288)
@@ -50,7 +50,7 @@
return;
if (type != GNC_CURSOR_NORMAL)
- cursor = gdk_cursor_new (type);
+ cursor = gdk_cursor_new ((GdkCursorType)type);
gdk_window_set_cursor (win, cursor);
Modified: gnucash/trunk/src/gnome-utils/gnc-query-view.c
===================================================================
--- gnucash/trunk/src/gnome-utils/gnc-query-view.c 2013-10-08 20:25:51 UTC (rev 23287)
+++ gnucash/trunk/src/gnome-utils/gnc-query-view.c 2013-10-09 05:28:02 UTC (rev 23288)
@@ -777,7 +777,7 @@
for (item = entries; item; item = item->next)
{
GList *node;
- gint row;
+ gint row = 0;
const QofParam *gup;
QofParam *qp = NULL;
Modified: gnucash/trunk/src/gnome-utils/gnc-tree-view-split-reg.c
===================================================================
--- gnucash/trunk/src/gnome-utils/gnc-tree-view-split-reg.c 2013-10-08 20:25:51 UTC (rev 23287)
+++ gnucash/trunk/src/gnome-utils/gnc-tree-view-split-reg.c 2013-10-09 05:28:02 UTC (rev 23288)
@@ -711,7 +711,8 @@
default:
{
static ViewCol col_list[] = {
- COL_DATE, COL_NUMACT, COL_DESCNOTES, COL_TRANSFERVOID, COL_RECN, COL_STATUS,
+ COL_DATE, COL_NUMACT, COL_DESCNOTES, COL_TRANSFERVOID, COL_RECN,
+ COL_STATUS,
COL_VALUE, COL_AMOUNT, COL_RATE, COL_PRICE, COL_DEBIT, COL_CREDIT,
COL_BALANCE, -1};
return col_list;
@@ -722,8 +723,9 @@
/* Creates a treeview with the list of fields */
static GncTreeViewSplitReg *
-gnc_tree_view_split_reg_set_cols (GncTreeViewSplitReg *view, GncTreeModelSplitReg *model,
- const ViewCol col_list[])
+gnc_tree_view_split_reg_set_cols (GncTreeViewSplitReg *view,
+ GncTreeModelSplitReg *model,
+ ViewCol col_list[])
{
int i = 0;
Modified: gnucash/trunk/src/gnome-utils/gnc-tree-view-split-reg.h
===================================================================
--- gnucash/trunk/src/gnome-utils/gnc-tree-view-split-reg.h 2013-10-08 20:25:51 UTC (rev 23287)
+++ gnucash/trunk/src/gnome-utils/gnc-tree-view-split-reg.h 2013-10-09 05:28:02 UTC (rev 23288)
@@ -88,6 +88,7 @@
}RowDepth;
typedef enum {
+ COL_END_OF_LIST = -1,
COL_CONTROL, //0 TreeView Control columns
COL_DATE, //1
COL_DUEDATE, //2
Modified: gnucash/trunk/src/libqof/qof/qofinstance.c
===================================================================
--- gnucash/trunk/src/libqof/qof/qofinstance.c 2013-10-08 20:25:51 UTC (rev 23287)
+++ gnucash/trunk/src/libqof/qof/qofinstance.c 2013-10-09 05:28:02 UTC (rev 23288)
@@ -809,10 +809,6 @@
{
return;
}
- if (idata < 0)
- {
- return;
- }
g_return_if_fail(QOF_IS_INSTANCE(inst));
GET_PRIVATE(inst)->idata = idata;
}
More information about the gnucash-changes
mailing list