Skip to content

Commit

Permalink
Merge branch 'maint' into unstable
Browse files Browse the repository at this point in the history
  • Loading branch information
jralls committed Nov 25, 2017
2 parents 50874d8 + 0d8112b commit 13657ee
Show file tree
Hide file tree
Showing 15 changed files with 277 additions and 295 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ po/POTFILES
po/POTFILES.in
po/gnucash.pot
po/stamp-it
po/glossary/gnc-glossary.pot
py-compile
bindings/python/.py-links
bindings/python/gnucash/
Expand Down
6 changes: 4 additions & 2 deletions bindings/python/sqlite3test.c
Original file line number Diff line number Diff line change
Expand Up @@ -20,19 +20,21 @@

#include <config.h>
#include "qofsession.h"

#define TESTFILE "/tmp/blah.gnucash"
int main()
{
const char* testurl = "sqlite3://" TESTFILE;
qof_log_init();
qof_init();
gnc_module_system_init();
char * no_args[1] = { NULL };
gnc_engine_init(0, no_args);

QofSession * s = qof_session_new();
qof_session_begin(s, "sqlite3:///tmp/blah.gnucash", 0, 1, 1);
qof_session_begin(s, testurl, 0, 1, 0);
qof_session_load(s, NULL);
qof_session_save(s, NULL);
qof_session_end(s);
unlink(TESTFILE);
return 0;
}
16 changes: 8 additions & 8 deletions cmake/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
# Post install actions go here.

INSTALL(CODE "EXECUTE_PROCESS(COMMAND ${GLIB_COMPILE_SCHEMAS} ${CMAKE_INSTALL_PREFIX}/share/glib-2.0/schemas)")

