mirror of
https://github.com/bitcoin/bitcoin.git
synced 2024-11-19 18:09:47 +01:00
Remove unused char serialize
This commit is contained in:
parent
fa24493d63
commit
fa5d2e678c
@ -189,7 +189,7 @@ template<typename X> const X& ReadWriteAsHelper(const X& x) { return x; }
|
||||
FORMATTER_METHODS(cls, obj)
|
||||
|
||||
#ifndef CHAR_EQUALS_INT8
|
||||
template<typename Stream> inline void Serialize(Stream& s, char a ) { ser_writedata8(s, a); } // TODO Get rid of bare char
|
||||
template <typename Stream> void Serialize(Stream&, char) = delete; // char serialization forbidden. Use uint8_t or int8_t
|
||||
#endif
|
||||
template<typename Stream> inline void Serialize(Stream& s, int8_t a ) { ser_writedata8(s, a); }
|
||||
template<typename Stream> inline void Serialize(Stream& s, uint8_t a ) { ser_writedata8(s, a); }
|
||||
@ -205,7 +205,7 @@ template<typename Stream> inline void Serialize(Stream& s, const Span<const unsi
|
||||
template<typename Stream> inline void Serialize(Stream& s, const Span<unsigned char>& span) { s.write(AsBytes(span)); }
|
||||
|
||||
#ifndef CHAR_EQUALS_INT8
|
||||
template<typename Stream> inline void Unserialize(Stream& s, char& a ) { a = ser_readdata8(s); } // TODO Get rid of bare char
|
||||
template <typename Stream> void Unserialize(Stream&, char) = delete; // char serialization forbidden. Use uint8_t or int8_t
|
||||
#endif
|
||||
template<typename Stream> inline void Unserialize(Stream& s, int8_t& a ) { a = ser_readdata8(s); }
|
||||
template<typename Stream> inline void Unserialize(Stream& s, uint8_t& a ) { a = ser_readdata8(s); }
|
||||
|
@ -205,11 +205,6 @@ FUZZ_TARGET_INIT(integer, initialize_integer)
|
||||
stream >> deserialized_i8;
|
||||
assert(i8 == deserialized_i8 && stream.empty());
|
||||
|
||||
char deserialized_ch;
|
||||
stream << ch;
|
||||
stream >> deserialized_ch;
|
||||
assert(ch == deserialized_ch && stream.empty());
|
||||
|
||||
bool deserialized_b;
|
||||
stream << b;
|
||||
stream >> deserialized_b;
|
||||
|
@ -339,7 +339,6 @@ void WriteToStream(FuzzedDataProvider& fuzzed_data_provider, Stream& stream) noe
|
||||
CallOneOf(
|
||||
fuzzed_data_provider,
|
||||
WRITE_TO_STREAM_CASE(bool, fuzzed_data_provider.ConsumeBool()),
|
||||
WRITE_TO_STREAM_CASE(char, fuzzed_data_provider.ConsumeIntegral<char>()),
|
||||
WRITE_TO_STREAM_CASE(int8_t, fuzzed_data_provider.ConsumeIntegral<int8_t>()),
|
||||
WRITE_TO_STREAM_CASE(uint8_t, fuzzed_data_provider.ConsumeIntegral<uint8_t>()),
|
||||
WRITE_TO_STREAM_CASE(int16_t, fuzzed_data_provider.ConsumeIntegral<int16_t>()),
|
||||
@ -349,7 +348,7 @@ void WriteToStream(FuzzedDataProvider& fuzzed_data_provider, Stream& stream) noe
|
||||
WRITE_TO_STREAM_CASE(int64_t, fuzzed_data_provider.ConsumeIntegral<int64_t>()),
|
||||
WRITE_TO_STREAM_CASE(uint64_t, fuzzed_data_provider.ConsumeIntegral<uint64_t>()),
|
||||
WRITE_TO_STREAM_CASE(std::string, fuzzed_data_provider.ConsumeRandomLengthString(32)),
|
||||
WRITE_TO_STREAM_CASE(std::vector<char>, ConsumeRandomLengthIntegralVector<char>(fuzzed_data_provider)));
|
||||
WRITE_TO_STREAM_CASE(std::vector<uint8_t>, ConsumeRandomLengthIntegralVector<uint8_t>(fuzzed_data_provider)));
|
||||
} catch (const std::ios_base::failure&) {
|
||||
break;
|
||||
}
|
||||
@ -369,7 +368,6 @@ void ReadFromStream(FuzzedDataProvider& fuzzed_data_provider, Stream& stream) no
|
||||
CallOneOf(
|
||||
fuzzed_data_provider,
|
||||
READ_FROM_STREAM_CASE(bool),
|
||||
READ_FROM_STREAM_CASE(char),
|
||||
READ_FROM_STREAM_CASE(int8_t),
|
||||
READ_FROM_STREAM_CASE(uint8_t),
|
||||
READ_FROM_STREAM_CASE(int16_t),
|
||||
@ -379,7 +377,7 @@ void ReadFromStream(FuzzedDataProvider& fuzzed_data_provider, Stream& stream) no
|
||||
READ_FROM_STREAM_CASE(int64_t),
|
||||
READ_FROM_STREAM_CASE(uint64_t),
|
||||
READ_FROM_STREAM_CASE(std::string),
|
||||
READ_FROM_STREAM_CASE(std::vector<char>));
|
||||
READ_FROM_STREAM_CASE(std::vector<uint8_t>));
|
||||
} catch (const std::ios_base::failure&) {
|
||||
break;
|
||||
}
|
||||
|
@ -61,7 +61,7 @@ public:
|
||||
|
||||
BOOST_AUTO_TEST_CASE(sizes)
|
||||
{
|
||||
BOOST_CHECK_EQUAL(sizeof(char), GetSerializeSize(char(0), 0));
|
||||
BOOST_CHECK_EQUAL(sizeof(unsigned char), GetSerializeSize((unsigned char)0, 0));
|
||||
BOOST_CHECK_EQUAL(sizeof(int8_t), GetSerializeSize(int8_t(0), 0));
|
||||
BOOST_CHECK_EQUAL(sizeof(uint8_t), GetSerializeSize(uint8_t(0), 0));
|
||||
BOOST_CHECK_EQUAL(sizeof(int16_t), GetSerializeSize(int16_t(0), 0));
|
||||
@ -74,7 +74,7 @@ BOOST_AUTO_TEST_CASE(sizes)
|
||||
BOOST_CHECK_EQUAL(sizeof(uint8_t), GetSerializeSize(bool(0), 0));
|
||||
|
||||
// Sanity-check GetSerializeSize and c++ type matching
|
||||
BOOST_CHECK_EQUAL(GetSerializeSize(char(0), 0), 1U);
|
||||
BOOST_CHECK_EQUAL(GetSerializeSize((unsigned char)0, 0), 1U);
|
||||
BOOST_CHECK_EQUAL(GetSerializeSize(int8_t(0), 0), 1U);
|
||||
BOOST_CHECK_EQUAL(GetSerializeSize(uint8_t(0), 0), 1U);
|
||||
BOOST_CHECK_EQUAL(GetSerializeSize(int16_t(0), 0), 2U);
|
||||
|
Loading…
Reference in New Issue
Block a user