Skip to content

Commit

Permalink
Limit variable scope.
Browse files Browse the repository at this point in the history
Issue found by cppcheck.
  • Loading branch information
mordante committed Apr 12, 2014
1 parent a3c51d2 commit 2b943e2
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/serialization/unicode.cpp
Expand Up @@ -276,9 +276,9 @@ size_t index(const utf8::string& str, const size_t index)
{
// chr counts characters, i is the codepoint index
// remark: several functions rely on the fallback to str.length()
unsigned int chr, i = 0, len = str.size();
unsigned int i = 0, len = str.size();
try {
for (chr=0; chr<index && i<len; ++chr) {
for (unsigned int chr=0; chr<index && i<len; ++chr) {
i += byte_size_from_utf8_first(str[i]);
}
} catch(invalid_utf8_exception&) {
Expand Down

0 comments on commit 2b943e2

Please sign in to comment.