mirror of
https://github.com/Gnucash/gnucash.git
synced 2025-02-25 18:55:30 -06:00
Applied Herbert Thoma's patch:
* lots of files... fixes for GCC 3.3 warnings comparison between signed and unsigned and dereferencing type-punned pointer will break strict-aliasing rules fixes #110320 * src/engine/gnc-pricedb-p.h * src/engine/gnc-pricedb.c * src/engine/gnc-pricedb.h: gnc_pricedb_lookup_at_time_any_currency, gnc_pricedb_lookup_day_any_currency and gnc_pricedb_lookup_nearest_in_time_any_currency functions git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@8223 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
parent
73a59d5ed4
commit
a2e2bda6d8
43
ChangeLog
43
ChangeLog
@ -1,3 +1,46 @@
|
||||
2003-04-12 Herbert Thoma <herbie@hthoma.de>
|
||||
|
||||
* src/backend/file/sixtp-dom-parsers.c
|
||||
* src/backend/file/sixtp-utils.c
|
||||
* src/backend/file/test/test-dom-converters1.c
|
||||
* src/backend/file/test/test-string-converters.c
|
||||
* src/business/business-ledger/gncEntryLedgerLayout.c
|
||||
* src/business/business-ledger/gncEntryLedgerModel.c
|
||||
* src/calculation/fin.c
|
||||
* src/engine/GNCId.c
|
||||
* src/engine/QueryCore.c
|
||||
* src/engine/gnc-engine-util.c
|
||||
* src/engine/guid.c
|
||||
* src/engine/test/test-commodities.c
|
||||
* src/gnome-utils/dialog-options.c
|
||||
* src/gnome-utils/dialog-utils.c
|
||||
* src/gnome-utils/gnc-dense-cal.c
|
||||
* src/gnome-utils/gnc-frequency.c
|
||||
* src/gnome-utils/gnc-html.c
|
||||
* src/gnome/dialog-fincalc.c
|
||||
* src/gnome/dialog-scheduledxaction.c
|
||||
* src/gnome/dialog-sx-from-trans.c
|
||||
* src/gnome/gnc-split-reg.h
|
||||
* src/gnome/reconcile-list.h
|
||||
* src/import-export/import-account-matcher.c
|
||||
* src/network-utils/gnc-gpg.c
|
||||
* src/register/register-core/formulacell.c
|
||||
* src/register/register-core/pricecell.c
|
||||
* src/register/register-gnome/combocell-gnome.c
|
||||
* src/register/register-gnome/datecell-gnome.c
|
||||
* src/register/register-gnome/gnucash-sheet.h:
|
||||
fixes for GCC 3.3 warnings
|
||||
comparison between signed and unsigned and
|
||||
dereferencing type-punned pointer will break strict-aliasing rules
|
||||
fixes #110320
|
||||
|
||||
* src/engine/gnc-pricedb-p.h
|
||||
* src/engine/gnc-pricedb.c
|
||||
* src/engine/gnc-pricedb.h:
|
||||
gnc_pricedb_lookup_at_time_any_currency,
|
||||
gnc_pricedb_lookup_day_any_currency and
|
||||
gnc_pricedb_lookup_nearest_in_time_any_currency functions
|
||||
|
||||
2003-04-11 Derek Atkins <derek@ihtfp.com>
|
||||
|
||||
* src/engine/Transaction.c: xaccSplitGetCorrAccountCode() should
|
||||
|
@ -206,7 +206,7 @@ string_to_binary(const gchar *str, void **v, guint64 *data_len)
|
||||
{
|
||||
guint64 str_len;
|
||||
guchar *data;
|
||||
int i, j;
|
||||
unsigned int i, j;
|
||||
|
||||
g_return_val_if_fail(v != NULL, FALSE);
|
||||
g_return_val_if_fail(data_len != NULL, FALSE);
|
||||
|
@ -496,7 +496,7 @@ gboolean
|
||||
string_to_timespec_nsecs(const gchar *str, Timespec *ts)
|
||||
{
|
||||
long int nanosecs;
|
||||
int charcount;
|
||||
unsigned int charcount;
|
||||
|
||||
if (!str || !ts) return FALSE;
|
||||
|
||||
|
@ -201,7 +201,7 @@ test_dom_tree_to_gnc_numeric(void)
|
||||
gchar *message = NULL;
|
||||
|
||||
message = test_gnc_nums_internal
|
||||
(gnc_numeric_create(18768786810, 100000));
|
||||
(gnc_numeric_create(18768786810LL, 100000));
|
||||
|
||||
do_test_args(message == NULL, "gnc_num 18768786810/100000",
|
||||
__FILE__, __LINE__, message);
|
||||
|
@ -23,7 +23,7 @@ test_binary()
|
||||
{
|
||||
bin_data *test_data1;
|
||||
void *test_data2;
|
||||
guint64 test_data2_len;
|
||||
gint64 test_data2_len;
|
||||
gchar *converted;
|
||||
|
||||
test_data1 = get_random_binary_data();
|
||||
|
@ -97,7 +97,7 @@ static void gnc_entry_ledger_layout_add_cells (GncEntryLedger *ledger,
|
||||
{ ENTRY_PAYMENT_CELL, COMBO_CELL_TYPE_NAME, N_("sample:Payment")+7,
|
||||
CELL_ALIGN_LEFT, FALSE, FALSE }
|
||||
};
|
||||
int i;
|
||||
unsigned int i;
|
||||
|
||||
for (i = 0; i < (sizeof(cells)/sizeof(*cells)); i++)
|
||||
gnc_register_add_cell (layout, cells[i].cell_name, cells[i].cell_type_name,
|
||||
|
@ -1127,7 +1127,7 @@ static void gnc_entry_ledger_model_new_handlers (TableModel *model,
|
||||
{ ENTRY_BILLABLE_CELL, get_billable_entry, get_billable_label, get_billable_help, get_typecell_io_flags },
|
||||
{ ENTRY_PAYMENT_CELL, get_payment_entry, get_payment_label, get_payment_help, get_standard_io_flags },
|
||||
};
|
||||
int i;
|
||||
unsigned int i;
|
||||
|
||||
gnc_table_model_set_default_bg_color_handler
|
||||
(model, gnc_entry_ledger_get_bg_color);
|
||||
|
@ -2418,7 +2418,7 @@ Amortization_Schedule (amort_sched_ptr amortsched)
|
||||
|
||||
for (jj = n, j = 0; jj > 0; jj -= yr_pmt, yr_pmt = PF, j++)
|
||||
{
|
||||
if (jj <= PF)
|
||||
if (jj <= (int)PF)
|
||||
{
|
||||
yr_fv = fv;
|
||||
yr_int = rnd (((jj - 1) * pmt) + hpv + final_pmt, prec);
|
||||
|
@ -131,7 +131,7 @@ id_hash (gconstpointer key)
|
||||
else
|
||||
{
|
||||
guint hash = 0;
|
||||
int i, j;
|
||||
unsigned int i, j;
|
||||
|
||||
for (i = 0, j = 0; i < sizeof(guint); i++, j++)
|
||||
{
|
||||
|
@ -1018,7 +1018,7 @@ QueryPredData_t gncQueryKVPPredicate (query_compare_t how,
|
||||
|
||||
static void init_tables (void)
|
||||
{
|
||||
int i;
|
||||
unsigned int i;
|
||||
struct {
|
||||
char const *name;
|
||||
QueryPredicate pred;
|
||||
|
@ -372,7 +372,7 @@ ultostr (unsigned long val, int base)
|
||||
}
|
||||
|
||||
/* print */
|
||||
for (i=0; i<places; i++) {
|
||||
for (i=0; i<(int)places; i++) {
|
||||
if (10>broke[i]) {
|
||||
buf[places-1-i] = 0x30+broke[i]; /* ascii digit zero */
|
||||
} else {
|
||||
|
@ -87,6 +87,14 @@ struct gnc_price_lookup_s
|
||||
Timespec date;
|
||||
};
|
||||
|
||||
|
||||
typedef struct gnc_price_lookup_helper_s
|
||||
{
|
||||
GList **return_list;
|
||||
Timespec time;
|
||||
} GNCPriceLookupHelper;
|
||||
|
||||
|
||||
void gnc_pricedb_mark_clean(GNCPriceDB *db);
|
||||
void gnc_pricedb_substitute_commodity(GNCPriceDB *db,
|
||||
gnc_commodity *old_c,
|
||||
|
@ -989,6 +989,7 @@ gnc_pricedb_lookup_latest(GNCPriceDB *db,
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
lookup_latest(gpointer key, gpointer val, gpointer user_data)
|
||||
{
|
||||
@ -998,7 +999,7 @@ lookup_latest(gpointer key, gpointer val, gpointer user_data)
|
||||
|
||||
if(!price_list) return;
|
||||
|
||||
/* the latest price ist the first in list */
|
||||
/* the latest price is the first in list */
|
||||
gnc_price_list_insert(return_list, price_list->data);
|
||||
}
|
||||
|
||||
@ -1014,6 +1015,15 @@ gnc_pricedb_lookup_latest_any_currency(GNCPriceDB *db,
|
||||
ENTER ("db=%p commodity=%p", db, commodity);
|
||||
if(!db || !commodity) return NULL;
|
||||
|
||||
if (db->book && db->book->backend && db->book->backend->price_lookup)
|
||||
{
|
||||
GNCPriceLookup pl;
|
||||
pl.type = LOOKUP_LATEST;
|
||||
pl.prdb = db;
|
||||
pl.commodity = commodity;
|
||||
(db->book->backend->price_lookup) (db->book->backend, &pl);
|
||||
}
|
||||
|
||||
currency_hash = g_hash_table_lookup(db->commodity_hash, commodity);
|
||||
if(!currency_hash) return NULL;
|
||||
|
||||
@ -1027,6 +1037,7 @@ gnc_pricedb_lookup_latest_any_currency(GNCPriceDB *db,
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
GList *
|
||||
gnc_pricedb_get_prices(GNCPriceDB *db,
|
||||
gnc_commodity *commodity,
|
||||
@ -1064,6 +1075,7 @@ gnc_pricedb_get_prices(GNCPriceDB *db,
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
GList *
|
||||
gnc_pricedb_lookup_day(GNCPriceDB *db,
|
||||
gnc_commodity *c,
|
||||
@ -1113,6 +1125,68 @@ gnc_pricedb_lookup_day(GNCPriceDB *db,
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
lookup_day(gpointer key, gpointer val, gpointer user_data)
|
||||
{
|
||||
//gnc_commodity *currency = (gnc_commodity *)key;
|
||||
GList *price_list = (GList *)val;
|
||||
GList *item = NULL;
|
||||
GNCPriceLookupHelper *lookup_helper = (GNCPriceLookupHelper *)user_data;
|
||||
GList **return_list = lookup_helper->return_list;
|
||||
Timespec t = lookup_helper->time;
|
||||
|
||||
item = price_list;
|
||||
while(item) {
|
||||
GNCPrice *p = item->data;
|
||||
Timespec price_time = timespecCanonicalDayTime(gnc_price_get_time(p));
|
||||
if(timespec_equal(&price_time, &t)) {
|
||||
gnc_price_list_insert(return_list, item->data);
|
||||
}
|
||||
item = item->next;
|
||||
}
|
||||
}
|
||||
|
||||
GList *
|
||||
gnc_pricedb_lookup_day_any_currency(GNCPriceDB *db,
|
||||
gnc_commodity *c,
|
||||
Timespec t)
|
||||
{
|
||||
GList *result = NULL;
|
||||
GHashTable *currency_hash;
|
||||
GNCPriceLookupHelper lookup_helper;
|
||||
|
||||
ENTER ("db=%p commodity=%p", db, c);
|
||||
if(!db || !c) return NULL;
|
||||
|
||||
/* Convert to noon local time. */
|
||||
t = timespecCanonicalDayTime(t);
|
||||
|
||||
if (db->book && db->book->backend && db->book->backend->price_lookup)
|
||||
{
|
||||
GNCPriceLookup pl;
|
||||
pl.type = LOOKUP_AT_TIME;
|
||||
pl.prdb = db;
|
||||
pl.commodity = c;
|
||||
pl.date = t;
|
||||
(db->book->backend->price_lookup) (db->book->backend, &pl);
|
||||
}
|
||||
|
||||
currency_hash = g_hash_table_lookup(db->commodity_hash, c);
|
||||
if(!currency_hash) return NULL;
|
||||
|
||||
lookup_helper.return_list = &result;
|
||||
lookup_helper.time = t;
|
||||
g_hash_table_foreach(currency_hash, lookup_day, &lookup_helper);
|
||||
|
||||
if(!result) return NULL;
|
||||
|
||||
result = g_list_sort(result, compare_prices_by_date);
|
||||
|
||||
LEAVE (" ");
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
GList *
|
||||
gnc_pricedb_lookup_at_time(GNCPriceDB *db,
|
||||
gnc_commodity *c,
|
||||
@ -1158,6 +1232,64 @@ gnc_pricedb_lookup_at_time(GNCPriceDB *db,
|
||||
return result;
|
||||
}
|
||||
|
||||
static void
|
||||
lookup_time(gpointer key, gpointer val, gpointer user_data)
|
||||
{
|
||||
//gnc_commodity *currency = (gnc_commodity *)key;
|
||||
GList *price_list = (GList *)val;
|
||||
GList *item = NULL;
|
||||
GNCPriceLookupHelper *lookup_helper = (GNCPriceLookupHelper *)user_data;
|
||||
GList **return_list = lookup_helper->return_list;
|
||||
Timespec t = lookup_helper->time;
|
||||
|
||||
item = price_list;
|
||||
while(item) {
|
||||
GNCPrice *p = item->data;
|
||||
Timespec price_time = gnc_price_get_time(p);
|
||||
if(timespec_equal(&price_time, &t)) {
|
||||
gnc_price_list_insert(return_list, item->data);
|
||||
}
|
||||
item = item->next;
|
||||
}
|
||||
}
|
||||
|
||||
GList *
|
||||
gnc_pricedb_lookup_at_time_any_currency(GNCPriceDB *db,
|
||||
gnc_commodity *c,
|
||||
Timespec t)
|
||||
{
|
||||
GList *result = NULL;
|
||||
GHashTable *currency_hash;
|
||||
GNCPriceLookupHelper lookup_helper;
|
||||
|
||||
ENTER ("db=%p commodity=%p", db, c);
|
||||
if(!db || !c) return NULL;
|
||||
|
||||
if (db->book && db->book->backend && db->book->backend->price_lookup)
|
||||
{
|
||||
GNCPriceLookup pl;
|
||||
pl.type = LOOKUP_AT_TIME;
|
||||
pl.prdb = db;
|
||||
pl.commodity = c;
|
||||
pl.date = t;
|
||||
(db->book->backend->price_lookup) (db->book->backend, &pl);
|
||||
}
|
||||
|
||||
currency_hash = g_hash_table_lookup(db->commodity_hash, c);
|
||||
if(!currency_hash) return NULL;
|
||||
|
||||
lookup_helper.return_list = &result;
|
||||
lookup_helper.time = t;
|
||||
g_hash_table_foreach(currency_hash, lookup_time, &lookup_helper);
|
||||
|
||||
if(!result) return NULL;
|
||||
|
||||
result = g_list_sort(result, compare_prices_by_date);
|
||||
|
||||
LEAVE (" ");
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
GNCPrice *
|
||||
gnc_pricedb_lookup_nearest_in_time(GNCPriceDB *db,
|
||||
@ -1234,6 +1366,96 @@ gnc_pricedb_lookup_nearest_in_time(GNCPriceDB *db,
|
||||
return result;
|
||||
}
|
||||
|
||||
static void
|
||||
lookup_nearest(gpointer key, gpointer val, gpointer user_data)
|
||||
{
|
||||
//gnc_commodity *currency = (gnc_commodity *)key;
|
||||
GList *price_list = (GList *)val;
|
||||
GNCPrice *current_price = NULL;
|
||||
GNCPrice *next_price = NULL;
|
||||
GNCPrice *result = NULL;
|
||||
GList *item = NULL;
|
||||
GNCPriceLookupHelper *lookup_helper = (GNCPriceLookupHelper *)user_data;
|
||||
GList **return_list = lookup_helper->return_list;
|
||||
Timespec t = lookup_helper->time;
|
||||
|
||||
item = price_list;
|
||||
|
||||
/* default answer */
|
||||
current_price = item->data;
|
||||
|
||||
/* find the first candidate past the one we want. Remember that
|
||||
prices are in most-recent-first order. */
|
||||
while (!next_price && item) {
|
||||
GNCPrice *p = item->data;
|
||||
Timespec price_time = gnc_price_get_time(p);
|
||||
if (timespec_cmp(&price_time, &t) <= 0) {
|
||||
next_price = item->data;
|
||||
break;
|
||||
}
|
||||
current_price = item->data;
|
||||
item = item->next;
|
||||
}
|
||||
|
||||
if (current_price) {
|
||||
if (!next_price) {
|
||||
result = current_price;
|
||||
} else {
|
||||
Timespec current_t = gnc_price_get_time(current_price);
|
||||
Timespec next_t = gnc_price_get_time(next_price);
|
||||
Timespec diff_current = timespec_diff(¤t_t, &t);
|
||||
Timespec diff_next = timespec_diff(&next_t, &t);
|
||||
Timespec abs_current = timespec_abs(&diff_current);
|
||||
Timespec abs_next = timespec_abs(&diff_next);
|
||||
|
||||
if (timespec_cmp(&abs_current, &abs_next) <= 0) {
|
||||
result = current_price;
|
||||
} else {
|
||||
result = next_price;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
gnc_price_list_insert(return_list, result);
|
||||
}
|
||||
|
||||
GList *
|
||||
gnc_pricedb_lookup_nearest_in_time_any_currency(GNCPriceDB *db,
|
||||
gnc_commodity *c,
|
||||
Timespec t)
|
||||
{
|
||||
GList *result = NULL;
|
||||
GHashTable *currency_hash;
|
||||
GNCPriceLookupHelper lookup_helper;
|
||||
|
||||
ENTER ("db=%p commodity=%p", db, c);
|
||||
if(!db || !c) return NULL;
|
||||
|
||||
if (db->book && db->book->backend && db->book->backend->price_lookup)
|
||||
{
|
||||
GNCPriceLookup pl;
|
||||
pl.type = LOOKUP_NEAREST_IN_TIME;
|
||||
pl.prdb = db;
|
||||
pl.commodity = c;
|
||||
pl.date = t;
|
||||
(db->book->backend->price_lookup) (db->book->backend, &pl);
|
||||
}
|
||||
|
||||
currency_hash = g_hash_table_lookup(db->commodity_hash, c);
|
||||
if(!currency_hash) return NULL;
|
||||
|
||||
lookup_helper.return_list = &result;
|
||||
lookup_helper.time = t;
|
||||
g_hash_table_foreach(currency_hash, lookup_nearest, &lookup_helper);
|
||||
|
||||
if(!result) return NULL;
|
||||
|
||||
result = g_list_sort(result, compare_prices_by_date);
|
||||
|
||||
LEAVE (" ");
|
||||
return result;
|
||||
}
|
||||
|
||||
/* ==================================================================== */
|
||||
/* gnc_pricedb_foreach_price infrastructure
|
||||
*/
|
||||
|
@ -32,10 +32,12 @@
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
/**********************************************************************\
|
||||
* @file gnc-pricedb.h
|
||||
/** @addtogroup Engine
|
||||
@{ */
|
||||
/**********************************************************************/
|
||||
/** @file gnc-pricedb.h
|
||||
|
||||
Introduction:
|
||||
@brief a simple price database for gnucash
|
||||
|
||||
The PriceDB is intended to be a database of price quotes, or more
|
||||
specifically, a database of GNCPrices. For the time being, it is
|
||||
@ -250,8 +252,8 @@ GNCPrice * gnc_pricedb_lookup_latest(GNCPriceDB *db,
|
||||
gnc_commodity *currency);
|
||||
|
||||
/** gnc_pricedb_lookup_latest_any_currency - find the most recent prices
|
||||
for the given commodity in any available currency. Returns NULL on
|
||||
failure. */
|
||||
for the given commodity in any available currency. Prices will be
|
||||
returned as a GNCPrice list (see above). */
|
||||
GList *gnc_pricedb_lookup_latest_any_currency(GNCPriceDB *db,
|
||||
gnc_commodity *commodity);
|
||||
|
||||
@ -270,6 +272,13 @@ GList * gnc_pricedb_lookup_at_time(GNCPriceDB *db,
|
||||
gnc_commodity *currency,
|
||||
Timespec t);
|
||||
|
||||
/** gnc_pricedb_lookup_at_time_any_currency - return all prices that match the
|
||||
given commodity and timespec in any available currency. Prices will be
|
||||
returned as a GNCPrice list (see above). */
|
||||
GList * gnc_pricedb_lookup_at_time_any_currency(GNCPriceDB *db,
|
||||
gnc_commodity *c,
|
||||
Timespec t);
|
||||
|
||||
/** gnc_pricedb_lookup_day - return all prices that match the given
|
||||
commodity, currency, and timespec. Prices will be returned as a
|
||||
GNCPrice list (see above). */
|
||||
@ -278,13 +287,26 @@ GList * gnc_pricedb_lookup_day(GNCPriceDB *db,
|
||||
gnc_commodity *currency,
|
||||
Timespec t);
|
||||
|
||||
/** gnc_pricedb_lookup_day_any_currency - return all prices that match the
|
||||
given commodity and timespec in any available currency. Prices will be
|
||||
returned as a GNCPrice list (see above). */
|
||||
GList * gnc_pricedb_lookup_day_any_currency(GNCPriceDB *db,
|
||||
gnc_commodity *c,
|
||||
Timespec t);
|
||||
|
||||
/** gnc_pricedb_lookup_nearest_in_time - return the price for the given
|
||||
commodity in the given currency nearest to the given time t. */
|
||||
GNCPrice *
|
||||
gnc_pricedb_lookup_nearest_in_time(GNCPriceDB *db,
|
||||
gnc_commodity *c,
|
||||
gnc_commodity *currency,
|
||||
Timespec t);
|
||||
GNCPrice * gnc_pricedb_lookup_nearest_in_time(GNCPriceDB *db,
|
||||
gnc_commodity *c,
|
||||
gnc_commodity *currency,
|
||||
Timespec t);
|
||||
|
||||
/** gnc_pricedb_lookup_nearest_in_time_any_currency - return all prices that
|
||||
match the given commodity and timespec in any available currency. Prices
|
||||
will be returned as a GNCPrice list (see above). */
|
||||
GList * gnc_pricedb_lookup_nearest_in_time_any_currency(GNCPriceDB *db,
|
||||
gnc_commodity *c,
|
||||
Timespec t);
|
||||
|
||||
/** gnc_pricedb_foreach_price - call f once for each price in db, until
|
||||
and unless f returns FALSE. If stable_order is not FALSE, make
|
||||
@ -312,3 +334,4 @@ void gnc_price_print(GNCPrice *db, FILE *f, int indent);
|
||||
void gnc_pricedb_print_contents(GNCPriceDB *db, FILE *f);
|
||||
|
||||
#endif
|
||||
/** @} */
|
||||
|
@ -186,7 +186,7 @@ init_from_dir(const char *dirname, unsigned int max_files)
|
||||
|
||||
result = snprintf(filename, sizeof(filename),
|
||||
"%s/%s", dirname, de->d_name);
|
||||
if ((result < 0) || (result >= sizeof(filename)))
|
||||
if ((result < 0) || (result >= (int)sizeof(filename)))
|
||||
continue;
|
||||
|
||||
if (stat(filename, &stats) != 0)
|
||||
@ -548,7 +548,7 @@ guid_hash_to_guint (gconstpointer ptr)
|
||||
else
|
||||
{
|
||||
guint hash = 0;
|
||||
int i, j;
|
||||
unsigned int i, j;
|
||||
|
||||
for (i = 0, j = 0; i < sizeof(guint); i++, j++) {
|
||||
if (j == 16) j = 0;
|
||||
|
@ -123,7 +123,7 @@ test_commodity(void)
|
||||
"insert test");
|
||||
|
||||
do_test_args(
|
||||
gnc_commodity_table_get_size(tbl) == i + 1,
|
||||
(int)gnc_commodity_table_get_size(tbl) == i + 1,
|
||||
"test next size table", __FILE__, __LINE__,
|
||||
"should be %d and is %d", i + 1,
|
||||
gnc_commodity_table_get_size(tbl));
|
||||
|
@ -1165,7 +1165,8 @@ gnc_build_options_dialog_contents(GNCOptionWin *propertybox,
|
||||
gint default_page = -1;
|
||||
gint num_sections;
|
||||
gint page;
|
||||
gint i, j;
|
||||
gint i;
|
||||
guint j;
|
||||
|
||||
g_return_if_fail (propertybox != NULL);
|
||||
g_return_if_fail (odb != NULL);
|
||||
|
@ -518,7 +518,7 @@ gnc_option_menu_init(GtkWidget * w)
|
||||
{
|
||||
GtkWidget * menu;
|
||||
GtkWidget * active;
|
||||
int i;
|
||||
unsigned int i;
|
||||
|
||||
menu = gtk_option_menu_get_menu(GTK_OPTION_MENU(w));
|
||||
|
||||
@ -1115,13 +1115,14 @@ gnc_glade_autoconnect_full_func(const gchar *handler_name,
|
||||
gpointer user_data)
|
||||
{
|
||||
GtkSignalFunc func;
|
||||
GtkSignalFunc *p_func = &func;
|
||||
|
||||
if (allsymbols == NULL) {
|
||||
/* get a handle on the main executable -- use this to find symbols */
|
||||
allsymbols = g_module_open(NULL, 0);
|
||||
}
|
||||
|
||||
if (!g_module_symbol(allsymbols, handler_name, (gpointer *)&func)) {
|
||||
if (!g_module_symbol(allsymbols, handler_name, (gpointer *)p_func)) {
|
||||
g_warning("could not find signal handler '%s'.", handler_name);
|
||||
return;
|
||||
}
|
||||
|
@ -308,7 +308,7 @@ gnc_dense_cal_init (GncDenseCal *dcal)
|
||||
/* Deal with the various label sizes. */
|
||||
{
|
||||
gint i;
|
||||
guint maxWidth, maxHeight, maxAscent, maxLBearing;
|
||||
gint maxWidth, maxHeight, maxAscent, maxLBearing;
|
||||
gint lbearing, rbearing, width, ascent, descent;
|
||||
|
||||
dcal->monthLabelFont = gdk_font_load( LABEL_FONT_NAME );
|
||||
@ -754,7 +754,7 @@ gnc_dense_cal_draw_to_buffer( GncDenseCal *dcal )
|
||||
gdk_visual_get_system()->depth );
|
||||
black.pixel = gdk_rgb_xpixel_from_rgb(0);
|
||||
for ( i=0; i<12; i++ ) {
|
||||
gint x,y;
|
||||
guint x,y;
|
||||
/* these are going to be rotated, so transpose width
|
||||
* and height */
|
||||
dcal->monthLabels[i] =
|
||||
@ -1497,7 +1497,8 @@ gnc_dense_cal_mark( GncDenseCal *dcal,
|
||||
guint size, GDate **dateArray,
|
||||
gchar *name, gchar *info )
|
||||
{
|
||||
gint i, doc;
|
||||
guint i;
|
||||
gint doc;
|
||||
gdc_mark_data *newMark;
|
||||
GDate *d;
|
||||
|
||||
@ -1547,7 +1548,7 @@ gnc_dense_cal_mark_remove( GncDenseCal *dcal, guint markToRemove )
|
||||
gdc_mark_data *gdcmd;
|
||||
|
||||
/* Ignore non-realistic marks */
|
||||
if ( markToRemove == -1 ) {
|
||||
if ( (gint)markToRemove == -1 ) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -564,7 +564,7 @@ gnc_frequency_save_state( GNCFrequency *gf, FreqSpec *fs, GDate *outStartDate )
|
||||
{
|
||||
gint page;
|
||||
struct tm *tmpTm;
|
||||
guint day;
|
||||
gint day;
|
||||
GtkWidget *o;
|
||||
UIFreqType uift;
|
||||
FreqSpec *tmpFS;
|
||||
|
@ -444,14 +444,16 @@ gnc_html_http_request_cb(const gchar * uri, int completed_ok,
|
||||
gnc_html * html = user_data;
|
||||
URLType type;
|
||||
char * location = NULL;
|
||||
char ** p_location = &location;
|
||||
char * label = NULL;
|
||||
GList * handles = NULL;
|
||||
GList ** p_handles = &handles;
|
||||
GList * current;
|
||||
|
||||
DEBUG("uri %s, ok %d, body %10.10s, body len %d", uri, completed_ok, body, body_len);
|
||||
g_hash_table_lookup_extended(html->request_info, uri,
|
||||
(gpointer *)&location,
|
||||
(gpointer *)&handles);
|
||||
(gpointer *)p_location,
|
||||
(gpointer *)p_handles);
|
||||
|
||||
/* handles will be NULL for an HTTP POST transaction, where we are
|
||||
* displaying the reply data. */
|
||||
@ -1388,11 +1390,13 @@ gnc_html_unregister_object_handler(const char * classid)
|
||||
{
|
||||
gchar * keyptr=NULL;
|
||||
gchar * valptr=NULL;
|
||||
gchar ** p_keyptr = &keyptr;
|
||||
gchar ** p_valptr = &valptr;
|
||||
|
||||
if (!g_hash_table_lookup_extended(gnc_html_object_handlers,
|
||||
classid,
|
||||
(gpointer *)&keyptr,
|
||||
(gpointer *)&valptr))
|
||||
(gpointer *)p_keyptr,
|
||||
(gpointer *)p_valptr))
|
||||
return;
|
||||
|
||||
g_hash_table_remove(gnc_html_object_handlers, classid);
|
||||
@ -1421,13 +1425,15 @@ gnc_html_unregister_action_handler(const char * actionid)
|
||||
{
|
||||
gchar * keyptr=NULL;
|
||||
gchar * valptr=NULL;
|
||||
gchar ** p_keyptr = &keyptr;
|
||||
gchar ** p_valptr = &valptr;
|
||||
|
||||
g_return_if_fail (actionid != NULL);
|
||||
|
||||
if (!g_hash_table_lookup_extended(gnc_html_action_handlers,
|
||||
actionid,
|
||||
(gpointer *)&keyptr,
|
||||
(gpointer *)&valptr))
|
||||
(gpointer *)p_keyptr,
|
||||
(gpointer *)p_valptr))
|
||||
return;
|
||||
|
||||
g_hash_table_remove(gnc_html_action_handlers, actionid);
|
||||
|
@ -341,7 +341,7 @@ can_calc_value(FinCalcDialog *fcd, FinCalcValue value, int *error_item)
|
||||
const char *bad_exp = _("You must enter a valid expression.");
|
||||
const char *string;
|
||||
gnc_numeric nvalue;
|
||||
int i;
|
||||
unsigned int i;
|
||||
|
||||
if (fcd == NULL)
|
||||
return NULL;
|
||||
|
@ -1796,14 +1796,15 @@ delete_button_clicked( GtkButton *b, gpointer d )
|
||||
book = gnc_get_current_book ();
|
||||
sxList = gnc_book_get_schedxactions( book );
|
||||
for ( sel = cl->selection; sel; sel = sel->next ) {
|
||||
guint tag;
|
||||
gint tag;
|
||||
gint *p_tag = &tag;
|
||||
gpointer unused;
|
||||
gboolean foundP;
|
||||
|
||||
sx = (SchedXaction*)gtk_clist_get_row_data( cl, (int)sel->data );
|
||||
sxList = g_list_remove( sxList, (gpointer)sx );
|
||||
foundP = g_hash_table_lookup_extended( sxd->sxData, sx,
|
||||
&unused, (gpointer*)&tag );
|
||||
&unused, (gpointer*)p_tag );
|
||||
g_assert( foundP );
|
||||
if ( tag != -1 ) {
|
||||
gnc_dense_cal_mark_remove( sxd->gdcal, tag );
|
||||
@ -1914,7 +1915,8 @@ putSchedXactionInDialog( gpointer data, gpointer user_data )
|
||||
int instArraySize;
|
||||
GDate **instArray;
|
||||
GList *instList;
|
||||
guint gdcMarkTag, oldMarkTag;
|
||||
gint gdcMarkTag, oldMarkTag;
|
||||
gint *p_oldMarkTag = &oldMarkTag;
|
||||
|
||||
sx = (SchedXaction*)data;
|
||||
sxd = (SchedXactionDialog*)user_data;
|
||||
@ -1998,7 +2000,7 @@ putSchedXactionInDialog( gpointer data, gpointer user_data )
|
||||
g_hash_table_lookup_extended( sxd->sxData,
|
||||
(gpointer)sx,
|
||||
&unused,
|
||||
(gpointer*)&oldMarkTag );
|
||||
(gpointer*)p_oldMarkTag );
|
||||
g_assert( foundP );
|
||||
}
|
||||
if ( row == -1 ) {
|
||||
|
@ -685,7 +685,7 @@ sxftd_update_example_cal( SXFromTransInfo *sxfti )
|
||||
struct tm *tmpTm;
|
||||
time_t tmp_tt;
|
||||
GDate date, startDate;
|
||||
int i;
|
||||
unsigned int i;
|
||||
FreqSpec *fs;
|
||||
getEndTuple get;
|
||||
gchar *name;
|
||||
|
@ -125,7 +125,7 @@ struct _GNCSplitReg {
|
||||
gint createFlags;
|
||||
gint disallowedCaps;
|
||||
|
||||
gint sort_type;
|
||||
guint sort_type;
|
||||
|
||||
gboolean read_only;
|
||||
};
|
||||
|
@ -71,7 +71,7 @@ struct _GNCReconcileList
|
||||
GNCReconcileList *sibling;
|
||||
|
||||
/* Sorting info */
|
||||
gint key;
|
||||
guint key;
|
||||
gboolean increasing;
|
||||
GtkWidget *title_arrow[5];
|
||||
|
||||
|
@ -81,7 +81,7 @@ static gboolean acct_tree_add_accts(struct _accountpickerdialog * picker, Accoun
|
||||
{
|
||||
GtkCTreeNode * node;
|
||||
Account *current_acct;
|
||||
guint i;
|
||||
gint i;
|
||||
gboolean expand_parent = FALSE;
|
||||
gboolean expand;
|
||||
gchar * acctinfo[NUM_COLUMNS_CLIST];
|
||||
|
@ -100,7 +100,7 @@ gnc_gpg_transform_async(const gchar * input, gint input_size,
|
||||
/* parent process. write passphrase to pipe first. */
|
||||
if(passphrase) {
|
||||
total_bytes = 0;
|
||||
while(total_bytes < strlen(passphrase)) {
|
||||
while(total_bytes < (int)strlen(passphrase)) {
|
||||
bytes = write(to_child[1],
|
||||
passphrase+total_bytes,
|
||||
strlen(passphrase)-total_bytes);
|
||||
|
@ -127,8 +127,8 @@ gnc_formula_cell_modify_verify( BasicCell *_cell,
|
||||
FormulaCell *cell = (FormulaCell *)_cell;
|
||||
struct lconv *lc = gnc_localeconv ();
|
||||
const char *toks = "+-*/=()_";
|
||||
char decimal_point;
|
||||
char thousands_sep;
|
||||
unsigned char decimal_point;
|
||||
unsigned char thousands_sep;
|
||||
int i;
|
||||
|
||||
DEBUG( "%s, %d, %s, %d, %d, %d, %d",
|
||||
|
@ -81,8 +81,8 @@ gnc_price_cell_modify_verify (BasicCell *_cell,
|
||||
PriceCell *cell = (PriceCell *) _cell;
|
||||
struct lconv *lc = gnc_localeconv ();
|
||||
const char *toks = "+-*/=()_";
|
||||
char decimal_point;
|
||||
char thousands_sep;
|
||||
unsigned char decimal_point;
|
||||
unsigned char thousands_sep;
|
||||
int i;
|
||||
|
||||
/* accept the newval string if user action was delete */
|
||||
|
@ -67,7 +67,7 @@ typedef struct _PopBox
|
||||
|
||||
gboolean strict;
|
||||
|
||||
char complete_char; /* char to be used for auto-completion */
|
||||
unsigned char complete_char; /* char to be used for auto-completion */
|
||||
|
||||
GList *ignore_strings;
|
||||
} PopBox;
|
||||
|
@ -483,7 +483,7 @@ gnc_date_cell_modify_verify (BasicCell *_cell,
|
||||
else
|
||||
{
|
||||
int i, count = 0;
|
||||
char separator = dateSeparator ();
|
||||
unsigned char separator = dateSeparator ();
|
||||
gboolean ok = TRUE;
|
||||
|
||||
for (i = 0; i < change_len; i++)
|
||||
|
@ -105,7 +105,7 @@ typedef struct
|
||||
|
||||
gint editing;
|
||||
|
||||
gint button; /* mouse button being held down */
|
||||
guint button; /* mouse button being held down */
|
||||
gboolean grabbed; /* has the grab */
|
||||
|
||||
guint insert_signal;
|
||||
|
Loading…
Reference in New Issue
Block a user