diff options
| author | Carl Hetherington <cth@carlh.net> | 2016-08-10 16:38:33 +0100 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2016-08-12 09:13:51 +0100 |
| commit | b1dc9c3a2f7e55c9afc5bf2d5b465371b048e14f (patch) | |
| tree | 9968238c6c0511f044e6fcdb4abcc08b5eb28f27 /src/lib/internet.cc | |
| parent | 4a0ae92e28d7d1f0dd648d1b620efc324fdef161 (diff) | |
Remove all use of stringstream in an attempt to fix
the suspected thread-unsafe crash bugs on OS X.
Diffstat (limited to 'src/lib/internet.cc')
| -rw-r--r-- | src/lib/internet.cc | 22 |
1 files changed, 12 insertions, 10 deletions
diff --git a/src/lib/internet.cc b/src/lib/internet.cc index c0a29bfbd..aafdf3a83 100644 --- a/src/lib/internet.cc +++ b/src/lib/internet.cc @@ -21,7 +21,6 @@ #include "scoped_temporary.h" #include "compose.hpp" #include "exceptions.h" -#include <locked_sstream.h> #include <curl/curl.h> #include <zip.h> #include <boost/function.hpp> @@ -74,7 +73,7 @@ get_from_zip_url (string url, string file, bool pasv, function<void (boost::file temp_zip.close (); curl_easy_cleanup (curl); if (cr != CURLE_OK) { - return String::compose (_("Download failed (%1/%2 error %3)"), url, file, cr); + return String::compose (_("Download failed (%1/%2 error %3)"), url, file, (int) cr); } /* Open the ZIP file and read `file' out of it */ @@ -149,16 +148,19 @@ ftp_ls (string url, bool pasv) throw NetworkError (curl_easy_strerror (r)); } - locked_stringstream s (ls_raw); list<string> ls; - while (s.good ()) { - string line = s.getline (); - trim (line); - if (line.length() > 55) { - string const file = line.substr (55); - if (file != "." && file != "..") { - ls.push_back (file); + string line; + for (size_t i = 0; i < ls_raw.length(); ++i) { + line += ls_raw[i]; + if (ls_raw[i] == '\n') { + trim (line); + if (line.length() > 55) { + string const file = line.substr (55); + if (file != "." && file != "..") { + ls.push_back (file); + } } + line = ""; } } |
