int __stdcall CEGUI__String__encode(LPCSTR lpMultiByteStr, int a2, int a3, int a4)
{
unsigned int v4; // eax@1
WCHAR *v5; // edi@1
int v6; // esi@1
v6 = MultiByteToWideChar(0, 0, lpMultiByteStr, -1, 0, 0);
v5 = (WCHAR *)operator new__(2 * v6);
MultiByteToWideChar(0, 0, lpMultiByteStr, -1, v5, v6);
v4 = 0;
if ( v6 )
{
do
{
*(_DWORD *)(a2 + 4 * v4) = v5[v4];
++v4;
}
while ( v4 < v6 );
}
*(_DWORD *)(a2 + 4 * v6 - 4) = 0;
operator delete__(v5);
return v6 - 1;
}
void *__thiscall CEGUI__String__assign(void *this, LPCSTR lpMultiByteStr, int a3)
{
void *v3; // esi@1
int v4; // eax@4
int v5; // edi@4
int v6; // ecx@5
unsigned __int8 v7; // cf@7
unsigned __int8 v8; // zf@7
int v9; // eax@8
char v11; // [sp+4h] [bp-54h]@2
char v12; // [sp+8h] [bp-50h]@2
int (__thiscall **v13)(void *, char); // [sp+20h] [bp-38h]@2
char v14; // [sp+2Ch] [bp-2Ch]@2
int v15; // [sp+50h] [bp-8h]@2
v3 = this;
if ( a3 == CEGUI__String__npos )
{
std__basic_string_char_std__char_traits_char__std__allocator_char____basic_string_char_std__char_traits_char__std__allocator_char__(&v12);
v15 = 0;
exception__exception(&v13);
LOBYTE(v15) = 1;
v13 = &off_100C52D0;
std__basic_string_char_std__char_traits_char__std__allocator_char____basic_string_char_std__char_traits_char__std__allocator_char__(
&v14,
&v11);
LOBYTE(v15) = 0;
v13 = &off_100C52D8;
CxxThrowException(&v13, &unk_100E9548);
}
v5 = CEGUI__String__encoded_size(lpMultiByteStr, a3);
CEGUI__String__grow(v5);
v4 = *((_DWORD *)v3 + 1);
if ( (unsigned int)v4 <= 0x20 )
v6 = (int)((char *)v3 + 20);
else
v6 = *((_DWORD *)v3 + 37);
CEGUI__String__encode(lpMultiByteStr, v6, v4, a3);
v7 = *((_DWORD *)v3 + 1) < 0x20u;
v8 = *((_DWORD *)v3 + 1) == 32;
*(_DWORD *)v3 = v5;
if ( v7 | v8 )
v9 = (int)((char *)v3 + 20);
else
v9 = *((_DWORD *)v3 + 37);
*(_DWORD *)(v9 + 4 * v5) = 0;
return v3;
}