[pan2] Prevent EOF char from stopping binary upload in Win
- From: Petr Kovář <pmkovar src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [pan2] Prevent EOF char from stopping binary upload in Win
- Date: Tue, 8 Mar 2016 21:20:31 +0000 (UTC)
commit b74bcc9c078482607dedd89b4f32190ef0a7a4f7
Author: Andrew Nile <andrewjnile gmail com>
Date: Tue Mar 8 22:07:27 2016 +0100
Prevent EOF char from stopping binary upload in Win
Remove erroneous tab characters from one of my last patches.
Prevent EOF character from stopping a binary upload in Windows
[joint credit with Steve Davies].
pan/data/encode-cache.cc | 11 ++++++++---
1 files changed, 8 insertions(+), 3 deletions(-)
---
diff --git a/pan/data/encode-cache.cc b/pan/data/encode-cache.cc
index 9d0c4c1..2d1de90 100644
--- a/pan/data/encode-cache.cc
+++ b/pan/data/encode-cache.cc
@@ -140,9 +140,9 @@ EncodeCache :: add (const Quark& message_id)
void EncodeCache :: finalize (std::string message_id)
{
struct stat sb;
- char out_path[4096];
-
- get_filename(out_path, Quark(message_id));
+ char out_path[4096];
+
+ get_filename(out_path, Quark(message_id));
stat (out_path, &sb);
_mid_to_info[message_id]._size = sb.st_size;
fire_added (message_id);
@@ -190,7 +190,12 @@ EncodeCache :: get_data(std::string& data, const Quark& where)
{
char buf[4096];
get_filename(buf, where);
+#ifdef G_OS_WIN32
+ // Prevent Windows EOF character from stopping the stream
+ std::ifstream in(buf, std::ios::binary);
+#else
std::ifstream in(buf, std::ios::in);
+#endif
std::stringstream out;
while (in.getline(buf,sizeof(buf)))
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]