diff options
author | Alex Beregszaszi <alex@rtfs.hu> | 2016-08-09 02:12:11 +0800 |
---|---|---|
committer | Alex Beregszaszi <alex@rtfs.hu> | 2016-08-09 02:58:39 +0800 |
commit | c1571634413fe7de3140b7fdbf55b1d884ef03ff (patch) | |
tree | 254f0e21ab937867f0c1218ab810ff183ccdfc10 /libdevcore/UTF8.cpp | |
parent | e8c2e87397c0dbb8e5be3e096385e45740a4cbf3 (diff) | |
download | dexon-solidity-c1571634413fe7de3140b7fdbf55b1d884ef03ff.tar dexon-solidity-c1571634413fe7de3140b7fdbf55b1d884ef03ff.tar.gz dexon-solidity-c1571634413fe7de3140b7fdbf55b1d884ef03ff.tar.bz2 dexon-solidity-c1571634413fe7de3140b7fdbf55b1d884ef03ff.tar.lz dexon-solidity-c1571634413fe7de3140b7fdbf55b1d884ef03ff.tar.xz dexon-solidity-c1571634413fe7de3140b7fdbf55b1d884ef03ff.tar.zst dexon-solidity-c1571634413fe7de3140b7fdbf55b1d884ef03ff.zip |
Use consts in dev::utf8::validate()
Diffstat (limited to 'libdevcore/UTF8.cpp')
-rw-r--r-- | libdevcore/UTF8.cpp | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/libdevcore/UTF8.cpp b/libdevcore/UTF8.cpp index 4bae75ef..0c385e81 100644 --- a/libdevcore/UTF8.cpp +++ b/libdevcore/UTF8.cpp @@ -31,19 +31,19 @@ namespace utf8 { -bool validate(std::string input, int &invalidPosition) +bool validate(std::string const& _input, int& _invalidPosition) { - const int length = input.length(); + const int length = _input.length(); bool valid = true; int i = 0; for (; i < length; i++) { - if ((unsigned char)input[i] < 0x80) + if ((unsigned char)_input[i] < 0x80) continue; int count = 0; - switch(input[i] & 0xe0) { + switch(_input[i] & 0xe0) { case 0xc0: count = 1; break; case 0xe0: count = 2; break; case 0xf0: count = 3; break; @@ -65,7 +65,7 @@ bool validate(std::string input, int &invalidPosition) for (int j = 0; j < count; j++) { i++; - if ((input[i] & 0xc0) != 0x80) + if ((_input[i] & 0xc0) != 0x80) { valid = false; break; @@ -76,7 +76,7 @@ bool validate(std::string input, int &invalidPosition) if (valid) return true; - invalidPosition = i; + _invalidPosition = i; return false; } |