Re-indentation of source code, next batch.

This also strips trailing whitespaces from lines where they existed.
This re-indentation was done using astyle-1.24 using the following options:

astyle --indent=spaces=4 --brackets=break --pad-oper --pad-header --suffix=none

git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@18787 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
Christian Stimming
2010-03-02 21:40:02 +00:00
parent b325f24c91
commit ce99c42871
20 changed files with 1224 additions and 1207 deletions

View File

@@ -36,14 +36,16 @@ gmtime_r(const time_t *const timep, struct tm *p_tm)
static int time_mutex_inited = 0; static int time_mutex_inited = 0;
struct tm *tmp; struct tm *tmp;
if (!time_mutex_inited) { if (!time_mutex_inited)
{
time_mutex_inited = 1; time_mutex_inited = 1;
pthread_mutex_init(&time_mutex, NULL); pthread_mutex_init(&time_mutex, NULL);
} }
pthread_mutex_lock(&time_mutex); pthread_mutex_lock(&time_mutex);
tmp = gmtime(timep); tmp = gmtime(timep);
if (tmp) { if (tmp)
{
memcpy(p_tm, tmp, sizeof(struct tm)); memcpy(p_tm, tmp, sizeof(struct tm));
tmp = p_tm; tmp = p_tm;
} }
@@ -57,7 +59,8 @@ gmtime_r(const time_t *const timep, struct tm *p_tm)
{ {
static struct tm* tmp; static struct tm* tmp;
tmp = gmtime(timep); tmp = gmtime(timep);
if (tmp) { if (tmp)
{
memcpy(p_tm, tmp, sizeof(struct tm)); memcpy(p_tm, tmp, sizeof(struct tm));
tmp = p_tm; tmp = p_tm;
} }

View File

@@ -2,5 +2,5 @@ void gnc_libc_missing_noop (void);
void gnc_libc_missing_noop (void) void gnc_libc_missing_noop (void)
{ {
return; return;
} }

View File

@@ -11,24 +11,26 @@
struct tm * struct tm *
localtime_r(const time_t *const timep, struct tm *p_tm) localtime_r(const time_t *const timep, struct tm *p_tm)
{ {
static pthread_mutex_t time_mutex; static pthread_mutex_t time_mutex;
static int time_mutex_inited = 0; static int time_mutex_inited = 0;
struct tm *tmp; struct tm *tmp;
if (!time_mutex_inited) { if (!time_mutex_inited)
time_mutex_inited = 1; {
pthread_mutex_init(&time_mutex, NULL); time_mutex_inited = 1;
} pthread_mutex_init(&time_mutex, NULL);
}
pthread_mutex_lock(&time_mutex); pthread_mutex_lock(&time_mutex);
tmp = localtime(timep); tmp = localtime(timep);
if (tmp) { if (tmp)
memcpy(p_tm, tmp, sizeof(struct tm)); {
tmp = p_tm; memcpy(p_tm, tmp, sizeof(struct tm));
} tmp = p_tm;
pthread_mutex_unlock(&time_mutex); }
pthread_mutex_unlock(&time_mutex);
return tmp; return tmp;
} }
#else #else
struct tm * struct tm *
@@ -36,9 +38,10 @@ localtime_r(const time_t *const timep, struct tm *p_tm)
{ {
static struct tm* tmp; static struct tm* tmp;
tmp = localtime(timep); tmp = localtime(timep);
if (tmp) { if (tmp)
memcpy(p_tm, tmp, sizeof(struct tm)); {
tmp = p_tm; memcpy(p_tm, tmp, sizeof(struct tm));
tmp = p_tm;
} }
return tmp; return tmp;
} }

View File

@@ -110,67 +110,67 @@ filltime (struct tm *bd_time, int zoff, char *zname);
static SCM static SCM
filltime (struct tm *bd_time, int zoff, char *zname) filltime (struct tm *bd_time, int zoff, char *zname)
{ {
SCM result = scm_make_vector (SCM_MAKINUM(11), SCM_UNDEFINED); SCM result = scm_make_vector (SCM_MAKINUM(11), SCM_UNDEFINED);
SCM_VELTS (result)[0] = SCM_MAKINUM (bd_time->tm_sec); SCM_VELTS (result)[0] = SCM_MAKINUM (bd_time->tm_sec);
SCM_VELTS (result)[1] = SCM_MAKINUM (bd_time->tm_min); SCM_VELTS (result)[1] = SCM_MAKINUM (bd_time->tm_min);
SCM_VELTS (result)[2] = SCM_MAKINUM (bd_time->tm_hour); SCM_VELTS (result)[2] = SCM_MAKINUM (bd_time->tm_hour);
SCM_VELTS (result)[3] = SCM_MAKINUM (bd_time->tm_mday); SCM_VELTS (result)[3] = SCM_MAKINUM (bd_time->tm_mday);
SCM_VELTS (result)[4] = SCM_MAKINUM (bd_time->tm_mon); SCM_VELTS (result)[4] = SCM_MAKINUM (bd_time->tm_mon);
SCM_VELTS (result)[5] = SCM_MAKINUM (bd_time->tm_year); SCM_VELTS (result)[5] = SCM_MAKINUM (bd_time->tm_year);
SCM_VELTS (result)[6] = SCM_MAKINUM (bd_time->tm_wday); SCM_VELTS (result)[6] = SCM_MAKINUM (bd_time->tm_wday);
SCM_VELTS (result)[7] = SCM_MAKINUM (bd_time->tm_yday); SCM_VELTS (result)[7] = SCM_MAKINUM (bd_time->tm_yday);
SCM_VELTS (result)[8] = SCM_MAKINUM (bd_time->tm_isdst); SCM_VELTS (result)[8] = SCM_MAKINUM (bd_time->tm_isdst);
SCM_VELTS (result)[9] = SCM_MAKINUM (zoff); SCM_VELTS (result)[9] = SCM_MAKINUM (zoff);
SCM_VELTS (result)[10] = zname ? scm_makfrom0str (zname) : SCM_BOOL_F; SCM_VELTS (result)[10] = zname ? scm_makfrom0str (zname) : SCM_BOOL_F;
return result; return result;
} }
#ifndef HAVE_STRPTIME #ifndef HAVE_STRPTIME
SCM_DEFINE (scm_strptime, "strptime", 2, 0, 0, SCM_DEFINE (scm_strptime, "strptime", 2, 0, 0,
(SCM format, SCM string), (SCM format, SCM string),
"Performs the reverse action to @code{strftime}, parsing @var{string}\n" "Performs the reverse action to @code{strftime}, parsing @var{string}\n"
"according to the specification supplied in @var{template}. The\n" "according to the specification supplied in @var{template}. The\n"
"interpretation of month and day names is dependent on the current\n" "interpretation of month and day names is dependent on the current\n"
"locale. The\n" "locale. The\n"
"value returned is a pair. The CAR has an object with time components \n" "value returned is a pair. The CAR has an object with time components \n"
"in the form returned by @code{localtime} or @code{gmtime},\n" "in the form returned by @code{localtime} or @code{gmtime},\n"
"but the time zone components\n" "but the time zone components\n"
"are not usefully set.\n" "are not usefully set.\n"
"The CDR reports the number of characters from @var{string} which\n" "The CDR reports the number of characters from @var{string} which\n"
"vwere used for the conversion.") "vwere used for the conversion.")
#define FUNC_NAME s_scm_strptime #define FUNC_NAME s_scm_strptime
{ {
struct tm t; struct tm t;
char *fmt, *str, *rest; char *fmt, *str, *rest;
SCM_VALIDATE_ROSTRING (1,format); SCM_VALIDATE_ROSTRING (1, format);
SCM_VALIDATE_ROSTRING (2,string); SCM_VALIDATE_ROSTRING (2, string);
SCM_COERCE_SUBSTR (format); SCM_COERCE_SUBSTR (format);
SCM_COERCE_SUBSTR (string); SCM_COERCE_SUBSTR (string);
fmt = SCM_ROCHARS (format); fmt = SCM_ROCHARS (format);
str = SCM_ROCHARS (string); str = SCM_ROCHARS (string);
/* initialize the struct tm */ /* initialize the struct tm */
#define tm_init(field) t.field = 0 #define tm_init(field) t.field = 0
tm_init (tm_sec); tm_init (tm_sec);
tm_init (tm_min); tm_init (tm_min);
tm_init (tm_hour); tm_init (tm_hour);
tm_init (tm_mday); tm_init (tm_mday);
tm_init (tm_mon); tm_init (tm_mon);
tm_init (tm_year); tm_init (tm_year);
tm_init (tm_wday); tm_init (tm_wday);
tm_init (tm_yday); tm_init (tm_yday);
#undef tm_init #undef tm_init
t.tm_isdst = -1; t.tm_isdst = -1;
SCM_DEFER_INTS; SCM_DEFER_INTS;
if ((rest = strptime (str, fmt, &t)) == NULL) if ((rest = strptime (str, fmt, &t)) == NULL)
SCM_SYSERROR; SCM_SYSERROR;
SCM_ALLOW_INTS; SCM_ALLOW_INTS;
return scm_cons (filltime (&t, 0, NULL), SCM_MAKINUM (rest - str)); return scm_cons (filltime (&t, 0, NULL), SCM_MAKINUM (rest - str));
} }
#undef FUNC_NAME #undef FUNC_NAME
#endif /* HAVE_STRPTIME */ #endif /* HAVE_STRPTIME */

View File

@@ -47,46 +47,46 @@
int int
setenv(const char *name, const char *value, int overwrite) setenv(const char *name, const char *value, int overwrite)
{ {
const char *old_value = getenv(name); const char *old_value = getenv(name);
int result = 0; int result = 0;
if ((name == NULL) || (value == NULL)) return -1; if ((name == NULL) || (value == NULL)) return -1;
if(overwrite || (!old_value)) if (overwrite || (!old_value))
{
char *new_value = g_strdup_printf("%s=%s", name, value);
if(putenv(new_value) != 0) result = -1;
if(old_value)
{ {
/* for now, do nothing, but it would be nice if we could figure char *new_value = g_strdup_printf("%s=%s", name, value);
out a safe way to reclaim any memory that *we* allocated, if (putenv(new_value) != 0) result = -1;
taking in to account whether or not other code (in other if (old_value)
system libs) is allowed to have cached a pointer into the {
value via getenv -- is that kosher? /* for now, do nothing, but it would be nice if we could figure
out a safe way to reclaim any memory that *we* allocated,
taking in to account whether or not other code (in other
system libs) is allowed to have cached a pointer into the
value via getenv -- is that kosher?
Also we have to *know* that we allocated the memory. Also we have to *know* that we allocated the memory.
*/ */
}
} }
} return result;
return result;
} }
int int
unsetenv(const char *name) unsetenv(const char *name)
{ {
int result = 0; int result = 0;
char *putenv_str; char *putenv_str;
if(name == NULL) return -1; if (name == NULL) return -1;
if(strchr(name, '=') != NULL) return -1; if (strchr(name, '=') != NULL) return -1;
if(*name == '\0') return -1; if (*name == '\0') return -1;
putenv_str = g_strdup_printf("%s=", name); putenv_str = g_strdup_printf("%s=", name);
if(!putenv_str) return -1; if (!putenv_str) return -1;
result = putenv(putenv_str); result = putenv(putenv_str);
g_free(putenv_str); g_free(putenv_str);
return result; return result;
} }
#endif #endif

File diff suppressed because it is too large Load Diff

View File

@@ -62,8 +62,8 @@ RecnWindow *recnWindow (gncUIWidget parent, Account *account);
* Return: recnData - the instance of this RecnWindow * Return: recnData - the instance of this RecnWindow
\********************************************************************/ \********************************************************************/
RecnWindow *recnWindowWithBalance (GtkWidget *parent, RecnWindow *recnWindowWithBalance (GtkWidget *parent,
Account *account, Account *account,
gnc_numeric new_ending, gnc_numeric new_ending,
time_t statement_date); time_t statement_date);
#endif #endif

View File

@@ -339,7 +339,7 @@ gnc_sx_instance_new(GncSxInstances *parent, GncSxInstanceState state, GDate *dat
static gint static gint
_compare_GncSxVariables(gconstpointer a, gconstpointer b) _compare_GncSxVariables(gconstpointer a, gconstpointer b)
{ {
return strcmp(((const GncSxVariable*)a)->name, ((const GncSxVariable*)b)->name); return strcmp(((const GncSxVariable*)a)->name, ((const GncSxVariable*)b)->name);
} }
static void static void

View File

@@ -243,9 +243,9 @@ xml_session_begin(QofBackend *be_start, QofSession *session,
rc = g_stat (be->dirname, &statbuf); rc = g_stat (be->dirname, &statbuf);
if (rc != 0 if (rc != 0
#ifndef _MSC_VER #ifndef _MSC_VER
|| !S_ISDIR(statbuf.st_mode) || !S_ISDIR(statbuf.st_mode)
#endif #endif
) )
{ {
/* Error on stat or if it isn't a directory means we /* Error on stat or if it isn't a directory means we
cannot find this filename */ cannot find this filename */
@@ -273,9 +273,9 @@ xml_session_begin(QofBackend *be_start, QofSession *session,
} }
if (rc == 0 if (rc == 0
#ifndef _MSC_VER #ifndef _MSC_VER
&& S_ISDIR(statbuf.st_mode) && S_ISDIR(statbuf.st_mode)
#endif #endif
) )
{ {
/* FIXME: What is actually checked here? Whether the /* FIXME: What is actually checked here? Whether the
fullpath erroneously points to a directory or what? fullpath erroneously points to a directory or what?

View File

@@ -70,36 +70,36 @@
extern gboolean extern gboolean
gnc_verify_dialog(gncUIWidget parent, gnc_verify_dialog(gncUIWidget parent,
gboolean yes_is_default, gboolean yes_is_default,
const char *format, ...) G_GNUC_PRINTF (3, 4); const char *format, ...) G_GNUC_PRINTF (3, 4);
extern gint extern gint
gnc_ok_cancel_dialog(gncUIWidget parent, gnc_ok_cancel_dialog(gncUIWidget parent,
gint default_result, gint default_result,
const char *format, ...) G_GNUC_PRINTF (3,4); const char *format, ...) G_GNUC_PRINTF (3, 4);
extern void extern void
gnc_warning_dialog(gncUIWidget parent, gnc_warning_dialog(gncUIWidget parent,
const char *format, ...) G_GNUC_PRINTF (2, 3); const char *format, ...) G_GNUC_PRINTF (2, 3);
extern void extern void
gnc_error_dialog(GtkWidget *parent, gnc_error_dialog(GtkWidget *parent,
const char *format, ...) G_GNUC_PRINTF (2, 3); const char *format, ...) G_GNUC_PRINTF (2, 3);
extern void extern void
gnc_gnome_help (const char *file_name, const char *target_link); gnc_gnome_help (const char *file_name, const char *target_link);
int gnc_choose_radio_option_dialog (gncUIWidget parent, int gnc_choose_radio_option_dialog (gncUIWidget parent,
const char *title, const char *title,
const char *msg, const char *msg,
const char *button_name, const char *button_name,
int default_value, int default_value,
GList *radio_list); GList *radio_list);
gboolean gnc_dup_trans_dialog (gncUIWidget parent, time_t *date_p, gboolean gnc_dup_trans_dialog (gncUIWidget parent, time_t *date_p,
const char *num, char **out_num); const char *num, char **out_num);
@@ -108,12 +108,12 @@ void gnc_stock_split_dialog (gncUIWidget parent, Account * initial);
typedef enum typedef enum
{ {
GNC_PRICE_EDIT, GNC_PRICE_EDIT,
GNC_PRICE_NEW, GNC_PRICE_NEW,
} GNCPriceEditType; } GNCPriceEditType;
void gnc_price_edit_dialog (gncUIWidget parent, QofSession *session, void gnc_price_edit_dialog (gncUIWidget parent, QofSession *session,
GNCPrice *price, GNCPriceEditType type); GNCPrice *price, GNCPriceEditType type);
GNCPrice* gnc_price_edit_by_guid (GtkWidget * parent, const GUID * guid); GNCPrice* gnc_price_edit_by_guid (GtkWidget * parent, const GUID * guid);
void gnc_prices_dialog (gncUIWidget parent); void gnc_prices_dialog (gncUIWidget parent);
void gnc_commodities_dialog (gncUIWidget parent); void gnc_commodities_dialog (gncUIWidget parent);

View File

@@ -991,9 +991,9 @@ impl_webkit_export_to_file( GncHtml* self, const char *filepath )
static void static void
impl_webkit_print( GncHtml* self ) impl_webkit_print( GncHtml* self )
{ {
extern void webkit_web_frame_print( WebKitWebFrame* frame ); extern void webkit_web_frame_print( WebKitWebFrame * frame );
extern GtkPrintOperationResult webkit_web_frame_print_full( WebKitWebFrame* frame, extern GtkPrintOperationResult webkit_web_frame_print_full( WebKitWebFrame * frame,
GtkPrintOperation* op, GtkPrintOperationAction action, GError** error ); GtkPrintOperation * op, GtkPrintOperationAction action, GError** error );
GncHtmlWebkitPrivate* priv; GncHtmlWebkitPrivate* priv;
WebKitWebFrame* frame; WebKitWebFrame* frame;
@@ -1006,17 +1006,18 @@ impl_webkit_print( GncHtml* self )
frame = webkit_web_view_get_main_frame( priv->web_view ); frame = webkit_web_view_get_main_frame( priv->web_view );
#if PRINT_WITH_OP #if PRINT_WITH_OP
gtk_print_operation_set_unit( op, GTK_UNIT_POINTS ); gtk_print_operation_set_unit( op, GTK_UNIT_POINTS );
webkit_web_frame_print_full( frame, op, GTK_PRINT_OPERATION_ACTION_PRINT_DIALOG, &error ); webkit_web_frame_print_full( frame, op, GTK_PRINT_OPERATION_ACTION_PRINT_DIALOG, &error );
g_object_unref( op ); g_object_unref( op );
if( error != NULL ) { if ( error != NULL )
{
GtkWidget* window = gtk_widget_get_toplevel( GTK_WIDGET(priv->web_view) ); GtkWidget* window = gtk_widget_get_toplevel( GTK_WIDGET(priv->web_view) );
GtkWidget* dialog = gtk_message_dialog_new( GTK_WIDGET_TOPLEVEL(window) ? GTK_WINDOW(window) : NULL, GtkWidget* dialog = gtk_message_dialog_new( GTK_WIDGET_TOPLEVEL(window) ? GTK_WINDOW(window) : NULL,
GTK_DIALOG_DESTROY_WITH_PARENT, GTK_DIALOG_DESTROY_WITH_PARENT,
GTK_MESSAGE_ERROR, GTK_MESSAGE_ERROR,
GTK_BUTTONS_CLOSE, GTK_BUTTONS_CLOSE,
"%s", error->message ); "%s", error->message );
g_error_free( error ); g_error_free( error );
g_signal_connect( dialog, "response", G_CALLBACK(gtk_widget_destroy), NULL); g_signal_connect( dialog, "response", G_CALLBACK(gtk_widget_destroy), NULL);

View File

@@ -765,7 +765,8 @@ static gboolean trans_property_list_verify_essentials(TransPropertyList* list, g
int i; int i;
/* possible_errors lists the ways in which a list can fail this test. */ /* possible_errors lists the ways in which a list can fail this test. */
enum PossibleErrorTypes {NO_DATE, NO_AMOUNT, NUM_OF_POSSIBLE_ERRORS}; enum PossibleErrorTypes {NO_DATE, NO_AMOUNT, NUM_OF_POSSIBLE_ERRORS};
gchar* possible_errors[NUM_OF_POSSIBLE_ERRORS] = { gchar* possible_errors[NUM_OF_POSSIBLE_ERRORS] =
{
N_("No date column."), N_("No date column."),
N_("No balance, deposit, or withdrawal column.") N_("No balance, deposit, or withdrawal column.")
}; };
@@ -857,7 +858,7 @@ static GncCsvTransLine* trans_property_list_to_trans(TransPropertyList* list, gc
QofBook* book = gnc_account_get_book(list->account); QofBook* book = gnc_account_get_book(list->account);
gnc_commodity* currency = xaccAccountGetCommodity(list->account); gnc_commodity* currency = xaccAccountGetCommodity(list->account);
gnc_numeric amount = double_to_gnc_numeric(0.0, xaccAccountGetCommoditySCU(list->account), gnc_numeric amount = double_to_gnc_numeric(0.0, xaccAccountGetCommoditySCU(list->account),
GNC_RND_ROUND); GNC_RND_ROUND);
/* This flag is set to TRUE if we can use the "Deposit" or "Withdrawal" column. */ /* This flag is set to TRUE if we can use the "Deposit" or "Withdrawal" column. */
gboolean amount_set = FALSE; gboolean amount_set = FALSE;
@@ -905,9 +906,9 @@ static GncCsvTransLine* trans_property_list_to_trans(TransPropertyList* list, gc
if (prop->value != NULL) if (prop->value != NULL)
{ {
amount = gnc_numeric_add(*((gnc_numeric*)(prop->value)), amount = gnc_numeric_add(*((gnc_numeric*)(prop->value)),
amount, amount,
xaccAccountGetCommoditySCU(list->account), xaccAccountGetCommoditySCU(list->account),
GNC_RND_ROUND); GNC_RND_ROUND);
amount_set = TRUE; amount_set = TRUE;
/* We will use the "Deposit" and "Withdrawal" columns in preference to "Balance". */ /* We will use the "Deposit" and "Withdrawal" columns in preference to "Balance". */
trans_line->balance_set = FALSE; trans_line->balance_set = FALSE;
@@ -918,9 +919,9 @@ static GncCsvTransLine* trans_property_list_to_trans(TransPropertyList* list, gc
if (prop->value != NULL) if (prop->value != NULL)
{ {
amount = gnc_numeric_add(gnc_numeric_neg(*((gnc_numeric*)(prop->value))), amount = gnc_numeric_add(gnc_numeric_neg(*((gnc_numeric*)(prop->value))),
amount, amount,
xaccAccountGetCommoditySCU(list->account), xaccAccountGetCommoditySCU(list->account),
GNC_RND_ROUND); GNC_RND_ROUND);
amount_set = TRUE; amount_set = TRUE;
/* We will use the "Deposit" and "Withdrawal" columns in preference to "Balance". */ /* We will use the "Deposit" and "Withdrawal" columns in preference to "Balance". */
trans_line->balance_set = FALSE; trans_line->balance_set = FALSE;
@@ -957,7 +958,7 @@ static GncCsvTransLine* trans_property_list_to_trans(TransPropertyList* list, gc
* @return 0 on success, 1 on failure * @return 0 on success, 1 on failure
*/ */
int gnc_csv_parse_to_trans(GncCsvParseData* parse_data, Account* account, int gnc_csv_parse_to_trans(GncCsvParseData* parse_data, Account* account,
gboolean redo_errors) gboolean redo_errors)
{ {
gboolean hasBalanceColumn; gboolean hasBalanceColumn;
int i, j, max_cols = 0; int i, j, max_cols = 0;
@@ -1041,7 +1042,7 @@ gboolean redo_errors)
{ {
errors = TRUE; errors = TRUE;
error_message = g_strdup_printf(_("%s column could not be understood."), error_message = g_strdup_printf(_("%s column could not be understood."),
_(gnc_csv_column_type_strs[property->type])); _(gnc_csv_column_type_strs[property->type]));
trans_property_free(property); trans_property_free(property);
break; break;
} }
@@ -1061,7 +1062,7 @@ gboolean redo_errors)
if (errors) if (errors)
{ {
parse_data->error_lines = g_list_append(parse_data->error_lines, parse_data->error_lines = g_list_append(parse_data->error_lines,
GINT_TO_POINTER(i)); GINT_TO_POINTER(i));
/* If there's already an error message, we need to replace it. */ /* If there's already an error message, we need to replace it. */
if (line->len > (int)(parse_data->orig_row_lengths->data[i])) if (line->len > (int)(parse_data->orig_row_lengths->data[i]))
{ {
@@ -1086,7 +1087,7 @@ gboolean redo_errors)
/* If we can just put it at the end, do so and increment last_transaction. */ /* If we can just put it at the end, do so and increment last_transaction. */
if (last_transaction == NULL || if (last_transaction == NULL ||
xaccTransGetDate(((GncCsvTransLine*)(last_transaction->data))->trans) <= xaccTransGetDate(trans_line->trans)) xaccTransGetDate(((GncCsvTransLine*)(last_transaction->data))->trans) <= xaccTransGetDate(trans_line->trans))
{ {
parse_data->transactions = g_list_append(parse_data->transactions, trans_line); parse_data->transactions = g_list_append(parse_data->transactions, trans_line);
/* If this is the first transaction, we need to get last_transaction on track. */ /* If this is the first transaction, we need to get last_transaction on track. */
@@ -1100,7 +1101,7 @@ gboolean redo_errors)
{ {
GList* insertion_spot = last_transaction; GList* insertion_spot = last_transaction;
while (insertion_spot != NULL && while (insertion_spot != NULL &&
xaccTransGetDate(((GncCsvTransLine*)(insertion_spot->data))->trans) > xaccTransGetDate(trans_line->trans)) xaccTransGetDate(((GncCsvTransLine*)(insertion_spot->data))->trans) > xaccTransGetDate(trans_line->trans))
{ {
insertion_spot = g_list_previous(insertion_spot); insertion_spot = g_list_previous(insertion_spot);
} }
@@ -1151,8 +1152,8 @@ gboolean redo_errors)
* imported. This will be sum of all the previous transactions for * imported. This will be sum of all the previous transactions for
* any given transaction. */ * any given transaction. */
gnc_numeric balance_offset = double_to_gnc_numeric(0.0, gnc_numeric balance_offset = double_to_gnc_numeric(0.0,
xaccAccountGetCommoditySCU(account), xaccAccountGetCommoditySCU(account),
GNC_RND_ROUND); GNC_RND_ROUND);
while (transactions != NULL) while (transactions != NULL)
{ {
GncCsvTransLine* trans_line = (GncCsvTransLine*)transactions->data; GncCsvTransLine* trans_line = (GncCsvTransLine*)transactions->data;
@@ -1161,15 +1162,15 @@ gboolean redo_errors)
time_t date = xaccTransGetDate(trans_line->trans); time_t date = xaccTransGetDate(trans_line->trans);
/* Find what the balance should be by adding the offset to the actual balance. */ /* Find what the balance should be by adding the offset to the actual balance. */
gnc_numeric existing_balance = gnc_numeric_add(balance_offset, gnc_numeric existing_balance = gnc_numeric_add(balance_offset,
xaccAccountGetBalanceAsOfDate(account, date), xaccAccountGetBalanceAsOfDate(account, date),
xaccAccountGetCommoditySCU(account), xaccAccountGetCommoditySCU(account),
GNC_RND_ROUND); GNC_RND_ROUND);
/* The amount of the transaction is the difference between the new and existing balance. */ /* The amount of the transaction is the difference between the new and existing balance. */
gnc_numeric amount = gnc_numeric_sub(trans_line->balance, gnc_numeric amount = gnc_numeric_sub(trans_line->balance,
existing_balance, existing_balance,
xaccAccountGetCommoditySCU(account), xaccAccountGetCommoditySCU(account),
GNC_RND_ROUND); GNC_RND_ROUND);
SplitList* splits = xaccTransGetSplitList(trans_line->trans); SplitList* splits = xaccTransGetSplitList(trans_line->trans);
while (splits) while (splits)
@@ -1183,9 +1184,9 @@ gboolean redo_errors)
/* This new transaction needs to be added to the balance offset. */ /* This new transaction needs to be added to the balance offset. */
balance_offset = gnc_numeric_add(balance_offset, balance_offset = gnc_numeric_add(balance_offset,
amount, amount,
xaccAccountGetCommoditySCU(account), xaccAccountGetCommoditySCU(account),
GNC_RND_ROUND); GNC_RND_ROUND);
} }
transactions = g_list_next(transactions); transactions = g_list_next(transactions);
} }

View File

@@ -762,10 +762,10 @@ static void split_find_match (GNCImportTransInfo * trans_info,
/* Append that to the list. Do not use g_list_append because /* Append that to the list. Do not use g_list_append because
it is slow. The list is sorted afterwards anyway. */ it is slow. The list is sorted afterwards anyway. */
trans_info->match_list = trans_info->match_list =
g_list_prepend(trans_info->match_list, g_list_prepend(trans_info->match_list,
match_info); match_info);
} }
}/* end split_find_match */ }/* end split_find_match */

View File

@@ -449,7 +449,7 @@ qof_print_date_dmy_buff (char * buff, size_t len, int day, int month, int year)
tm_str.tm_mday = day; tm_str.tm_mday = day;
tm_str.tm_mon = month - 1; /* tm_mon = 0 through 11 */ tm_str.tm_mon = month - 1; /* tm_mon = 0 through 11 */
tm_str.tm_year = year - 1900; /* this is what the standard tm_str.tm_year = year - 1900; /* this is what the standard
* says, it's not a Y2K thing */ says, it's not a Y2K thing */
gnc_tm_set_day_start (&tm_str); gnc_tm_set_day_start (&tm_str);
t = mktime (&tm_str); t = mktime (&tm_str);

View File

@@ -258,7 +258,7 @@ init_from_dir(const char *dirname, unsigned int max_files)
total += strlen(de); total += strlen(de);
result = g_snprintf(filename, sizeof(filename), result = g_snprintf(filename, sizeof(filename),
"%s/%s", dirname, de); "%s/%s", dirname, de);
if ((result < 0) || (result >= (int)sizeof(filename))) if ((result < 0) || (result >= (int)sizeof(filename)))
continue; continue;
@@ -378,7 +378,7 @@ guid_init(void)
/* process and parent ids */ /* process and parent ids */
{ {
#ifdef HAVE_UNISTD_H #ifdef HAVE_UNISTD_H
pid_t pid; pid_t pid;
pid = getpid(); pid = getpid();
md5_process_bytes(&pid, sizeof(pid), &guid_context); md5_process_bytes(&pid, sizeof(pid), &guid_context);
@@ -390,7 +390,7 @@ guid_init(void)
bytes += sizeof(pid); bytes += sizeof(pid);
#endif #endif
#endif #endif
} }
/* user info */ /* user info */
{ {

View File

@@ -43,9 +43,10 @@
# include <sys/time.h> # include <sys/time.h>
#else #else
/* We simply define the struct timeval on our own here. */ /* We simply define the struct timeval on our own here. */
struct timeval { struct timeval
long tv_sec; /* seconds */ {
long tv_usec; /* and microseconds */ long tv_sec; /* seconds */
long tv_usec; /* and microseconds */
}; };
/* include <Winsock2.h> */ /* include <Winsock2.h> */
#endif #endif

View File

@@ -161,10 +161,10 @@ main(int argc, char ** argv)
gnc_module_system_init(); gnc_module_system_init();
qof_backend_module_init(); qof_backend_module_init();
/* gnc_gnome_init (argc, argv, VERSION); */ /* gnc_gnome_init (argc, argv, VERSION); */
/* gnc_gui_init(); */ /* gnc_gui_init(); */
/* scm_boot_guile(argc, argv, inner_main, 0); */ /* scm_boot_guile(argc, argv, inner_main, 0); */
exit(0); /* never reached */ exit(0); /* never reached */
} }