File tree Expand file tree Collapse file tree 1 file changed +4
-9
lines changed Expand file tree Collapse file tree 1 file changed +4
-9
lines changed Original file line number Diff line number Diff line change 6
6
#include < bech32.h>
7
7
#include < util/vector.h>
8
8
9
+ #include < array>
9
10
#include < assert.h>
11
+ #include < numeric>
10
12
#include < optional>
11
- #include < array>
12
13
13
14
namespace bech32
14
15
{
@@ -282,13 +283,6 @@ inline unsigned char LowerCase(unsigned char c)
282
283
return (c >= ' A' && c <= ' Z' ) ? (c - ' A' ) + ' a' : c;
283
284
}
284
285
285
- void push_range (int from, int to, std::vector<int >& vec)
286
- {
287
- for (int i = from; i < to; i++) {
288
- vec.push_back (i);
289
- }
290
- }
291
-
292
286
/* * Return indices of invalid characters in a Bech32 string. */
293
287
bool CheckCharacters (const std::string& str, std::vector<int >& errors) {
294
288
bool lower = false , upper = false ;
@@ -404,7 +398,8 @@ DecodeResult Decode(const std::string& str) {
404
398
/* * Find index of an incorrect character in a Bech32 string. */
405
399
std::string LocateErrors (const std::string& str, std::vector<int >& error_locations) {
406
400
if (str.size () > 90 ) {
407
- push_range (90 , str.size (), error_locations);
401
+ error_locations.resize (str.size () - 90 );
402
+ std::iota (error_locations.begin (), error_locations.end (), 90 );
408
403
return " Bech32 string too long" ;
409
404
}
410
405
if (!CheckCharacters (str, error_locations)){
You can’t perform that action at this time.
0 commit comments