libeuropa/io: Clean up TeeInOut()
Remove debugging stuff that didn't need to to be there anymore.
This commit is contained in:
parent
5657cdd0af
commit
361cd12437
1 changed files with 5 additions and 10 deletions
|
@ -61,7 +61,7 @@ namespace europa::io::impl {
|
|||
s.resize(length - 1);
|
||||
|
||||
// Read the string
|
||||
for(std::uint32_t i = 0; i < length-1; ++i) {
|
||||
for(std::uint32_t i = 0; i < length - 1; ++i) {
|
||||
s[i] = static_cast<char>(is.get());
|
||||
}
|
||||
static_cast<void>(is.get());
|
||||
|
@ -76,24 +76,19 @@ namespace europa::io::impl {
|
|||
|
||||
// Write the length and the string.
|
||||
os.write(reinterpret_cast<char*>(&len), sizeof(len));
|
||||
|
||||
|
||||
// It might be iffy to just depend on the C++ STL's
|
||||
// implicit NUL termination?
|
||||
// I mean, c_str() would be broken and the library implementation could be considered
|
||||
// implicit NUL termination?
|
||||
// I mean, c_str() would be broken and the library implementation could be considered
|
||||
// faulty, so idk.
|
||||
os.write(string.data(), string.length() + 1);
|
||||
}
|
||||
|
||||
void TeeInOut(std::istream& is, std::ostream& os) {
|
||||
std::uint8_t buffer[1024] {};
|
||||
//int i = 0;
|
||||
|
||||
while(!is.eof()) {
|
||||
is.read(reinterpret_cast<char*>(&buffer[0]), sizeof(buffer));
|
||||
auto c = is.gcount();
|
||||
//fprintf(stderr, "loop %d: Read %d bytes\n", i, c);
|
||||
os.write(reinterpret_cast<char*>(&buffer[0]), c);
|
||||
//i++;
|
||||
os.write(reinterpret_cast<char*>(&buffer[0]), is.gcount());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue