Skip to content

Commit 9f477bc

Browse files
tests: Apply clang-format to deserialize.cpp. Clean up some redundancies.
1 parent 9c3b5df commit 9f477bc

File tree

1 file changed

+101
-101
lines changed

1 file changed

+101
-101
lines changed

src/test/fuzz/deserialize.cpp

+101-101
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ void test_one_input(const std::vector<uint8_t>& buffer)
3636
int nVersion;
3737
ds >> nVersion;
3838
ds.SetVersion(nVersion);
39-
} catch (const std::ios_base::failure& e) {
39+
} catch (const std::ios_base::failure&) {
4040
return;
4141
}
4242

@@ -161,124 +161,124 @@ void test_one_input(const std::vector<uint8_t>& buffer)
161161
} catch (const std::ios_base::failure&) {
162162
}
163163
#elif BLOCK_DESERIALIZE
164-
try
165-
{
166-
CBlock block;
167-
ds >> block;
168-
} catch (const std::ios_base::failure& e) {return;}
164+
try {
165+
CBlock block;
166+
ds >> block;
167+
} catch (const std::ios_base::failure&) {
168+
}
169169
#elif BLOCKLOCATOR_DESERIALIZE
170-
try
171-
{
172-
CBlockLocator bl;
173-
ds >> bl;
174-
} catch (const std::ios_base::failure& e) {return;}
170+
try {
171+
CBlockLocator bl;
172+
ds >> bl;
173+
} catch (const std::ios_base::failure&) {
174+
}
175175
#elif BLOCKMERKLEROOT
176-
try
177-
{
178-
CBlock block;
179-
ds >> block;
180-
bool mutated;
181-
BlockMerkleRoot(block, &mutated);
182-
} catch (const std::ios_base::failure& e) {return;}
176+
try {
177+
CBlock block;
178+
ds >> block;
179+
bool mutated;
180+
BlockMerkleRoot(block, &mutated);
181+
} catch (const std::ios_base::failure&) {
182+
}
183183
#elif ADDRMAN_DESERIALIZE
184-
try
185-
{
186-
CAddrMan am;
187-
ds >> am;
188-
} catch (const std::ios_base::failure& e) {return;}
184+
try {
185+
CAddrMan am;
186+
ds >> am;
187+
} catch (const std::ios_base::failure&) {
188+
}
189189
#elif BLOCKHEADER_DESERIALIZE
190-
try
191-
{
192-
CBlockHeader bh;
193-
ds >> bh;
194-
} catch (const std::ios_base::failure& e) {return;}
190+
try {
191+
CBlockHeader bh;
192+
ds >> bh;
193+
} catch (const std::ios_base::failure&) {
194+
}
195195
#elif BANENTRY_DESERIALIZE
196-
try
197-
{
198-
CBanEntry be;
199-
ds >> be;
200-
} catch (const std::ios_base::failure& e) {return;}
196+
try {
197+
CBanEntry be;
198+
ds >> be;
199+
} catch (const std::ios_base::failure&) {
200+
}
201201
#elif TXUNDO_DESERIALIZE
202-
try
203-
{
204-
CTxUndo tu;
205-
ds >> tu;
206-
} catch (const std::ios_base::failure& e) {return;}
202+
try {
203+
CTxUndo tu;
204+
ds >> tu;
205+
} catch (const std::ios_base::failure&) {
206+
}
207207
#elif BLOCKUNDO_DESERIALIZE
208-
try
209-
{
210-
CBlockUndo bu;
211-
ds >> bu;
212-
} catch (const std::ios_base::failure& e) {return;}
208+
try {
209+
CBlockUndo bu;
210+
ds >> bu;
211+
} catch (const std::ios_base::failure&) {
212+
}
213213
#elif COINS_DESERIALIZE
214-
try
215-
{
216-
Coin coin;
217-
ds >> coin;
218-
} catch (const std::ios_base::failure& e) {return;}
214+
try {
215+
Coin coin;
216+
ds >> coin;
217+
} catch (const std::ios_base::failure&) {
218+
}
219219
#elif NETADDR_DESERIALIZE
220-
try
221-
{
222-
CNetAddr na;
223-
ds >> na;
224-
} catch (const std::ios_base::failure& e) {return;}
220+
try {
221+
CNetAddr na;
222+
ds >> na;
223+
} catch (const std::ios_base::failure&) {
224+
}
225225
#elif SERVICE_DESERIALIZE
226-
try
227-
{
228-
CService s;
229-
ds >> s;
230-
} catch (const std::ios_base::failure& e) {return;}
226+
try {
227+
CService s;
228+
ds >> s;
229+
} catch (const std::ios_base::failure&) {
230+
}
231231
#elif MESSAGEHEADER_DESERIALIZE
232-
CMessageHeader::MessageStartChars pchMessageStart = {0x00, 0x00, 0x00, 0x00};
233-
try
234-
{
235-
CMessageHeader mh(pchMessageStart);
236-
ds >> mh;
237-
if (!mh.IsValid(pchMessageStart)) {return;}
238-
} catch (const std::ios_base::failure& e) {return;}
232+
CMessageHeader::MessageStartChars pchMessageStart = {0x00, 0x00, 0x00, 0x00};
233+
try {
234+
CMessageHeader mh(pchMessageStart);
235+
ds >> mh;
236+
(void)mh.IsValid(pchMessageStart);
237+
} catch (const std::ios_base::failure&) {
238+
}
239239
#elif ADDRESS_DESERIALIZE
240-
try
241-
{
242-
CAddress a;
243-
ds >> a;
244-
} catch (const std::ios_base::failure& e) {return;}
240+
try {
241+
CAddress a;
242+
ds >> a;
243+
} catch (const std::ios_base::failure&) {
244+
}
245245
#elif INV_DESERIALIZE
246-
try
247-
{
248-
CInv i;
249-
ds >> i;
250-
} catch (const std::ios_base::failure& e) {return;}
246+
try {
247+
CInv i;
248+
ds >> i;
249+
} catch (const std::ios_base::failure&) {
250+
}
251251
#elif BLOOMFILTER_DESERIALIZE
252-
try
253-
{
254-
CBloomFilter bf;
255-
ds >> bf;
256-
} catch (const std::ios_base::failure& e) {return;}
252+
try {
253+
CBloomFilter bf;
254+
ds >> bf;
255+
} catch (const std::ios_base::failure&) {
256+
}
257257
#elif DISKBLOCKINDEX_DESERIALIZE
258-
try
259-
{
260-
CDiskBlockIndex dbi;
261-
ds >> dbi;
262-
} catch (const std::ios_base::failure& e) {return;}
258+
try {
259+
CDiskBlockIndex dbi;
260+
ds >> dbi;
261+
} catch (const std::ios_base::failure&) {
262+
}
263263
#elif TXOUTCOMPRESSOR_DESERIALIZE
264-
CTxOut to;
265-
CTxOutCompressor toc(to);
266-
try
267-
{
268-
ds >> toc;
269-
} catch (const std::ios_base::failure& e) {return;}
264+
CTxOut to;
265+
CTxOutCompressor toc(to);
266+
try {
267+
ds >> toc;
268+
} catch (const std::ios_base::failure&) {
269+
}
270270
#elif BLOCKTRANSACTIONS_DESERIALIZE
271-
try
272-
{
273-
BlockTransactions bt;
274-
ds >> bt;
275-
} catch (const std::ios_base::failure& e) {return;}
271+
try {
272+
BlockTransactions bt;
273+
ds >> bt;
274+
} catch (const std::ios_base::failure&) {
275+
}
276276
#elif BLOCKTRANSACTIONSREQUEST_DESERIALIZE
277-
try
278-
{
279-
BlockTransactionsRequest btr;
280-
ds >> btr;
281-
} catch (const std::ios_base::failure& e) {return;}
277+
try {
278+
BlockTransactionsRequest btr;
279+
ds >> btr;
280+
} catch (const std::ios_base::failure&) {
281+
}
282282
#else
283283
#error Need at least one fuzz target to compile
284284
#endif

0 commit comments

Comments
 (0)