lmi
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [lmi] C++ modernization


From: Vadim Zeitlin
Subject: Re: [lmi] C++ modernization
Date: Tue, 10 Jan 2017 14:44:42 +0100

On Tue, 10 Jan 2017 11:54:50 +0000 Greg Chicares <address@hidden> wrote:

GC> Moving on to pull/47...
GC> 
GC> There's a problem with one file:
GC> 
GC> | The only significant change was the removal of the default ctor of
GC> | database_impl in rate_table.cpp as it was confusing to have an empty ctor
GC> | which wasn't really equivalent to the default implementation due to the 
use of
GC> | const member field. Clarify the intention by leaving only the ctor taking 
a
GC> | path and calling it explicitly with an empty path when necessary.
GC> 
GC> Running rate_table_test:
GC> Expect 'Possibly unknown field...':
GC> Possibly unknown field 'Bloordyblop' ignored at line 1.
GC> 
GC> ** uncaught exception: std::exception: boost::filesystem::path: invalid 
name ".ndx" in path: ".ndx"
GC> 
GC> **** returning with error code 200
GC> **********  errors detected; see stdout for details  ***********
GC> /opt/lmi/src/lmi/workhorse.make:1141: recipe for target 
'rate_table_test.exe-run' failed
GC> 
GC> I think I'd better ask you to resolve that.

 You're probably even more tired of seeing my excuses than I'm of writing
them, but I've somehow forgot to finish this change (which is
understandable, to err is human and all that) and then somehow missed this
test failure (which is much less so :-(). So sorry again and please apply
the following patch to fix the code I broke:

---------------------------------- >8 --------------------------------------
diff --git a/rate_table.cpp b/rate_table.cpp
index 0106078..9bb9435 100644
--- a/rate_table.cpp
+++ b/rate_table.cpp
@@ -2476,6 +2476,13 @@ class database_impl
 database_impl::database_impl(fs::path const& path)
     :path_(path)
 {
+    if(path_.empty())
+        {
+        // This ctor can be explicitly used with an empty path to create a
+        // database not (yet) associated with any physical file.
+        return;
+        }
+
     fs::path const index_path = get_index_path(path);
     fs::ifstream ifs(index_path, ios_in_binary());
     if(!ifs) fatal_error() << "Unable to open '" << index_path << "'." << 
LMI_FLUSH;
---------------------------------- >8 --------------------------------------

 Thanks in advance,
VZ


reply via email to

[Prev in Thread] Current Thread [Next in Thread]