Bug 797356 - ninja check fails with GCC-9

This commit is contained in:
John Ralls 2019-09-09 14:44:10 -07:00
parent b1d0dd7d58
commit e6e2258a74
17 changed files with 98 additions and 94 deletions

View File

@ -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);

View File

@ -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;

View File

@ -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);

View File

@ -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);

View File

@ -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) {
@ -1465,7 +1465,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 = FALSE;
}
else if (is_split && show_extra_dates) {
@ -1473,7 +1473,7 @@ gtv_sr_cdf0 (GtkTreeViewColumn *col, GtkCellRenderer *cell, GtkTreeModel *s_mode
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;
}
@ -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)
@ -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 {

View File

@ -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);

View File

@ -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

View File

@ -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;
@ -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;

View File

@ -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

View File

@ -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),

View File

@ -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,
@ -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,
@ -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++,

View File

@ -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)

View File

@ -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,

View File

@ -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",

View File

@ -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);
@ -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);
@ -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);

View File

@ -642,7 +642,7 @@ static void tm_set_dmy (struct tm *tm, gint year, gint month, gint mday)
static void
test_qof_print_date_dmy_buff (void)
{
gchar buff[MAX_DATE_LENGTH], t_buff[MAX_DATE_LENGTH];
gchar buff[MAX_DATE_LENGTH + 1], t_buff[MAX_DATE_LENGTH + 1];
gchar *locale = g_strdup (setlocale (LC_TIME, NULL));
struct tm tm = { 0, 0, 0, 0, 0, 0, 0, 0, 0
#ifdef HAVE_STRUCT_TM_GMTOFF
@ -652,47 +652,47 @@ test_qof_print_date_dmy_buff (void)
qof_date_format_set (QOF_DATE_FORMAT_UK);
memset ((gpointer)buff, 0, sizeof (buff));
g_assert_cmpint (qof_print_date_dmy_buff (buff, sizeof (buff), 23, 11, 1974), ==, strlen (buff));
g_assert_cmpint (qof_print_date_dmy_buff (buff, MAX_DATE_LENGTH, 23, 11, 1974), ==, strlen (buff));
g_assert_cmpstr (buff, ==, "23/11/1974");
memset ((gpointer)buff, 0, sizeof (buff));
g_assert_cmpint (qof_print_date_dmy_buff (buff, sizeof (buff), 2, 2, 1961), ==, strlen (buff));
g_assert_cmpint (qof_print_date_dmy_buff (buff, MAX_DATE_LENGTH, 2, 2, 1961), ==, strlen (buff));
g_assert_cmpstr (buff, ==, "02/02/1961");
memset ((gpointer)buff, 0, sizeof (buff));
g_assert_cmpint (qof_print_date_dmy_buff (buff, sizeof (buff), 16, 6, 2045), ==, strlen (buff));
g_assert_cmpint (qof_print_date_dmy_buff (buff, MAX_DATE_LENGTH, 16, 6, 2045), ==, strlen (buff));
g_assert_cmpstr (buff, ==, "16/06/2045");
qof_date_format_set (QOF_DATE_FORMAT_CE);
memset ((gpointer)buff, 0, sizeof (buff));
g_assert_cmpint (qof_print_date_dmy_buff (buff, sizeof (buff), 23, 11, 1974), ==, strlen (buff));
g_assert_cmpint (qof_print_date_dmy_buff (buff, MAX_DATE_LENGTH, 23, 11, 1974), ==, strlen (buff));
g_assert_cmpstr (buff, ==, "23.11.1974");
memset ((gpointer)buff, 0, sizeof (buff));
g_assert_cmpint (qof_print_date_dmy_buff (buff, sizeof (buff), 2, 2, 1961), ==, strlen (buff));
g_assert_cmpint (qof_print_date_dmy_buff (buff, MAX_DATE_LENGTH, 2, 2, 1961), ==, strlen (buff));
g_assert_cmpstr (buff, ==, "02.02.1961");
memset ((gpointer)buff, 0, sizeof (buff));
g_assert_cmpint (qof_print_date_dmy_buff (buff, sizeof (buff), 16, 6, 2045), ==, strlen (buff));
g_assert_cmpint (qof_print_date_dmy_buff (buff, MAX_DATE_LENGTH, 16, 6, 2045), ==, strlen (buff));
g_assert_cmpstr (buff, ==, "16.06.2045");
qof_date_format_set (QOF_DATE_FORMAT_US);
memset ((gpointer)buff, 0, sizeof (buff));
g_assert_cmpint (qof_print_date_dmy_buff (buff, sizeof (buff), 23, 11, 1974), ==, strlen (buff));
g_assert_cmpint (qof_print_date_dmy_buff (buff, MAX_DATE_LENGTH, 23, 11, 1974), ==, strlen (buff));
g_assert_cmpstr (buff, ==, "11/23/1974");
memset ((gpointer)buff, 0, sizeof (buff));
g_assert_cmpint (qof_print_date_dmy_buff (buff, sizeof (buff), 2, 2, 1961), ==, strlen (buff));
g_assert_cmpint (qof_print_date_dmy_buff (buff, MAX_DATE_LENGTH, 2, 2, 1961), ==, strlen (buff));
g_assert_cmpstr (buff, ==, "02/02/1961");
memset ((gpointer)buff, 0, sizeof (buff));
g_assert_cmpint (qof_print_date_dmy_buff (buff, sizeof (buff), 16, 6, 2045), ==, strlen (buff));
g_assert_cmpint (qof_print_date_dmy_buff (buff, MAX_DATE_LENGTH, 16, 6, 2045), ==, strlen (buff));
g_assert_cmpstr (buff, ==, "06/16/2045");
qof_date_format_set (QOF_DATE_FORMAT_ISO);
memset ((gpointer)buff, 0, sizeof (buff));
g_assert_cmpint (qof_print_date_dmy_buff (buff, sizeof (buff), 23, 11, 1974), ==, strlen (buff));
g_assert_cmpint (qof_print_date_dmy_buff (buff, MAX_DATE_LENGTH, 23, 11, 1974), ==, strlen (buff));
g_assert_cmpstr (buff, ==, "1974-11-23");
memset ((gpointer)buff, 0, sizeof (buff));
g_assert_cmpint (qof_print_date_dmy_buff (buff, sizeof (buff), 2, 2, 1961),
g_assert_cmpint (qof_print_date_dmy_buff (buff, MAX_DATE_LENGTH, 2, 2, 1961),
==, strlen (buff));
g_assert_cmpstr (buff, ==, "1961-02-02");
memset ((gpointer)buff, 0, sizeof (buff));
g_assert_cmpint (qof_print_date_dmy_buff (buff, sizeof (buff), 16, 6, 2045),
g_assert_cmpint (qof_print_date_dmy_buff (buff, MAX_DATE_LENGTH, 16, 6, 2045),
==, strlen (buff));
g_assert_cmpstr (buff, ==, "2045-06-16");
@ -701,7 +701,7 @@ test_qof_print_date_dmy_buff (void)
tm_set_dmy (&tm, 1974, 11, 23);
strftime(t_buff, MAX_DATE_LENGTH, GNC_D_FMT, &tm);
memset ((gpointer)buff, 0, sizeof (buff));
g_assert_cmpint (qof_print_date_dmy_buff (buff, sizeof (buff), tm.tm_mday,
g_assert_cmpint (qof_print_date_dmy_buff (buff, MAX_DATE_LENGTH, tm.tm_mday,
tm.tm_mon + 1, tm.tm_year + 1900),
==, strlen (buff));
g_assert_cmpstr (buff, ==, t_buff);
@ -710,7 +710,7 @@ test_qof_print_date_dmy_buff (void)
tm_set_dmy (&tm, 1961, 2, 2);
strftime(t_buff, MAX_DATE_LENGTH, GNC_D_FMT, &tm);
memset ((gpointer)buff, 0, sizeof (buff));
g_assert_cmpint (qof_print_date_dmy_buff (buff, sizeof (buff), tm.tm_mday,
g_assert_cmpint (qof_print_date_dmy_buff (buff, MAX_DATE_LENGTH, tm.tm_mday,
tm.tm_mon + 1, tm.tm_year + 1900),
==, strlen (buff));
g_assert_cmpstr (buff, ==, t_buff);
@ -718,7 +718,7 @@ test_qof_print_date_dmy_buff (void)
tm_set_dmy (&tm, 2045, 6, 16);
strftime(t_buff, MAX_DATE_LENGTH, GNC_D_FMT, &tm);
memset ((gpointer)buff, 0, sizeof (buff));
g_assert_cmpint (qof_print_date_dmy_buff (buff, sizeof (buff), tm.tm_mday,
g_assert_cmpint (qof_print_date_dmy_buff (buff, MAX_DATE_LENGTH, tm.tm_mday,
tm.tm_mon + 1, tm.tm_year + 1900),
==, strlen (buff));
g_assert_cmpstr (buff, ==, t_buff);
@ -727,22 +727,22 @@ test_qof_print_date_dmy_buff (void)
tm_set_dmy (&tm, 1974, 11, 23);
strftime(t_buff, MAX_DATE_LENGTH, GNC_D_FMT, &tm);
memset ((gpointer)buff, 0, sizeof (buff));
g_assert_cmpint (qof_print_date_dmy_buff (buff, sizeof (buff), tm.tm_mday,
g_assert_cmpint (qof_print_date_dmy_buff (buff, MAX_DATE_LENGTH, tm.tm_mday,
tm.tm_mon + 1, tm.tm_year + 1900),
==, strlen (buff));
g_assert_cmpstr (buff, ==, t_buff);
tm_set_dmy (&tm, 1961, 2, 2);
strftime(t_buff, MAX_DATE_LENGTH, GNC_D_FMT, &tm);
memset ((gpointer)buff, 0, sizeof (buff));
g_assert_cmpint (qof_print_date_dmy_buff (buff, sizeof (buff), tm.tm_mday,
g_assert_cmpint (qof_print_date_dmy_buff (buff, MAX_DATE_LENGTH, tm.tm_mday,
tm.tm_mon + 1, tm.tm_year + 1900),
==, strlen (buff));
g_assert_cmpstr (buff, ==, t_buff);
memset ((gpointer)buff, 0, sizeof (buff));
tm_set_dmy (&tm, 2045, 6, 16);
strftime(t_buff, MAX_DATE_LENGTH, GNC_D_FMT, &tm);
memset ((gpointer)buff, 0, sizeof (buff));
g_assert_cmpint (qof_print_date_dmy_buff (buff, sizeof (buff), tm.tm_mday,
memset ((gpointer)buff, 0, MAX_DATE_LENGTH);
g_assert_cmpint (qof_print_date_dmy_buff (buff, MAX_DATE_LENGTH, tm.tm_mday,
tm.tm_mon + 1, tm.tm_year + 1900),
==, strlen (buff));
g_assert_cmpstr (buff, ==, t_buff);
@ -751,14 +751,14 @@ test_qof_print_date_dmy_buff (void)
tm_set_dmy (&tm, 1974, 11, 23);
strftime(t_buff, MAX_DATE_LENGTH, GNC_D_FMT, &tm);
memset ((gpointer)buff, 0, sizeof (buff));
g_assert_cmpint (qof_print_date_dmy_buff (buff, sizeof (buff), tm.tm_mday,
g_assert_cmpint (qof_print_date_dmy_buff (buff, MAX_DATE_LENGTH, tm.tm_mday,
tm.tm_mon + 1, tm.tm_year + 1900),
==, strlen (buff));
g_assert_cmpstr (buff, ==, t_buff);
tm_set_dmy (&tm, 1961, 2, 2);
strftime(t_buff, MAX_DATE_LENGTH, GNC_D_FMT, &tm);
memset ((gpointer)buff, 0, sizeof (buff));
g_assert_cmpint (qof_print_date_dmy_buff (buff, sizeof (buff), tm.tm_mday,
g_assert_cmpint (qof_print_date_dmy_buff (buff, MAX_DATE_LENGTH, tm.tm_mday,
tm.tm_mon + 1, tm.tm_year + 1900),
==, strlen (buff));
g_assert_cmpstr (buff, ==, t_buff);
@ -766,7 +766,7 @@ test_qof_print_date_dmy_buff (void)
tm_set_dmy (&tm, 2045, 6, 16);
strftime(t_buff, MAX_DATE_LENGTH, GNC_D_FMT, &tm);
memset ((gpointer)buff, 0, sizeof (buff));
g_assert_cmpint (qof_print_date_dmy_buff (buff, sizeof (buff), tm.tm_mday,
g_assert_cmpint (qof_print_date_dmy_buff (buff, MAX_DATE_LENGTH, tm.tm_mday,
tm.tm_mon + 1, tm.tm_year + 1900),
==, strlen (buff));
g_assert_cmpstr (buff, ==, t_buff);
@ -787,7 +787,7 @@ test_qof_print_date_dmy_buff (void)
#define test_assert_localized_timestring(time, datestr) \
{ \
gchar t_buff[MAX_DATE_LENGTH]; \
gchar t_buff[MAX_DATE_LENGTH + 1]; \
struct tm *ltime = gnc_localtime ((time64 *)(&time)); \
strftime (t_buff, sizeof (t_buff), GNC_D_FMT, ltime); \
gnc_tm_free (ltime); \
@ -802,7 +802,7 @@ qof_print_date_buff (char * buff, size_t len, time64 t)// C: 3 in 1 Local: 2:0:
static void
test_qof_print_date_buff (void)
{
gchar buff[MAX_DATE_LENGTH], ans[MAX_DATE_LENGTH];
gchar buff[MAX_DATE_LENGTH + 1], ans[MAX_DATE_LENGTH + 1];
gchar *locale = g_strdup (setlocale (LC_TIME, NULL));
struct tm tm1 = {0, 0, 12, 23, 10, 74};
@ -814,110 +814,110 @@ test_qof_print_date_buff (void)
qof_date_format_set (QOF_DATE_FORMAT_UK);
memset ((gpointer)buff, 0, sizeof (buff));
g_assert_cmpint (qof_print_date_buff (buff, sizeof (buff), time1),
g_assert_cmpint (qof_print_date_buff (buff, MAX_DATE_LENGTH, time1),
==, strlen (buff));
g_assert_cmpstr (buff, ==, "23/11/1974");
memset ((gpointer)buff, 0, sizeof (buff));
g_assert_cmpint (qof_print_date_buff (buff, sizeof (buff), time2),
g_assert_cmpint (qof_print_date_buff (buff, MAX_DATE_LENGTH, time2),
==, strlen (buff));
g_assert_cmpstr (buff, ==, "02/02/1961");
memset ((gpointer)buff, 0, sizeof (buff));
g_assert_cmpint (qof_print_date_buff (buff, sizeof (buff), time3),
g_assert_cmpint (qof_print_date_buff (buff, MAX_DATE_LENGTH, time3),
==, strlen (buff));
g_assert_cmpstr (buff, ==, "16/06/2045");
qof_date_format_set (QOF_DATE_FORMAT_CE);
memset ((gpointer)buff, 0, sizeof (buff));
g_assert_cmpint (qof_print_date_buff (buff, sizeof (buff), time1),
g_assert_cmpint (qof_print_date_buff (buff, MAX_DATE_LENGTH, time1),
==, strlen (buff));
g_assert_cmpstr (buff, ==, "23.11.1974");
memset ((gpointer)buff, 0, sizeof (buff));
g_assert_cmpint (qof_print_date_buff (buff, sizeof (buff), time2),
g_assert_cmpint (qof_print_date_buff (buff, MAX_DATE_LENGTH, time2),
==, strlen (buff));
g_assert_cmpstr (buff, ==, "02.02.1961");
memset ((gpointer)buff, 0, sizeof (buff));
g_assert_cmpint (qof_print_date_buff (buff, sizeof (buff), time3),
g_assert_cmpint (qof_print_date_buff (buff, MAX_DATE_LENGTH, time3),
==, strlen (buff));
g_assert_cmpstr (buff, ==, "16.06.2045");
qof_date_format_set (QOF_DATE_FORMAT_US);
memset ((gpointer)buff, 0, sizeof (buff));
g_assert_cmpint (qof_print_date_buff (buff, sizeof (buff), time1),
g_assert_cmpint (qof_print_date_buff (buff, MAX_DATE_LENGTH, time1),
==, strlen (buff));
g_assert_cmpstr (buff, ==, "11/23/1974");
memset ((gpointer)buff, 0, sizeof (buff));
g_assert_cmpint (qof_print_date_buff (buff, sizeof (buff), time2),
g_assert_cmpint (qof_print_date_buff (buff, MAX_DATE_LENGTH, time2),
==, strlen (buff));
g_assert_cmpstr (buff, ==, "02/02/1961");
memset ((gpointer)buff, 0, sizeof (buff));
g_assert_cmpint (qof_print_date_buff (buff, sizeof (buff), time3),
g_assert_cmpint (qof_print_date_buff (buff, MAX_DATE_LENGTH, time3),
==, strlen (buff));
g_assert_cmpstr (buff, ==, "06/16/2045");
qof_date_format_set (QOF_DATE_FORMAT_ISO);
memset ((gpointer)buff, 0, sizeof (buff));
g_assert_cmpint (qof_print_date_buff (buff, sizeof (buff), time1),
g_assert_cmpint (qof_print_date_buff (buff, MAX_DATE_LENGTH, time1),
==, strlen (buff));
g_assert_cmpstr (buff, ==, "1974-11-23");
memset ((gpointer)buff, 0, sizeof (buff));
g_assert_cmpint (qof_print_date_buff (buff, sizeof (buff), time2),
g_assert_cmpint (qof_print_date_buff (buff, MAX_DATE_LENGTH, time2),
==, strlen (buff));
g_assert_cmpstr (buff, ==, "1961-02-02");
memset ((gpointer)buff, 0, sizeof (buff));
g_assert_cmpint (qof_print_date_buff (buff, sizeof (buff), time3),
g_assert_cmpint (qof_print_date_buff (buff, MAX_DATE_LENGTH, time3),
==, strlen (buff));
g_assert_cmpstr (buff, ==, "2045-06-16");
qof_date_format_set (QOF_DATE_FORMAT_LOCALE);
test_gnc_setlocale (LC_TIME, "en_US");
memset ((gpointer)buff, 0, sizeof (buff));
g_assert_cmpint (qof_print_date_buff (buff, sizeof (buff), time1),
g_assert_cmpint (qof_print_date_buff (buff, MAX_DATE_LENGTH, time1),
==, strlen (buff));
g_assert_cmpstr (buff, ==, "11/23/1974");
memset ((gpointer)buff, 0, sizeof (buff));
g_assert_cmpint (qof_print_date_buff (buff, sizeof (buff), time2),
g_assert_cmpint (qof_print_date_buff (buff, MAX_DATE_LENGTH, time2),
==, strlen (buff));
g_assert_cmpstr (buff, ==, "02/02/1961");
memset ((gpointer)buff, 0, sizeof (buff));
g_assert_cmpint (qof_print_date_buff (buff, sizeof (buff), time3),
g_assert_cmpint (qof_print_date_buff (buff, MAX_DATE_LENGTH, time3),
==, strlen (buff));
g_assert_cmpstr (buff, ==, "06/16/2045");
test_gnc_setlocale (LC_TIME, "en_GB");
memset ((gpointer)buff, 0, sizeof (buff));
g_assert_cmpint (qof_print_date_buff (buff, sizeof (buff), time1),
g_assert_cmpint (qof_print_date_buff (buff, MAX_DATE_LENGTH, time1),
==, strlen (buff));
strftime(ans, MAX_DATE_LENGTH, GNC_D_FMT, &tm1);
g_assert_cmpstr (buff, ==, ans);
memset ((gpointer)buff, 0, sizeof (buff));
g_assert_cmpint (qof_print_date_buff (buff, sizeof (buff), time2),
g_assert_cmpint (qof_print_date_buff (buff, MAX_DATE_LENGTH, time2),
==, strlen (buff));
strftime(ans, MAX_DATE_LENGTH, GNC_D_FMT, &tm2);
g_assert_cmpstr (buff, ==, ans);
memset ((gpointer)buff, 0, sizeof (buff));
g_assert_cmpint (qof_print_date_buff (buff, sizeof (buff), time3),
g_assert_cmpint (qof_print_date_buff (buff, MAX_DATE_LENGTH, time3),
==, strlen (buff));
strftime(ans, MAX_DATE_LENGTH, GNC_D_FMT, &tm3);
g_assert_cmpstr (buff, ==, ans);
test_gnc_setlocale (LC_TIME, "fr_FR");
memset ((gpointer)buff, 0, sizeof (buff));
g_assert_cmpint (qof_print_date_buff (buff, sizeof (buff), time1),
g_assert_cmpint (qof_print_date_buff (buff, MAX_DATE_LENGTH, time1),
==, strlen (buff));
strftime(ans, MAX_DATE_LENGTH, GNC_D_FMT, &tm1);
g_assert_cmpstr (buff, ==, ans);
memset ((gpointer)buff, 0, sizeof (buff));
g_assert_cmpint (qof_print_date_buff (buff, sizeof (buff), time2),
g_assert_cmpint (qof_print_date_buff (buff, MAX_DATE_LENGTH, time2),
==, strlen (buff));
strftime(ans, MAX_DATE_LENGTH, GNC_D_FMT, &tm2);
g_assert_cmpstr (buff, ==, ans);
memset ((gpointer)buff, 0, sizeof (buff));
g_assert_cmpint (qof_print_date_buff (buff, sizeof (buff), time3),
g_assert_cmpint (qof_print_date_buff (buff, MAX_DATE_LENGTH, time3),
==, strlen (buff));
strftime(ans, MAX_DATE_LENGTH, GNC_D_FMT, &tm3);
g_assert_cmpstr (buff, ==, ans);
@ -932,7 +932,7 @@ qof_print_gdate( char *buf, size_t len, const GDate *gd )// C: 6 in 5 Local: 0:
static void
test_qof_print_gdate (void)
{
gchar buff[MAX_DATE_LENGTH], t_buff[MAX_DATE_LENGTH];
gchar buff[MAX_DATE_LENGTH + 1], t_buff[MAX_DATE_LENGTH + 1];
gchar *locale = g_strdup (setlocale (LC_TIME, NULL));
GDate *gd1 = g_date_new_dmy (23, 11, 1974);
GDate *gd2 = g_date_new_dmy (2, 2, 1961);
@ -940,59 +940,59 @@ test_qof_print_gdate (void)
qof_date_format_set (QOF_DATE_FORMAT_UK);
memset ((gpointer)buff, 0, sizeof (buff));
g_assert_cmpint (qof_print_gdate (buff, sizeof (buff), gd1),
g_assert_cmpint (qof_print_gdate (buff, MAX_DATE_LENGTH, gd1),
==, strlen (buff));
g_assert_cmpstr (buff, ==, "23/11/1974");
memset ((gpointer)buff, 0, sizeof (buff));
g_assert_cmpint (qof_print_gdate (buff, sizeof (buff), gd2),
g_assert_cmpint (qof_print_gdate (buff, MAX_DATE_LENGTH, gd2),
==, strlen (buff));
g_assert_cmpstr (buff, ==, "02/02/1961");
memset ((gpointer)buff, 0, sizeof (buff));
g_assert_cmpint (qof_print_gdate (buff, sizeof (buff), gd3),
g_assert_cmpint (qof_print_gdate (buff, MAX_DATE_LENGTH, gd3),
==, strlen (buff));
g_assert_cmpstr (buff, ==, "16/06/2045");
qof_date_format_set (QOF_DATE_FORMAT_CE);
memset ((gpointer)buff, 0, sizeof (buff));
g_assert_cmpint (qof_print_gdate (buff, sizeof (buff), gd1),
g_assert_cmpint (qof_print_gdate (buff, MAX_DATE_LENGTH, gd1),
==, strlen (buff));
g_assert_cmpstr (buff, ==, "23.11.1974");
memset ((gpointer)buff, 0, sizeof (buff));
g_assert_cmpint (qof_print_gdate (buff, sizeof (buff), gd2),
g_assert_cmpint (qof_print_gdate (buff, MAX_DATE_LENGTH, gd2),
==, strlen (buff));
g_assert_cmpstr (buff, ==, "02.02.1961");
memset ((gpointer)buff, 0, sizeof (buff));
g_assert_cmpint (qof_print_gdate (buff, sizeof (buff), gd3),
g_assert_cmpint (qof_print_gdate (buff, MAX_DATE_LENGTH, gd3),
==, strlen (buff));
g_assert_cmpstr (buff, ==, "16.06.2045");
qof_date_format_set (QOF_DATE_FORMAT_US);
memset ((gpointer)buff, 0, sizeof (buff));
g_assert_cmpint (qof_print_gdate (buff, sizeof (buff), gd1),
g_assert_cmpint (qof_print_gdate (buff, MAX_DATE_LENGTH, gd1),
==, strlen (buff));
g_assert_cmpstr (buff, ==, "11/23/1974");
memset ((gpointer)buff, 0, sizeof (buff));
g_assert_cmpint (qof_print_gdate (buff, sizeof (buff), gd2),
g_assert_cmpint (qof_print_gdate (buff, MAX_DATE_LENGTH, gd2),
==, strlen (buff));
g_assert_cmpstr (buff, ==, "02/02/1961");
memset ((gpointer)buff, 0, sizeof (buff));
g_assert_cmpint (qof_print_gdate (buff, sizeof (buff), gd3),
g_assert_cmpint (qof_print_gdate (buff, MAX_DATE_LENGTH, gd3),
==, strlen (buff));
g_assert_cmpstr (buff, ==, "06/16/2045");
qof_date_format_set (QOF_DATE_FORMAT_ISO);
memset ((gpointer)buff, 0, sizeof (buff));
g_assert_cmpint (qof_print_gdate (buff, sizeof (buff), gd1),
g_assert_cmpint (qof_print_gdate (buff, MAX_DATE_LENGTH, gd1),
==, strlen (buff));
g_assert_cmpstr (buff, ==, "1974-11-23");
memset ((gpointer)buff, 0, sizeof (buff));
g_assert_cmpint (qof_print_gdate (buff, sizeof (buff), gd2),
g_assert_cmpint (qof_print_gdate (buff, MAX_DATE_LENGTH, gd2),
==, strlen (buff));
g_assert_cmpstr (buff, ==, "1961-02-02");
memset ((gpointer)buff, 0, sizeof (buff));
g_assert_cmpint (qof_print_gdate (buff, sizeof (buff), gd3),
g_assert_cmpint (qof_print_gdate (buff, MAX_DATE_LENGTH, gd3),
==, strlen (buff));
g_assert_cmpstr (buff, ==, "2045-06-16");
@ -1000,34 +1000,34 @@ test_qof_print_gdate (void)
qof_date_format_set (QOF_DATE_FORMAT_LOCALE);
test_gnc_setlocale (LC_TIME, "en_US");
memset ((gpointer)buff, 0, sizeof (buff));
g_assert_cmpint (qof_print_gdate (buff, sizeof (buff), gd1),
g_assert_cmpint (qof_print_gdate (buff, MAX_DATE_LENGTH, gd1),
==, strlen (buff));
g_date_strftime (t_buff, MAX_DATE_LENGTH, GNC_D_FMT, gd1);
g_assert_cmpstr (buff, ==, t_buff);
memset ((gpointer)buff, 0, sizeof (buff));
g_assert_cmpint (qof_print_gdate (buff, sizeof (buff), gd2),
g_assert_cmpint (qof_print_gdate (buff, MAX_DATE_LENGTH, gd2),
==, strlen (buff));
g_date_strftime (t_buff, MAX_DATE_LENGTH, GNC_D_FMT, gd2);
g_assert_cmpstr (buff, ==, t_buff);
memset ((gpointer)buff, 0, sizeof (buff));
g_assert_cmpint (qof_print_gdate (buff, sizeof (buff), gd3),
g_assert_cmpint (qof_print_gdate (buff, MAX_DATE_LENGTH, gd3),
==, strlen (buff));
g_date_strftime (t_buff, MAX_DATE_LENGTH, GNC_D_FMT, gd3);
g_assert_cmpstr (buff, ==, t_buff);
test_gnc_setlocale (LC_TIME, "en_GB");
memset ((gpointer)buff, 0, sizeof (buff));
g_assert_cmpint (qof_print_gdate (buff, sizeof (buff), gd1),
g_assert_cmpint (qof_print_gdate (buff, MAX_DATE_LENGTH, gd1),
==, strlen (buff));
g_date_strftime (t_buff, MAX_DATE_LENGTH, GNC_D_FMT, gd1);
g_assert_cmpstr (buff, ==, t_buff);
memset ((gpointer)buff, 0, sizeof (buff));
g_assert_cmpint (qof_print_gdate (buff, sizeof (buff), gd2),
g_assert_cmpint (qof_print_gdate (buff, MAX_DATE_LENGTH, gd2),
==, strlen (buff));
g_date_strftime (t_buff, MAX_DATE_LENGTH, GNC_D_FMT, gd2);
g_assert_cmpstr (buff, ==, t_buff);
memset ((gpointer)buff, 0, sizeof (buff));
g_assert_cmpint (qof_print_gdate (buff, sizeof (buff), gd3),
g_assert_cmpint (qof_print_gdate (buff, MAX_DATE_LENGTH, gd3),
==, strlen (buff));
g_date_strftime (t_buff, MAX_DATE_LENGTH, GNC_D_FMT, gd3);
g_assert_cmpstr (buff, ==, t_buff);
@ -1035,17 +1035,17 @@ test_qof_print_gdate (void)
test_gnc_setlocale (LC_TIME, "fr_FR");
memset ((gpointer)buff, 0, sizeof (buff));
g_assert_cmpint (qof_print_gdate (buff, sizeof (buff), gd1),
g_assert_cmpint (qof_print_gdate (buff, MAX_DATE_LENGTH, gd1),
==, strlen (buff));
g_date_strftime (t_buff, MAX_DATE_LENGTH, GNC_D_FMT, gd1);
g_assert_cmpstr (buff, ==, t_buff);
memset ((gpointer)buff, 0, sizeof (buff));
g_assert_cmpint (qof_print_gdate (buff, sizeof (buff), gd2),
g_assert_cmpint (qof_print_gdate (buff, MAX_DATE_LENGTH, gd2),
==, strlen (buff));
g_date_strftime (t_buff, MAX_DATE_LENGTH, GNC_D_FMT, gd2);
g_assert_cmpstr (buff, ==, t_buff);
memset ((gpointer)buff, 0, sizeof (buff));
g_assert_cmpint (qof_print_gdate (buff, sizeof (buff), gd3),
g_assert_cmpint (qof_print_gdate (buff, MAX_DATE_LENGTH, gd3),
==, strlen (buff));
g_date_strftime (t_buff, MAX_DATE_LENGTH, GNC_D_FMT, gd3);
g_assert_cmpstr (buff, ==, t_buff);

View File

@ -157,6 +157,7 @@ gnucash/gnome-utils/gnc-main-window.c
gnucash/gnome-utils/gnc-menu-extensions.c
gnucash/gnome-utils/gnc-menu-extensions.scm
gnucash/gnome-utils/gncmod-gnome-utils.c
gnucash/gnome-utils/gnc-option-wrapper.cpp
gnucash/gnome-utils/gnc-period-select.c
gnucash/gnome-utils/gnc-plugin.c
gnucash/gnome-utils/gnc-plugin-file-history.c