msvcp110: Fix Yarn::operator=(const char*) implementation.

Signed-off-by: Piotr Caban <piotr@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Piotr Caban 2016-05-10 15:23:58 +02:00 committed by Alexandre Julliard
parent ed79f45817
commit f8a0f90eff
1 changed files with 20 additions and 16 deletions

View File

@ -1644,17 +1644,19 @@ _Yarn_char* __thiscall _Yarn_char_op_assign_cstr(_Yarn_char *this, const char *s
{
TRACE("(%p %p)\n", this, str);
_Yarn_char__Tidy(this);
if(str != this->str) {
_Yarn_char__Tidy(this);
if(str) {
MSVCP_size_t len = strlen(str);
if(str) {
MSVCP_size_t len = strlen(str);
this->str = MSVCRT_operator_new((len+1)*sizeof(char));
if(!this->str) {
ERR("out of memory\n");
return NULL;
this->str = MSVCRT_operator_new((len+1)*sizeof(char));
if(!this->str) {
ERR("out of memory\n");
return NULL;
}
memcpy(this->str, str, (len+1)*sizeof(char));
}
memcpy(this->str, str, (len+1)*sizeof(char));
}
return this;
}
@ -1762,17 +1764,19 @@ _Yarn_wchar* __thiscall _Yarn_wchar_op_assign_cstr(_Yarn_wchar *this, const wcha
{
TRACE("(%p %p)\n", this, str);
_Yarn_wchar__Tidy(this);
if(str != this->str) {
_Yarn_wchar__Tidy(this);
if(str) {
MSVCP_size_t len = wcslen(str);
if(str) {
MSVCP_size_t len = wcslen(str);
this->str = MSVCRT_operator_new((len+1)*sizeof(wchar_t));
if(!this->str) {
ERR("out of memory\n");
return NULL;
this->str = MSVCRT_operator_new((len+1)*sizeof(wchar_t));
if(!this->str) {
ERR("out of memory\n");
return NULL;
}
memcpy(this->str, str, (len+1)*sizeof(wchar_t));
}
memcpy(this->str, str, (len+1)*sizeof(wchar_t));
}
return this;
}