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

Daniel Lehman dlehman at esri.com
Mon Jul 16 14:38:10 CDT 2012


> -----Original Message-----
> From: daniel.r.kegel at gmail.com [mailto:daniel.r.kegel at gmail.com] On
> Behalf Of Dan Kegel
> Sent: Monday, July 16, 2012 12:27 PM
> To: Daniel Lehman
> Cc: wine-devel at 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



More information about the wine-devel mailing list