Commit f8a0f90e authored by Piotr Caban's avatar Piotr Caban Committed by Alexandre Julliard

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

parent ed79f458
......@@ -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) {
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;
if(str != this->str) {
_Yarn_char__Tidy(this);
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;
}
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;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment