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

randombit / botan / 16052725896

03 Jul 2025 02:09PM UTC coverage: 90.57% (-0.003%) from 90.573%
16052725896

Pull #4931

github

web-flow
Merge d969ea76a into 750c4cef7
Pull Request #4931: Address various warnings from clang-tidy

99049 of 109362 relevant lines covered (90.57%)

12428027.87 hits per line

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

89.47
/src/lib/math/bigint/big_io.cpp
1
/*
2
* BigInt Input/Output
3
* (C) 1999-2007 Jack Lloyd
4
*
5
* Botan is released under the Simplified BSD License (see license.txt)
6
*/
7

8
#include <botan/bigint.h>
9
#include <istream>
10
#include <ostream>
11

12
namespace Botan {
13

14
/*
15
* Write the BigInt into a stream
16
*/
17
std::ostream& operator<<(std::ostream& stream, const BigInt& n) {
58✔
18
   const auto stream_flags = stream.flags();
58✔
19
   if((stream_flags & std::ios::oct) != 0) {
58✔
20
      throw Invalid_Argument("Octal output of BigInt not supported");
1✔
21
   }
22

23
   const size_t base = (stream_flags & std::ios::hex) != 0 ? 16 : 10;
57✔
24

25
   if(base == 10) {
57✔
26
      stream << n.to_dec_string();
54✔
27
   } else {
28
      stream << n.to_hex_string();
60✔
29
   }
30

31
   if(!stream.good()) {
57✔
32
      throw Stream_IO_Error("BigInt output operator has failed");
×
33
   }
34
   return stream;
57✔
35
}
36

37
/*
38
* Read the BigInt from a stream
39
*/
40
std::istream& operator>>(std::istream& stream, BigInt& n) {
5✔
41
   std::string str;
5✔
42
   std::getline(stream, str);
5✔
43
   if(stream.bad() || (stream.fail() && !stream.eof())) {
5✔
44
      throw Stream_IO_Error("BigInt input operator has failed");
×
45
   }
46
   n = BigInt(str);
5✔
47
   return stream;
5✔
48
}
5✔
49

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