Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/prusa3d/PrusaSlicer.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVojtech Kral <vojtech@kral.hk>2018-06-21 12:41:08 +0300
committerVojtech Kral <vojtech@kral.hk>2018-06-21 13:06:55 +0300
commit7cf39227076fbb04fd9b99d7313b8d265e34c47c (patch)
tree8492326a9621eee44f8efb863be0d94e2a2a8e2c
parent9ee10a877938e371b9200601c53b69b78886d015 (diff)
Http: Fix nowide fstream usageversion_1.40.1-alpha
-rw-r--r--xs/src/slic3r/Utils/Http.cpp9
1 files changed, 4 insertions, 5 deletions
diff --git a/xs/src/slic3r/Utils/Http.cpp b/xs/src/slic3r/Utils/Http.cpp
index 7c4126633..47021d39f 100644
--- a/xs/src/slic3r/Utils/Http.cpp
+++ b/xs/src/slic3r/Utils/Http.cpp
@@ -41,7 +41,7 @@ struct Http::priv
std::string buffer;
// Used for storing file streams added as multipart form parts
// Using a deque here because unlike vector it doesn't ivalidate pointers on insertion
- std::deque<std::ifstream> form_files;
+ std::deque<fs::ifstream> form_files;
size_t limit;
bool cancel;
@@ -168,19 +168,18 @@ void Http::priv::form_add_file(const char *name, const fs::path &path, const cha
filename = path.string().c_str();
}
- fs::ifstream stream(path, std::ios::in | std::ios::binary);
+ form_files.emplace_back(path, std::ios::in | std::ios::binary);
+ auto &stream = form_files.back();
stream.seekg(0, std::ios::end);
size_t size = stream.tellg();
stream.seekg(0);
- form_files.push_back(std::move(stream));
- auto stream_ptr = &form_files.back();
if (filename != nullptr) {
::curl_formadd(&form, &form_end,
CURLFORM_COPYNAME, name,
CURLFORM_FILENAME, filename,
CURLFORM_CONTENTTYPE, "application/octet-stream",
- CURLFORM_STREAM, static_cast<void*>(stream_ptr),
+ CURLFORM_STREAM, static_cast<void*>(&stream),
CURLFORM_CONTENTSLENGTH, static_cast<long>(size),
CURLFORM_END
);