IF (APPLE)
INSTALL(CODE "EXECUTE_PROCESS(
COMMAND /usr/bin/install_name_tool -add_rpath ${CMAKE_INSTALL_PREFIX}/lib
Expand All @@ -21,18 +19,20 @@ SET(schema-targets csv-exp-gschema csv-imp-gschema
IF (WITH_AQBANKING)
LIST(APPEND schema-targets aqb-gschema)
ENDIF (WITH_AQBANKING)

IF (WITH_OFX)
LIST(APPEND schema-targets ofx-gschema)
ENDIF (WITH_OFX)
SET(SCHEMA_DIRECTORY ${DATADIR_BUILD}/glib-2.0/schemas)

SET(SCHEMA_BUILD_DIR ${DATADIR_BUILD}/glib-2.0/schemas)
ADD_CUSTOM_COMMAND(
OUTPUT ${SCHEMA_DIRECTORY}/gschemas.compiled
COMMAND ${CMAKE_COMMAND_TMP} ${GLIB_COMPILE_SCHEMAS} ${SCHEMA_DIRECTORY}
OUTPUT ${SCHEMA_BUILD_DIR}/gschemas.compiled
COMMAND ${CMAKE_COMMAND_TMP} ${GLIB_COMPILE_SCHEMAS} ${SCHEMA_BUILD_DIR}
DEPENDS ${schema-targets}
)

ADD_CUSTOM_TARGET(compiled-schemas ALL DEPENDS ${SCHEMA_DIRECTORY}/gschemas.compiled)
ADD_CUSTOM_TARGET(compiled-schemas ALL DEPENDS ${SCHEMA_BUILD_DIR}/gschemas.compiled)

INSTALL(FILES ${SCHEMA_BUILD_DIR}/gschemas.compiled DESTINATION ${DATADIR}/glib-2.0/schemas)

SET_DIST_LIST(cmake_DIST CMakeLists.txt README_CMAKE.txt cmake_uninstall.cmake.in)
2 changes: 1 addition & 1 deletion libgnucash/backend/dbi/gnc-dbisqlresult.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -179,9 +179,9 @@ GncDbiSqlResult::IteratorImpl::get_time64_at_col (const char* col) const
auto row = dbi_result_get_currow (result);
auto idx = dbi_result_get_field_idx (result, col) - 1;
time64 retval = result->rows[row]->field_values[idx].d_datetime;
#endif //HAVE_LIBDBI_TO_LONGLONG
if (retval < MINTIME || retval > MAXTIME)
retval = 0;
#endif //HAVE_LIBDBI_TO_LONGLONG
gnc_pop_locale (LC_NUMERIC);
return retval;
}
Expand Down
2 changes: 1 addition & 1 deletion libgnucash/backend/sql/gnc-sql-column-table-entry.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -397,7 +397,7 @@ GncSqlColumnTableEntryImpl<CT_TIMESPEC>::load (const GncSqlBackend* sql_be,
{
constexpr size_t datelen = 14;
auto val = row.get_string_at_col(m_col_name);
if (val.length() == datelen)
if (val.length() == datelen && val != "0000-00-00 00:00:00")
{
using std::stoi;
#ifdef HAVE_STRUCT_TM_GMTOFF
Expand Down
18 changes: 3 additions & 15 deletions libgnucash/engine/gnc-date.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -72,17 +72,6 @@ extern "C"
# define GNC_T_FMT "%r"
#endif

/* t < MINTIME is probably from a bad conversion from t 0 to
* 0000-00-00, so restore it to the Unix Epoch. t anywhere near
* MAXTIME is obviously an error, but we don't want to crash with a
* bad date-time so just clamp it to MAXTIME.
*/
static inline time64
clamp_time(time64 t)
{
return t < MINTIME ? 0 : t > MAXTIME ? MAXTIME : t;
}

const char *gnc_default_strftime_date_format =
#ifdef G_OS_WIN32
/* The default date format for use with strftime in Win32. */
Expand Down Expand Up @@ -244,7 +233,7 @@ gnc_timegm (struct tm* time)
char*
gnc_ctime (const time64 *secs)
{
return gnc_print_time64(clamp_time(*secs), "%a %b %d %H:%M:%S %Y");
return gnc_print_time64(*secs, "%a %b %d %H:%M:%S %Y");
}

time64
Expand Down Expand Up @@ -651,10 +640,9 @@ size_t
qof_print_date_buff (char * buff, size_t len, time64 t)
{
if (!buff) return 0;

try
{
GncDateTime gncdt(clamp_time(t));
GncDateTime gncdt(t);
std::string str = gncdt.format(qof_date_format_get_string(dateFormat));
strncpy(buff, str.c_str(), len);
if (str.length() >= len)
Expand Down Expand Up @@ -1304,7 +1292,7 @@ gnc_dmy2timespec_neutral (int day, int month, int year)
void
timespecFromTime64 ( Timespec *ts, time64 t )
{
ts->tv_sec = clamp_time (t);
ts->tv_sec = t;
ts->tv_nsec = 0;
}

Expand Down
2 changes: 1 addition & 1 deletion libgnucash/engine/gnc-date.h
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ extern "C"

#include <glib-object.h>
#include <time.h>
#include <stdint.h>

/**
* Many systems, including Microsoft Windows and BSD-derived Unixes
* like Darwin, are retaining the int-32 typedef for time_t. Since
Expand Down
23 changes: 7 additions & 16 deletions libgnucash/engine/test/test-gnc-date.c
Original file line number Diff line number Diff line change
Expand Up @@ -1917,23 +1917,14 @@ gnc_timezone (const struct tm *tm)// C: 5 in 2 Local: 2:0:0
test_gnc_timezone (void)
{
}*/
/* timespecFromTime64
/* timespecFromtime64
void
timespecFromTime64( Timespec *ts, time64 t )// C: 22 in 11 Local: 0:0:0
timespecFromtime64( Timespec *ts, time64 t )// C: 22 in 11 Local: 0:0:0
*/
static void
test_timespecFromTime64 (void)
{
Timespec ts = {-9999, 0};
timespecFromTime64 (&ts, MINTIME - 1);
g_assert_cmpint (0, ==, ts.tv_sec);
timespecFromTime64 (&ts, MINTIME + 1);
g_assert_cmpint (MINTIME + 1, ==, ts.tv_sec);
timespecFromTime64 (&ts, MAXTIME + 1);
g_assert_cmpint (MAXTIME, ==, ts.tv_sec);
timespecFromTime64 (&ts, MAXTIME - 1);
g_assert_cmpint (MAXTIME - 1, ==, ts.tv_sec);
}
/* static void
test_timespecFromtime64 (void)
{
}*/
/* timespec_now
Timespec
timespec_now()// C: 2 in 2 Local: 0:0:0
Expand Down Expand Up @@ -2262,7 +2253,7 @@ test_suite_gnc_date (void)
GNC_TEST_ADD (suitename, "gnc dmy2timespec end", FixtureB, NULL, setup_end, test_gnc_dmy2timespec_end, NULL);
GNC_TEST_ADD (suitename, "gnc dmy2timespec Neutral", FixtureB, NULL, setup_neutral, test_gnc_dmy2timespec_neutral, NULL);
// GNC_TEST_ADD_FUNC (suitename, "gnc timezone", test_gnc_timezone);
GNC_TEST_ADD_FUNC (suitename, "timespecFromTime64", test_timespecFromTime64);
// GNC_TEST_ADD_FUNC (suitename, "timespecFromTime t", test_timespecFromtime64);
// GNC_TEST_ADD_FUNC (suitename, "timespec now", test_timespec_now);
// GNC_TEST_ADD_FUNC (suitename, "timespecToTime t", test_timespecTotime64);
GNC_TEST_ADD (suitename, "timespec to gdate", FixtureA, NULL, setup, test_timespec_to_gdate, NULL);
Expand Down
2 changes: 1 addition & 1 deletion po/glossary/ca.po
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ msgstr ""
"Language: ca\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8-bit\n"
"Content-Transfer-Encoding: 8bit\n"

#. "English Definition (Dear translator: This file will never be visible to the user! It should only serve as a tool for you, the translator. Nothing more.)"
msgid "Term (Dear translator: This file will never be visible to the user!)"
Expand Down
Loading

0 comments on commit 13657ee

Please sign in to comment.