gnucash stable: Fix Finance::Quote use on Win32.

John Ralls jralls at code.gnucash.org
Thu Mar 30 20:55:35 EDT 2023


Updated	 via  https://github.com/Gnucash/gnucash/commit/0d598d51 (commit)
	from  https://github.com/Gnucash/gnucash/commit/a587dfff (commit)



commit 0d598d51ed6b3e6b2d3355d2eab368fb7d26af5a
Author: John Ralls <jralls at ceridwen.us>
Date:   Thu Mar 30 16:41:25 2023 -0700

    Fix Finance::Quote use on Win32.
    
    By dealing with Win32 \r\n newlines on return from finance-quote-wrapper.

diff --git a/libgnucash/app-utils/gnc-quotes.cpp b/libgnucash/app-utils/gnc-quotes.cpp
index 69c6de5075..d8b1215de0 100644
--- a/libgnucash/app-utils/gnc-quotes.cpp
+++ b/libgnucash/app-utils/gnc-quotes.cpp
@@ -237,8 +237,13 @@ GncFQQuoteSource::run_cmd (const StrVec& args, const std::string& json_string) c
             std::istream is(&sb);
 
             while (std::getline(is, line) && !line.empty())
+	    {
+#ifdef __WIN32
+		if (line.back() == '\r')
+		    line.pop_back();
+#endif
                 out_vec.push_back (std::move(line));
-
+	    }
             raw = err_buf.get();
             bio::stream_buffer<bio::array_source> eb(raw.data(), raw.size());
             std::istream es(&eb);



Summary of changes:
 libgnucash/app-utils/gnc-quotes.cpp | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)



More information about the gnucash-changes mailing list