lmi
[Top][All Lists]
Advanced

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

[lmi] Strange format message in list_soa_file_tables()


From: Vadim Zeitlin
Subject: [lmi] Strange format message in list_soa_file_tables()
Date: Sun, 16 Nov 2014 03:13:48 +0100

 Hello,

 I've been trying to build LMI with a newer version of MSVC (12, which is
part of Microsoft Visual Studio 2013) and found a strange compilation
problem: compiler refused to pass "fs::ifstream" object as argument to
boost::format claiming that no suitable overload was found. It's a bit
difficult to understand what's going on here, but the existing code seems
pretty strange to me:

                boost::format("Table index file file '%1%': attempted to read 
%2% bytes, but got %3% bytes instead.")
                % index_path.string()
                % index_record_length
                % index_ifs

 Surely "index_ifs" which is, again, of "fs::ifstream" type, can't
represent the number of bytes read on its own? AFAICS there is a missing
".gcount()" here and the following patch should be applied:

---------------------------------- >8 --------------------------------------
diff --git a/soa_helpers.hpp b/soa_helpers.hpp
index cc756aa..ee4b172 100644
--- a/soa_helpers.hpp
+++ b/soa_helpers.hpp
@@ -101,7 +101,7 @@ std::vector<soa_record_info> list_soa_file_tables(char 
const* filename)
                 boost::format("Table index file file '%1%': attempted to read 
%2% bytes, but got %3% bytes instead.")
                 % index_path.string()
                 % index_record_length
-                % index_ifs
+                % index_ifs.gcount()
                 );
             }

---------------------------------- >8 --------------------------------------

and not just to make the code compile (and probably work, although I admit
I haven't tested this) with MSVC 12 but also to fix it with any other
compiler, including g++.

 Am I missing something?
VZ

reply via email to

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