Fix bug in String==StrRange comparison

It was comparing the StrRange with itself, always return true if both
were the same length.

Fix #3843

(cherry picked from commit f4dfa37a23)
This commit is contained in:
George Marques 2016-06-24 12:39:58 -03:00 committed by Rémi Verschelde
parent 6e49bc8210
commit c015341221
1 changed files with 2 additions and 5 deletions

View File

@ -256,13 +256,10 @@ bool String::operator==(const StrRange &p_range) const {
return true; return true;
const CharType *c_str=p_range.c_str; const CharType *c_str=p_range.c_str;
const CharType *dst = &operator[](0);
int l=length();
const CharType *dst = p_range.c_str;
/* Compare char by char */ /* Compare char by char */
for (int i=0;i<l;i++) { for (int i=0;i<len;i++) {
if (c_str[i]!=dst[i]) if (c_str[i]!=dst[i])
return false; return false;