gnucash master: Multiple changes pushed

John Ralls jralls at code.gnucash.org
Mon Apr 9 15:25:02 EDT 2018


Updated	 via  https://github.com/Gnucash/gnucash/commit/ba3bf37d (commit)
	 via  https://github.com/Gnucash/gnucash/commit/7a0f0d57 (commit)
	 via  https://github.com/Gnucash/gnucash/commit/89a1cfd2 (commit)
	 via  https://github.com/Gnucash/gnucash/commit/cf24f983 (commit)
	from  https://github.com/Gnucash/gnucash/commit/11ac05ae (commit)



commit ba3bf37d93514a1ad254144cf3cb7fe4fb6b584a
Merge: 7a0f0d5 cf24f98
Author: John Ralls <jralls at ceridwen.us>
Date:   Mon Apr 9 12:22:05 2018 -0700

    Merge DiMan's GNUCASH_MICRO_VERSION fix into unstable.


commit 7a0f0d57c809a2177d015ad4a961e2b1d34dfee6
Author: John Ralls <jralls at ceridwen.us>
Date:   Sun Apr 8 17:37:39 2018 -0700

    Bug 782144 - git-master - Save Corrupts Data File / Not Open Data File
    
    After much thrashing this turned out to be caused by a date string
    with a 3-digit year and that caused an unexpected boost::bad_cast
    exception from boost::posix_time::time_from_string().
    
    To prevent that and anything like it, pre-parse the string with
    regular expressions to classify them and split out the timezone
    if there is one. If neither (perhaps eventually none) of the
    regexes match throw std::invalid_argument. The C function will
    catch this and return 0.

diff --git a/libgnucash/engine/gnc-datetime.cpp b/libgnucash/engine/gnc-datetime.cpp
index e86d47e..61fa701 100644
--- a/libgnucash/engine/gnc-datetime.cpp
+++ b/libgnucash/engine/gnc-datetime.cpp
@@ -282,19 +282,31 @@ GncDateTimeImpl::GncDateTimeImpl(std::string str) :
     m_time(unix_epoch, utc_zone)
 {
     if (str.empty()) return;
-
-    auto tzpos = str.find_first_of("+-", str.find(":"));
-    auto tzptr = tz_from_string(tzpos != str.npos ? str.substr(tzpos) : "");
-    if (tzpos != str.npos && str[tzpos - 1] == ' ') --tzpos;
-
+    TZ_Ptr tzptr;
     try
     {
-        bool delimited = str.find("-") == 4;
-        if (!delimited)
-            str.insert(8, "T");
-        auto pdt = delimited ?
-            boost::posix_time::time_from_string(str.substr(0, tzpos)) :
-            boost::posix_time::from_iso_string(str.substr(0,tzpos));
+        static const boost::regex delim_iso("^(\\d{4}-\\d{2}-\\d{2} \\d{2}:\\d{2}:\\d{2}(?:\\.\\d{0,9})?)\\s*([+-]\\d{2}(?::?\\d{2})?)?$");
+        static const boost::regex non_delim("^(\\d{14}(?:\\.\\d{0,9})?)\\s*([+-]\\d{2}\\s*(:?\\d{2})?)?$");
+        PTime pdt;
+        boost::smatch sm;
+        if (regex_match(str, sm, non_delim))
+        {
+            std::string time_str(sm[1]);
+            time_str.insert(8, "T");
+            pdt = boost::posix_time::from_iso_string(time_str);
+        }
+        else if (regex_match(str, sm, delim_iso))
+        {
+            pdt = boost::posix_time::time_from_string(sm[1]);
+        }
+        else
+        {
+            throw(std::invalid_argument("The date string was not formatted in a way that GncDateTime(std::string) knows how to parse."));
+        }
+        std::string tzstr("");
+        if (sm[2].matched)
+            tzstr += sm[2];
+        tzptr = tz_from_string(tzstr);
         m_time = LDT(pdt.date(), pdt.time_of_day(), tzptr,
                          LDTBase::NOT_DATE_TIME_ON_ERROR);
     }

commit 89a1cfd24af529c7ca885ec7e90d198908133cbf
Author: John Ralls <jralls at ceridwen.us>
Date:   Sun Apr 8 14:11:28 2018 -0700

    Add note about ALLOW_OLD_GETTEXT.

diff --git a/README.dependencies b/README.dependencies
index 2239492..0b16ca7 100644
--- a/README.dependencies
+++ b/README.dependencies
@@ -66,7 +66,10 @@ Libraries/Deps
   gtk+3			3.14.0
   guile			2.2.0 or 2.0.0
   libxml2		2.5.10
-  gettext		0.19.6
+  gettext               0.19.6                  Can use older if you pass
+                                                -DALLOW_OLD_CMAKE to cmake;
+                                                doesn't include all file types
+                                                when building gnucash.pot.
   libxslt, including xsltproc
   ICU                                           International Compnents for
                                                 Unicode

commit cf24f9830bb81392d445e689d67c74a21e026422
Author: Di Mang <DiMan at users.noreply.github.com>
Date:   Wed Apr 4 23:11:13 2018 +0200

    Remove GNUCASH_MICRO_VERSION from VERSION...
    
    and remove of variable CPACK_PACKAGE_VERSION_PATCH

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 2c77e39..1624245 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -13,7 +13,7 @@ ENABLE_TESTING()
 # Version number of gnucash
 SET (GNUCASH_MAJOR_VERSION 3)
 SET (GNUCASH_MINOR_VERSION 0)
-SET (VERSION "${GNUCASH_MAJOR_VERSION}.${GNUCASH_MINOR_VERSION}.${GNUCASH_MICRO_VERSION}")
+SET (VERSION "${GNUCASH_MAJOR_VERSION}.${GNUCASH_MINOR_VERSION}")
 SET (GNUCASH_LATEST_STABLE_SERIES 3.0)
 
 SET (PACKAGE gnucash)
@@ -926,7 +926,6 @@ ENDIF()
 
 SET(CPACK_PACKAGE_VERSION_MAJOR "${GNUCASH_MAJOR_VERSION}")
 SET(CPACK_PACKAGE_VERSION_MINOR "${GNUCASH_MINOR_VERSION}")
-SET(CPACK_PACKAGE_VERSION_PATCH "${GNUCASH_MICRO_VERSION}")
 SET(CPACK_PACKAGE_VERSION "${VERSION}")
 
 IF(UNIX)



Summary of changes:
 CMakeLists.txt                     |  3 +--
 README.dependencies                |  5 ++++-
 libgnucash/engine/gnc-datetime.cpp | 34 +++++++++++++++++++++++-----------
 3 files changed, 28 insertions(+), 14 deletions(-)



More information about the gnucash-changes mailing list