• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

randombit / botan / 6704830136

31 Oct 2023 09:55AM UTC coverage: 91.722% (+0.001%) from 91.721%
6704830136

push

github

web-flow
Merge pull request #3752 from randombit/jack/allocator-helper

Split out allocator helpers to allocator.h

80150 of 87384 relevant lines covered (91.72%)

8593301.14 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

89.47
/src/lib/filters/pipe_io.cpp
1
/*
2
* Pipe I/O
3
* (C) 1999-2007 Jack Lloyd
4
*
5
* Botan is released under the Simplified BSD License (see license.txt)
6
*/
7

8
#include <botan/pipe.h>
9

10
#include <botan/mem_ops.h>
11
#include <istream>
12
#include <ostream>
13

14
namespace Botan {
15

16
/*
17
* Write data from a pipe into an ostream
18
*/
19
std::ostream& operator<<(std::ostream& stream, Pipe& pipe) {
2✔
20
   secure_vector<uint8_t> buffer(BOTAN_DEFAULT_BUFFER_SIZE);
2✔
21
   while(stream.good() && pipe.remaining()) {
4✔
22
      const size_t got = pipe.read(buffer.data(), buffer.size());
2✔
23
      stream.write(cast_uint8_ptr_to_char(buffer.data()), got);
2✔
24
   }
25
   if(!stream.good()) {
2✔
26
      throw Stream_IO_Error("Pipe output operator (iostream) has failed");
×
27
   }
28
   return stream;
2✔
29
}
2✔
30

31
/*
32
* Read data from an istream into a pipe
33
*/
34
std::istream& operator>>(std::istream& stream, Pipe& pipe) {
1✔
35
   secure_vector<uint8_t> buffer(BOTAN_DEFAULT_BUFFER_SIZE);
1✔
36
   while(stream.good()) {
2✔
37
      stream.read(cast_uint8_ptr_to_char(buffer.data()), buffer.size());
1✔
38
      const size_t got = static_cast<size_t>(stream.gcount());
1✔
39
      pipe.write(buffer.data(), got);
1✔
40
   }
41
   if(stream.bad() || (stream.fail() && !stream.eof())) {
1✔
42
      throw Stream_IO_Error("Pipe input operator (iostream) has failed");
×
43
   }
44
   return stream;
1✔
45
}
1✔
46

47
}  // namespace Botan
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc