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

randombit / botan / 5111374265

29 May 2023 11:19AM UTC coverage: 92.227% (+0.5%) from 91.723%
5111374265

push

github

randombit
Next release will be 3.1.0. Update release notes

75588 of 81959 relevant lines covered (92.23%)

11886470.91 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
#include <istream>
10
#include <ostream>
11

12
namespace Botan {
13

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

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

43
}  // 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