HomePhabricator

minor refactor to use ranged_for, auto and const-ness

Description

minor refactor to use ranged_for, auto and const-ness

Summary:
as above

edit: also renamed a variable that used Hungarian notation

Test Plan:
created a minor cpp unit test which replicated the desired behavior in the code. that being insufficient, as soon as my node syncs I'll prune it, set a breakpoint and verify correct behavior

edit: To check for correct behavior, wrote a test that creates empty blk000xx.dat and rev000xx.dat files from 0 to 28, with contiguous and non-contiguous segments, and runs the CleanupBlockRevFiles() function. then, this test will be run with clang's address, memory and undefined sanitizers, in turn.

Reviewers: O1 Bitcoin ABC, #bitcoin_abc, deadalnix

Reviewed By: O1 Bitcoin ABC, #bitcoin_abc, deadalnix

Differential Revision: https://reviews.bitcoinabc.org/D4495