gnucash master: Multiple changes pushed
John Ralls
jralls at code.gnucash.org
Fri Jan 16 15:12:34 EST 2015
Updated via https://github.com/Gnucash/gnucash/commit/7b5ae715 (commit)
via https://github.com/Gnucash/gnucash/commit/1d3f4867 (commit)
via https://github.com/Gnucash/gnucash/commit/97a689a8 (commit)
from https://github.com/Gnucash/gnucash/commit/98fe3364 (commit)
commit 7b5ae715e6e4f69948498821dcdafb441f5820a7
Author: John Ralls <jralls at ceridwen.us>
Date: Thu Jan 15 16:14:58 2015 -0800
Make string lengths equal in test print of time zone name.
Windows uses a long time zone name which over-runs the buffer in
gnc_timespec_to_iso8601_buff(). Truncate the test string so that
it compares correctly.
diff --git a/src/libqof/qof/test/test-gnc-date.c b/src/libqof/qof/test/test-gnc-date.c
index 5ee224d..1cccfe6 100644
--- a/src/libqof/qof/test/test-gnc-date.c
+++ b/src/libqof/qof/test/test-gnc-date.c
@@ -1688,7 +1688,7 @@ test_gnc_iso8601_to_timespec_gmt (void)
char *
gnc_timespec_to_iso8601_buff (Timespec ts, char * buff)// C: 18 in 7 Local: 0:0:0
*/
-#define ISO8601_SIZE 38
+#define ISO8601_SIZE MAX_DATE_LENGTH + 4
static Timespec
g_date_time_to_timespec (GDateTime *gdt)
{
@@ -1701,17 +1701,21 @@ g_date_time_to_timespec (GDateTime *gdt)
static gchar*
format_timestring (GDateTime *gdt)
{
+ static const unsigned tzlen = MAX_DATE_LENGTH - 26;
gchar *fmt = "%Y-%m-%d %H:%M";
GDateTime *ngdt = gncdt.to_local (gdt);
gchar *date_base = g_date_time_format (ngdt, fmt);
+ gchar buf[tzlen], *retval;
#ifdef G_OS_WIN32
gchar *tz = g_date_time_format (ngdt, "%Z");
#else
gchar *tz = g_date_time_format (ngdt, "%z");
#endif
- gchar *retval = g_strdup_printf ("%s:%02d.%06d %s", date_base,
+ memset (buf, 0, tzlen);
+ g_snprintf (buf, tzlen, "%s", tz);
+ retval = g_strdup_printf ("%s:%02d.%06d %s", date_base,
g_date_time_get_second (ngdt),
- g_date_time_get_microsecond (ngdt), tz);
+ g_date_time_get_microsecond (ngdt), buf);
g_date_time_unref (ngdt);
g_free (date_base);
g_free (tz);
commit 1d3f486751c34a31890dfecc471ecdf412b31c84
Author: John Ralls <jralls at ceridwen.us>
Date: Thu Jan 15 16:08:00 2015 -0800
Minor fixups for tests in Windows.
diff --git a/src/engine/test-core/test-engine-stuff.h b/src/engine/test-core/test-engine-stuff.h
index 707a744..25b9fba 100644
--- a/src/engine/test-core/test-engine-stuff.h
+++ b/src/engine/test-core/test-engine-stuff.h
@@ -7,6 +7,7 @@
#include <glib.h>
#include <stdlib.h>
+#include <stdint.h>
#include "qof.h"
#include "Query.h"
diff --git a/src/libqof/qof/kvp-value.cpp b/src/libqof/qof/kvp-value.cpp
index 3a8519d..499b575 100644
--- a/src/libqof/qof/kvp-value.cpp
+++ b/src/libqof/qof/kvp-value.cpp
@@ -173,7 +173,7 @@ struct to_string_visitor : boost::static_visitor<void>
void operator()(Timespec val)
{
- char tmp1[40];
+ char tmp1[40] {};
gnc_timespec_to_iso8601_buff (val, tmp1);
output << "KVP_VALUE_TIMESPEC(" << tmp1 << ")";
}
commit 97a689a83f36a6dd4d77809d7cef2fd17502ed7f
Author: John Ralls <jralls at ceridwen.us>
Date: Thu Jan 15 16:07:14 2015 -0800
Consolidate gtest tests in libqof/qof/test/Makefile.am.
diff --git a/src/libqof/qof/test/Makefile.am b/src/libqof/qof/test/Makefile.am
index f17e4a2..26d5150 100644
--- a/src/libqof/qof/test/Makefile.am
+++ b/src/libqof/qof/test/Makefile.am
@@ -34,6 +34,24 @@ check_PROGRAMS = \
TESTS = ${check_PROGRAMS}
if WITH_GOOGLE_TEST
+test_kvp_value_SOURCES = \
+ $(top_srcdir)/$(MODULEPATH)/kvp-value.cpp \
+ $(GTEST_ROOT)/src/gtest_main.cc \
+ test-kvp-value.cpp \
+ test-kvp-frame.cpp
+
+test_kvp_value_LDADD = \
+ $(top_builddir)/$(MODULEPATH)/libgnc-qof.la \
+ $(top_builddir)/src/test-core/libgtest.a \
+ $(GLIB_LIBS) \
+ $(BOOST_LDFLAGS)
+
+test_kvp_value_CPPFLAGS = \
+ -I$(GTEST_HEADERS) \
+ -I$(top_srcdir)/$(MODULEPATH) \
+ $(BOOST_CPPFLAGS) \
+ $(GLIB_CFLAGS)
+
test_gnc_int128_SOURCES = \
$(top_srcdir)/${MODULEPATH}/gnc-int128.cpp \
gtest-gnc-int128.cpp
@@ -67,27 +85,3 @@ test_qof_CPPFLAGS = \
-DTESTPROG=test_qof \
-I$(top_srcdir)/lib/libc \
${GLIB_CFLAGS}
-
-if WITH_GOOGLE_TEST
-test_kvp_value_SOURCES = \
- $(top_srcdir)/$(MODULEPATH)/kvp-value.cpp \
- test-kvp-value.cpp \
- test-kvp-frame.cpp
-
-nodist_test_kvp_value_SOURCES = \
- $(GTEST_ROOT)/src/gtest_main.cc
-
-test_kvp_value_LDADD = \
- $(top_builddir)/$(MODULEPATH)/libgnc-qof.la \
- $(top_builddir)/src/test-core/libgtest.a \
- $(GLIB_LIBS) \
- $(BOOST_LDFLAGS)
-test_kvp_value_CPPFLAGS = \
- -I$(GTEST_HEADERS) \
- -I$(top_srcdir)/$(MODULEPATH) \
- $(BOOST_CPPFLAGS) \
- $(GLIB_CFLAGS)
-
-check_PROGRAMS += test_kvp_value
-
-endif
Summary of changes:
src/engine/test-core/test-engine-stuff.h | 1 +
src/libqof/qof/kvp-value.cpp | 2 +-
src/libqof/qof/test/Makefile.am | 42 ++++++++++++++------------------
src/libqof/qof/test/test-gnc-date.c | 10 +++++---
4 files changed, 27 insertions(+), 28 deletions(-)
More information about the gnucash-changes
mailing list