Changeset View
Changeset View
Standalone View
Standalone View
src/test/test_bitcoin_fuzzy.cpp
Show All 40 Lines | enum TEST_ID { | ||||
CADDRESS_DESERIALIZE, | CADDRESS_DESERIALIZE, | ||||
CINV_DESERIALIZE, | CINV_DESERIALIZE, | ||||
CBLOOMFILTER_DESERIALIZE, | CBLOOMFILTER_DESERIALIZE, | ||||
CDISKBLOCKINDEX_DESERIALIZE, | CDISKBLOCKINDEX_DESERIALIZE, | ||||
CTXOUTCOMPRESSOR_DESERIALIZE, | CTXOUTCOMPRESSOR_DESERIALIZE, | ||||
TEST_ID_END | TEST_ID_END | ||||
}; | }; | ||||
bool read_stdin(std::vector<char> &data) { | static bool read_stdin(std::vector<char> &data) { | ||||
char buffer[1024]; | char buffer[1024]; | ||||
ssize_t length = 0; | ssize_t length = 0; | ||||
while ((length = read(STDIN_FILENO, buffer, 1024)) > 0) { | while ((length = read(STDIN_FILENO, buffer, 1024)) > 0) { | ||||
data.insert(data.end(), buffer, buffer + length); | data.insert(data.end(), buffer, buffer + length); | ||||
if (data.size() > (1 << 20)) return false; | if (data.size() > (1 << 20)) return false; | ||||
} | } | ||||
return length == 0; | return length == 0; | ||||
▲ Show 20 Lines • Show All 200 Lines • Show Last 20 Lines |