Skip to content

Commit

Permalink
Bug 797356 - ninja check fails with GCC-9
Browse files Browse the repository at this point in the history
  • Loading branch information
jralls committed Sep 9, 2019
1 parent b1d0dd7 commit e6e2258
Show file tree
Hide file tree
Showing 17 changed files with 98 additions and 94 deletions.
4 changes: 2 additions & 2 deletions gnucash/gnome-utils/gnc-date-edit.c
Original file line number Diff line number Diff line change
Expand Up @@ -558,13 +558,13 @@ fill_time_combo (GtkWidget *widget, GNCDateEdit *gde)
static void
gnc_date_edit_set_time_internal (GNCDateEdit *gde, time64 the_time)
{
char buffer [40];
char buffer [MAX_DATE_LENGTH + 1];
struct tm *mytm = gnc_localtime (&the_time);

g_return_if_fail(mytm != NULL);

/* Update the date text. */
qof_print_date_dmy_buff(buffer, 40,
qof_print_date_dmy_buff(buffer, MAX_DATE_LENGTH,
mytm->tm_mday,
mytm->tm_mon + 1,
1900 + mytm->tm_year);
Expand Down
2 changes: 1 addition & 1 deletion gnucash/gnome-utils/gnc-period-select.c
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ static void
gnc_period_sample_update_date_label (GncPeriodSelect *period)
{
GncPeriodSelectPrivate *priv;
gchar time_string[MAX_DATE_LENGTH];
gchar time_string[MAX_DATE_LENGTH + 1];
GDate *date;
GncAccountingPeriod which;

Expand Down
2 changes: 1 addition & 1 deletion gnucash/gnome-utils/gnc-tree-model-price.c
Original file line number Diff line number Diff line change
Expand Up @@ -735,7 +735,7 @@ gnc_tree_model_price_get_value (GtkTreeModel *tree_model,
g_value_set_string (value, gnc_commodity_get_printname (commodity));
break;
case GNC_TREE_MODEL_PRICE_COL_DATE:
qof_print_date_buff (datebuff, sizeof(datebuff),
qof_print_date_buff (datebuff, MAX_DATE_LENGTH,
gnc_price_get_time64 (price));
g_value_init (value, G_TYPE_STRING);
g_value_set_string (value, datebuff);
Expand Down
2 changes: 1 addition & 1 deletion gnucash/gnome-utils/gnc-tree-model-split-reg.c
Original file line number Diff line number Diff line change
Expand Up @@ -850,7 +850,7 @@ gnc_tree_model_split_reg_get_tooltip (GncTreeModelSplitReg *model, gint position
else
{
time64 t = xaccTransRetDatePosted (trans);
qof_print_date_buff (date_text, sizeof(date_text), t);
qof_print_date_buff (date_text, MAX_DATE_LENGTH, t);
desc_text = xaccTransGetDescription (trans);
model->current_trans = trans;
return g_strconcat (date_text, "\n", desc_text, NULL);
Expand Down
10 changes: 5 additions & 5 deletions gnucash/gnome-utils/gnc-tree-view-split-reg.c
Original file line number Diff line number Diff line change
Expand Up @@ -1454,7 +1454,7 @@ gtv_sr_cdf0 (GtkTreeViewColumn *col, GtkCellRenderer *cell, GtkTreeModel *s_mode
//date on new transactions
if (t == 0)
t = gnc_time (NULL);
qof_print_date_buff (datebuff, sizeof(datebuff), t);
qof_print_date_buff (datebuff, MAX_DATE_LENGTH, t);
editable = TRUE;
}
else if (is_trow2 && show_extra_dates) {
Expand All @@ -1465,15 +1465,15 @@ gtv_sr_cdf0 (GtkTreeViewColumn *col, GtkCellRenderer *cell, GtkTreeModel *s_mode
//date on new transactions
if (t == 0)
t = gnc_time (NULL);
qof_print_date_buff (datebuff, sizeof(datebuff), t);
qof_print_date_buff (datebuff, MAX_DATE_LENGTH, t);
editable = FALSE;
}
else if (is_split && show_extra_dates) {

if (xaccSplitGetReconcile (split) == YREC)
{
time64 t = xaccSplitGetDateReconciled (split);
qof_print_date_buff (datebuff, sizeof(datebuff), t);
qof_print_date_buff (datebuff, MAX_DATE_LENGTH, t);
}
editable = FALSE;
}
Expand All @@ -1484,7 +1484,7 @@ gtv_sr_cdf0 (GtkTreeViewColumn *col, GtkCellRenderer *cell, GtkTreeModel *s_mode
/* Is this a template */
if (is_template && is_trow1)
{
strncpy (datebuff, _(" Scheduled "), sizeof(datebuff)-1);
strncpy (datebuff, _(" Scheduled "), MAX_DATE_LENGTH);
editable = FALSE;
}
else if (is_template && is_trow2 && show_extra_dates)
Expand Down Expand Up @@ -1514,7 +1514,7 @@ gtv_sr_cdf0 (GtkTreeViewColumn *col, GtkCellRenderer *cell, GtkTreeModel *s_mode
if (type == TXN_TYPE_INVOICE)
{
time64 t = xaccTransRetDateDue (trans);
qof_print_date_buff (datebuff, sizeof(datebuff), t);
qof_print_date_buff (datebuff, MAX_DATE_LENGTH, t);
editable = FALSE;
}
else {
Expand Down
2 changes: 1 addition & 1 deletion gnucash/gnome/dialog-price-edit-db.c
Original file line number Diff line number Diff line change
Expand Up @@ -364,7 +364,7 @@ get_fiscal_end_date (void)
char datebuff[MAX_DATE_LENGTH + 1];
memset (datebuff, 0, sizeof(datebuff));
end = gnc_accounting_period_fiscal_end();
qof_print_date_buff(datebuff, sizeof(datebuff),
qof_print_date_buff(datebuff, MAX_DATE_LENGTH,
gnc_accounting_period_fiscal_end());
PINFO("Fiscal end date is %s", datebuff);

Expand Down
2 changes: 1 addition & 1 deletion gnucash/gnome/dialog-trans-assoc.c
Original file line number Diff line number Diff line change
Expand Up @@ -422,7 +422,7 @@ get_trans_info (AssocDialog *assoc_dialog)
memset (datebuff, 0, sizeof(datebuff));
if (t == 0)
t = gnc_time (NULL);
qof_print_date_buff (datebuff, sizeof(datebuff), t);
qof_print_date_buff (datebuff, MAX_DATE_LENGTH, t);
gtk_list_store_append (GTK_LIST_STORE(model), &iter);

if (!scheme) // path is relative
Expand Down
4 changes: 2 additions & 2 deletions gnucash/gnome/gnc-budget-view.c
Original file line number Diff line number Diff line change
Expand Up @@ -1227,7 +1227,7 @@ gbv_refresh_col_titles(GncBudgetView *view)
GtkTreeViewColumn *col;
guint titlelen;
gint num_periods_visible;
gchar title[MAX_DATE_LENGTH];
gchar title[MAX_DATE_LENGTH + 1];
GList *col_list;
gint i;

Expand Down Expand Up @@ -1420,7 +1420,7 @@ gnc_budget_view_refresh(GncBudgetView *view)

if (priv->total_col == NULL)
{
gchar title[MAX_DATE_LENGTH];
gchar title[MAX_DATE_LENGTH + 1];
guint titlelen;
GDate *date;
GtkCellRenderer* renderer;
Expand Down
2 changes: 1 addition & 1 deletion gnucash/import-export/csv-exp/csv-transactions-export.c
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ add_reconcile_date (gchar *so_far, Split *split, CsvExportInfo *info)
time64 t = xaccSplitGetDateReconciled (split);
char str_rec_date[MAX_DATE_LENGTH + 1];
memset (str_rec_date, 0, sizeof(str_rec_date));
qof_print_date_buff (str_rec_date, sizeof(str_rec_date), t);
qof_print_date_buff (str_rec_date, MAX_DATE_LENGTH, t);
result = g_strconcat (so_far, str_rec_date, info->mid_sep, NULL);
}
else
Expand Down
2 changes: 1 addition & 1 deletion gnucash/import-export/csv-imp/gnc-imp-props-price.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -316,7 +316,7 @@ Result GncImportPrice::create_price (QofBook* book, GNCPriceDB *pdb, bool over)

char date_str [MAX_DATE_LENGTH + 1];
memset (date_str, 0, sizeof(date_str));
qof_print_date_buff (date_str, sizeof(date_str), date);
qof_print_date_buff (date_str, MAX_DATE_LENGTH, date);
DEBUG("Date is %s, Commodity from is '%s', Currency is '%s', "
"Amount is %s", date_str,
gnc_commodity_get_fullname (*m_from_commodity),
Expand Down
6 changes: 3 additions & 3 deletions gnucash/import-export/qif-imp/assistant-qif-import.c
Original file line number Diff line number Diff line change
Expand Up @@ -1186,7 +1186,7 @@ refresh_old_transactions (QIFImportWindow * wind, int selection)
}

gtk_list_store_append (store, &iter);
qof_print_date_buff (datebuff, sizeof (datebuff),
qof_print_date_buff (datebuff, MAX_DATE_LENGTH,
xaccTransRetDatePosted (gnc_xtn));
gtk_list_store_set
(store, &iter,
Expand Down Expand Up @@ -3304,7 +3304,7 @@ gnc_ui_qif_import_duplicates_match_prepare (GtkAssistant *assistant,
gdouble amount_gd = 0;
time64 send_time = 0;
char datebuff [MAX_DATE_LENGTH + 1];
memset (datebuff, 0, sizeof (datebuff));
memset (datebuff, 0, MAX_DATE_LENGTH);
current_xtn = SCM_CAAR(duplicates);
#define FUNC_NAME "xaccTransCountSplits"
gnc_xtn = SWIG_MustGetPtr (current_xtn,
Expand All @@ -3323,7 +3323,7 @@ gnc_ui_qif_import_duplicates_match_prepare (GtkAssistant *assistant,
}
gtk_list_store_append (store, &iter);
send_time = xaccTransRetDatePosted (gnc_xtn);
qof_print_date_buff (datebuff, sizeof (datebuff), send_time);
qof_print_date_buff (datebuff, MAX_DATE_LENGTH, send_time);
gtk_list_store_set
(store, &iter,
QIF_TRANS_COL_INDEX, rownum++,
Expand Down
2 changes: 1 addition & 1 deletion gnucash/register/ledger-core/split-register-model.c
Original file line number Diff line number Diff line change
Expand Up @@ -526,7 +526,7 @@ gnc_split_register_get_recn_tooltip (VirtualLocation virt_loc,
char datebuff[MAX_DATE_LENGTH + 1];
time64 time = xaccSplitGetDateReconciled (split);
memset (datebuff, 0, sizeof(datebuff));
qof_print_date_buff (datebuff, sizeof(datebuff), time);
qof_print_date_buff (datebuff, MAX_DATE_LENGTH, time);
return g_strdup_printf (_("Reconciled on %s"), datebuff);
}
else if (xaccSplitGetReconcile (split) == VREC)
Expand Down
2 changes: 1 addition & 1 deletion libgnucash/engine/Split.c
Original file line number Diff line number Diff line change
Expand Up @@ -656,7 +656,7 @@ xaccSplitDump (const Split *split, const char *tag)
{
char datebuff[MAX_DATE_LENGTH + 1];
memset (datebuff, 0, sizeof(datebuff));
qof_print_date_buff (datebuff, sizeof(datebuff), split->date_reconciled);
qof_print_date_buff (datebuff, MAX_DATE_LENGTH, split->date_reconciled);
printf(" %s Split %p", tag, split);
printf(" Book: %p\n", qof_instance_get_book(split));
printf(" Account: %p (%s)\n", split->acc,
Expand Down
5 changes: 3 additions & 2 deletions libgnucash/engine/Transaction.c
Original file line number Diff line number Diff line change
Expand Up @@ -524,13 +524,14 @@ void
xaccTransDump (const Transaction *trans, const char *tag)
{
GList *node;
char datebuff[MAX_DATE_LENGTH + 1];

printf("%s Trans %p", tag, trans);
memset(datebuff, 0, sizeof(datebuff));
qof_print_date_buff(datebuff, sizeof(datebuff), trans->date_entered);
qof_print_date_buff(datebuff, MAX_DATE_LENGTH, trans->date_entered);
printf(" Entered: %s\n", datebuff);
memset(datebuff, 0, sizeof(datebuff));
qof_print_date_buff(datebuff, sizeof(datebuff), trans->date_posted);
qof_print_date_buff(datebuff, MAX_DATE_LENGTH, trans->date_posted);
printf(" Posted: %s\n", datebuff);
printf(" Num: %s\n", trans->num ? trans->num : "(null)");
printf(" Description: %s\n",
Expand Down
8 changes: 5 additions & 3 deletions libgnucash/engine/gnc-date.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -552,9 +552,10 @@ const gchar *qof_date_text_format_get_string(QofDateFormat df)
}

size_t
qof_print_date_dmy_buff (char * buff, size_t len, int day, int month, int year)
qof_print_date_dmy_buff (char * buff, const size_t len, int day, int month, int year)
{
if (!buff) return 0;

try
{
GncDate date(year, month, day);
Expand All @@ -577,9 +578,10 @@ qof_print_date_dmy_buff (char * buff, size_t len, int day, int month, int year)
}

size_t
qof_print_date_buff (char * buff, size_t len, time64 t)
qof_print_date_buff (char * buff, const size_t len, time64 t)
{
if (!buff) return 0;

try
{
GncDateTime gncdt(t);
Expand Down Expand Up @@ -614,7 +616,7 @@ qof_print_gdate( char *buf, size_t len, const GDate *gd )
char *
qof_print_date (time64 t)
{
char buff[MAX_DATE_LENGTH];
char buff[MAX_DATE_LENGTH + 1];
memset (buff, 0, sizeof (buff));
qof_print_date_buff (buff, MAX_DATE_LENGTH, t);
return g_strdup (buff);
Expand Down
Loading

0 comments on commit e6e2258

Please sign in to comment.