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

2012-07-16 Thread Daniel Lehman
> -Original Message-
> From: daniel.r.ke...@gmail.com [mailto:daniel.r.ke...@gmail.com] On
> Behalf Of Dan Kegel
> Sent: Monday, July 16, 2012 12:27 PM
> To: Daniel Lehman
> Cc: wine-devel@winehq.org
> Subject: re: msvcp90: handle npos as a len in basic_string<>::replace
> 
> 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;
> ?

Yeah, that looks better.  I'll change it

 
> 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

I hadn't run into that issue




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

2012-07-16 Thread Dan Kegel
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