mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Use size_t in dev::utf8::validate()
This commit is contained in:
1 parent
c157163441
commit
f1df3dee53
3 files changed
+7
-7
No files matched your search
+5
-5
@@ -31,18 +31,18 @@ namespace utf8
|
||||
{
|
||||
|
||||
|
||||
bool validate(std::string const& _input, int& _invalidPosition)
|
||||
bool validate(std::string const& _input, size_t& _invalidPosition)
|
||||
{
|
||||
const int length = _input.length();
|
||||
const size_t length = _input.length();
|
||||
bool valid = true;
|
||||
int i = 0;
|
||||
size_t i = 0;
|
||||
|
||||
for (; i < length; i++)
|
||||
{
|
||||
if ((unsigned char)_input[i] < 0x80)
|
||||
continue;
|
||||
|
||||
int count = 0;
|
||||
size_t count = 0;
|
||||
switch(_input[i] & 0xe0) {
|
||||
case 0xc0: count = 1; break;
|
||||
case 0xe0: count = 2; break;
|
||||
@@ -62,7 +62,7 @@ bool validate(std::string const& _input, int& _invalidPosition)
|
||||
break;
|
||||
}
|
||||
|
||||
for (int j = 0; j < count; j++)
|
||||
for (size_t j = 0; j < count; j++)
|
||||
{
|
||||
i++;
|
||||
if ((_input[i] & 0xc0) != 0x80)
|
||||
|
||||
Reference in new issue
Block a user