msvcp60: Fixed handling of empty strings.

This commit is contained in:
Piotr Caban 2012-11-18 21:44:08 +01:00 committed by Alexandre Julliard
parent 4f4f93802a
commit 95c4284822
1 changed files with 19 additions and 12 deletions

View File

@ -236,6 +236,7 @@ void __thiscall basic_string_char__Split(basic_string_char *this)
len = this->size; len = this->size;
basic_string_char__Tidy(this, TRUE); basic_string_char__Tidy(this, TRUE);
if(basic_string_char__Grow(this, len, FALSE)) { if(basic_string_char__Grow(this, len, FALSE)) {
if(ptr)
char_traits_char__Copy_s(this->ptr, this->res, ptr, len); char_traits_char__Copy_s(this->ptr, this->res, ptr, len);
basic_string_char__Eos(this, len); basic_string_char__Eos(this, len);
} }
@ -345,8 +346,8 @@ basic_string_char* __thiscall basic_string_char_assign_substr(
basic_string_char_erase(this, pos+len, basic_string_char_npos); basic_string_char_erase(this, pos+len, basic_string_char_npos);
basic_string_char_erase(this, 0, pos); basic_string_char_erase(this, 0, pos);
} else if(basic_string_char__Grow(this, len, FALSE)) { } else if(basic_string_char__Grow(this, len, FALSE)) {
char_traits_char__Copy_s(this->ptr, this->res, if(assign->ptr)
assign->ptr+pos, len); char_traits_char__Copy_s(this->ptr, this->res, assign->ptr+pos, len);
basic_string_char__Eos(this, len); basic_string_char__Eos(this, len);
} }
@ -1149,8 +1150,9 @@ basic_string_char* __thiscall basic_string_char_append_substr(basic_string_char
_Xlen(); _Xlen();
if(basic_string_char__Grow(this, this->size+count, FALSE)) { if(basic_string_char__Grow(this, this->size+count, FALSE)) {
char_traits_char__Copy_s(this->ptr+this->size, if(append->ptr)
this->res-this->size, append->ptr+offset, count); char_traits_char__Copy_s(this->ptr+this->size, this->res-this->size,
append->ptr+offset, count);
basic_string_char__Eos(this, this->size+count); basic_string_char__Eos(this, this->size+count);
} }
@ -1763,6 +1765,7 @@ MSVCP_size_t __thiscall basic_string_char_copy(const basic_string_char *this,
_Xran(); _Xran();
if(count > this->size-off) if(count > this->size-off)
count = this->size-off; count = this->size-off;
if(this->ptr)
char_traits_char__Copy_s(dest, count, this->ptr+off, count); char_traits_char__Copy_s(dest, count, this->ptr+off, count);
return count; return count;
} }
@ -1949,6 +1952,7 @@ void __thiscall basic_string_wchar__Split(basic_string_wchar *this)
len = this->size; len = this->size;
basic_string_wchar__Tidy(this, TRUE); basic_string_wchar__Tidy(this, TRUE);
if(basic_string_wchar__Grow(this, len, FALSE)) { if(basic_string_wchar__Grow(this, len, FALSE)) {
if(ptr)
char_traits_wchar__Copy_s(this->ptr, this->res, ptr, len); char_traits_wchar__Copy_s(this->ptr, this->res, ptr, len);
basic_string_wchar__Eos(this, len); basic_string_wchar__Eos(this, len);
} }
@ -2058,6 +2062,7 @@ basic_string_wchar* __thiscall basic_string_wchar_assign_substr(
basic_string_wchar_erase(this, pos+len, basic_string_wchar_npos); basic_string_wchar_erase(this, pos+len, basic_string_wchar_npos);
basic_string_wchar_erase(this, 0, pos); basic_string_wchar_erase(this, 0, pos);
} else if(basic_string_wchar__Grow(this, len, FALSE)) { } else if(basic_string_wchar__Grow(this, len, FALSE)) {
if(assign->ptr)
char_traits_wchar__Copy_s(this->ptr, this->res, char_traits_wchar__Copy_s(this->ptr, this->res,
assign->ptr+pos, len); assign->ptr+pos, len);
basic_string_wchar__Eos(this, len); basic_string_wchar__Eos(this, len);
@ -2861,8 +2866,9 @@ basic_string_wchar* __thiscall basic_string_wchar_append_substr(basic_string_wch
_Xlen(); _Xlen();
if(basic_string_wchar__Grow(this, this->size+count, FALSE)) { if(basic_string_wchar__Grow(this, this->size+count, FALSE)) {
char_traits_wchar__Copy_s(this->ptr+this->size, if(append->ptr)
this->res-this->size, append->ptr+offset, count); char_traits_wchar__Copy_s(this->ptr+this->size, this->res-this->size,
append->ptr+offset, count);
basic_string_wchar__Eos(this, this->size+count); basic_string_wchar__Eos(this, this->size+count);
} }
@ -3475,6 +3481,7 @@ MSVCP_size_t __thiscall basic_string_wchar_copy(const basic_string_wchar *this,
_Xran(); _Xran();
if(count > this->size-off) if(count > this->size-off)
count = this->size-off; count = this->size-off;
if(this->ptr)
char_traits_wchar__Copy_s(dest, count, this->ptr+off, count); char_traits_wchar__Copy_s(dest, count, this->ptr+off, count);
return count; return count;
} }