|
24 | 24 | #include <QTimer> |
25 | 25 | #include <exception> |
26 | 26 | #include <thread> |
27 | | -#include <iostream> |
28 | | - |
29 | | -#include "Application.h" |
30 | 27 |
|
31 | 28 | namespace { |
32 | 29 | template <typename F, class... Args> |
@@ -84,32 +81,6 @@ namespace { |
84 | 81 | return escaped; |
85 | 82 | } |
86 | 83 |
|
87 | | - inline qint64 copyIODevice(std::basic_istream<char> *from, QIODevice *to, qint64 max = std::numeric_limits<qint64>::max()) |
88 | | - { |
89 | | - std::array<char,16*1024> buf{}; |
90 | | - size_t total_read = 0; |
91 | | - while ((total_read < max) && !from->eof() && !from->bad()) { |
92 | | - size_t to_read = std::min<size_t>(max, buf.size()); |
93 | | - from->read(buf.data(), to_read); |
94 | | - size_t n_read = from->gcount(); |
95 | | - if(to->write(buf.data(), n_read) != n_read) return -1; |
96 | | - total_read += n_read; |
97 | | - } |
98 | | - return total_read; |
99 | | - } |
100 | | - |
101 | | - inline qint64 copyIODevice(QIODevice *from, std::streambuf *to, qint64 max = std::numeric_limits<qint64>::max()) |
102 | | - { |
103 | | - std::array<char,16*1024> buf{}; |
104 | | - qint64 size = 0, i = 0; |
105 | | - for(; (i = from->read(buf.data(), std::min<qint64>(max, buf.size()))) > 0; size += i, max -= i) |
106 | | - { |
107 | | - if(to->sputn(buf.data(), i) != i) |
108 | | - return -1; |
109 | | - } |
110 | | - return i < 0 ? i : size; |
111 | | - } |
112 | | - |
113 | 84 | inline qint64 copyIODevice(QIODevice *from, QIODevice *to, qint64 max = std::numeric_limits<qint64>::max()) |
114 | 85 | { |
115 | 86 | std::array<char,16*1024> buf{}; |
|
0 commit comments