msvcp90: handle npos as a len in basic_string<>::replace

Dan Kegel dank at kegel.com
Mon Jul 16 14:27:29 CDT 2012


Daniel Lehman wrote:

@@ -1949,7 +1949,7 @@ basic_string_char* __thiscall
basic_string_char_replace_cstr_len(basic_string_ch

-    if(off+len > this->size)
+    if(off+len < off || off+len > this->size)
         len = this->size-off;

Wouldn't this be more elegant:

    if(num > this->size-pos)
        num = this->size-pos;
?

Also, you may have missed the similar case in
basic_string_char_compare_substr_cstr_len
(which uses 'pos' and 'num' rather than 'off' and 'len').

See http://bugs.winehq.org/show_bug.cgi?id=31085#c5



More information about the wine-devel mailing list