string.c 159 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28
/*
 * Copyright 2012 Piotr Caban for CodeWeavers
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
 */

#include "config.h"

#include <stdarg.h>

#include "msvcp.h"
#include "stdio.h"

#include "windef.h"
#include "winbase.h"
#include "wine/debug.h"
29
WINE_DEFAULT_DEBUG_CHANNEL(msvcp);
30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64

#define FROZEN 255

/* _String_iterator<char> and _String_const_iterator<char> class */
typedef struct {
    char *ptr;
} String_reverse_iterator_char;

typedef struct {
    wchar_t *ptr;
} String_reverse_iterator_wchar;

/* allocator class */
typedef struct {
    char empty_struct;
} allocator;

/* ?_Xran@std@@YAXXZ */
void __cdecl _Xran(void)
{
    static const char msg[] = "invalid string position";

    TRACE("\n");
    throw_exception(EXCEPTION_OUT_OF_RANGE, msg);
}

/* ?_Xlen@std@@YAXXZ */
void __cdecl _Xlen(void)
{
    static const char msg[] = "string too long";

    TRACE("\n");
    throw_exception(EXCEPTION_LENGTH_ERROR, msg);
}

65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83
/* ?compare@?$char_traits@D@std@@SAHPBD0I@Z */
/* ?compare@?$char_traits@D@std@@SAHPEBD0_K@Z */
int CDECL MSVCP_char_traits_char_compare(
        const char *s1, const char *s2, MSVCP_size_t count)
{
    int ret = memcmp(s1, s2, count);
    return (ret>0 ? 1 : (ret<0 ? -1 : 0));
}

/* ?length@?$char_traits@D@std@@SAIPBD@Z */
/* ?length@?$char_traits@D@std@@SA_KPEBD@Z */
MSVCP_size_t CDECL MSVCP_char_traits_char_length(const char *str)
{
    return strlen(str);
}

/* ?_Copy_s@?$char_traits@D@std@@SAPADPADIPBDI@Z */
/* ?_Copy_s@?$char_traits@D@std@@SAPEADPEAD_KPEBD1@Z */
char* CDECL MSVCP_char_traits_char__Copy_s(char *dest,
84 85 86 87 88 89 90 91 92
        MSVCP_size_t size, const char *src, MSVCP_size_t count)
{
    if(!dest || !src || size<count) {
        if(dest && size)
            dest[0] = '\0';
        _invalid_parameter(NULL, NULL, NULL, 0, 0);
        return dest;
    }

93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109
    return memcpy(dest, src, count);
}

/* ?copy@?$char_traits@D@std@@SAPADPADPBDI@Z */
/* ?copy@?$char_traits@D@std@@SAPEADPEADPEBD_K@Z */
char* CDECL MSVCP_char_traits_char_copy(
        char *dest, const char *src, MSVCP_size_t count)
{
    return MSVCP_char_traits_char__Copy_s(dest, count, src, count);
}

/* ?find@?$char_traits@D@std@@SAPBDPBDIABD@Z */
/* ?find@?$char_traits@D@std@@SAPEBDPEBD_KAEBD@Z */
const char * CDECL MSVCP_char_traits_char_find(
        const char *str, MSVCP_size_t range, const char *c)
{
    return memchr(str, *c, range);
110 111
}

112 113 114
/* ?_Move_s@?$char_traits@D@std@@SAPADPADIPBDI@Z */
/* ?_Move_s@?$char_traits@D@std@@SAPEADPEAD_KPEBD1@Z */
char* CDECL MSVCP_char_traits_char__Move_s(char *dest,
115 116 117 118 119 120 121 122 123
        MSVCP_size_t size, const char *src, MSVCP_size_t count)
{
    if(!dest || !src || size<count) {
        if(dest && size)
            dest[0] = '\0';
        _invalid_parameter(NULL, NULL, NULL, 0, 0);
        return dest;
    }

124
    return memmove(dest, src, count);
125 126
}

127 128 129 130
/* ?move@?$char_traits@D@std@@SAPADPADPBDI@Z */
/* ?move@?$char_traits@D@std@@SAPEADPEADPEBD_K@Z */
char* CDECL MSVCP_char_traits_char_move(
        char *dest, const char *src, MSVCP_size_t count)
131
{
132
    return MSVCP_char_traits_char__Move_s(dest, count, src, count);
133 134
}

135 136 137
/* ?assign@?$char_traits@D@std@@SAPADPADID@Z */
/* ?assign@?$char_traits@D@std@@SAPEADPEAD_KD@Z */
char* CDECL MSVCP_char_traits_char_assignn(char *str, MSVCP_size_t num, char c)
138 139 140 141
{
    return memset(str, c, num);
}

142 143 144 145
/* ?compare@?$char_traits@_W@std@@SAHPB_W0I@Z */
/* ?compare@?$char_traits@_W@std@@SAHPEB_W0_K@Z */
int CDECL MSVCP_char_traits_wchar_compare(const wchar_t *s1,
        const wchar_t *s2, MSVCP_size_t count)
146
{
147 148 149 150
    MSVCP_size_t i;
    int ret = 0;

    for (i = 0; i < count && !ret; i++) ret = s1[i] - s2[i];
151 152 153
    return (ret>0 ? 1 : (ret<0 ? -1 : 0));
}

154 155 156
/* ?length@?$char_traits@_W@std@@SAIPB_W@Z */
/* ?length@?$char_traits@_W@std@@SA_KPEB_W@Z */
MSVCP_size_t CDECL MSVCP_char_traits_wchar_length(const wchar_t *str)
157
{
158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231
    return wcslen((WCHAR*)str);
}

/* ?_Copy_s@?$char_traits@_W@std@@SAPA_WPA_WIPB_WI@Z */
/* ?_Copy_s@?$char_traits@_W@std@@SAPEA_WPEA_W_KPEB_W1@Z */
wchar_t* CDECL MSVCP_char_traits_wchar__Copy_s(wchar_t *dest,
        MSVCP_size_t size, const wchar_t *src, MSVCP_size_t count)
{
    if(!dest || !src || size<count) {
        if(dest && size)
            dest[0] = '\0';
        _invalid_parameter(NULL, NULL, NULL, 0, 0);
        return dest;
    }

    return memcpy(dest, src, count * sizeof(wchar_t));
}

/* ?copy@?$char_traits@_W@std@@SAPA_WPA_WPB_WI@Z */
/* ?copy@?$char_traits@_W@std@@SAPEA_WPEA_WPEB_W_K@Z */
wchar_t* CDECL MSVCP_char_traits_wchar_copy(wchar_t *dest,
        const wchar_t *src, MSVCP_size_t count)
{
    return MSVCP_char_traits_wchar__Copy_s(dest, count, src, count);
}

/* ?find@?$char_traits@_W@std@@SAPB_WPB_WIAB_W@Z */
/* ?find@?$char_traits@_W@std@@SAPEB_WPEB_W_KAEB_W@Z */
const wchar_t* CDECL MSVCP_char_traits_wchar_find(
        const wchar_t *str, MSVCP_size_t range, const wchar_t *c)
{
    MSVCP_size_t i=0;

    for(i=0; i<range; i++)
        if(str[i] == *c)
            return str+i;

    return NULL;
}

/* ?_Move_s@?$char_traits@_W@std@@SAPA_WPA_WIPB_WI@Z */
/* ?_Move_s@?$char_traits@_W@std@@SAPEA_WPEA_W_KPEB_W1@Z */
wchar_t* CDECL MSVCP_char_traits_wchar__Move_s(wchar_t *dest,
        MSVCP_size_t size, const wchar_t *src, MSVCP_size_t count)
{
    if(!dest || !src || size<count) {
        if(dest && size)
            dest[0] = '\0';
        _invalid_parameter(NULL, NULL, NULL, 0, 0);
        return dest;
    }

    return memmove(dest, src, count * sizeof(WCHAR));
}

/* ?move@?$char_traits@_W@std@@SAPA_WPA_WPB_WI@Z */
/* ?move@?$char_traits@_W@std@@SAPEA_WPEA_WPEB_W_K@Z */
wchar_t* CDECL MSVCP_char_traits_wchar_move(wchar_t *dest,
        const wchar_t *src, MSVCP_size_t count)
{
    return MSVCP_char_traits_wchar__Move_s(dest, count, src, count);
}

/* ?assign@?$char_traits@_W@std@@SAPA_WPA_WI_W@Z */
/* ?assign@?$char_traits@_W@std@@SAPEA_WPEA_W_K_W@Z */
wchar_t* CDECL MSVCP_char_traits_wchar_assignn(wchar_t *str,
        MSVCP_size_t num, wchar_t c)
{
    MSVCP_size_t i;

    for(i=0; i<num; i++)
        str[i] = c;

    return str;
232 233 234 235 236
}

static MSVCP_bool basic_string_char_inside(
        basic_string_char *this, const char *ptr)
{
237
    return ptr>=this->ptr && ptr<this->ptr+this->size;
238 239 240 241
}

/* ?npos@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@2IB */
/* ?npos@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@2_KB */
242
const MSVCP_size_t MSVCP_basic_string_char_npos = -1;
243 244 245

/* ?_C@?1??_Nullstr@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@CAPBDXZ@4DB */
/* ?_C@?1??_Nullstr@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@CAPEBDXZ@4DB */
246
const char basic_string_char_nullbyte = '\0';
247 248 249 250 251

/* ?_Nullstr@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@CAPBDXZ */
/* ?_Nullstr@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@CAPEBDXZ */
const char* __cdecl basic_string_char__Nullstr(void)
{
252
    return &basic_string_char_nullbyte;
253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272
}

/* ?_Refcnt@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@AAEAAEPBD@Z */
/* ?_Refcnt@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@AEAAAEAEPEBD@Z */
DEFINE_THISCALL_WRAPPER(basic_string_char__Refcnt, 8)
unsigned char* __thiscall basic_string_char__Refcnt(basic_string_char *this, const char *ptr)
{
    TRACE("(%p %p)\n", this, ptr);
    return (unsigned char*)ptr-1;
}

/* ?_Eos@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@AAEXI@Z */
/* ?_Eos@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@AEAAX_K@Z */
DEFINE_THISCALL_WRAPPER(basic_string_char__Eos, 8)
void __thiscall basic_string_char__Eos(basic_string_char *this, MSVCP_size_t len)
{
    this->size = len;
    this->ptr[len] = 0;
}

273 274 275 276
/* ?clear@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAEXXZ */
/* ?clear@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QEAAXXZ */
DEFINE_THISCALL_WRAPPER(MSVCP_basic_string_char_clear, 4)
void __thiscall MSVCP_basic_string_char_clear(basic_string_char *this)
277
{
278 279
    if(this->ptr)
        basic_string_char__Eos(this, 0);
280 281
}

282 283 284 285 286 287 288
/* ?_Tidy@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@AAEX_N@Z */
/* ?_Tidy@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@AEAAX_N@Z */
DEFINE_THISCALL_WRAPPER(basic_string_char__Tidy, 8)
void __thiscall basic_string_char__Tidy(basic_string_char *this, MSVCP_bool built)
{
    TRACE("(%p %d)\n", this, built);

289
    if(!built || !this->ptr);
290
    else if(!this->ptr[-1] || (unsigned char)this->ptr[-1]==FROZEN)
291
        MSVCP_allocator_char_deallocate(NULL, this->ptr-1, this->res+2);
292 293 294 295 296 297
    else
        this->ptr[-1]--;

    memset(this, 0, sizeof(*this));
}

298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328
/* ?_Grow@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@AAE_NI_N@Z */
/* ?_Grow@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@AEAA_N_K_N@Z */
DEFINE_THISCALL_WRAPPER(basic_string_char__Grow, 12)
MSVCP_bool __thiscall basic_string_char__Grow(basic_string_char *this, MSVCP_size_t new_size, MSVCP_bool trim)
{
    if(!new_size) {
        if(trim)
            basic_string_char__Tidy(this, TRUE);
        else if(this->ptr)
            basic_string_char__Eos(this, 0);
    } else if(this->res<new_size || trim ||
            (this->ptr && this->ptr[-1] && (unsigned char)this->ptr[-1]!=FROZEN)) {
        MSVCP_size_t new_res = new_size, len = this->size;
        char *ptr;

        if(!trim && this->ptr && !this->ptr[-1]) {
            new_res |= 0xf;
            if(new_res/3 < this->res/2)
                new_res = this->res + this->res/2;
        }

        ptr = MSVCP_allocator_char_allocate(this->allocator, new_res+2);
        if(!ptr) {
            new_res = new_size;
            ptr = MSVCP_allocator_char_allocate(this->allocator, new_size+2);
        }
        if(!ptr) {
            ERR("Out of memory\n");
            return FALSE;
        }

329 330 331
        if(len > new_res)
            len = new_res;

332 333
        *ptr = 0;
        if(this->ptr)
334
            MSVCP_char_traits_char__Copy_s(ptr+1, new_size, this->ptr, len);
335 336 337
        basic_string_char__Tidy(this, TRUE);
        this->ptr = ptr+1;
        this->res = new_res;
338
        basic_string_char__Eos(this, len);
339 340 341 342
    }

    return new_size>0;
}
343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360

/* ?_Split@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@AAEXXZ */
/* ?_Split@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@AEAAXXZ */
DEFINE_THISCALL_WRAPPER(basic_string_char__Split, 4)
void __thiscall basic_string_char__Split(basic_string_char *this)
{
    MSVCP_size_t len;
    char *ptr;

    TRACE("(%p)\n", this);

    if(!this->ptr || !this->ptr[-1] || (unsigned char)this->ptr[-1]==FROZEN)
        return;

    ptr = this->ptr;
    len = this->size;
    basic_string_char__Tidy(this, TRUE);
    if(basic_string_char__Grow(this, len, FALSE)) {
361
        if(ptr)
362
            MSVCP_char_traits_char__Copy_s(this->ptr, this->res, ptr, len);
363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384
        basic_string_char__Eos(this, len);
    }
}

/* ?_Freeze@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@AAEXXZ */
/* ?_Freeze@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@AEAAXXZ */
DEFINE_THISCALL_WRAPPER(basic_string_char__Freeze, 4)
void __thiscall basic_string_char__Freeze(basic_string_char *this)
{
    TRACE("(%p)\n", this);
    basic_string_char__Split(this);
    if(this->ptr)
        this->ptr[-1] = FROZEN;
}

/* ?_Copy@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@AAEXI@Z */
/* ?_Copy@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@AEAAX_K@Z */
DEFINE_THISCALL_WRAPPER(basic_string_char__Copy, 8)
void __thiscall basic_string_char__Copy(basic_string_char *this, MSVCP_size_t copy_len)
{
    TRACE("%p %lu\n", this, copy_len);

385
    if(!basic_string_char__Grow(this, copy_len, TRUE))
386 387 388 389 390 391 392 393 394
        return;
}

/* ?_Psum@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@CAPADPADI@Z */
/* ?_Psum@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@CAPEADPEAD_K@Z */
/* ?_Psum@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@CAPBDPBDI@Z */
/* ?_Psum@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@CAPEBDPEBD_K@Z */
char* __cdecl basic_string_char__Psum(char *iter, MSVCP_size_t add)
{
395
    TRACE("(%p %lu)\n", iter, add);
396 397 398 399 400
    return iter ? iter+add : iter;
}

/* ?erase@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAEAAV12@II@Z */
/* ?erase@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QEAAAEAV12@_K0@Z */
401 402
DEFINE_THISCALL_WRAPPER(MSVCP_basic_string_char_erase, 12)
basic_string_char* __thiscall MSVCP_basic_string_char_erase(
403 404 405 406 407 408 409 410 411 412 413 414
        basic_string_char *this, MSVCP_size_t pos, MSVCP_size_t len)
{
    TRACE("%p %lu %lu\n", this, pos, len);

    if(pos > this->size)
        _Xran();

    if(len > this->size-pos)
        len = this->size-pos;

    if(len) {
        basic_string_char__Split(this);
415
        MSVCP_char_traits_char__Move_s(this->ptr+pos, this->res-pos,
416 417 418 419 420 421 422 423 424 425 426 427 428
                this->ptr+pos+len, this->size-pos-len);
        basic_string_char__Eos(this, this->size-len);
    }

    return this;
}

/* ?erase@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAEPADPAD@Z */
/* ?erase@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QEAAPEADPEAD@Z */
DEFINE_THISCALL_WRAPPER(basic_string_char_erase_beg, 8)
char* __thiscall basic_string_char_erase_beg(basic_string_char *this, char *beg)
{
    MSVCP_size_t pos = beg-this->ptr;
429
    MSVCP_basic_string_char_erase(this, pos, 1);
430 431 432 433 434
    return this->ptr+pos;
}

/* ?assign@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAEAAV12@ABV12@II@Z */
/* ?assign@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QEAAAEAV12@AEBV12@_K1@Z */
435 436
DEFINE_THISCALL_WRAPPER(MSVCP_basic_string_char_assign_substr, 16)
basic_string_char* __thiscall MSVCP_basic_string_char_assign_substr(
437 438 439 440 441 442 443 444 445 446 447 448
        basic_string_char *this, const basic_string_char *assign,
        MSVCP_size_t pos, MSVCP_size_t len)
{
    TRACE("%p %p %lu %lu\n", this, assign, pos, len);

    if(assign->size < pos)
        _Xran();

    if(len > assign->size-pos)
        len = assign->size-pos;

    if(this == assign) {
449 450
        MSVCP_basic_string_char_erase(this, pos+len, MSVCP_basic_string_char_npos);
        MSVCP_basic_string_char_erase(this, 0, pos);
451
    } else if(basic_string_char__Grow(this, len, FALSE)) {
452
        if(assign->ptr)
453
            MSVCP_char_traits_char__Copy_s(this->ptr, this->res, assign->ptr+pos, len);
454 455 456 457 458 459 460 461
        basic_string_char__Eos(this, len);
    }

    return this;
}

/* ?assign@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAEAAV12@PBDI@Z */
/* ?assign@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QEAAAEAV12@PEBD_K@Z */
462 463
DEFINE_THISCALL_WRAPPER(MSVCP_basic_string_char_assign_cstr_len, 12)
basic_string_char* __thiscall MSVCP_basic_string_char_assign_cstr_len(
464 465
        basic_string_char *this, const char *str, MSVCP_size_t len)
{
466
    TRACE("%p %s %lu\n", this, debugstr_an(str, len), len);
467 468

    if(basic_string_char_inside(this, str))
469
        return MSVCP_basic_string_char_assign_substr(this, this, str-this->ptr, len);
470
    else if(basic_string_char__Grow(this, len, FALSE)) {
471
        MSVCP_char_traits_char__Copy_s(this->ptr, this->res, str, len);
472 473 474 475 476 477 478 479 480 481
        basic_string_char__Eos(this, len);
    }

    return this;
}

/* ?assign@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAEAAV12@ABV12@@Z */
/* ?assign@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QEAAAEAV12@AEBV12@@Z */
/* ??4?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAEAAV01@ABV01@@Z */
/* ??4?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QEAAAEAV01@AEBV01@@Z */
482 483
DEFINE_THISCALL_WRAPPER(MSVCP_basic_string_char_assign, 8)
basic_string_char* __thiscall MSVCP_basic_string_char_assign(
484 485
        basic_string_char *this, const basic_string_char *assign)
{
486 487
    return MSVCP_basic_string_char_assign_substr(this, assign,
            0, MSVCP_basic_string_char_npos);
488 489 490 491 492 493
}

/* ?assign@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAEAAV12@PBD@Z */
/* ?assign@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QEAAAEAV12@PEBD@Z */
/* ??4?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAEAAV01@PBD@Z */
/* ??4?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QEAAAEAV01@PEBD@Z */
494 495
DEFINE_THISCALL_WRAPPER(MSVCP_basic_string_char_assign_cstr, 8)
basic_string_char* __thiscall MSVCP_basic_string_char_assign_cstr(
496 497
        basic_string_char *this, const char *str)
{
498
    return MSVCP_basic_string_char_assign_cstr_len(this, str,
499
            MSVCP_char_traits_char_length(str));
500 501 502 503
}

/* ??4?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAEAAV01@D@Z */
/* ??4?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QEAAAEAV01@D@Z */
504 505
DEFINE_THISCALL_WRAPPER(MSVCP_basic_string_char_assign_ch, 8)
basic_string_char* __thiscall MSVCP_basic_string_char_assign_ch(
506 507
        basic_string_char *this, char ch)
{
508
    return MSVCP_basic_string_char_assign_cstr_len(this, &ch, 1);
509 510 511 512
}

/* ?assign@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAEAAV12@ID@Z */
/* ?assign@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QEAAAEAV12@_KD@Z */
513 514
DEFINE_THISCALL_WRAPPER(MSVCP_basic_string_char_assignn, 12)
basic_string_char* __thiscall MSVCP_basic_string_char_assignn(
515 516 517 518 519
        basic_string_char *this, MSVCP_size_t count, char ch)
{
    TRACE("%p %ld %c\n", this, count, ch);

    basic_string_char__Grow(this, count, FALSE);
520
    MSVCP_char_traits_char_assignn(this->ptr, count, ch);
521 522 523 524 525 526
    basic_string_char__Eos(this, count);
    return this;
}

/* ?assign@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAEAAV12@PBD0@Z */
/* ?assign@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QEAAAEAV12@PEBD0@Z */
527 528
DEFINE_THISCALL_WRAPPER(MSVCP_basic_string_char_assign_ptr_ptr, 12)
basic_string_char* __thiscall MSVCP_basic_string_char_assign_ptr_ptr(
529 530
        basic_string_char *this, const char *first, const char *last)
{
531
    return MSVCP_basic_string_char_assign_cstr_len(this, first, last-first);
532 533 534 535
}

/* ??0?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAE@PBDIABV?$allocator@D@1@@Z */
/* ??0?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QEAA@PEBD_KAEBV?$allocator@D@1@@Z */
536 537
DEFINE_THISCALL_WRAPPER(MSVCP_basic_string_char_ctor_cstr_len_alloc, 16)
basic_string_char* __thiscall MSVCP_basic_string_char_ctor_cstr_len_alloc(
538 539
        basic_string_char *this, const char *str, MSVCP_size_t len, const void *alloc)
{
540
    TRACE("%p %s %ld\n", this, debugstr_an(str, len), len);
541 542

    basic_string_char__Tidy(this, FALSE);
543
    MSVCP_basic_string_char_assign_cstr_len(this, str, len);
544 545 546
    return this;
}

547 548 549 550 551
/* ??0?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAE@PBDI@Z */
/* ??0?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QEAA@PEBD_K@Z */
DEFINE_THISCALL_WRAPPER(MSVCP_basic_string_char_ctor_cstr_len, 12)
basic_string_char* __thiscall MSVCP_basic_string_char_ctor_cstr_len(
        basic_string_char *this, const char *str, MSVCP_size_t len)
552
{
553
    return MSVCP_basic_string_char_ctor_cstr_len_alloc(this, str, len, NULL);
554 555
}

556 557
/* ??0?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAE@ABV01@IIABV?$allocator@D@1@@Z */
/* ??0?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QEAA@AEBV01@_K1AEBV?$allocator@D@1@@Z */
558 559
DEFINE_THISCALL_WRAPPER(MSVCP_basic_string_char_ctor_substr_alloc, 20)
basic_string_char* __thiscall MSVCP_basic_string_char_ctor_substr_alloc(
560 561 562 563 564 565
        basic_string_char *this, const basic_string_char *assign,
        MSVCP_size_t pos, MSVCP_size_t len, const void *alloc)
{
    TRACE("%p %p %lu %lu\n", this, assign, pos, len);

    basic_string_char__Tidy(this, FALSE);
566
    MSVCP_basic_string_char_assign_substr(this, assign, pos, len);
567 568 569 570 571
    return this;
}

/* ??0?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAE@PBDABV?$allocator@D@1@@Z */
/* ??0?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QEAA@PEBDAEBV?$allocator@D@1@@Z */
572 573
DEFINE_THISCALL_WRAPPER(MSVCP_basic_string_char_ctor_cstr_alloc, 12)
basic_string_char* __thiscall MSVCP_basic_string_char_ctor_cstr_alloc(
574 575 576 577 578
        basic_string_char *this, const char *str, const void *alloc)
{
    TRACE("%p %s\n", this, debugstr_a(str));

    basic_string_char__Tidy(this, FALSE);
579
    MSVCP_basic_string_char_assign_cstr(this, str);
580 581 582
    return this;
}

583 584 585 586
/* ??0?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAE@PBD@Z */
/* ??0?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QEAA@PEBD@Z */
DEFINE_THISCALL_WRAPPER(MSVCP_basic_string_char_ctor_cstr, 8)
basic_string_char* __thiscall MSVCP_basic_string_char_ctor_cstr(
587 588
        basic_string_char *this, const char *str)
{
589
    return MSVCP_basic_string_char_ctor_cstr_alloc(this, str, NULL);
590 591 592 593
}

/* ??0?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAE@IDABV?$allocator@D@1@@Z */
/* ??0?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QEAA@_KDAEBV?$allocator@D@1@@Z */
594 595
DEFINE_THISCALL_WRAPPER(MSVCP_basic_string_char_ctor_ch_alloc, 16)
basic_string_char* __thiscall MSVCP_basic_string_char_ctor_ch_alloc(basic_string_char *this,
596 597 598 599 600
        MSVCP_size_t count, char ch, const void *alloc)
{
    TRACE("%p %ld %c\n", this, count, ch);

    basic_string_char__Tidy(this, FALSE);
601
    MSVCP_basic_string_char_assignn(this, count, ch);
602 603 604 605 606
    return this;
}

/* ??_F?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAEXXZ */
/* ??_F?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QEAAXXZ */
607 608
DEFINE_THISCALL_WRAPPER(MSVCP_basic_string_char_ctor, 4)
basic_string_char* __thiscall MSVCP_basic_string_char_ctor(basic_string_char *this)
609 610 611 612 613 614 615 616 617
{
    TRACE("%p\n", this);

    basic_string_char__Tidy(this, FALSE);
    return this;
}

/* ??0?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAE@ABV?$allocator@D@1@@Z */
/* ??0?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QEAA@AEBV?$allocator@D@1@@Z */
618 619
DEFINE_THISCALL_WRAPPER(MSVCP_basic_string_char_ctor_alloc, 8)
basic_string_char* __thiscall MSVCP_basic_string_char_ctor_alloc(
620 621 622 623 624 625 626 627 628 629
        basic_string_char *this, const void *alloc)
{
    TRACE("%p %p\n", this, alloc);

    basic_string_char__Tidy(this, FALSE);
    return this;
}

/* ??0?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAE@ABV01@@Z */
/* ??0?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QEAA@AEBV01@@Z */
630 631
DEFINE_THISCALL_WRAPPER(MSVCP_basic_string_char_copy_ctor, 8)
basic_string_char* __thiscall MSVCP_basic_string_char_copy_ctor(
632 633 634 635 636
        basic_string_char *this, const basic_string_char *copy)
{
    TRACE("%p %p\n", this, copy);

    basic_string_char__Tidy(this, FALSE);
637
    MSVCP_basic_string_char_assign(this, copy);
638 639 640 641 642
    return this;
}

/* ??1?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAE@XZ */
/* ??1?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QEAA@XZ */
643 644
DEFINE_THISCALL_WRAPPER(MSVCP_basic_string_char_dtor, 4)
void __thiscall MSVCP_basic_string_char_dtor(basic_string_char *this)
645 646 647 648 649 650 651
{
    TRACE("%p\n", this);
    basic_string_char__Tidy(this, TRUE);
}

/* ?compare@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QBEHIIPBDI@Z */
/* ?compare@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QEBAH_K0PEBD0@Z */
652 653
DEFINE_THISCALL_WRAPPER(MSVCP_basic_string_char_compare_substr_cstr_len, 20)
int __thiscall MSVCP_basic_string_char_compare_substr_cstr_len(
654 655 656 657 658
        const basic_string_char *this, MSVCP_size_t pos, MSVCP_size_t num,
        const char *str, MSVCP_size_t count)
{
    int ans;

659
    TRACE("%p %lu %lu %s %lu\n", this, pos, num, debugstr_an(str, count), count);
660 661 662 663

    if(this->size < pos)
        _Xran();

664
    if(num > this->size-pos)
665 666
        num = this->size-pos;

667
    ans = MSVCP_char_traits_char_compare(this->ptr+pos,
668 669 670 671 672 673 674 675 676 677 678 679 680
            str, num>count ? count : num);
    if(ans)
        return ans;

    if(num > count)
        ans = 1;
    else if(num < count)
        ans = -1;
    return ans;
}

/* ?compare@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QBEHPBD@Z */
/* ?compare@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QEBAHPEBD@Z */
681 682
DEFINE_THISCALL_WRAPPER(MSVCP_basic_string_char_compare_cstr, 8)
int __thiscall MSVCP_basic_string_char_compare_cstr(
683 684
        const basic_string_char *this, const char *str)
{
685
    return MSVCP_basic_string_char_compare_substr_cstr_len(this, 0, this->size,
686
            str, MSVCP_char_traits_char_length(str));
687 688 689 690
}

/* ?compare@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QBEHIIABV12@II@Z */
/* ?compare@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QEBAH_K0AEBV12@00@Z */
691 692
DEFINE_THISCALL_WRAPPER(MSVCP_basic_string_char_compare_substr_substr, 24)
int __thiscall MSVCP_basic_string_char_compare_substr_substr(
693 694 695 696 697 698 699 700
        const basic_string_char *this, MSVCP_size_t pos, MSVCP_size_t num,
        const basic_string_char *compare, MSVCP_size_t off, MSVCP_size_t count)
{
    TRACE("%p %lu %lu %p %lu %lu\n", this, pos, num, compare, off, count);

    if(compare->size < off)
        _Xran();

701
    if(count > compare->size-off)
702 703
        count = compare->size-off;

704
    return MSVCP_basic_string_char_compare_substr_cstr_len(this, pos, num,
705 706 707 708 709
            compare->ptr+off, count);
}

/* ?compare@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QBEHIIABV12@@Z */
/* ?compare@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QEBAH_K0AEBV12@@Z */
710 711
DEFINE_THISCALL_WRAPPER(MSVCP_basic_string_char_compare_substr, 16)
int __thiscall MSVCP_basic_string_char_compare_substr(
712 713 714
        const basic_string_char *this, MSVCP_size_t pos, MSVCP_size_t num,
        const basic_string_char *compare)
{
715
    return MSVCP_basic_string_char_compare_substr_cstr_len(this, pos, num,
716 717 718 719 720
            compare->ptr, compare->size);
}

/* ?compare@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QBEHABV12@@Z */
/* ?compare@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QEBAHAEBV12@@Z */
721 722
DEFINE_THISCALL_WRAPPER(MSVCP_basic_string_char_compare, 8)
int __thiscall MSVCP_basic_string_char_compare(
723 724
        const basic_string_char *this, const basic_string_char *compare)
{
725
    return MSVCP_basic_string_char_compare_substr_cstr_len(this, 0, this->size,
726 727 728 729 730
            compare->ptr, compare->size);
}

/* ?compare@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QBEHIIPBD@Z */
/* ?compare@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QEBAH_K0PEBD@Z */
731 732
DEFINE_THISCALL_WRAPPER(MSVCP_basic_string_char_compare_substr_cstr, 16)
int __thiscall MSVCP_basic_string_char_compare_substr_cstr(const basic_string_char *this,
733 734
        MSVCP_size_t pos, MSVCP_size_t num, const char *str)
{
735
    return MSVCP_basic_string_char_compare_substr_cstr_len(this, pos, num,
736
            str, MSVCP_char_traits_char_length(str));
737 738 739 740 741 742
}

/* ??$?8DU?$char_traits@D@std@@V?$allocator@D@1@@std@@YA_NABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@0@0@Z */
/* ??$?8DU?$char_traits@D@std@@V?$allocator@D@1@@std@@YA_NAEBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@0@0@Z */
/* ??8std@@YA_NABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@0@0@Z */
/* ??8std@@YA_NAEBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@0@0@Z */
743
MSVCP_bool __cdecl MSVCP_basic_string_char_equal(
744 745
        const basic_string_char *left, const basic_string_char *right)
{
746
    return MSVCP_basic_string_char_compare(left, right) == 0;
747 748 749 750 751 752
}

/* ??$?8DU?$char_traits@D@std@@V?$allocator@D@1@@std@@YA_NABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@0@PBD@Z */
/* ??$?8DU?$char_traits@D@std@@V?$allocator@D@1@@std@@YA_NAEBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@0@PEBD@Z */
/* ??8std@@YA_NABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@0@PBD@Z */
/* ??8std@@YA_NAEBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@0@PEBD@Z */
753
MSVCP_bool __cdecl MSVCP_basic_string_char_equal_str_cstr(
754 755
        const basic_string_char *left, const char *right)
{
756
    return MSVCP_basic_string_char_compare_cstr(left, right) == 0;
757 758 759 760 761 762
}

/* ??$?8DU?$char_traits@D@std@@V?$allocator@D@1@@std@@YA_NPBDABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@0@@Z */
/* ??$?8DU?$char_traits@D@std@@V?$allocator@D@1@@std@@YA_NPEBDAEBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@0@@Z */
/* ??8std@@YA_NPBDABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@0@@Z */
/* ??8std@@YA_NPEBDAEBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@0@@Z */
763
MSVCP_bool __cdecl MSVCP_basic_string_char_equal_cstr_str(
764 765
        const char *left, const basic_string_char *right)
{
766
    return MSVCP_basic_string_char_compare_cstr(right, left) == 0;
767 768 769 770 771 772
}

/* ??$?9DU?$char_traits@D@std@@V?$allocator@D@1@@std@@YA_NABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@0@0@Z */
/* ??$?9DU?$char_traits@D@std@@V?$allocator@D@1@@std@@YA_NAEBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@0@0@Z */
/* ??9std@@YA_NABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@0@0@Z */
/* ??9std@@YA_NAEBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@0@0@Z */
773
MSVCP_bool __cdecl MSVCP_basic_string_char_not_equal(
774 775
        const basic_string_char *left, const basic_string_char *right)
{
776
    return MSVCP_basic_string_char_compare(left, right) != 0;
777 778 779 780 781 782
}

/* ??$?9DU?$char_traits@D@std@@V?$allocator@D@1@@std@@YA_NABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@0@PBD@Z */
/* ??$?9DU?$char_traits@D@std@@V?$allocator@D@1@@std@@YA_NAEBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@0@PEBD@Z */
/* ??9std@@YA_NABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@0@PBD@Z */
/* ??9std@@YA_NAEBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@0@PEBD@Z */
783
MSVCP_bool __cdecl MSVCP_basic_string_char_not_equal_str_cstr(
784 785
        const basic_string_char *left, const char *right)
{
786
    return MSVCP_basic_string_char_compare_cstr(left, right) != 0;
787 788 789 790 791 792
}

/* ??$?9DU?$char_traits@D@std@@V?$allocator@D@1@@std@@YA_NPBDABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@0@@Z */
/* ??$?9DU?$char_traits@D@std@@V?$allocator@D@1@@std@@YA_NPEBDAEBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@0@@Z */
/* ??9std@@YA_NPBDABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@0@@Z */
/* ??9std@@YA_NPEBDAEBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@0@@Z */
793
MSVCP_bool __cdecl MSVCP_basic_string_char_not_equal_cstr_str(
794 795
        const char *left, const basic_string_char *right)
{
796
    return MSVCP_basic_string_char_compare_cstr(right, left) != 0;
797 798 799 800 801 802
}

/* ??$?MDU?$char_traits@D@std@@V?$allocator@D@1@@std@@YA_NABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@0@0@Z */
/* ??$?MDU?$char_traits@D@std@@V?$allocator@D@1@@std@@YA_NAEBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@0@0@Z */
/* ??Mstd@@YA_NABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@0@0@Z */
/* ??Mstd@@YA_NAEBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@0@0@Z */
803
MSVCP_bool __cdecl MSVCP_basic_string_char_lower(
804 805
        const basic_string_char *left, const basic_string_char *right)
{
806
    return MSVCP_basic_string_char_compare(left, right) < 0;
807 808 809 810 811 812
}

/* ??$?MDU?$char_traits@D@std@@V?$allocator@D@1@@std@@YA_NABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@0@PBD@Z */
/* ??$?MDU?$char_traits@D@std@@V?$allocator@D@1@@std@@YA_NAEBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@0@PEBD@Z */
/* ??Mstd@@YA_NABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@0@PBD@Z */
/* ??Mstd@@YA_NAEBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@0@PEBD@Z */
813
MSVCP_bool __cdecl MSVCP_basic_string_char_lower_bstr_cstr(
814 815
        const basic_string_char *left, const char *right)
{
816
    return MSVCP_basic_string_char_compare_cstr(left, right) < 0;
817 818 819 820 821 822
}

/* ??$?MDU?$char_traits@D@std@@V?$allocator@D@1@@std@@YA_NPBDABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@0@@Z */
/* ??$?MDU?$char_traits@D@std@@V?$allocator@D@1@@std@@YA_NPEBDAEBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@0@@Z */
/* ??Mstd@@YA_NPBDABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@0@@Z */
/* ??Mstd@@YA_NPEBDAEBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@0@@Z */
823
MSVCP_bool __cdecl MSVCP_basic_string_char_lower_cstr_bstr(
824 825
        const char *left, const basic_string_char *right)
{
826
    return MSVCP_basic_string_char_compare_cstr(right, left) > 0;
827 828 829 830 831 832
}

/* ??$?NDU?$char_traits@D@std@@V?$allocator@D@1@@std@@YA_NABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@0@0@Z */
/* ??$?NDU?$char_traits@D@std@@V?$allocator@D@1@@std@@YA_NAEBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@0@0@Z */
/* ??Nstd@@YA_NABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@0@0@Z */
/* ??Nstd@@YA_NAEBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@0@0@Z */
833
MSVCP_bool __cdecl MSVCP_basic_string_char_leq(
834 835
        const basic_string_char *left, const basic_string_char *right)
{
836
    return MSVCP_basic_string_char_compare(left, right) <= 0;
837 838 839 840 841 842
}

/* ??$?NDU?$char_traits@D@std@@V?$allocator@D@1@@std@@YA_NABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@0@PBD@Z */
/* ??$?NDU?$char_traits@D@std@@V?$allocator@D@1@@std@@YA_NAEBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@0@PEBD@Z */
/* ??Nstd@@YA_NABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@0@PBD@Z */
/* ??Nstd@@YA_NAEBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@0@PEBD@Z */
843
MSVCP_bool __cdecl MSVCP_basic_string_char_leq_bstr_cstr(
844 845
        const basic_string_char *left, const char *right)
{
846
    return MSVCP_basic_string_char_compare_cstr(left, right) <= 0;
847 848 849 850 851 852
}

/* ??$?NDU?$char_traits@D@std@@V?$allocator@D@1@@std@@YA_NPBDABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@0@@Z */
/* ??$?NDU?$char_traits@D@std@@V?$allocator@D@1@@std@@YA_NPEBDAEBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@0@@Z */
/* ??Nstd@@YA_NPBDABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@0@@Z */
/* ??Nstd@@YA_NPEBDAEBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@0@@Z */
853
MSVCP_bool __cdecl MSVCP_basic_string_char_leq_cstr_bstr(
854 855
        const char *left, const basic_string_char *right)
{
856
    return MSVCP_basic_string_char_compare_cstr(right, left) >= 0;
857 858 859 860 861 862
}

/* ??$?ODU?$char_traits@D@std@@V?$allocator@D@1@@std@@YA_NABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@0@0@Z */
/* ??$?ODU?$char_traits@D@std@@V?$allocator@D@1@@std@@YA_NAEBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@0@0@Z */
/* ??Ostd@@YA_NABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@0@0@Z */
/* ??Ostd@@YA_NAEBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@0@0@Z */
863
MSVCP_bool __cdecl MSVCP_basic_string_char_greater(
864 865
        const basic_string_char *left, const basic_string_char *right)
{
866
    return MSVCP_basic_string_char_compare(left, right) > 0;
867 868 869 870 871 872
}

/* ??$?ODU?$char_traits@D@std@@V?$allocator@D@1@@std@@YA_NABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@0@PBD@Z */
/* ??$?ODU?$char_traits@D@std@@V?$allocator@D@1@@std@@YA_NAEBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@0@PEBD@Z */
/* ??Ostd@@YA_NABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@0@PBD@Z */
/* ??Ostd@@YA_NAEBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@0@PEBD@Z */
873
MSVCP_bool __cdecl MSVCP_basic_string_char_greater_bstr_cstr(
874 875
        const basic_string_char *left, const char *right)
{
876
    return MSVCP_basic_string_char_compare_cstr(left, right) > 0;
877 878 879 880 881 882
}

/* ??$?ODU?$char_traits@D@std@@V?$allocator@D@1@@std@@YA_NPBDABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@0@@Z */
/* ??$?ODU?$char_traits@D@std@@V?$allocator@D@1@@std@@YA_NPEBDAEBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@0@@Z */
/* ??Ostd@@YA_NPBDABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@0@@Z */
/* ??Ostd@@YA_NPEBDAEBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@0@@Z */
883
MSVCP_bool __cdecl MSVCP_basic_string_char_greater_cstr_bstr(
884 885
        const char *left, const basic_string_char *right)
{
886
    return MSVCP_basic_string_char_compare_cstr(right, left) < 0;
887 888 889 890 891 892
}

/* ??$?PDU?$char_traits@D@std@@V?$allocator@D@1@@std@@YA_NABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@0@0@Z */
/* ??$?PDU?$char_traits@D@std@@V?$allocator@D@1@@std@@YA_NAEBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@0@0@Z */
/* ??Pstd@@YA_NABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@0@0@Z */
/* ??Pstd@@YA_NAEBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@0@0@Z */
893
MSVCP_bool __cdecl MSVCP_basic_string_char_geq(
894 895
        const basic_string_char *left, const basic_string_char *right)
{
896
    return MSVCP_basic_string_char_compare(left, right) >= 0;
897 898 899 900 901 902
}

/* ??$?PDU?$char_traits@D@std@@V?$allocator@D@1@@std@@YA_NABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@0@PBD@Z */
/* ??$?PDU?$char_traits@D@std@@V?$allocator@D@1@@std@@YA_NAEBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@0@PEBD@Z */
/* ??Pstd@@YA_NABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@0@PBD@Z */
/* ??Pstd@@YA_NAEBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@0@PEBD@Z */
903
MSVCP_bool __cdecl MSVCP_basic_string_char_geq_bstr_cstr(
904 905
        const basic_string_char *left, const char *right)
{
906
    return MSVCP_basic_string_char_compare_cstr(left, right) >= 0;
907 908 909 910 911 912
}

/* ??$?PDU?$char_traits@D@std@@V?$allocator@D@1@@std@@YA_NPBDABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@0@@Z */
/* ??$?PDU?$char_traits@D@std@@V?$allocator@D@1@@std@@YA_NPEBDAEBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@0@@Z */
/* ??Pstd@@YA_NPBDABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@0@@Z */
/* ??Pstd@@YA_NPEBDAEBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@0@@Z */
913
MSVCP_bool __cdecl MSVCP_basic_string_char_geq_cstr_bstr(
914 915
        const char *left, const basic_string_char *right)
{
916
    return MSVCP_basic_string_char_compare_cstr(right, left) <= 0;
917 918 919 920
}

/* ?find@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QBEIPBDII@Z */
/* ?find@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QEBA_KPEBD_K1@Z */
921 922
DEFINE_THISCALL_WRAPPER(MSVCP_basic_string_char_find_cstr_substr, 16)
MSVCP_size_t __thiscall MSVCP_basic_string_char_find_cstr_substr(
923 924 925 926
        const basic_string_char *this, const char *find, MSVCP_size_t pos, MSVCP_size_t len)
{
    const char *p, *end;

927
    TRACE("%p %s %lu %lu\n", this, debugstr_an(find, len), pos, len);
928 929 930

    if(len==0 && pos<=this->size)
        return pos;
931
    if(pos>=this->size || len>this->size)
932
        return MSVCP_basic_string_char_npos;
933 934 935

    end = this->ptr+this->size-len+1;
    for(p=this->ptr+pos; p<end; p++) {
936
        p = MSVCP_char_traits_char_find(p, end-p, find);
937 938 939
        if(!p)
            break;

940
        if(!MSVCP_char_traits_char_compare(p, find, len))
941 942 943
            return p-this->ptr;
    }

944
    return MSVCP_basic_string_char_npos;
945 946 947 948
}

/* ?find@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QBEIABV12@I@Z */
/* ?find@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QEBA_KAEBV12@_K@Z */
949 950
DEFINE_THISCALL_WRAPPER(MSVCP_basic_string_char_find_off, 12)
MSVCP_size_t __thiscall MSVCP_basic_string_char_find_off(
951 952
        const basic_string_char *this, const basic_string_char *find, MSVCP_size_t off)
{
953
    return MSVCP_basic_string_char_find_cstr_substr(this, find->ptr, off, find->size);
954 955 956 957
}

/* ?find@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QBEIDI@Z */
/* ?find@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QEBA_KD_K@Z */
958 959
DEFINE_THISCALL_WRAPPER(MSVCP_basic_string_char_find_ch, 12)
MSVCP_size_t __thiscall MSVCP_basic_string_char_find_ch(
960 961
        const basic_string_char *this, char ch, MSVCP_size_t pos)
{
962
    return MSVCP_basic_string_char_find_cstr_substr(this, &ch, pos, 1);
963 964 965 966
}

/* ?find@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QBEIPBDI@Z */
/* ?find@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QEBA_KPEBD_K@Z */
967 968
DEFINE_THISCALL_WRAPPER(MSVCP_basic_string_char_find_cstr_off, 12)
MSVCP_size_t __thiscall MSVCP_basic_string_char_find_cstr_off(
969 970
        const basic_string_char *this, const char *find, MSVCP_size_t pos)
{
971
    return MSVCP_basic_string_char_find_cstr_substr(this, find, pos,
972
            MSVCP_char_traits_char_length(find));
973 974 975 976
}

/* ?rfind@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QBEIPBDII@Z */
/* ?rfind@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QEBA_KPEBD_K1@Z */
977 978
DEFINE_THISCALL_WRAPPER(MSVCP_basic_string_char_rfind_cstr_substr, 16)
MSVCP_size_t __thiscall MSVCP_basic_string_char_rfind_cstr_substr(
979 980 981 982
        const basic_string_char *this, const char *find, MSVCP_size_t pos, MSVCP_size_t len)
{
    const char *p, *end;

983
    TRACE("%p %s %lu %lu\n", this, debugstr_an(find, len), pos, len);
984 985 986 987 988

    if(len==0)
        return pos<this->size ? pos : this->size;

    if(len > this->size)
989
        return MSVCP_basic_string_char_npos;
990

991 992
    if(pos > this->size-len)
        pos = this->size-len;
993
    end = this->ptr;
994
    for(p=end+pos; p>=end; p--) {
995
        if(*p==*find && !MSVCP_char_traits_char_compare(p, find, len))
996 997 998
            return p-this->ptr;
    }

999
    return MSVCP_basic_string_char_npos;
1000 1001 1002 1003
}

/* ?rfind@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QBEIABV12@I@Z */
/* ?rfind@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QEBA_KAEBV12@_K@Z */
1004 1005
DEFINE_THISCALL_WRAPPER(MSVCP_basic_string_char_rfind_off, 12)
MSVCP_size_t __thiscall MSVCP_basic_string_char_rfind_off(
1006 1007
        const basic_string_char *this, const basic_string_char *find, MSVCP_size_t off)
{
1008
    return MSVCP_basic_string_char_rfind_cstr_substr(this, find->ptr, off, find->size);
1009 1010 1011 1012
}

/* ?rfind@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QBEIDI@Z */
/* ?rfind@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QEBA_KD_K@Z */
1013 1014
DEFINE_THISCALL_WRAPPER(MSVCP_basic_string_char_rfind_ch, 12)
MSVCP_size_t __thiscall MSVCP_basic_string_char_rfind_ch(
1015 1016
        const basic_string_char *this, char ch, MSVCP_size_t pos)
{
1017
    return MSVCP_basic_string_char_rfind_cstr_substr(this, &ch, pos, 1);
1018 1019 1020 1021
}

/* ?rfind@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QBEIPBDI@Z */
/* ?rfind@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QEBA_KPEBD_K@Z */
1022 1023
DEFINE_THISCALL_WRAPPER(MSVCP_basic_string_char_rfind_cstr_off, 12)
MSVCP_size_t __thiscall MSVCP_basic_string_char_rfind_cstr_off(
1024 1025
        const basic_string_char *this, const char *find, MSVCP_size_t pos)
{
1026
    return MSVCP_basic_string_char_rfind_cstr_substr(this, find, pos,
1027
            MSVCP_char_traits_char_length(find));
1028 1029 1030 1031
}

/* ?find_first_not_of@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QBEIPBDII@Z */
/* ?find_first_not_of@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QEBA_KPEBD_K1@Z */
1032 1033
DEFINE_THISCALL_WRAPPER(MSVCP_basic_string_char_find_first_not_of_cstr_substr, 16)
MSVCP_size_t __thiscall MSVCP_basic_string_char_find_first_not_of_cstr_substr(
1034 1035 1036 1037 1038 1039 1040 1041 1042
        const basic_string_char *this, const char *find, MSVCP_size_t off, MSVCP_size_t len)
{
    const char *p, *end;

    TRACE("%p %p %lu %lu\n", this, find, off, len);

    if(off<this->size) {
        end = this->ptr+this->size;
        for(p=this->ptr+off; p<end; p++)
1043
            if(!MSVCP_char_traits_char_find(find, len, p))
1044 1045 1046
                return p-this->ptr;
    }

1047
    return MSVCP_basic_string_char_npos;
1048 1049 1050 1051
}

/* ?find_first_not_of@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QBEIABV12@I@Z */
/* ?find_first_not_of@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QEBA_KAEBV12@_K@Z */
1052 1053
DEFINE_THISCALL_WRAPPER(MSVCP_basic_string_char_find_first_not_of, 12)
MSVCP_size_t __thiscall MSVCP_basic_string_char_find_first_not_of(
1054 1055
        const basic_string_char *this, const basic_string_char *find, MSVCP_size_t off)
{
1056
    return MSVCP_basic_string_char_find_first_not_of_cstr_substr(this,
1057 1058 1059 1060 1061
            find->ptr, off, find->size);
}

/* ?find_first_not_of@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QBEIDI@Z */
/* ?find_first_not_of@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QEBA_KD_K@Z */
1062 1063
DEFINE_THISCALL_WRAPPER(MSVCP_basic_string_char_find_first_not_of_ch, 12)
MSVCP_size_t __thiscall MSVCP_basic_string_char_find_first_not_of_ch(
1064 1065
        const basic_string_char *this, char ch, MSVCP_size_t off)
{
1066
    return MSVCP_basic_string_char_find_first_not_of_cstr_substr(this, &ch, off, 1);
1067 1068 1069 1070
}

/* ?find_first_not_of@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QBEIPBDI@Z */
/* ?find_first_not_of@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QEBA_KPEBD_K@Z */
1071 1072
DEFINE_THISCALL_WRAPPER(MSVCP_basic_string_char_find_first_not_of_cstr, 12)
MSVCP_size_t __thiscall MSVCP_basic_string_char_find_first_not_of_cstr(
1073 1074
        const basic_string_char *this, const char *find, MSVCP_size_t off)
{
1075
    return MSVCP_basic_string_char_find_first_not_of_cstr_substr(
1076
            this, find, off, MSVCP_char_traits_char_length(find));
1077 1078 1079 1080
}

/* ?find_first_of@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QBEIPBDII@Z */
/* ?find_first_of@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QEBA_KPEBD_K1@Z */
1081 1082
DEFINE_THISCALL_WRAPPER(MSVCP_basic_string_char_find_first_of_cstr_substr, 16)
MSVCP_size_t __thiscall MSVCP_basic_string_char_find_first_of_cstr_substr(
1083 1084 1085 1086 1087 1088 1089 1090 1091
        const basic_string_char *this, const char *find, MSVCP_size_t off, MSVCP_size_t len)
{
    const char *p, *end;

    TRACE("%p %p %lu %lu\n", this, find, off, len);

    if(len>0 && off<this->size) {
        end = this->ptr+this->size;
        for(p=this->ptr+off; p<end; p++)
1092
            if(MSVCP_char_traits_char_find(find, len, p))
1093 1094 1095
                return p-this->ptr;
    }

1096
    return MSVCP_basic_string_char_npos;
1097 1098 1099 1100
}

/* ?find_first_of@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QBEIABV12@I@Z */
/* ?find_first_of@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QEBA_KAEBV12@_K@Z */
1101 1102
DEFINE_THISCALL_WRAPPER(MSVCP_basic_string_char_find_first_of, 12)
MSVCP_size_t __thiscall MSVCP_basic_string_char_find_first_of(
1103 1104
        const basic_string_char *this, const basic_string_char *find, MSVCP_size_t off)
{
1105
    return MSVCP_basic_string_char_find_first_of_cstr_substr(this,
1106 1107 1108 1109 1110
            find->ptr, off, find->size);
}

/* ?find_first_of@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QBEIDI@Z */
/* ?find_first_of@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QEBA_KD_K@Z */
1111 1112
DEFINE_THISCALL_WRAPPER(MSVCP_basic_string_char_find_first_of_ch, 12)
MSVCP_size_t __thiscall MSVCP_basic_string_char_find_first_of_ch(
1113 1114
        const basic_string_char *this, char ch, MSVCP_size_t off)
{
1115
    return MSVCP_basic_string_char_find_first_of_cstr_substr(this, &ch, off, 1);
1116 1117 1118 1119
}

/* ?find_first_of@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QBEIPBDI@Z */
/* ?find_first_of@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QEBA_KPEBD_K@Z */
1120 1121
DEFINE_THISCALL_WRAPPER(MSVCP_basic_string_char_find_first_of_cstr, 12)
MSVCP_size_t __thiscall MSVCP_basic_string_char_find_first_of_cstr(
1122 1123
        const basic_string_char *this, const char *find, MSVCP_size_t off)
{
1124
    return MSVCP_basic_string_char_find_first_of_cstr_substr(
1125
            this, find, off, MSVCP_char_traits_char_length(find));
1126 1127 1128 1129
}

/* ?find_last_not_of@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QBEIPBDII@Z */
/* ?find_last_not_of@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QEBA_KPEBD_K1@Z */
1130 1131
DEFINE_THISCALL_WRAPPER(MSVCP_basic_string_char_find_last_not_of_cstr_substr, 16)
MSVCP_size_t __thiscall MSVCP_basic_string_char_find_last_not_of_cstr_substr(
1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143
        const basic_string_char *this, const char *find, MSVCP_size_t off, MSVCP_size_t len)
{
    const char *p, *beg;

    TRACE("%p %p %lu %lu\n", this, find, off, len);

    if(len>0 && this->size>0) {
        if(off >= this->size)
            off = this->size-1;

        beg = this->ptr;
        for(p=beg+off; p>=beg; p--)
1144
            if(!MSVCP_char_traits_char_find(find, len, p))
1145 1146 1147
                return p-beg;
    }

1148
    return MSVCP_basic_string_char_npos;
1149 1150 1151 1152
}

/* ?find_last_not_of@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QBEIABV12@I@Z */
/* ?find_last_not_of@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QEBA_KAEBV12@_K@Z */
1153 1154
DEFINE_THISCALL_WRAPPER(MSVCP_basic_string_char_find_last_not_of, 12)
MSVCP_size_t __thiscall MSVCP_basic_string_char_find_last_not_of(
1155 1156
        const basic_string_char *this, const basic_string_char *find, MSVCP_size_t off)
{
1157
    return MSVCP_basic_string_char_find_last_not_of_cstr_substr(this,
1158 1159 1160 1161 1162
            find->ptr, off, find->size);
}

/* ?find_last_not_of@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QBEIDI@Z */
/* ?find_last_not_of@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QEBA_KD_K@Z */
1163 1164
DEFINE_THISCALL_WRAPPER(MSVCP_basic_string_char_find_last_not_of_ch, 12)
MSVCP_size_t __thiscall MSVCP_basic_string_char_find_last_not_of_ch(
1165 1166
        const basic_string_char *this, char ch, MSVCP_size_t off)
{
1167
    return MSVCP_basic_string_char_find_last_not_of_cstr_substr(this, &ch, off, 1);
1168 1169 1170 1171
}

/* ?find_last_not_of@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QBEIPBDI@Z */
/* ?find_last_not_of@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QEBA_KPEBD_K@Z */
1172 1173
DEFINE_THISCALL_WRAPPER(MSVCP_basic_string_char_find_last_not_of_cstr, 12)
MSVCP_size_t __thiscall MSVCP_basic_string_char_find_last_not_of_cstr(
1174 1175
        const basic_string_char *this, const char *find, MSVCP_size_t off)
{
1176
    return MSVCP_basic_string_char_find_last_not_of_cstr_substr(
1177
            this, find, off, MSVCP_char_traits_char_length(find));
1178 1179 1180 1181
}

/* ?find_last_of@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QBEIPBDII@Z */
/* ?find_last_of@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QEBA_KPEBD_K1@Z */
1182 1183
DEFINE_THISCALL_WRAPPER(MSVCP_basic_string_char_find_last_of_cstr_substr, 16)
MSVCP_size_t __thiscall MSVCP_basic_string_char_find_last_of_cstr_substr(
1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195
        const basic_string_char *this, const char *find, MSVCP_size_t off, MSVCP_size_t len)
{
    const char *p, *beg;

    TRACE("%p %p %lu %lu\n", this, find, off, len);

    if(len>0 && this->size>0) {
        if(off >= this->size)
            off = this->size-1;

        beg = this->ptr;
        for(p=beg+off; p>=beg; p--)
1196
            if(MSVCP_char_traits_char_find(find, len, p))
1197 1198 1199
                return p-beg;
    }

1200
    return MSVCP_basic_string_char_npos;
1201 1202 1203 1204
}

/* ?find_last_of@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QBEIABV12@I@Z */
/* ?find_last_of@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QEBA_KAEBV12@_K@Z */
1205 1206
DEFINE_THISCALL_WRAPPER(MSVCP_basic_string_char_find_last_of, 12)
MSVCP_size_t __thiscall MSVCP_basic_string_char_find_last_of(
1207 1208
        const basic_string_char *this, const basic_string_char *find, MSVCP_size_t off)
{
1209
    return MSVCP_basic_string_char_find_last_of_cstr_substr(this,
1210 1211 1212 1213 1214
            find->ptr, off, find->size);
}

/* ?find_last_of@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QBEIDI@Z */
/* ?find_last_of@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QEBA_KD_K@Z */
1215 1216
DEFINE_THISCALL_WRAPPER(MSVCP_basic_string_char_find_last_of_ch, 12)
MSVCP_size_t __thiscall MSVCP_basic_string_char_find_last_of_ch(
1217 1218
        const basic_string_char *this, char ch, MSVCP_size_t off)
{
1219
    return MSVCP_basic_string_char_find_last_of_cstr_substr(this, &ch, off, 1);
1220 1221 1222 1223
}

/* ?find_last_of@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QBEIPBDI@Z */
/* ?find_last_of@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QEBA_KPEBD_K@Z */
1224 1225
DEFINE_THISCALL_WRAPPER(MSVCP_basic_string_char_find_last_of_cstr, 12)
MSVCP_size_t __thiscall MSVCP_basic_string_char_find_last_of_cstr(
1226 1227
        const basic_string_char *this, const char *find, MSVCP_size_t off)
{
1228
    return MSVCP_basic_string_char_find_last_of_cstr_substr(
1229
            this, find, off, MSVCP_char_traits_char_length(find));
1230 1231 1232 1233
}

/* ?append@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAEAAV12@ABV12@II@Z */
/* ?append@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QEAAAEAV12@AEBV12@_K1@Z */
1234 1235
DEFINE_THISCALL_WRAPPER(MSVCP_basic_string_char_append_substr, 16)
basic_string_char* __thiscall MSVCP_basic_string_char_append_substr(basic_string_char *this,
1236 1237 1238 1239 1240 1241 1242 1243 1244 1245
        const basic_string_char *append, MSVCP_size_t offset, MSVCP_size_t count)
{
    TRACE("%p %p %lu %lu\n", this, append, offset, count);

    if(append->size < offset)
        _Xran();

    if(count > append->size-offset)
        count = append->size-offset;

1246
    if(MSVCP_basic_string_char_npos-this->size<=count || this->size+count<this->size)
1247 1248 1249
        _Xlen();

    if(basic_string_char__Grow(this, this->size+count, FALSE)) {
1250
        if(append->ptr)
1251
            MSVCP_char_traits_char__Copy_s(this->ptr+this->size, this->res-this->size,
1252
                    append->ptr+offset, count);
1253 1254 1255 1256 1257 1258 1259 1260
        basic_string_char__Eos(this, this->size+count);
    }

    return this;
}

/* ?append@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAEAAV12@PBDI@Z */
/* ?append@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QEAAAEAV12@PEBD_K@Z */
1261 1262
DEFINE_THISCALL_WRAPPER(MSVCP_basic_string_char_append_cstr_len, 12)
basic_string_char* __thiscall MSVCP_basic_string_char_append_cstr_len(
1263 1264
        basic_string_char *this, const char *append, MSVCP_size_t count)
{
1265
    TRACE("%p %s %lu\n", this, debugstr_an(append, count), count);
1266 1267

    if(basic_string_char_inside(this, append))
1268
        return MSVCP_basic_string_char_append_substr(this, this, append-this->ptr, count);
1269

1270
    if(MSVCP_basic_string_char_npos-this->size<=count || this->size+count<this->size)
1271 1272 1273
        _Xlen();

    if(basic_string_char__Grow(this, this->size+count, FALSE)) {
1274
        MSVCP_char_traits_char__Copy_s(this->ptr+this->size,
1275 1276 1277 1278 1279 1280 1281 1282 1283
                this->res-this->size, append, count);
        basic_string_char__Eos(this, this->size+count);
    }

    return this;
}

/* ?append@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAEAAV12@ID@Z */
/* ?append@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QEAAAEAV12@_KD@Z */
1284 1285
DEFINE_THISCALL_WRAPPER(MSVCP_basic_string_char_append_len_ch, 12)
basic_string_char* __thiscall MSVCP_basic_string_char_append_len_ch(
1286 1287 1288 1289
        basic_string_char *this, MSVCP_size_t count, char ch)
{
    TRACE("%p %lu %c\n", this, count, ch);

1290
    if(MSVCP_basic_string_char_npos-this->size <= count)
1291 1292 1293
        _Xlen();

    if(basic_string_char__Grow(this, this->size+count, FALSE)) {
1294
        MSVCP_char_traits_char_assignn(this->ptr+this->size, count, ch);
1295 1296 1297 1298 1299 1300 1301 1302 1303 1304
        basic_string_char__Eos(this, this->size+count);
    }

    return this;
}

/* ?append@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAEAAV12@ABV12@@Z */
/* ?append@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QEAAAEAV12@AEBV12@@Z */
/* ??Y?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAEAAV01@ABV01@@Z */
/* ??Y?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QEAAAEAV01@AEBV01@@Z */
1305 1306
DEFINE_THISCALL_WRAPPER(MSVCP_basic_string_char_append, 8)
basic_string_char* __thiscall MSVCP_basic_string_char_append(
1307 1308
        basic_string_char *this, const basic_string_char *append)
{
1309 1310
    return MSVCP_basic_string_char_append_substr(this, append,
            0, MSVCP_basic_string_char_npos);
1311 1312 1313 1314
}

/* ??Y?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAEAAV01@D@Z */
/* ??Y?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QEAAAEAV01@D@Z */
1315 1316
DEFINE_THISCALL_WRAPPER(MSVCP_basic_string_char_append_ch, 8)
basic_string_char* __thiscall MSVCP_basic_string_char_append_ch(
1317 1318
        basic_string_char *this, char ch)
{
1319
    return MSVCP_basic_string_char_append_len_ch(this, 1, ch);
1320 1321 1322 1323
}

/* ?append@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAEAAV12@PBD0@Z */
/* ?append@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QEAAAEAV12@PEBD0@Z */
1324 1325
DEFINE_THISCALL_WRAPPER(MSVCP_basic_string_char_append_beg_end, 12)
basic_string_char* __thiscall MSVCP_basic_string_char_append_beg_end(
1326 1327
        basic_string_char *this, const char *beg, const char *end)
{
1328
    return MSVCP_basic_string_char_append_cstr_len(this, beg, end-beg);
1329 1330 1331 1332 1333 1334
}

/* ?append@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAEAAV12@PBD@Z */
/* ?append@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QEAAAEAV12@PEBD@Z */
/* ??Y?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAEAAV01@PBD@Z */
/* ??Y?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QEAAAEAV01@PEBD@Z */
1335 1336
DEFINE_THISCALL_WRAPPER(MSVCP_basic_string_char_append_cstr, 8)
basic_string_char* __thiscall MSVCP_basic_string_char_append_cstr(
1337 1338
        basic_string_char *this, const char *append)
{
1339
    return MSVCP_basic_string_char_append_cstr_len(this, append,
1340
            MSVCP_char_traits_char_length(append));
1341 1342 1343 1344 1345
}
/* ??$?HDU?$char_traits@D@std@@V?$allocator@D@1@@std@@YA?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@0@ABV10@0@Z */
/* ??$?HDU?$char_traits@D@std@@V?$allocator@D@1@@std@@YA?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@0@AEBV10@0@Z */
/* ??Hstd@@YA?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@0@ABV10@0@Z */
/* ??Hstd@@YA?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@0@AEBV10@0@Z */
1346
basic_string_char* __cdecl MSVCP_basic_string_char_concatenate(basic_string_char *ret,
1347 1348 1349 1350
        const basic_string_char *left, const basic_string_char *right)
{
    TRACE("%p %p\n", left, right);

1351
    MSVCP_basic_string_char_copy_ctor(ret, left);
1352
    MSVCP_basic_string_char_append(ret, right);
1353 1354 1355 1356 1357 1358 1359
    return ret;
}

/* ??$?HDU?$char_traits@D@std@@V?$allocator@D@1@@std@@YA?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@0@ABV10@D@Z */
/* ??$?HDU?$char_traits@D@std@@V?$allocator@D@1@@std@@YA?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@0@AEBV10@D@Z */
/* ??Hstd@@YA?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@0@ABV10@D@Z */
/* ??Hstd@@YA?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@0@AEBV10@D@Z */
1360
basic_string_char* __cdecl MSVCP_basic_string_char_concatenate_bstr_ch(basic_string_char *ret,
1361 1362 1363 1364
        const basic_string_char *left, char right)
{
    TRACE("%p %c\n", left, right);

1365 1366
    MSVCP_basic_string_char_copy_ctor(ret, left);
    MSVCP_basic_string_char_append_ch(ret, right);
1367 1368 1369 1370 1371 1372 1373
    return ret;
}

/* ??$?HDU?$char_traits@D@std@@V?$allocator@D@1@@std@@YA?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@0@ABV10@PBD@Z */
/* ??$?HDU?$char_traits@D@std@@V?$allocator@D@1@@std@@YA?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@0@AEBV10@PEBD@Z */
/* ??Hstd@@YA?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@0@ABV10@PBD@Z */
/* ??Hstd@@YA?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@0@AEBV10@PEBD@Z */
1374
basic_string_char* __cdecl MSVCP_basic_string_char_concatenate_bstr_cstr(basic_string_char *ret,
1375 1376 1377 1378
        const basic_string_char *left, const char *right)
{
    TRACE("%p %s\n", left, debugstr_a(right));

1379
    MSVCP_basic_string_char_copy_ctor(ret, left);
1380
    MSVCP_basic_string_char_append_cstr(ret, right);
1381 1382 1383 1384 1385 1386 1387
    return ret;
}

/* ??$?HDU?$char_traits@D@std@@V?$allocator@D@1@@std@@YA?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@0@DABV10@@Z */
/* ??$?HDU?$char_traits@D@std@@V?$allocator@D@1@@std@@YA?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@0@DAEBV10@@Z */
/* ??Hstd@@YA?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@0@DABV10@@Z */
/* ??Hstd@@YA?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@0@DAEBV10@@Z */
1388
basic_string_char* __cdecl MSVCP_basic_string_char_concatenate_ch_bstr(basic_string_char *ret,
1389 1390 1391 1392
        char left, const basic_string_char *right)
{
    TRACE("%c %p\n", left, right);

1393 1394
    MSVCP_basic_string_char_ctor_cstr_len_alloc(ret, &left, 1, NULL);
    MSVCP_basic_string_char_append(ret, right);
1395 1396 1397 1398 1399 1400 1401
    return ret;
}

/* ??$?HDU?$char_traits@D@std@@V?$allocator@D@1@@std@@YA?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@0@PBDABV10@@Z */
/* ??$?HDU?$char_traits@D@std@@V?$allocator@D@1@@std@@YA?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@0@PEBDAEBV10@@Z */
/* ??Hstd@@YA?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@0@PBDABV10@@Z */
/* ??Hstd@@YA?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@0@PEBDAEBV10@@Z */
1402
basic_string_char* __cdecl MSVCP_basic_string_char_concatenate_cstr_bstr(basic_string_char *ret,
1403 1404 1405 1406
        const char *left, const basic_string_char *right)
{
    TRACE("%s %p\n", debugstr_a(left), right);

1407 1408
    MSVCP_basic_string_char_ctor_cstr_alloc(ret, left, NULL);
    MSVCP_basic_string_char_append(ret, right);
1409 1410 1411 1412 1413
    return ret;
}

/* ??A?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAEAADI@Z */
/* ??A?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QEAAAEAD_K@Z */
1414 1415
DEFINE_THISCALL_WRAPPER(MSVCP_basic_string_char_operator_at, 8)
char* __thiscall MSVCP_basic_string_char_operator_at(
1416 1417 1418 1419
        basic_string_char *this, MSVCP_size_t pos)
{
    TRACE("%p %lu\n", this, pos);

1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436
    if(!this->ptr || pos>this->size)
        return (char*)basic_string_char__Nullstr();

    basic_string_char__Freeze(this);
    return this->ptr+pos;
}

/* ??A?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QBEABDI@Z */
/* ??A?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QEBAAEBD_K@Z */
DEFINE_THISCALL_WRAPPER(MSVCP_basic_string_char_operator_at_const, 8)
const char* __thiscall MSVCP_basic_string_char_operator_at_const(
        const basic_string_char *this, MSVCP_size_t pos)
{
    TRACE("%p %lu\n", this, pos);

    if(!this->ptr)
        return basic_string_char__Nullstr();
1437 1438 1439 1440 1441 1442 1443
    return this->ptr+pos;
}

/* ?at@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAEAADI@Z */
/* ?at@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QEAAAEAD_K@Z */
/* ?at@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QBEABDI@Z */
/* ?at@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QEBAAEBD_K@Z */
1444 1445
DEFINE_THISCALL_WRAPPER(MSVCP_basic_string_char_at, 8)
char* __thiscall MSVCP_basic_string_char_at(
1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469
        basic_string_char *this, MSVCP_size_t pos)
{
    TRACE("%p %lu\n", this, pos);

    if(this->size <= pos)
        _Xran();

    return this->ptr+pos;
}

/* ?replace@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAEAAV12@IIPBDI@Z */
/* ?replace@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QEAAAEAV12@_K0PEBD0@Z */
DEFINE_THISCALL_WRAPPER(basic_string_char_replace_cstr_len, 20)
basic_string_char* __thiscall basic_string_char_replace_cstr_len(basic_string_char *this,
        MSVCP_size_t off, MSVCP_size_t len, const char *str, MSVCP_size_t str_len)
{
    MSVCP_size_t inside_pos = -1;
    char *ptr = this->ptr;

    TRACE("%p %ld %ld %p %ld\n", this, off, len, str, str_len);

    if(this->size < off)
        _Xran();

1470
    if(len > this->size-off)
1471 1472
        len = this->size-off;

1473
    if(MSVCP_basic_string_char_npos-str_len <= this->size-len)
1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506
        _Xlen();

    if(basic_string_char_inside(this, str))
        inside_pos = str-ptr;

    if(this->size-len+str_len)
        basic_string_char__Grow(this, this->size-len+str_len, FALSE);
    ptr = this->ptr;

    if(inside_pos == -1) {
        memmove(ptr+off+str_len, ptr+off+len, (this->size-off-len)*sizeof(char));
        memcpy(ptr+off, str, str_len*sizeof(char));
    } else if(len >= str_len) {
        memmove(ptr+off, ptr+inside_pos, str_len*sizeof(char));
        memmove(ptr+off+str_len, ptr+off+len, (this->size-off-len)*sizeof(char));
    } else {
        MSVCP_size_t size;

        memmove(ptr+off+str_len, ptr+off+len, (this->size-off-len)*sizeof(char));

        if(inside_pos < off+len) {
            size = off+len-inside_pos;
            if(size > str_len)
                size = str_len;
            memmove(ptr+off, ptr+inside_pos, size*sizeof(char));
        } else {
            size = 0;
        }

        if(str_len > size)
            memmove(ptr+off+size, ptr+off+str_len, (str_len-size)*sizeof(char));
    }

1507 1508
    if(this->ptr)
        basic_string_char__Eos(this, this->size-len+str_len);
1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520
    return this;
}

/* ?replace@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAEAAV12@IIABV12@II@Z */
/* ?replace@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QEAAAEAV12@_K0AEBV12@00@Z */
DEFINE_THISCALL_WRAPPER(basic_string_char_replace_substr, 24)
basic_string_char* __thiscall basic_string_char_replace_substr(basic_string_char *this, MSVCP_size_t off,
        MSVCP_size_t len, const basic_string_char *str, MSVCP_size_t str_off, MSVCP_size_t str_len)
{
    if(str->size < str_off)
        _Xran();

1521
    if(str_len > str->size-str_off)
1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543
        str_len = str->size-str_off;

    return basic_string_char_replace_cstr_len(this, off, len,
            str->ptr+str_off, str_len);
}

/* ?replace@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAEAAV12@IIABV12@@Z */
/* ?replace@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QEAAAEAV12@_K0AEBV12@@Z */
DEFINE_THISCALL_WRAPPER(basic_string_char_replace, 16)
basic_string_char* __thiscall basic_string_char_replace(basic_string_char *this,
        MSVCP_size_t off, MSVCP_size_t len, const basic_string_char *str)
{
    return basic_string_char_replace_cstr_len(this, off, len,
            str->ptr, str->size);
}

/* ?replace@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAEAAV12@IIID@Z */
/* ?replace@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QEAAAEAV12@_K00D@Z */
DEFINE_THISCALL_WRAPPER(basic_string_char_replace_ch, 20)
basic_string_char* __thiscall basic_string_char_replace_ch(basic_string_char *this,
        MSVCP_size_t off, MSVCP_size_t len, MSVCP_size_t count, char ch)
{
1544
    char *ptr;
1545 1546 1547 1548 1549 1550

    TRACE("%p %ld %ld %ld %c\n", this, off, len, count, ch);

    if(this->size < off)
        _Xran();

1551
    if(len > this->size-off)
1552 1553
        len = this->size-off;

1554
    if(MSVCP_basic_string_char_npos-count <= this->size-len)
1555 1556 1557 1558 1559 1560 1561
        _Xlen();

    if(this->size-len+count)
        basic_string_char__Grow(this, this->size-len+count, FALSE);
    ptr = this->ptr;

    memmove(ptr+off+count, ptr+off+len, (this->size-off-len)*sizeof(char));
1562
    MSVCP_char_traits_char_assignn(ptr+off, count, ch);
1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574
    basic_string_char__Eos(this, this->size-len+count);

    return this;
}

/* ?replace@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAEAAV12@IIPBD@Z */
/* ?replace@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QEAAAEAV12@_K0PEBD@Z */
DEFINE_THISCALL_WRAPPER(basic_string_char_replace_cstr, 16)
basic_string_char* __thiscall basic_string_char_replace_cstr(basic_string_char *this,
        MSVCP_size_t off, MSVCP_size_t len, const char *str)
{
    return basic_string_char_replace_cstr_len(this, off, len, str,
1575
            MSVCP_char_traits_char_length(str));
1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625
}

/* ?insert@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAEAAV12@IABV12@@Z */
/* ?insert@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QEAAAEAV12@_KAEBV12@@Z */
DEFINE_THISCALL_WRAPPER(basic_string_char_insert, 12)
basic_string_char* __thiscall basic_string_char_insert(basic_string_char *this,
        MSVCP_size_t off, const basic_string_char *str)
{
    return basic_string_char_replace(this, off, 0, str);
}

/* ?insert@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAEAAV12@IABV12@II@Z */
/* ?insert@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QEAAAEAV12@_KAEBV12@00@Z */
DEFINE_THISCALL_WRAPPER(basic_string_char_insert_substr, 20)
basic_string_char* __thiscall basic_string_char_insert_substr(
        basic_string_char *this, MSVCP_size_t off, const basic_string_char *str,
        MSVCP_size_t str_off, MSVCP_size_t str_count)
{
    return basic_string_char_replace_substr(this, off, 0, str, str_off, str_count);
}

/* ?insert@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAEAAV12@IPBD@Z */
/* ?insert@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QEAAAEAV12@_KPEBD@Z */
DEFINE_THISCALL_WRAPPER(basic_string_char_insert_cstr, 12)
basic_string_char* __thiscall basic_string_char_insert_cstr(
        basic_string_char *this, MSVCP_size_t off, const char *str)
{
    return basic_string_char_replace_cstr(this, off, 0, str);
}

/* ?insert@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAEAAV12@IPBDI@Z */
/* ?insert@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QEAAAEAV12@_KPEBD0@Z */
DEFINE_THISCALL_WRAPPER(basic_string_char_insert_cstr_len, 16)
basic_string_char* __thiscall basic_string_char_insert_cstr_len(basic_string_char *this,
        MSVCP_size_t off, const char *str, MSVCP_size_t str_len)
{
    return basic_string_char_replace_cstr_len(this, off, 0, str, str_len);
}

/* ?insert@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAEAAV12@IID@Z */
/* ?insert@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QEAAAEAV12@_K0D@Z */
DEFINE_THISCALL_WRAPPER(basic_string_char_insert_chn, 16)
basic_string_char* __thiscall basic_string_char_insert_chn(basic_string_char *this,
        MSVCP_size_t off, MSVCP_size_t count, char ch)
{
    return basic_string_char_replace_ch(this, off, 0, count, ch);
}

/* ?resize@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAEXID@Z */
/* ?resize@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QEAAX_KD@Z */
1626 1627
DEFINE_THISCALL_WRAPPER(MSVCP_basic_string_char_resize_ch, 12)
void __thiscall MSVCP_basic_string_char_resize_ch(
1628 1629 1630 1631 1632
        basic_string_char *this, MSVCP_size_t size, char ch)
{
    TRACE("%p %lu %c\n", this, size, ch);

    if(size <= this->size)
1633
        MSVCP_basic_string_char_erase(this, size, this->size);
1634
    else
1635
        MSVCP_basic_string_char_append_len_ch(this, size-this->size, ch);
1636 1637 1638 1639
}

/* ?resize@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAEXI@Z */
/* ?resize@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QEAAX_K@Z */
1640 1641
DEFINE_THISCALL_WRAPPER(MSVCP_basic_string_char_resize, 8)
void __thiscall MSVCP_basic_string_char_resize(
1642 1643
        basic_string_char *this, MSVCP_size_t size)
{
1644
    MSVCP_basic_string_char_resize_ch(this, size, '\0');
1645 1646 1647 1648 1649 1650
}

/* ?c_str@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QBEPBDXZ */
/* ?c_str@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QEBAPEBDXZ */
/* ?data@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QBEPBDXZ */
/* ?data@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QEBAPEBDXZ */
1651 1652
DEFINE_THISCALL_WRAPPER(MSVCP_basic_string_char_c_str, 4)
const char* __thiscall MSVCP_basic_string_char_c_str(const basic_string_char *this)
1653 1654
{
    TRACE("%p\n", this);
1655
    return this->ptr ? this->ptr : basic_string_char__Nullstr();
1656 1657 1658 1659 1660 1661
}

/* ?size@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QBEIXZ */
/* ?size@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QEBA_KXZ */
/* ?length@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QBEIXZ */
/* ?length@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QEBA_KXZ */
1662 1663
DEFINE_THISCALL_WRAPPER(MSVCP_basic_string_char_length, 4)
MSVCP_size_t __thiscall MSVCP_basic_string_char_length(const basic_string_char *this)
1664 1665 1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679
{
    TRACE("%p\n", this);
    return this->size;
}

/* ?max_size@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QBEIXZ */
/* ?max_size@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QEBA_KXZ */
DEFINE_THISCALL_WRAPPER(basic_string_char_max_size, 4)
MSVCP_size_t __thiscall basic_string_char_max_size(const basic_string_char *this)
{
    TRACE("%p\n", this);
    return MSVCP_allocator_char_max_size(NULL)-1;
}

/* ?capacity@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QBEIXZ */
/* ?capacity@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QEBA_KXZ */
1680 1681
DEFINE_THISCALL_WRAPPER(MSVCP_basic_string_char_capacity, 4)
MSVCP_size_t __thiscall MSVCP_basic_string_char_capacity(basic_string_char *this)
1682 1683 1684 1685 1686 1687 1688
{
    TRACE("%p\n", this);
    return this->res;
}

/* ?reserve@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAEXI@Z */
/* ?reserve@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QEAAX_K@Z */
1689 1690
DEFINE_THISCALL_WRAPPER(MSVCP_basic_string_char_reserve, 8)
void __thiscall MSVCP_basic_string_char_reserve(basic_string_char *this, MSVCP_size_t size)
1691 1692 1693 1694 1695 1696 1697 1698 1699
{
    MSVCP_size_t len;

    TRACE("%p %ld\n", this, size);

    len = this->size;
    if(len > size)
        return;

1700 1701
    if(basic_string_char__Grow(this, size, FALSE))
        basic_string_char__Eos(this, len);
1702 1703 1704 1705
}

/* ?empty@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QBE_NXZ */
/* ?empty@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QEBA_NXZ */
1706 1707
DEFINE_THISCALL_WRAPPER(MSVCP_basic_string_char_empty, 4)
MSVCP_bool __thiscall MSVCP_basic_string_char_empty(basic_string_char *this)
1708 1709 1710 1711 1712 1713 1714
{
    TRACE("%p\n", this);
    return this->size == 0;
}

/* ?swap@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAEXAAV12@@Z */
/* ?swap@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QEAAXAEAV12@@Z */
1715 1716
DEFINE_THISCALL_WRAPPER(MSVCP_basic_string_char_swap, 8)
void __thiscall MSVCP_basic_string_char_swap(basic_string_char *this, basic_string_char *str)
1717 1718 1719 1720 1721 1722 1723 1724 1725 1726 1727
{
    basic_string_char tmp;
    TRACE("%p %p\n", this, str);

    tmp = *this;
    *this = *str;
    *str = tmp;
}

/* ?substr@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QBE?AV12@II@Z */
/* ?substr@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QEBA?AV12@_K0@Z */
1728 1729
DEFINE_THISCALL_WRAPPER(MSVCP_basic_string_char_substr, 16)
basic_string_char* __thiscall MSVCP_basic_string_char_substr(basic_string_char *this,
1730 1731 1732 1733
        basic_string_char *ret, MSVCP_size_t off, MSVCP_size_t len)
{
    TRACE("%p %lu %lu\n", this, off, len);

1734
    MSVCP_basic_string_char_ctor_substr_alloc(ret, this, off, len, NULL);
1735 1736 1737 1738 1739 1740 1741 1742 1743 1744 1745 1746 1747 1748 1749
    return ret;
}

/* ?copy@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QBEIPADII@Z */
/* ?copy@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QEBA_KPEAD_K1@Z */
DEFINE_THISCALL_WRAPPER(basic_string_char_copy, 16)
MSVCP_size_t __thiscall basic_string_char_copy(const basic_string_char *this,
        char *dest, MSVCP_size_t count, MSVCP_size_t off)
{
    TRACE("%p %p %lu %lu\n", this, dest, count, off);

    if(off > this->size)
        _Xran();
    if(count > this->size-off)
        count = this->size-off;
1750
    if(this->ptr)
1751
        MSVCP_char_traits_char__Copy_s(dest, count, this->ptr+off, count);
1752 1753 1754 1755 1756 1757 1758 1759 1760 1761 1762
    return count;
}

/* ?get_allocator@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QBE?AV?$allocator@D@2@XZ */
/* ?get_allocator@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QEBA?AV?$allocator@D@2@XZ */
DEFINE_THISCALL_WRAPPER(basic_string_char_get_allocator, 8)
allocator* __thiscall basic_string_char_get_allocator(const basic_string_char *this, allocator *ret)
{
    TRACE("%p\n", this);
    return ret;
}
1763 1764 1765 1766

static MSVCP_bool basic_string_wchar_inside(
        basic_string_wchar *this, const wchar_t *ptr)
{
1767
    return ptr>=this->ptr && ptr<this->ptr+this->size;
1768 1769 1770 1771
}

/* ?npos@?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@2IB */
/* ?npos@?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@2_KB */
1772
const MSVCP_size_t MSVCP_basic_string_wchar_npos = -1;
1773 1774 1775 1776 1777 1778 1779 1780 1781 1782 1783 1784 1785 1786 1787 1788 1789 1790 1791 1792 1793 1794 1795 1796 1797 1798 1799 1800 1801 1802

/* ?_C@?1??_Nullstr@?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@CAPBGXZ@4GB */
/* ?_C@?1??_Nullstr@?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@CAPEBGXZ@4GB */
const wchar_t basic_string_wchar_nullbyte = '\0';

/* ?_Nullstr@?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@CAPBGXZ */
/* ?_Nullstr@?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@CAPEBGXZ */
const wchar_t* __cdecl basic_string_wchar__Nullstr(void)
{
    return &basic_string_wchar_nullbyte;
}

/* ?_Refcnt@?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@AAEAAEPBG@Z */
/* ?_Refcnt@?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@AEAAAEAEPEBG@Z */
DEFINE_THISCALL_WRAPPER(basic_string_wchar__Refcnt, 8)
unsigned short* __thiscall basic_string_wchar__Refcnt(basic_string_wchar *this, const wchar_t *ptr)
{
    TRACE("(%p %p)\n", this, ptr);
    return (unsigned short*)ptr-1;
}

/* ?_Eos@?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@AAEXI@Z */
/* ?_Eos@?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@AEAAX_K@Z */
DEFINE_THISCALL_WRAPPER(basic_string_wchar__Eos, 8)
void __thiscall basic_string_wchar__Eos(basic_string_wchar *this, MSVCP_size_t len)
{
    this->size = len;
    this->ptr[len] = 0;
}

1803 1804 1805 1806 1807 1808
/* ?clear@?$basic_string@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@QAEXXZ */
/* ?clear@?$basic_string@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@QEAAXXZ */
/* ?clear@?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QAEXXZ */
/* ?clear@?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QEAAXXZ */
DEFINE_THISCALL_WRAPPER(MSVCP_basic_string_wchar_clear, 4)
void __thiscall MSVCP_basic_string_wchar_clear(basic_string_wchar *this)
1809
{
1810 1811
    if(this->ptr)
        basic_string_wchar__Eos(this, 0);
1812 1813
}

1814 1815 1816 1817 1818 1819 1820
/* ?_Tidy@?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@AAEX_N@Z */
/* ?_Tidy@?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@AEAAX_N@Z */
DEFINE_THISCALL_WRAPPER(basic_string_wchar__Tidy, 8)
void __thiscall basic_string_wchar__Tidy(basic_string_wchar *this, MSVCP_bool built)
{
    TRACE("(%p %d)\n", this, built);

1821
    if(!built || !this->ptr);
1822
    else if(!this->ptr[-1] || (unsigned short)this->ptr[-1]==FROZEN)
1823
        MSVCP_allocator_wchar_deallocate(NULL, this->ptr-1, this->res+2);
1824 1825 1826 1827 1828 1829
    else
        this->ptr[-1]--;

    memset(this, 0, sizeof(*this));
}

1830 1831 1832 1833 1834 1835 1836 1837 1838 1839 1840 1841 1842 1843 1844 1845 1846 1847 1848 1849 1850 1851 1852 1853 1854 1855 1856 1857 1858 1859 1860
/* ?_Grow@?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@AAE_NI_N@Z */
/* ?_Grow@?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@AEAA_N_K_N@Z */
DEFINE_THISCALL_WRAPPER(basic_string_wchar__Grow, 12)
MSVCP_bool __thiscall basic_string_wchar__Grow(basic_string_wchar *this, MSVCP_size_t new_size, MSVCP_bool trim)
{
    if(!new_size) {
        if(trim)
            basic_string_wchar__Tidy(this, TRUE);
        else if(this->ptr)
            basic_string_wchar__Eos(this, 0);
    } else if(this->res<new_size || trim ||
            (this->ptr && this->ptr[-1] && (unsigned short)this->ptr[-1]!=FROZEN)) {
        MSVCP_size_t new_res = new_size, len = this->size;
        wchar_t *ptr;

        if(!trim && this->ptr && !this->ptr[-1]) {
            new_res |= 0xf;
            if(new_res/3 < this->res/2)
                new_res = this->res + this->res/2;
        }

        ptr = MSVCP_allocator_wchar_allocate(this->allocator, new_res+2);
        if(!ptr) {
            new_res = new_size;
            ptr = MSVCP_allocator_wchar_allocate(this->allocator, new_size+2);
        }
        if(!ptr) {
            ERR("Out of memory\n");
            return FALSE;
        }

1861 1862 1863
        if(len > new_res)
            len = new_res;

1864 1865
        *ptr = 0;
        if(this->ptr)
1866
            MSVCP_char_traits_wchar__Copy_s(ptr+1, new_size, this->ptr, len);
1867 1868 1869
        basic_string_wchar__Tidy(this, TRUE);
        this->ptr = ptr+1;
        this->res = new_res;
1870
        basic_string_wchar__Eos(this, len);
1871 1872 1873 1874
    }

    return new_size>0;
}
1875 1876 1877 1878 1879 1880 1881 1882 1883 1884 1885 1886 1887 1888 1889 1890 1891 1892

/* ?_Split@?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@AAEXXZ */
/* ?_Split@?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@AEAAXXZ */
DEFINE_THISCALL_WRAPPER(basic_string_wchar__Split, 4)
void __thiscall basic_string_wchar__Split(basic_string_wchar *this)
{
    MSVCP_size_t len;
    wchar_t *ptr;

    TRACE("(%p)\n", this);

    if(!this->ptr || !this->ptr[-1] || (unsigned short)this->ptr[-1]==FROZEN)
        return;

    ptr = this->ptr;
    len = this->size;
    basic_string_wchar__Tidy(this, TRUE);
    if(basic_string_wchar__Grow(this, len, FALSE)) {
1893
        if(ptr)
1894
            MSVCP_char_traits_wchar__Copy_s(this->ptr, this->res, ptr, len);
1895 1896 1897 1898 1899 1900 1901 1902 1903 1904 1905 1906 1907 1908 1909 1910 1911 1912 1913 1914 1915 1916
        basic_string_wchar__Eos(this, len);
    }
}

/* ?_Freeze@?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@AAEXXZ */
/* ?_Freeze@?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@AEAAXXZ */
DEFINE_THISCALL_WRAPPER(basic_string_wchar__Freeze, 4)
void __thiscall basic_string_wchar__Freeze(basic_string_wchar *this)
{
    TRACE("(%p)\n", this);
    basic_string_wchar__Split(this);
    if(this->ptr)
        this->ptr[-1] = FROZEN;
}

/* ?_Copy@?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@AAEXI@Z */
/* ?_Copy@?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@AEAAX_K@Z */
DEFINE_THISCALL_WRAPPER(basic_string_wchar__Copy, 8)
void __thiscall basic_string_wchar__Copy(basic_string_wchar *this, MSVCP_size_t copy_len)
{
    TRACE("%p %lu\n", this, copy_len);

1917
    if(!basic_string_wchar__Grow(this, copy_len, TRUE))
1918 1919 1920 1921 1922 1923 1924 1925 1926
        return;
}

/* ?_Psum@?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@CAPAGPAGI@Z */
/* ?_Psum@?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@CAPEAGPEAG_K@Z */
/* ?_Psum@?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@CAPBGPBGI@Z */
/* ?_Psum@?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@CAPEBGPEBG_K@Z */
wchar_t* __cdecl basic_string_wchar__Psum(wchar_t *iter, MSVCP_size_t add)
{
1927
    TRACE("(%p %lu)\n", iter, add);
1928 1929 1930 1931 1932
    return iter ? iter+add : iter;
}

/* ?erase@?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QAEAAV12@II@Z */
/* ?erase@?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QEAAAEAV12@_K0@Z */
1933 1934
DEFINE_THISCALL_WRAPPER(MSVCP_basic_string_wchar_erase, 12)
basic_string_wchar* __thiscall MSVCP_basic_string_wchar_erase(
1935 1936 1937 1938 1939 1940 1941 1942 1943 1944 1945 1946
        basic_string_wchar *this, MSVCP_size_t pos, MSVCP_size_t len)
{
    TRACE("%p %lu %lu\n", this, pos, len);

    if(pos > this->size)
        _Xran();

    if(len > this->size-pos)
        len = this->size-pos;

    if(len) {
        basic_string_wchar__Split(this);
1947
        MSVCP_char_traits_wchar__Move_s(this->ptr+pos, this->res-pos,
1948 1949 1950 1951 1952 1953 1954 1955 1956 1957 1958 1959 1960
                this->ptr+pos+len, this->size-pos-len);
        basic_string_wchar__Eos(this, this->size-len);
    }

    return this;
}

/* ?erase@?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QAEPAGPAG@Z */
/* ?erase@?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QEAAPEAGPEAG@Z */
DEFINE_THISCALL_WRAPPER(basic_string_wchar_erase_beg, 8)
wchar_t* __thiscall basic_string_wchar_erase_beg(basic_string_wchar *this, wchar_t *beg)
{
    MSVCP_size_t pos = beg-this->ptr;
1961
    MSVCP_basic_string_wchar_erase(this, pos, 1);
1962 1963 1964 1965 1966
    return this->ptr+pos;
}

/* ?assign@?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QAEAAV12@ABV12@II@Z */
/* ?assign@?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QEAAAEAV12@AEBV12@_K1@Z */
1967 1968
DEFINE_THISCALL_WRAPPER(MSVCP_basic_string_wchar_assign_substr, 16)
basic_string_wchar* __thiscall MSVCP_basic_string_wchar_assign_substr(
1969 1970 1971 1972 1973 1974 1975 1976 1977 1978 1979 1980
        basic_string_wchar *this, const basic_string_wchar *assign,
        MSVCP_size_t pos, MSVCP_size_t len)
{
    TRACE("%p %p %lu %lu\n", this, assign, pos, len);

    if(assign->size < pos)
        _Xran();

    if(len > assign->size-pos)
        len = assign->size-pos;

    if(this == assign) {
1981 1982
        MSVCP_basic_string_wchar_erase(this, pos+len, MSVCP_basic_string_wchar_npos);
        MSVCP_basic_string_wchar_erase(this, 0, pos);
1983
    } else if(basic_string_wchar__Grow(this, len, FALSE)) {
1984
        if(assign->ptr)
1985
            MSVCP_char_traits_wchar__Copy_s(this->ptr, this->res,
1986
                    assign->ptr+pos, len);
1987 1988 1989 1990 1991 1992 1993 1994
        basic_string_wchar__Eos(this, len);
    }

    return this;
}

/* ?assign@?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QAEAAV12@PBGI@Z */
/* ?assign@?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QEAAAEAV12@PEBG_K@Z */
1995 1996
DEFINE_THISCALL_WRAPPER(MSVCP_basic_string_wchar_assign_cstr_len, 12)
basic_string_wchar* __thiscall MSVCP_basic_string_wchar_assign_cstr_len(
1997 1998
        basic_string_wchar *this, const wchar_t *str, MSVCP_size_t len)
{
1999
    TRACE("%p %s %lu\n", this, debugstr_wn(str, len), len);
2000 2001

    if(basic_string_wchar_inside(this, str))
2002
        return MSVCP_basic_string_wchar_assign_substr(this, this, str-this->ptr, len);
2003
    else if(basic_string_wchar__Grow(this, len, FALSE)) {
2004
        MSVCP_char_traits_wchar__Copy_s(this->ptr, this->res, str, len);
2005 2006 2007 2008 2009 2010 2011 2012 2013 2014
        basic_string_wchar__Eos(this, len);
    }

    return this;
}

/* ?assign@?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QAEAAV12@ABV12@@Z */
/* ?assign@?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QEAAAEAV12@AEBV12@@Z */
/* ??4?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QAEAAV01@ABV01@@Z */
/* ??4?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QEAAAEAV01@AEBV01@@Z */
2015 2016
DEFINE_THISCALL_WRAPPER(MSVCP_basic_string_wchar_assign, 8)
basic_string_wchar* __thiscall MSVCP_basic_string_wchar_assign(
2017 2018
        basic_string_wchar *this, const basic_string_wchar *assign)
{
2019 2020
    return MSVCP_basic_string_wchar_assign_substr(this, assign,
            0, MSVCP_basic_string_wchar_npos);
2021 2022 2023 2024 2025 2026
}

/* ?assign@?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QAEAAV12@PBG@Z */
/* ?assign@?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QEAAAEAV12@PEBG@Z */
/* ??4?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QAEAAV01@PBG@Z */
/* ??4?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QEAAAEAV01@PEBG@Z */
2027 2028
DEFINE_THISCALL_WRAPPER(MSVCP_basic_string_wchar_assign_cstr, 8)
basic_string_wchar* __thiscall MSVCP_basic_string_wchar_assign_cstr(
2029 2030
        basic_string_wchar *this, const wchar_t *str)
{
2031
    return MSVCP_basic_string_wchar_assign_cstr_len(this, str,
2032
            MSVCP_char_traits_wchar_length(str));
2033 2034 2035 2036
}

/* ??4?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QAEAAV01@G@Z */
/* ??4?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QEAAAEAV01@G@Z */
2037 2038
DEFINE_THISCALL_WRAPPER(MSVCP_basic_string_wchar_assign_ch, 8)
basic_string_wchar* __thiscall MSVCP_basic_string_wchar_assign_ch(
2039 2040
        basic_string_wchar *this, wchar_t ch)
{
2041
    return MSVCP_basic_string_wchar_assign_cstr_len(this, &ch, 1);
2042 2043 2044 2045
}

/* ?assign@?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QAEAAV12@IG@Z */
/* ?assign@?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QEAAAEAV12@_KG@Z */
2046 2047
DEFINE_THISCALL_WRAPPER(MSVCP_basic_string_wchar_assignn, 12)
basic_string_wchar* __thiscall MSVCP_basic_string_wchar_assignn(
2048 2049 2050 2051 2052
        basic_string_wchar *this, MSVCP_size_t count, wchar_t ch)
{
    TRACE("%p %ld %c\n", this, count, ch);

    basic_string_wchar__Grow(this, count, FALSE);
2053
    MSVCP_char_traits_wchar_assignn(this->ptr, count, ch);
2054 2055 2056 2057 2058 2059
    basic_string_wchar__Eos(this, count);
    return this;
}

/* ?assign@?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QAEAAV12@PBG0@Z */
/* ?assign@?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QEAAAEAV12@PEBG0@Z */
2060 2061
DEFINE_THISCALL_WRAPPER(MSVCP_basic_string_wchar_assign_ptr_ptr, 12)
basic_string_wchar* __thiscall MSVCP_basic_string_wchar_assign_ptr_ptr(
2062 2063
        basic_string_wchar *this, const wchar_t *first, const wchar_t *last)
{
2064
    return MSVCP_basic_string_wchar_assign_cstr_len(this, first, last-first);
2065 2066 2067 2068
}

/* ??0?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QAE@PBGIABV?$allocator@G@1@@Z */
/* ??0?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QEAA@PEBG_KAEBV?$allocator@G@1@@Z */
2069 2070
DEFINE_THISCALL_WRAPPER(MSVCP_basic_string_wchar_ctor_cstr_len_alloc, 16)
basic_string_wchar* __thiscall MSVCP_basic_string_wchar_ctor_cstr_len_alloc(
2071 2072
        basic_string_wchar *this, const wchar_t *str, MSVCP_size_t len, const void *alloc)
{
2073
    TRACE("%p %s %ld\n", this, debugstr_wn(str, len), len);
2074 2075

    basic_string_wchar__Tidy(this, FALSE);
2076
    MSVCP_basic_string_wchar_assign_cstr_len(this, str, len);
2077 2078 2079
    return this;
}

2080 2081 2082 2083 2084 2085 2086
/* ??0?$basic_string@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@QAE@PB_WI@Z */
/* ??0?$basic_string@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@QEAA@PEB_W_K@Z */
/* ??0?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QAE@PBGI@Z */
/* ??0?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QEAA@PEBG_K@Z */
DEFINE_THISCALL_WRAPPER(MSVCP_basic_string_wchar_ctor_cstr_len, 12)
basic_string_wchar* __thiscall MSVCP_basic_string_wchar_ctor_cstr_len(
        basic_string_wchar *this, const wchar_t *str, MSVCP_size_t len)
2087
{
2088
    return MSVCP_basic_string_wchar_ctor_cstr_len_alloc(this, str, len, NULL);
2089 2090
}

2091 2092
/* ??0?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QAE@ABV01@IIABV?$allocator@G@1@@Z */
/* ??0?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QEAA@AEBV01@_K1AEBV?$allocator@G@1@@Z */
2093 2094
DEFINE_THISCALL_WRAPPER(MSVCP_basic_string_wchar_ctor_substr_alloc, 20)
basic_string_wchar* __thiscall MSVCP_basic_string_wchar_ctor_substr_alloc(
2095 2096 2097 2098 2099 2100
        basic_string_wchar *this, const basic_string_wchar *assign,
        MSVCP_size_t pos, MSVCP_size_t len, const void *alloc)
{
    TRACE("%p %p %lu %lu\n", this, assign, pos, len);

    basic_string_wchar__Tidy(this, FALSE);
2101
    MSVCP_basic_string_wchar_assign_substr(this, assign, pos, len);
2102 2103 2104 2105 2106
    return this;
}

/* ??0?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QAE@PBGABV?$allocator@G@1@@Z */
/* ??0?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QEAA@PEBGAEBV?$allocator@G@1@@Z */
2107 2108
DEFINE_THISCALL_WRAPPER(MSVCP_basic_string_wchar_ctor_cstr_alloc, 12)
basic_string_wchar* __thiscall MSVCP_basic_string_wchar_ctor_cstr_alloc(
2109 2110 2111 2112 2113
        basic_string_wchar *this, const wchar_t *str, const void *alloc)
{
    TRACE("%p %s\n", this, debugstr_w(str));

    basic_string_wchar__Tidy(this, FALSE);
2114
    MSVCP_basic_string_wchar_assign_cstr(this, str);
2115 2116 2117
    return this;
}

2118 2119 2120 2121 2122 2123 2124
/* ??0?$basic_string@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@QAE@PB_W@Z */
/* ??0?$basic_string@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@QEAA@PEB_W@Z */
/* ??0?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QAE@PBG@Z */
/* ??0?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QEAA@PEBG@Z */
DEFINE_THISCALL_WRAPPER(MSVCP_basic_string_wchar_ctor_cstr, 8)
basic_string_wchar* __thiscall MSVCP_basic_string_wchar_ctor_cstr(
            basic_string_wchar *this, const wchar_t *str)
2125
{
2126
    return MSVCP_basic_string_wchar_ctor_cstr_alloc(this, str, NULL);
2127 2128
}

2129 2130
/* ??0?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QAE@IGABV?$allocator@G@1@@Z */
/* ??0?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QEAA@_KGAEBV?$allocator@G@1@@Z */
2131 2132
DEFINE_THISCALL_WRAPPER(MSVCP_basic_string_wchar_ctor_ch_alloc, 16)
basic_string_wchar* __thiscall MSVCP_basic_string_wchar_ctor_ch_alloc(basic_string_wchar *this,
2133 2134 2135 2136 2137
        MSVCP_size_t count, wchar_t ch, const void *alloc)
{
    TRACE("%p %ld %c\n", this, count, ch);

    basic_string_wchar__Tidy(this, FALSE);
2138
    MSVCP_basic_string_wchar_assignn(this, count, ch);
2139 2140 2141 2142 2143
    return this;
}

/* ??_F?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QAEXXZ */
/* ??_F?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QEAAXXZ */
2144 2145
DEFINE_THISCALL_WRAPPER(MSVCP_basic_string_wchar_ctor, 4)
basic_string_wchar* __thiscall MSVCP_basic_string_wchar_ctor(basic_string_wchar *this)
2146 2147 2148 2149 2150 2151 2152 2153 2154
{
    TRACE("%p\n", this);

    basic_string_wchar__Tidy(this, FALSE);
    return this;
}

/* ??0?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QAE@ABV?$allocator@G@1@@Z */
/* ??0?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QEAA@AEBV?$allocator@G@1@@Z */
2155 2156
DEFINE_THISCALL_WRAPPER(MSVCP_basic_string_wchar_ctor_alloc, 8)
basic_string_wchar* __thiscall MSVCP_basic_string_wchar_ctor_alloc(
2157 2158 2159 2160 2161 2162 2163 2164 2165 2166
        basic_string_wchar *this, const void *alloc)
{
    TRACE("%p %p\n", this, alloc);

    basic_string_wchar__Tidy(this, FALSE);
    return this;
}

/* ??0?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QAE@ABV01@@Z */
/* ??0?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QEAA@AEBV01@@Z */
2167 2168
DEFINE_THISCALL_WRAPPER(MSVCP_basic_string_wchar_copy_ctor, 8)
basic_string_wchar* __thiscall MSVCP_basic_string_wchar_copy_ctor(
2169 2170 2171 2172 2173
        basic_string_wchar *this, const basic_string_wchar *copy)
{
    TRACE("%p %p\n", this, copy);

    basic_string_wchar__Tidy(this, FALSE);
2174
    MSVCP_basic_string_wchar_assign(this, copy);
2175 2176 2177 2178 2179
    return this;
}

/* ??1?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QAE@XZ */
/* ??1?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QEAA@XZ */
2180 2181
DEFINE_THISCALL_WRAPPER(MSVCP_basic_string_wchar_dtor, 4)
void __thiscall MSVCP_basic_string_wchar_dtor(basic_string_wchar *this)
2182 2183 2184 2185 2186 2187 2188
{
    TRACE("%p\n", this);
    basic_string_wchar__Tidy(this, TRUE);
}

/* ?compare@?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QBEHIIPBGI@Z */
/* ?compare@?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QEBAH_K0PEBG0@Z */
2189 2190
DEFINE_THISCALL_WRAPPER(MSVCP_basic_string_wchar_compare_substr_cstr_len, 20)
int __thiscall MSVCP_basic_string_wchar_compare_substr_cstr_len(
2191 2192 2193 2194 2195
        const basic_string_wchar *this, MSVCP_size_t pos, MSVCP_size_t num,
        const wchar_t *str, MSVCP_size_t count)
{
    int ans;

2196
    TRACE("%p %lu %lu %s %lu\n", this, pos, num, debugstr_wn(str, count), count);
2197 2198 2199 2200

    if(this->size < pos)
        _Xran();

2201
    if(num > this->size-pos)
2202 2203
        num = this->size-pos;

2204
    ans = MSVCP_char_traits_wchar_compare(this->ptr+pos,
2205 2206 2207 2208 2209 2210 2211 2212 2213 2214 2215 2216 2217
            str, num>count ? count : num);
    if(ans)
        return ans;

    if(num > count)
        ans = 1;
    else if(num < count)
        ans = -1;
    return ans;
}

/* ?compare@?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QBEHPBG@Z */
/* ?compare@?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QEBAHPEBG@Z */
2218 2219
DEFINE_THISCALL_WRAPPER(MSVCP_basic_string_wchar_compare_cstr, 8)
int __thiscall MSVCP_basic_string_wchar_compare_cstr(
2220 2221
        const basic_string_wchar *this, const wchar_t *str)
{
2222
    return MSVCP_basic_string_wchar_compare_substr_cstr_len(this, 0, this->size,
2223
            str, MSVCP_char_traits_wchar_length(str));
2224 2225 2226 2227
}

/* ?compare@?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QBEHIIABV12@II@Z */
/* ?compare@?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QEBAH_K0AEBV12@00@Z */
2228 2229
DEFINE_THISCALL_WRAPPER(MSVCP_basic_string_wchar_compare_substr_substr, 24)
int __thiscall MSVCP_basic_string_wchar_compare_substr_substr(
2230 2231 2232 2233 2234 2235 2236 2237
        const basic_string_wchar *this, MSVCP_size_t pos, MSVCP_size_t num,
        const basic_string_wchar *compare, MSVCP_size_t off, MSVCP_size_t count)
{
    TRACE("%p %lu %lu %p %lu %lu\n", this, pos, num, compare, off, count);

    if(compare->size < off)
        _Xran();

2238
    if(count > compare->size-off)
2239 2240
        count = compare->size-off;

2241
    return MSVCP_basic_string_wchar_compare_substr_cstr_len(this, pos, num,
2242 2243 2244 2245 2246
            compare->ptr+off, count);
}

/* ?compare@?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QBEHIIABV12@@Z */
/* ?compare@?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QEBAH_K0AEBV12@@Z */
2247 2248
DEFINE_THISCALL_WRAPPER(MSVCP_basic_string_wchar_compare_substr, 16)
int __thiscall MSVCP_basic_string_wchar_compare_substr(
2249 2250 2251
        const basic_string_wchar *this, MSVCP_size_t pos, MSVCP_size_t num,
        const basic_string_wchar *compare)
{
2252
    return MSVCP_basic_string_wchar_compare_substr_cstr_len(this, pos, num,
2253 2254 2255 2256 2257
            compare->ptr, compare->size);
}

/* ?compare@?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QBEHABV12@@Z */
/* ?compare@?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QEBAHAEBV12@@Z */
2258 2259
DEFINE_THISCALL_WRAPPER(MSVCP_basic_string_wchar_compare, 8)
int __thiscall MSVCP_basic_string_wchar_compare(
2260 2261
        const basic_string_wchar *this, const basic_string_wchar *compare)
{
2262
    return MSVCP_basic_string_wchar_compare_substr_cstr_len(this, 0, this->size,
2263 2264 2265 2266 2267
            compare->ptr, compare->size);
}

/* ?compare@?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QBEHIIPBG@Z */
/* ?compare@?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QEBAH_K0PEBG@Z */
2268 2269
DEFINE_THISCALL_WRAPPER(MSVCP_basic_string_wchar_compare_substr_cstr, 16)
int __thiscall MSVCP_basic_string_wchar_compare_substr_cstr(const basic_string_wchar *this,
2270 2271
        MSVCP_size_t pos, MSVCP_size_t num, const wchar_t *str)
{
2272
    return MSVCP_basic_string_wchar_compare_substr_cstr_len(this, pos, num,
2273
            str, MSVCP_char_traits_wchar_length(str));
2274 2275 2276 2277 2278 2279
}

/* ??$?8GU?$char_traits@G@std@@V?$allocator@G@1@@std@@YA_NABV?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@0@0@Z */
/* ??$?8GU?$char_traits@G@std@@V?$allocator@G@1@@std@@YA_NAEBV?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@0@0@Z */
/* ??8std@@YA_NABV?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@0@0@Z */
/* ??8std@@YA_NAEBV?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@0@0@Z */
2280
MSVCP_bool __cdecl MSVCP_basic_string_wchar_equal(
2281 2282
        const basic_string_wchar *left, const basic_string_wchar *right)
{
2283
    return MSVCP_basic_string_wchar_compare(left, right) == 0;
2284 2285 2286 2287 2288 2289
}

/* ??$?8GU?$char_traits@G@std@@V?$allocator@G@1@@std@@YA_NABV?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@0@PBG@Z */
/* ??$?8GU?$char_traits@G@std@@V?$allocator@G@1@@std@@YA_NAEBV?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@0@PEBG@Z */
/* ??8std@@YA_NABV?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@0@PBG@Z */
/* ??8std@@YA_NAEBV?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@0@PEBG@Z */
2290
MSVCP_bool __cdecl MSVCP_basic_string_wchar_equal_str_cstr(
2291 2292
        const basic_string_wchar *left, const wchar_t *right)
{
2293
    return MSVCP_basic_string_wchar_compare_cstr(left, right) == 0;
2294 2295 2296 2297 2298 2299
}

/* ??$?8GU?$char_traits@G@std@@V?$allocator@G@1@@std@@YA_NPBGABV?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@0@@Z */
/* ??$?8GU?$char_traits@G@std@@V?$allocator@G@1@@std@@YA_NPEBGAEBV?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@0@@Z */
/* ??8std@@YA_NPBGABV?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@0@@Z */
/* ??8std@@YA_NPEBGAEBV?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@0@@Z */
2300
MSVCP_bool __cdecl MSVCP_basic_string_wchar_equal_cstr_str(
2301 2302
        const wchar_t *left, const basic_string_wchar *right)
{
2303
    return MSVCP_basic_string_wchar_compare_cstr(right, left) == 0;
2304 2305 2306 2307 2308 2309
}

/* ??$?9GU?$char_traits@G@std@@V?$allocator@G@1@@std@@YA_NABV?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@0@0@Z */
/* ??$?9GU?$char_traits@G@std@@V?$allocator@G@1@@std@@YA_NAEBV?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@0@0@Z */
/* ??9std@@YA_NABV?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@0@0@Z */
/* ??9std@@YA_NAEBV?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@0@0@Z */
2310
MSVCP_bool __cdecl MSVCP_basic_string_wchar_not_equal(
2311 2312
        const basic_string_wchar *left, const basic_string_wchar *right)
{
2313
    return MSVCP_basic_string_wchar_compare(left, right) != 0;
2314 2315 2316 2317 2318 2319
}

/* ??$?9GU?$char_traits@G@std@@V?$allocator@G@1@@std@@YA_NABV?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@0@PBG@Z */
/* ??$?9GU?$char_traits@G@std@@V?$allocator@G@1@@std@@YA_NAEBV?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@0@PEBG@Z */
/* ??9std@@YA_NABV?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@0@PBG@Z */
/* ??9std@@YA_NAEBV?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@0@PEBG@Z */
2320
MSVCP_bool __cdecl MSVCP_basic_string_wchar_not_equal_str_cstr(
2321 2322
        const basic_string_wchar *left, const wchar_t *right)
{
2323
    return MSVCP_basic_string_wchar_compare_cstr(left, right) != 0;
2324 2325 2326 2327 2328 2329
}

/* ??$?9GU?$char_traits@G@std@@V?$allocator@G@1@@std@@YA_NPBGABV?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@0@@Z */
/* ??$?9GU?$char_traits@G@std@@V?$allocator@G@1@@std@@YA_NPEBGAEBV?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@0@@Z */
/* ??9std@@YA_NPBGABV?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@0@@Z */
/* ??9std@@YA_NPEBGAEBV?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@0@@Z */
2330
MSVCP_bool __cdecl MSVCP_basic_string_wchar_not_equal_cstr_str(
2331 2332
        const wchar_t *left, const basic_string_wchar *right)
{
2333
    return MSVCP_basic_string_wchar_compare_cstr(right, left) != 0;
2334 2335 2336 2337 2338 2339
}

/* ??$?MGU?$char_traits@G@std@@V?$allocator@G@1@@std@@YA_NABV?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@0@0@Z */
/* ??$?MGU?$char_traits@G@std@@V?$allocator@G@1@@std@@YA_NAEBV?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@0@0@Z */
/* ??Mstd@@YA_NABV?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@0@0@Z */
/* ??Mstd@@YA_NAEBV?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@0@0@Z */
2340
MSVCP_bool __cdecl MSVCP_basic_string_wchar_lower(
2341 2342
        const basic_string_wchar *left, const basic_string_wchar *right)
{
2343
    return MSVCP_basic_string_wchar_compare(left, right) < 0;
2344 2345 2346 2347 2348 2349
}

/* ??$?MGU?$char_traits@G@std@@V?$allocator@G@1@@std@@YA_NABV?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@0@PBG@Z */
/* ??$?MGU?$char_traits@G@std@@V?$allocator@G@1@@std@@YA_NAEBV?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@0@PEBG@Z */
/* ??Mstd@@YA_NABV?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@0@PBG@Z */
/* ??Mstd@@YA_NAEBV?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@0@PEBG@Z */
2350
MSVCP_bool __cdecl MSVCP_basic_string_wchar_lower_bstr_cstr(
2351 2352
        const basic_string_wchar *left, const wchar_t *right)
{
2353
    return MSVCP_basic_string_wchar_compare_cstr(left, right) < 0;
2354 2355 2356 2357 2358 2359
}

/* ??$?MGU?$char_traits@G@std@@V?$allocator@G@1@@std@@YA_NPBGABV?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@0@@Z */
/* ??$?MGU?$char_traits@G@std@@V?$allocator@G@1@@std@@YA_NPEBGAEBV?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@0@@Z */
/* ??Mstd@@YA_NPBGABV?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@0@@Z */
/* ??Mstd@@YA_NPEBGAEBV?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@0@@Z */
2360
MSVCP_bool __cdecl MSVCP_basic_string_wchar_lower_cstr_bstr(
2361 2362
        const wchar_t *left, const basic_string_wchar *right)
{
2363
    return MSVCP_basic_string_wchar_compare_cstr(right, left) > 0;
2364 2365 2366 2367 2368 2369
}

/* ??$?NGU?$char_traits@G@std@@V?$allocator@G@1@@std@@YA_NABV?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@0@0@Z */
/* ??$?NGU?$char_traits@G@std@@V?$allocator@G@1@@std@@YA_NAEBV?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@0@0@Z */
/* ??Nstd@@YA_NABV?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@0@0@Z */
/* ??Nstd@@YA_NAEBV?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@0@0@Z */
2370
MSVCP_bool __cdecl MSVCP_basic_string_wchar_leq(
2371 2372
        const basic_string_wchar *left, const basic_string_wchar *right)
{
2373
    return MSVCP_basic_string_wchar_compare(left, right) <= 0;
2374 2375 2376 2377 2378 2379
}

/* ??$?NGU?$char_traits@G@std@@V?$allocator@G@1@@std@@YA_NABV?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@0@PBG@Z */
/* ??$?NGU?$char_traits@G@std@@V?$allocator@G@1@@std@@YA_NAEBV?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@0@PEBG@Z */
/* ??Nstd@@YA_NABV?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@0@PBG@Z */
/* ??Nstd@@YA_NAEBV?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@0@PEBG@Z */
2380
MSVCP_bool __cdecl MSVCP_basic_string_wchar_leq_bstr_cstr(
2381 2382
        const basic_string_wchar *left, const wchar_t *right)
{
2383
    return MSVCP_basic_string_wchar_compare_cstr(left, right) <= 0;
2384 2385 2386 2387 2388 2389
}

/* ??$?NGU?$char_traits@G@std@@V?$allocator@G@1@@std@@YA_NPBGABV?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@0@@Z */
/* ??$?NGU?$char_traits@G@std@@V?$allocator@G@1@@std@@YA_NPEBGAEBV?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@0@@Z */
/* ??Nstd@@YA_NPBGABV?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@0@@Z */
/* ??Nstd@@YA_NPEBGAEBV?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@0@@Z */
2390
MSVCP_bool __cdecl MSVCP_basic_string_wchar_leq_cstr_bstr(
2391 2392
        const wchar_t *left, const basic_string_wchar *right)
{
2393
    return MSVCP_basic_string_wchar_compare_cstr(right, left) >= 0;
2394 2395 2396 2397 2398 2399
}

/* ??$?OGU?$char_traits@G@std@@V?$allocator@G@1@@std@@YA_NABV?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@0@0@Z */
/* ??$?OGU?$char_traits@G@std@@V?$allocator@G@1@@std@@YA_NAEBV?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@0@0@Z */
/* ??Ostd@@YA_NABV?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@0@0@Z */
/* ??Ostd@@YA_NAEBV?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@0@0@Z */
2400
MSVCP_bool __cdecl MSVCP_basic_string_wchar_greater(
2401 2402
        const basic_string_wchar *left, const basic_string_wchar *right)
{
2403
    return MSVCP_basic_string_wchar_compare(left, right) > 0;
2404 2405 2406 2407 2408 2409
}

/* ??$?OGU?$char_traits@G@std@@V?$allocator@G@1@@std@@YA_NABV?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@0@PBG@Z */
/* ??$?OGU?$char_traits@G@std@@V?$allocator@G@1@@std@@YA_NAEBV?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@0@PEBG@Z */
/* ??Ostd@@YA_NABV?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@0@PBG@Z */
/* ??Ostd@@YA_NAEBV?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@0@PEBG@Z */
2410
MSVCP_bool __cdecl MSVCP_basic_string_wchar_greater_bstr_cstr(
2411 2412
        const basic_string_wchar *left, const wchar_t *right)
{
2413
    return MSVCP_basic_string_wchar_compare_cstr(left, right) > 0;
2414 2415 2416 2417 2418 2419
}

/* ??$?OGU?$char_traits@G@std@@V?$allocator@G@1@@std@@YA_NPBGABV?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@0@@Z */
/* ??$?OGU?$char_traits@G@std@@V?$allocator@G@1@@std@@YA_NPEBGAEBV?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@0@@Z */
/* ??Ostd@@YA_NPBGABV?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@0@@Z */
/* ??Ostd@@YA_NPEBGAEBV?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@0@@Z */
2420
MSVCP_bool __cdecl MSVCP_basic_string_wchar_greater_cstr_bstr(
2421 2422
        const wchar_t *left, const basic_string_wchar *right)
{
2423
    return MSVCP_basic_string_wchar_compare_cstr(right, left) < 0;
2424 2425 2426 2427 2428 2429
}

/* ??$?PGU?$char_traits@G@std@@V?$allocator@G@1@@std@@YA_NABV?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@0@0@Z */
/* ??$?PGU?$char_traits@G@std@@V?$allocator@G@1@@std@@YA_NAEBV?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@0@0@Z */
/* ??Pstd@@YA_NABV?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@0@0@Z */
/* ??Pstd@@YA_NAEBV?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@0@0@Z */
2430
MSVCP_bool __cdecl MSVCP_basic_string_wchar_geq(
2431 2432
        const basic_string_wchar *left, const basic_string_wchar *right)
{
2433
    return MSVCP_basic_string_wchar_compare(left, right) >= 0;
2434 2435 2436 2437 2438 2439
}

/* ??$?PGU?$char_traits@G@std@@V?$allocator@G@1@@std@@YA_NABV?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@0@PBG@Z */
/* ??$?PGU?$char_traits@G@std@@V?$allocator@G@1@@std@@YA_NAEBV?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@0@PEBG@Z */
/* ??Pstd@@YA_NABV?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@0@PBG@Z */
/* ??Pstd@@YA_NAEBV?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@0@PEBG@Z */
2440
MSVCP_bool __cdecl MSVCP_basic_string_wchar_geq_bstr_cstr(
2441 2442
        const basic_string_wchar *left, const wchar_t *right)
{
2443
    return MSVCP_basic_string_wchar_compare_cstr(left, right) >= 0;
2444 2445 2446 2447 2448 2449
}

/* ??$?PGU?$char_traits@G@std@@V?$allocator@G@1@@std@@YA_NPBGABV?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@0@@Z */
/* ??$?PGU?$char_traits@G@std@@V?$allocator@G@1@@std@@YA_NPEBGAEBV?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@0@@Z */
/* ??Pstd@@YA_NPBGABV?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@0@@Z */
/* ??Pstd@@YA_NPEBGAEBV?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@0@@Z */
2450
MSVCP_bool __cdecl MSVCP_basic_string_wchar_geq_cstr_bstr(
2451 2452
        const wchar_t *left, const basic_string_wchar *right)
{
2453
    return MSVCP_basic_string_wchar_compare_cstr(right, left) <= 0;
2454 2455 2456 2457
}

/* ?find@?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QBEIPBGII@Z */
/* ?find@?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QEBA_KPEBG_K1@Z */
2458 2459
DEFINE_THISCALL_WRAPPER(MSVCP_basic_string_wchar_find_cstr_substr, 16)
MSVCP_size_t __thiscall MSVCP_basic_string_wchar_find_cstr_substr(
2460 2461 2462 2463
        const basic_string_wchar *this, const wchar_t *find, MSVCP_size_t pos, MSVCP_size_t len)
{
    const wchar_t *p, *end;

2464
    TRACE("%p %s %lu %lu\n", this, debugstr_wn(find, len), pos, len);
2465 2466 2467

    if(len==0 && pos<=this->size)
        return pos;
2468
    if(pos>=this->size || len>this->size)
2469
        return MSVCP_basic_string_wchar_npos;
2470 2471 2472

    end = this->ptr+this->size-len+1;
    for(p=this->ptr+pos; p<end; p++) {
2473
        p = MSVCP_char_traits_wchar_find(p, end-p, find);
2474 2475 2476
        if(!p)
            break;

2477
        if(!MSVCP_char_traits_wchar_compare(p, find, len))
2478 2479 2480
            return p-this->ptr;
    }

2481
    return MSVCP_basic_string_wchar_npos;
2482 2483 2484 2485
}

/* ?find@?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QBEIABV12@I@Z */
/* ?find@?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QEBA_KAEBV12@_K@Z */
2486 2487
DEFINE_THISCALL_WRAPPER(MSVCP_basic_string_wchar_find_off, 12)
MSVCP_size_t __thiscall MSVCP_basic_string_wchar_find_off(
2488 2489
        const basic_string_wchar *this, const basic_string_wchar *find, MSVCP_size_t off)
{
2490
    return MSVCP_basic_string_wchar_find_cstr_substr(this, find->ptr, off, find->size);
2491 2492 2493 2494
}

/* ?find@?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QBEIGI@Z */
/* ?find@?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QEBA_KG_K@Z */
2495 2496
DEFINE_THISCALL_WRAPPER(MSVCP_basic_string_wchar_find_ch, 12)
MSVCP_size_t __thiscall MSVCP_basic_string_wchar_find_ch(
2497 2498
        const basic_string_wchar *this, wchar_t ch, MSVCP_size_t pos)
{
2499
    return MSVCP_basic_string_wchar_find_cstr_substr(this, &ch, pos, 1);
2500 2501 2502 2503
}

/* ?find@?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QBEIPBGI@Z */
/* ?find@?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QEBA_KPEBG_K@Z */
2504 2505
DEFINE_THISCALL_WRAPPER(MSVCP_basic_string_wchar_find_cstr_off, 12)
MSVCP_size_t __thiscall MSVCP_basic_string_wchar_find_cstr_off(
2506 2507
        const basic_string_wchar *this, const wchar_t *find, MSVCP_size_t pos)
{
2508
    return MSVCP_basic_string_wchar_find_cstr_substr(this, find, pos,
2509
            MSVCP_char_traits_wchar_length(find));
2510 2511 2512 2513
}

/* ?rfind@?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QBEIPBGII@Z */
/* ?rfind@?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QEBA_KPEBG_K1@Z */
2514 2515
DEFINE_THISCALL_WRAPPER(MSVCP_basic_string_wchar_rfind_cstr_substr, 16)
MSVCP_size_t __thiscall MSVCP_basic_string_wchar_rfind_cstr_substr(
2516 2517 2518 2519
        const basic_string_wchar *this, const wchar_t *find, MSVCP_size_t pos, MSVCP_size_t len)
{
    const wchar_t *p, *end;

2520
    TRACE("%p %s %lu %lu\n", this, debugstr_wn(find, len), pos, len);
2521 2522 2523 2524 2525

    if(len==0)
        return pos<this->size ? pos : this->size;

    if(len > this->size)
2526
        return MSVCP_basic_string_wchar_npos;
2527

2528 2529
    if(pos > this->size-len)
        pos = this->size-len;
2530
    end = this->ptr;
2531
    for(p=end+pos; p>=end; p--) {
2532
        if(*p==*find && !MSVCP_char_traits_wchar_compare(p, find, len))
2533 2534 2535
            return p-this->ptr;
    }

2536
    return MSVCP_basic_string_wchar_npos;
2537 2538 2539 2540
}

/* ?rfind@?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QBEIABV12@I@Z */
/* ?rfind@?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QEBA_KAEBV12@_K@Z */
2541 2542
DEFINE_THISCALL_WRAPPER(MSVCP_basic_string_wchar_rfind_off, 12)
MSVCP_size_t __thiscall MSVCP_basic_string_wchar_rfind_off(
2543 2544
        const basic_string_wchar *this, const basic_string_wchar *find, MSVCP_size_t off)
{
2545
    return MSVCP_basic_string_wchar_rfind_cstr_substr(this, find->ptr, off, find->size);
2546 2547 2548 2549
}

/* ?rfind@?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QBEIGI@Z */
/* ?rfind@?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QEBA_KG_K@Z */
2550 2551
DEFINE_THISCALL_WRAPPER(MSVCP_basic_string_wchar_rfind_ch, 12)
MSVCP_size_t __thiscall MSVCP_basic_string_wchar_rfind_ch(
2552 2553
        const basic_string_wchar *this, wchar_t ch, MSVCP_size_t pos)
{
2554
    return MSVCP_basic_string_wchar_rfind_cstr_substr(this, &ch, pos, 1);
2555 2556 2557 2558
}

/* ?rfind@?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QBEIPBGI@Z */
/* ?rfind@?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QEBA_KPEBG_K@Z */
2559 2560
DEFINE_THISCALL_WRAPPER(MSVCP_basic_string_wchar_rfind_cstr_off, 12)
MSVCP_size_t __thiscall MSVCP_basic_string_wchar_rfind_cstr_off(
2561 2562
        const basic_string_wchar *this, const wchar_t *find, MSVCP_size_t pos)
{
2563
    return MSVCP_basic_string_wchar_rfind_cstr_substr(this, find, pos,
2564
            MSVCP_char_traits_wchar_length(find));
2565 2566 2567 2568
}

/* ?find_first_not_of@?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QBEIPBGII@Z */
/* ?find_first_not_of@?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QEBA_KPEBG_K1@Z */
2569 2570
DEFINE_THISCALL_WRAPPER(MSVCP_basic_string_wchar_find_first_not_of_cstr_substr, 16)
MSVCP_size_t __thiscall MSVCP_basic_string_wchar_find_first_not_of_cstr_substr(
2571 2572 2573 2574 2575 2576 2577 2578 2579
        const basic_string_wchar *this, const wchar_t *find, MSVCP_size_t off, MSVCP_size_t len)
{
    const wchar_t *p, *end;

    TRACE("%p %p %lu %lu\n", this, find, off, len);

    if(off<this->size) {
        end = this->ptr+this->size;
        for(p=this->ptr+off; p<end; p++)
2580
            if(!MSVCP_char_traits_wchar_find(find, len, p))
2581 2582 2583
                return p-this->ptr;
    }

2584
    return MSVCP_basic_string_wchar_npos;
2585 2586 2587 2588
}

/* ?find_first_not_of@?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QBEIABV12@I@Z */
/* ?find_first_not_of@?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QEBA_KAEBV12@_K@Z */
2589 2590
DEFINE_THISCALL_WRAPPER(MSVCP_basic_string_wchar_find_first_not_of, 12)
MSVCP_size_t __thiscall MSVCP_basic_string_wchar_find_first_not_of(
2591 2592
        const basic_string_wchar *this, const basic_string_wchar *find, MSVCP_size_t off)
{
2593
    return MSVCP_basic_string_wchar_find_first_not_of_cstr_substr(this,
2594 2595 2596 2597 2598
            find->ptr, off, find->size);
}

/* ?find_first_not_of@?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QBEIGI@Z */
/* ?find_first_not_of@?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QEBA_KG_K@Z */
2599 2600
DEFINE_THISCALL_WRAPPER(MSVCP_basic_string_wchar_find_first_not_of_ch, 12)
MSVCP_size_t __thiscall MSVCP_basic_string_wchar_find_first_not_of_ch(
2601 2602
        const basic_string_wchar *this, wchar_t ch, MSVCP_size_t off)
{
2603
    return MSVCP_basic_string_wchar_find_first_not_of_cstr_substr(this, &ch, off, 1);
2604 2605 2606 2607
}

/* ?find_first_not_of@?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QBEIPBGI@Z */
/* ?find_first_not_of@?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QEBA_KPEBG_K@Z */
2608 2609
DEFINE_THISCALL_WRAPPER(MSVCP_basic_string_wchar_find_first_not_of_cstr, 12)
MSVCP_size_t __thiscall MSVCP_basic_string_wchar_find_first_not_of_cstr(
2610 2611
        const basic_string_wchar *this, const wchar_t *find, MSVCP_size_t off)
{
2612
    return MSVCP_basic_string_wchar_find_first_not_of_cstr_substr(
2613
            this, find, off, MSVCP_char_traits_wchar_length(find));
2614 2615 2616 2617
}

/* ?find_first_of@?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QBEIPBGII@Z */
/* ?find_first_of@?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QEBA_KPEBG_K1@Z */
2618 2619
DEFINE_THISCALL_WRAPPER(MSVCP_basic_string_wchar_find_first_of_cstr_substr, 16)
MSVCP_size_t __thiscall MSVCP_basic_string_wchar_find_first_of_cstr_substr(
2620 2621 2622 2623 2624 2625 2626 2627 2628
        const basic_string_wchar *this, const wchar_t *find, MSVCP_size_t off, MSVCP_size_t len)
{
    const wchar_t *p, *end;

    TRACE("%p %p %lu %lu\n", this, find, off, len);

    if(len>0 && off<this->size) {
        end = this->ptr+this->size;
        for(p=this->ptr+off; p<end; p++)
2629
            if(MSVCP_char_traits_wchar_find(find, len, p))
2630 2631 2632
                return p-this->ptr;
    }

2633
    return MSVCP_basic_string_wchar_npos;
2634 2635 2636 2637
}

/* ?find_first_of@?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QBEIABV12@I@Z */
/* ?find_first_of@?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QEBA_KAEBV12@_K@Z */
2638 2639
DEFINE_THISCALL_WRAPPER(MSVCP_basic_string_wchar_find_first_of, 12)
MSVCP_size_t __thiscall MSVCP_basic_string_wchar_find_first_of(
2640 2641
        const basic_string_wchar *this, const basic_string_wchar *find, MSVCP_size_t off)
{
2642
    return MSVCP_basic_string_wchar_find_first_of_cstr_substr(this,
2643 2644 2645 2646 2647
            find->ptr, off, find->size);
}

/* ?find_first_of@?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QBEIGI@Z */
/* ?find_first_of@?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QEBA_KG_K@Z */
2648 2649
DEFINE_THISCALL_WRAPPER(MSVCP_basic_string_wchar_find_first_of_ch, 12)
MSVCP_size_t __thiscall MSVCP_basic_string_wchar_find_first_of_ch(
2650 2651
        const basic_string_wchar *this, wchar_t ch, MSVCP_size_t off)
{
2652
    return MSVCP_basic_string_wchar_find_first_of_cstr_substr(this, &ch, off, 1);
2653 2654 2655 2656
}

/* ?find_first_of@?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QBEIPBGI@Z */
/* ?find_first_of@?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QEBA_KPEBG_K@Z */
2657 2658
DEFINE_THISCALL_WRAPPER(MSVCP_basic_string_wchar_find_first_of_cstr, 12)
MSVCP_size_t __thiscall MSVCP_basic_string_wchar_find_first_of_cstr(
2659 2660
        const basic_string_wchar *this, const wchar_t *find, MSVCP_size_t off)
{
2661
    return MSVCP_basic_string_wchar_find_first_of_cstr_substr(
2662
            this, find, off, MSVCP_char_traits_wchar_length(find));
2663 2664 2665 2666
}

/* ?find_last_not_of@?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QBEIPBGII@Z */
/* ?find_last_not_of@?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QEBA_KPEBG_K1@Z */
2667 2668
DEFINE_THISCALL_WRAPPER(MSVCP_basic_string_wchar_find_last_not_of_cstr_substr, 16)
MSVCP_size_t __thiscall MSVCP_basic_string_wchar_find_last_not_of_cstr_substr(
2669 2670 2671 2672 2673 2674 2675 2676 2677 2678 2679 2680
        const basic_string_wchar *this, const wchar_t *find, MSVCP_size_t off, MSVCP_size_t len)
{
    const wchar_t *p, *beg;

    TRACE("%p %p %lu %lu\n", this, find, off, len);

    if(len>0 && this->size>0) {
        if(off >= this->size)
            off = this->size-1;

        beg = this->ptr;
        for(p=beg+off; p>=beg; p--)
2681
            if(!MSVCP_char_traits_wchar_find(find, len, p))
2682 2683 2684
                return p-beg;
    }

2685
    return MSVCP_basic_string_wchar_npos;
2686 2687 2688 2689
}

/* ?find_last_not_of@?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QBEIABV12@I@Z */
/* ?find_last_not_of@?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QEBA_KAEBV12@_K@Z */
2690 2691
DEFINE_THISCALL_WRAPPER(MSVCP_basic_string_wchar_find_last_not_of, 12)
MSVCP_size_t __thiscall MSVCP_basic_string_wchar_find_last_not_of(
2692 2693
        const basic_string_wchar *this, const basic_string_wchar *find, MSVCP_size_t off)
{
2694
    return MSVCP_basic_string_wchar_find_last_not_of_cstr_substr(this,
2695 2696 2697 2698 2699
            find->ptr, off, find->size);
}

/* ?find_last_not_of@?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QBEIGI@Z */
/* ?find_last_not_of@?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QEBA_KG_K@Z */
2700 2701
DEFINE_THISCALL_WRAPPER(MSVCP_basic_string_wchar_find_last_not_of_ch, 12)
MSVCP_size_t __thiscall MSVCP_basic_string_wchar_find_last_not_of_ch(
2702 2703
        const basic_string_wchar *this, wchar_t ch, MSVCP_size_t off)
{
2704
    return MSVCP_basic_string_wchar_find_last_not_of_cstr_substr(this, &ch, off, 1);
2705 2706 2707 2708
}

/* ?find_last_not_of@?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QBEIPBGI@Z */
/* ?find_last_not_of@?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QEBA_KPEBG_K@Z */
2709 2710
DEFINE_THISCALL_WRAPPER(MSVCP_basic_string_wchar_find_last_not_of_cstr, 12)
MSVCP_size_t __thiscall MSVCP_basic_string_wchar_find_last_not_of_cstr(
2711 2712
        const basic_string_wchar *this, const wchar_t *find, MSVCP_size_t off)
{
2713
    return MSVCP_basic_string_wchar_find_last_not_of_cstr_substr(
2714
            this, find, off, MSVCP_char_traits_wchar_length(find));
2715 2716 2717 2718
}

/* ?find_last_of@?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QBEIPBGII@Z */
/* ?find_last_of@?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QEBA_KPEBG_K1@Z */
2719 2720
DEFINE_THISCALL_WRAPPER(MSVCP_basic_string_wchar_find_last_of_cstr_substr, 16)
MSVCP_size_t __thiscall MSVCP_basic_string_wchar_find_last_of_cstr_substr(
2721 2722 2723 2724 2725 2726 2727 2728 2729 2730 2731 2732
        const basic_string_wchar *this, const wchar_t *find, MSVCP_size_t off, MSVCP_size_t len)
{
    const wchar_t *p, *beg;

    TRACE("%p %p %lu %lu\n", this, find, off, len);

    if(len>0 && this->size>0) {
        if(off >= this->size)
            off = this->size-1;

        beg = this->ptr;
        for(p=beg+off; p>=beg; p--)
2733
            if(MSVCP_char_traits_wchar_find(find, len, p))
2734 2735 2736
                return p-beg;
    }

2737
    return MSVCP_basic_string_wchar_npos;
2738 2739 2740 2741
}

/* ?find_last_of@?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QBEIABV12@I@Z */
/* ?find_last_of@?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QEBA_KAEBV12@_K@Z */
2742 2743
DEFINE_THISCALL_WRAPPER(MSVCP_basic_string_wchar_find_last_of, 12)
MSVCP_size_t __thiscall MSVCP_basic_string_wchar_find_last_of(
2744 2745
        const basic_string_wchar *this, const basic_string_wchar *find, MSVCP_size_t off)
{
2746
    return MSVCP_basic_string_wchar_find_last_of_cstr_substr(this,
2747 2748 2749 2750 2751
            find->ptr, off, find->size);
}

/* ?find_last_of@?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QBEIGI@Z */
/* ?find_last_of@?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QEBA_KG_K@Z */
2752 2753
DEFINE_THISCALL_WRAPPER(MSVCP_basic_string_wchar_find_last_of_ch, 12)
MSVCP_size_t __thiscall MSVCP_basic_string_wchar_find_last_of_ch(
2754 2755
        const basic_string_wchar *this, wchar_t ch, MSVCP_size_t off)
{
2756
    return MSVCP_basic_string_wchar_find_last_of_cstr_substr(this, &ch, off, 1);
2757 2758 2759 2760
}

/* ?find_last_of@?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QBEIPBGI@Z */
/* ?find_last_of@?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QEBA_KPEBG_K@Z */
2761 2762
DEFINE_THISCALL_WRAPPER(MSVCP_basic_string_wchar_find_last_of_cstr, 12)
MSVCP_size_t __thiscall MSVCP_basic_string_wchar_find_last_of_cstr(
2763 2764
        const basic_string_wchar *this, const wchar_t *find, MSVCP_size_t off)
{
2765
    return MSVCP_basic_string_wchar_find_last_of_cstr_substr(
2766
            this, find, off, MSVCP_char_traits_wchar_length(find));
2767 2768 2769 2770
}

/* ?append@?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QAEAAV12@ABV12@II@Z */
/* ?append@?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QEAAAEAV12@AEBV12@_K1@Z */
2771 2772
DEFINE_THISCALL_WRAPPER(MSVCP_basic_string_wchar_append_substr, 16)
basic_string_wchar* __thiscall MSVCP_basic_string_wchar_append_substr(basic_string_wchar *this,
2773 2774 2775 2776 2777 2778 2779 2780 2781 2782
        const basic_string_wchar *append, MSVCP_size_t offset, MSVCP_size_t count)
{
    TRACE("%p %p %lu %lu\n", this, append, offset, count);

    if(append->size < offset)
        _Xran();

    if(count > append->size-offset)
        count = append->size-offset;

2783
    if(MSVCP_basic_string_wchar_npos-this->size<=count || this->size+count<this->size)
2784 2785 2786
        _Xlen();

    if(basic_string_wchar__Grow(this, this->size+count, FALSE)) {
2787
        if(append->ptr)
2788
            MSVCP_char_traits_wchar__Copy_s(this->ptr+this->size, this->res-this->size,
2789
                    append->ptr+offset, count);
2790 2791 2792 2793 2794 2795 2796 2797
        basic_string_wchar__Eos(this, this->size+count);
    }

    return this;
}

/* ?append@?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QAEAAV12@PBGI@Z */
/* ?append@?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QEAAAEAV12@PEBG_K@Z */
2798 2799
DEFINE_THISCALL_WRAPPER(MSVCP_basic_string_wchar_append_cstr_len, 12)
basic_string_wchar* __thiscall MSVCP_basic_string_wchar_append_cstr_len(
2800 2801
        basic_string_wchar *this, const wchar_t *append, MSVCP_size_t count)
{
2802
    TRACE("%p %s %lu\n", this, debugstr_wn(append, count), count);
2803 2804

    if(basic_string_wchar_inside(this, append))
2805
        return MSVCP_basic_string_wchar_append_substr(this, this, append-this->ptr, count);
2806

2807
    if(MSVCP_basic_string_wchar_npos-this->size<=count || this->size+count<this->size)
2808 2809 2810
        _Xlen();

    if(basic_string_wchar__Grow(this, this->size+count, FALSE)) {
2811
        MSVCP_char_traits_wchar__Copy_s(this->ptr+this->size,
2812 2813 2814 2815 2816 2817 2818 2819 2820
                this->res-this->size, append, count);
        basic_string_wchar__Eos(this, this->size+count);
    }

    return this;
}

/* ?append@?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QAEAAV12@IG@Z */
/* ?append@?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QEAAAEAV12@_KG@Z */
2821 2822
DEFINE_THISCALL_WRAPPER(MSVCP_basic_string_wchar_append_len_ch, 12)
basic_string_wchar* __thiscall MSVCP_basic_string_wchar_append_len_ch(
2823 2824 2825 2826
        basic_string_wchar *this, MSVCP_size_t count, wchar_t ch)
{
    TRACE("%p %lu %c\n", this, count, ch);

2827
    if(MSVCP_basic_string_wchar_npos-this->size <= count)
2828 2829 2830
        _Xlen();

    if(basic_string_wchar__Grow(this, this->size+count, FALSE)) {
2831
        MSVCP_char_traits_wchar_assignn(this->ptr+this->size, count, ch);
2832 2833 2834 2835 2836 2837 2838 2839 2840 2841
        basic_string_wchar__Eos(this, this->size+count);
    }

    return this;
}

/* ?append@?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QAEAAV12@ABV12@@Z */
/* ?append@?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QEAAAEAV12@AEBV12@@Z */
/* ??Y?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QAEAAV01@ABV01@@Z */
/* ??Y?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QEAAAEAV01@AEBV01@@Z */
2842 2843
DEFINE_THISCALL_WRAPPER(MSVCP_basic_string_wchar_append, 8)
basic_string_wchar* __thiscall MSVCP_basic_string_wchar_append(
2844 2845
        basic_string_wchar *this, const basic_string_wchar *append)
{
2846 2847
    return MSVCP_basic_string_wchar_append_substr(this, append,
            0, MSVCP_basic_string_wchar_npos);
2848 2849 2850 2851
}

/* ??Y?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QAEAAV01@G@Z */
/* ??Y?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QEAAAEAV01@G@Z */
2852 2853
DEFINE_THISCALL_WRAPPER(MSVCP_basic_string_wchar_append_ch, 8)
basic_string_wchar* __thiscall MSVCP_basic_string_wchar_append_ch(
2854 2855
        basic_string_wchar *this, wchar_t ch)
{
2856
    return MSVCP_basic_string_wchar_append_len_ch(this, 1, ch);
2857 2858 2859 2860
}

/* ?append@?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QAEAAV12@PBG0@Z */
/* ?append@?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QEAAAEAV12@PEBG0@Z */
2861 2862
DEFINE_THISCALL_WRAPPER(MSVCP_basic_string_wchar_append_beg_end, 12)
basic_string_wchar* __thiscall MSVCP_basic_string_wchar_append_beg_end(
2863 2864
        basic_string_wchar *this, const wchar_t *beg, const wchar_t *end)
{
2865
    return MSVCP_basic_string_wchar_append_cstr_len(this, beg, end-beg);
2866 2867 2868 2869 2870 2871
}

/* ?append@?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QAEAAV12@PBG@Z */
/* ?append@?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QEAAAEAV12@PEBG@Z */
/* ??Y?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QAEAAV01@PBG@Z */
/* ??Y?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QEAAAEAV01@PEBG@Z */
2872 2873
DEFINE_THISCALL_WRAPPER(MSVCP_basic_string_wchar_append_cstr, 8)
basic_string_wchar* __thiscall MSVCP_basic_string_wchar_append_cstr(
2874 2875
        basic_string_wchar *this, const wchar_t *append)
{
2876
    return MSVCP_basic_string_wchar_append_cstr_len(this, append,
2877
            MSVCP_char_traits_wchar_length(append));
2878 2879 2880 2881 2882
}
/* ??$?HGU?$char_traits@G@std@@V?$allocator@G@1@@std@@YA?AV?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@0@ABV10@0@Z */
/* ??$?HGU?$char_traits@G@std@@V?$allocator@G@1@@std@@YA?AV?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@0@AEBV10@0@Z */
/* ??Hstd@@YA?AV?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@0@ABV10@0@Z */
/* ??Hstd@@YA?AV?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@0@AEBV10@0@Z */
2883
basic_string_wchar* __cdecl MSVCP_basic_string_wchar_concatenate(basic_string_wchar *ret,
2884 2885 2886 2887
        const basic_string_wchar *left, const basic_string_wchar *right)
{
    TRACE("%p %p\n", left, right);

2888 2889
    MSVCP_basic_string_wchar_copy_ctor(ret, left);
    MSVCP_basic_string_wchar_append(ret, right);
2890 2891 2892 2893 2894 2895 2896
    return ret;
}

/* ??$?HGU?$char_traits@G@std@@V?$allocator@G@1@@std@@YA?AV?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@0@ABV10@G@Z */
/* ??$?HGU?$char_traits@G@std@@V?$allocator@G@1@@std@@YA?AV?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@0@AEBV10@G@Z */
/* ??Hstd@@YA?AV?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@0@ABV10@G@Z */
/* ??Hstd@@YA?AV?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@0@AEBV10@G@Z */
2897
basic_string_wchar* __cdecl MSVCP_basic_string_wchar_concatenate_bstr_ch(basic_string_wchar *ret,
2898 2899 2900 2901
        const basic_string_wchar *left, wchar_t right)
{
    TRACE("%p %c\n", left, right);

2902
    MSVCP_basic_string_wchar_copy_ctor(ret, left);
2903
    MSVCP_basic_string_wchar_append_ch(ret, right);
2904 2905 2906 2907 2908 2909 2910
    return ret;
}

/* ??$?HGU?$char_traits@G@std@@V?$allocator@G@1@@std@@YA?AV?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@0@ABV10@PBG@Z */
/* ??$?HGU?$char_traits@G@std@@V?$allocator@G@1@@std@@YA?AV?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@0@AEBV10@PEBG@Z */
/* ??Hstd@@YA?AV?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@0@ABV10@PBG@Z */
/* ??Hstd@@YA?AV?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@0@AEBV10@PEBG@Z */
2911
basic_string_wchar* __cdecl MSVCP_basic_string_wchar_concatenate_bstr_cstr(basic_string_wchar *ret,
2912 2913 2914 2915
        const basic_string_wchar *left, const wchar_t *right)
{
    TRACE("%p %s\n", left, debugstr_w(right));

2916 2917
    MSVCP_basic_string_wchar_copy_ctor(ret, left);
    MSVCP_basic_string_wchar_append_cstr(ret, right);
2918 2919 2920 2921 2922 2923 2924
    return ret;
}

/* ??$?HGU?$char_traits@G@std@@V?$allocator@G@1@@std@@YA?AV?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@0@GABV10@@Z */
/* ??$?HGU?$char_traits@G@std@@V?$allocator@G@1@@std@@YA?AV?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@0@GAEBV10@@Z */
/* ??Hstd@@YA?AV?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@0@GABV10@@Z */
/* ??Hstd@@YA?AV?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@0@GAEBV10@@Z */
2925
basic_string_wchar* __cdecl MSVCP_basic_string_wchar_concatenate_ch_bstr(basic_string_wchar *ret,
2926 2927 2928 2929
        wchar_t left, const basic_string_wchar *right)
{
    TRACE("%c %p\n", left, right);

2930 2931
    MSVCP_basic_string_wchar_ctor_cstr_len_alloc(ret, &left, 1, NULL);
    MSVCP_basic_string_wchar_append(ret, right);
2932 2933 2934 2935 2936 2937 2938
    return ret;
}

/* ??$?HGU?$char_traits@G@std@@V?$allocator@G@1@@std@@YA?AV?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@0@PBGABV10@@Z */
/* ??$?HGU?$char_traits@G@std@@V?$allocator@G@1@@std@@YA?AV?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@0@PEBGAEBV10@@Z */
/* ??Hstd@@YA?AV?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@0@PBGABV10@@Z */
/* ??Hstd@@YA?AV?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@0@PEBGAEBV10@@Z */
2939
basic_string_wchar* __cdecl MSVCP_basic_string_wchar_concatenate_cstr_bstr(basic_string_wchar *ret,
2940 2941 2942 2943
        const wchar_t *left, const basic_string_wchar *right)
{
    TRACE("%s %p\n", debugstr_w(left), right);

2944 2945
    MSVCP_basic_string_wchar_ctor_cstr_alloc(ret, left, NULL);
    MSVCP_basic_string_wchar_append(ret, right);
2946 2947 2948 2949 2950
    return ret;
}

/* ??A?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QAEAAGI@Z */
/* ??A?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QEAAAEAG_K@Z */
2951 2952
DEFINE_THISCALL_WRAPPER(MSVCP_basic_string_wchar_operator_at, 8)
wchar_t* __thiscall MSVCP_basic_string_wchar_operator_at(
2953 2954 2955 2956
        basic_string_wchar *this, MSVCP_size_t pos)
{
    TRACE("%p %lu\n", this, pos);

2957 2958 2959 2960 2961 2962 2963 2964 2965 2966 2967 2968 2969 2970 2971 2972 2973
    if(!this->ptr || pos>this->size)
        return (wchar_t*)basic_string_wchar__Nullstr();

    basic_string_wchar__Freeze(this);
    return this->ptr+pos;
}

/* ??A?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QBEABGI@Z */
/* ??A?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QEBAAEBG_K@Z */
DEFINE_THISCALL_WRAPPER(MSVCP_basic_string_wchar_operator_at_const, 8)
const wchar_t* __thiscall MSVCP_basic_string_wchar_operator_at_const(
        const basic_string_wchar *this, MSVCP_size_t pos)
{
    TRACE("%p %lu\n", this, pos);

    if(!this->ptr)
        return basic_string_wchar__Nullstr();
2974 2975 2976 2977 2978 2979 2980
    return this->ptr+pos;
}

/* ?at@?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QAEAAGI@Z */
/* ?at@?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QEAAAEAG_K@Z */
/* ?at@?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QBEABGI@Z */
/* ?at@?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QEBAAEBG_K@Z */
2981 2982
DEFINE_THISCALL_WRAPPER(MSVCP_basic_string_wchar_at, 8)
wchar_t* __thiscall MSVCP_basic_string_wchar_at(
2983 2984 2985 2986 2987 2988 2989 2990 2991 2992 2993 2994 2995 2996 2997 2998 2999 3000 3001 3002 3003 3004 3005 3006
        basic_string_wchar *this, MSVCP_size_t pos)
{
    TRACE("%p %lu\n", this, pos);

    if(this->size <= pos)
        _Xran();

    return this->ptr+pos;
}

/* ?replace@?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QAEAAV12@IIPBGI@Z */
/* ?replace@?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QEAAAEAV12@_K0PEBG0@Z */
DEFINE_THISCALL_WRAPPER(basic_string_wchar_replace_cstr_len, 20)
basic_string_wchar* __thiscall basic_string_wchar_replace_cstr_len(basic_string_wchar *this,
        MSVCP_size_t off, MSVCP_size_t len, const wchar_t *str, MSVCP_size_t str_len)
{
    MSVCP_size_t inside_pos = -1;
    wchar_t *ptr = this->ptr;

    TRACE("%p %ld %ld %p %ld\n", this, off, len, str, str_len);

    if(this->size < off)
        _Xran();

3007
    if(len > this->size-off)
3008 3009
        len = this->size-off;

3010
    if(MSVCP_basic_string_wchar_npos-str_len <= this->size-len)
3011 3012 3013 3014 3015 3016 3017 3018 3019 3020 3021 3022 3023 3024 3025 3026 3027 3028 3029 3030 3031 3032 3033 3034 3035 3036 3037 3038 3039 3040 3041 3042 3043
        _Xlen();

    if(basic_string_wchar_inside(this, str))
        inside_pos = str-ptr;

    if(this->size-len+str_len)
        basic_string_wchar__Grow(this, this->size-len+str_len, FALSE);
    ptr = this->ptr;

    if(inside_pos == -1) {
        memmove(ptr+off+str_len, ptr+off+len, (this->size-off-len)*sizeof(char));
        memcpy(ptr+off, str, str_len*sizeof(char));
    } else if(len >= str_len) {
        memmove(ptr+off, ptr+inside_pos, str_len*sizeof(char));
        memmove(ptr+off+str_len, ptr+off+len, (this->size-off-len)*sizeof(char));
    } else {
        MSVCP_size_t size;

        memmove(ptr+off+str_len, ptr+off+len, (this->size-off-len)*sizeof(char));

        if(inside_pos < off+len) {
            size = off+len-inside_pos;
            if(size > str_len)
                size = str_len;
            memmove(ptr+off, ptr+inside_pos, size*sizeof(char));
        } else {
            size = 0;
        }

        if(str_len > size)
            memmove(ptr+off+size, ptr+off+str_len, (str_len-size)*sizeof(char));
    }

3044 3045
    if(this->ptr)
        basic_string_wchar__Eos(this, this->size-len+str_len);
3046 3047 3048 3049 3050 3051 3052 3053 3054 3055 3056 3057
    return this;
}

/* ?replace@?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QAEAAV12@IIABV12@II@Z */
/* ?replace@?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QEAAAEAV12@_K0AEBV12@00@Z */
DEFINE_THISCALL_WRAPPER(basic_string_wchar_replace_substr, 24)
basic_string_wchar* __thiscall basic_string_wchar_replace_substr(basic_string_wchar *this, MSVCP_size_t off,
        MSVCP_size_t len, const basic_string_wchar *str, MSVCP_size_t str_off, MSVCP_size_t str_len)
{
    if(str->size < str_off)
        _Xran();

3058
    if(str_len > str->size-str_off)
3059 3060 3061 3062 3063 3064 3065 3066 3067 3068 3069 3070 3071 3072 3073 3074 3075 3076 3077 3078 3079 3080
        str_len = str->size-str_off;

    return basic_string_wchar_replace_cstr_len(this, off, len,
            str->ptr+str_off, str_len);
}

/* ?replace@?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QAEAAV12@IIABV12@@Z */
/* ?replace@?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QEAAAEAV12@_K0AEBV12@@Z */
DEFINE_THISCALL_WRAPPER(basic_string_wchar_replace, 16)
basic_string_wchar* __thiscall basic_string_wchar_replace(basic_string_wchar *this,
        MSVCP_size_t off, MSVCP_size_t len, const basic_string_wchar *str)
{
    return basic_string_wchar_replace_cstr_len(this, off, len,
            str->ptr, str->size);
}

/* ?replace@?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QAEAAV12@IIIG@Z */
/* ?replace@?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QEAAAEAV12@_K00G@Z */
DEFINE_THISCALL_WRAPPER(basic_string_wchar_replace_ch, 20)
basic_string_wchar* __thiscall basic_string_wchar_replace_ch(basic_string_wchar *this,
        MSVCP_size_t off, MSVCP_size_t len, MSVCP_size_t count, wchar_t ch)
{
3081
    wchar_t *ptr;
3082 3083 3084 3085 3086 3087

    TRACE("%p %ld %ld %ld %c\n", this, off, len, count, ch);

    if(this->size < off)
        _Xran();

3088
    if(len > this->size-off)
3089 3090
        len = this->size-off;

3091
    if(MSVCP_basic_string_wchar_npos-count <= this->size-len)
3092 3093 3094 3095 3096 3097 3098
        _Xlen();

    if(this->size-len+count)
        basic_string_wchar__Grow(this, this->size-len+count, FALSE);
    ptr = this->ptr;

    memmove(ptr+off+count, ptr+off+len, (this->size-off-len)*sizeof(char));
3099
    MSVCP_char_traits_wchar_assignn(ptr+off, count, ch);
3100 3101 3102 3103 3104 3105 3106 3107 3108 3109 3110 3111
    basic_string_wchar__Eos(this, this->size-len+count);

    return this;
}

/* ?replace@?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QAEAAV12@IIPBG@Z */
/* ?replace@?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QEAAAEAV12@_K0PEBG@Z */
DEFINE_THISCALL_WRAPPER(basic_string_wchar_replace_cstr, 16)
basic_string_wchar* __thiscall basic_string_wchar_replace_cstr(basic_string_wchar *this,
        MSVCP_size_t off, MSVCP_size_t len, const wchar_t *str)
{
    return basic_string_wchar_replace_cstr_len(this, off, len, str,
3112
            MSVCP_char_traits_wchar_length(str));
3113 3114 3115 3116 3117 3118 3119 3120 3121 3122 3123 3124 3125 3126 3127 3128 3129 3130 3131 3132 3133 3134 3135 3136 3137 3138 3139 3140 3141 3142 3143 3144 3145 3146 3147 3148 3149 3150 3151 3152 3153 3154 3155 3156 3157 3158 3159 3160
}

/* ?insert@?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QAEAAV12@IABV12@@Z */
/* ?insert@?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QEAAAEAV12@_KAEBV12@@Z */
DEFINE_THISCALL_WRAPPER(basic_string_wchar_insert, 12)
basic_string_wchar* __thiscall basic_string_wchar_insert(basic_string_wchar *this,
        MSVCP_size_t off, const basic_string_wchar *str)
{
    return basic_string_wchar_replace(this, off, 0, str);
}

/* ?insert@?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QAEAAV12@IABV12@II@Z */
/* ?insert@?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QEAAAEAV12@_KAEBV12@00@Z */
DEFINE_THISCALL_WRAPPER(basic_string_wchar_insert_substr, 20)
basic_string_wchar* __thiscall basic_string_wchar_insert_substr(
        basic_string_wchar *this, MSVCP_size_t off, const basic_string_wchar *str,
        MSVCP_size_t str_off, MSVCP_size_t str_count)
{
    return basic_string_wchar_replace_substr(this, off, 0, str, str_off, str_count);
}

/* ?insert@?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QAEAAV12@IPBG@Z */
/* ?insert@?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QEAAAEAV12@_KPEBG@Z */
DEFINE_THISCALL_WRAPPER(basic_string_wchar_insert_cstr, 12)
basic_string_wchar* __thiscall basic_string_wchar_insert_cstr(
        basic_string_wchar *this, MSVCP_size_t off, const wchar_t *str)
{
    return basic_string_wchar_replace_cstr(this, off, 0, str);
}

/* ?insert@?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QAEAAV12@IPBGI@Z */
/* ?insert@?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QEAAAEAV12@_KPEBG0@Z */
DEFINE_THISCALL_WRAPPER(basic_string_wchar_insert_cstr_len, 16)
basic_string_wchar* __thiscall basic_string_wchar_insert_cstr_len(basic_string_wchar *this,
        MSVCP_size_t off, const wchar_t *str, MSVCP_size_t str_len)
{
    return basic_string_wchar_replace_cstr_len(this, off, 0, str, str_len);
}

/* ?insert@?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QAEAAV12@IIG@Z */
/* ?insert@?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QEAAAEAV12@_K0G@Z */
DEFINE_THISCALL_WRAPPER(basic_string_wchar_insert_chn, 16)
basic_string_wchar* __thiscall basic_string_wchar_insert_chn(basic_string_wchar *this,
        MSVCP_size_t off, MSVCP_size_t count, wchar_t ch)
{
    return basic_string_wchar_replace_ch(this, off, 0, count, ch);
}

3161 3162 3163 3164 3165
/* ?resize@?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QAEXIG@Z */
/* ?resize@?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QEAAX_KG@Z */
DEFINE_THISCALL_WRAPPER(MSVCP_basic_string_wchar_resize_ch, 12)
void __thiscall MSVCP_basic_string_wchar_resize_ch(
        basic_string_wchar *this, MSVCP_size_t size, wchar_t ch)
3166
{
3167
    TRACE("%p %lu %c\n", this, size, ch);
3168 3169

    if(size <= this->size)
3170
        MSVCP_basic_string_wchar_erase(this, size, this->size);
3171
    else
3172
        MSVCP_basic_string_wchar_append_len_ch(this, size-this->size, ch);
3173 3174 3175 3176
}

/* ?resize@?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QAEXI@Z */
/* ?resize@?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QEAAX_K@Z */
3177 3178
DEFINE_THISCALL_WRAPPER(MSVCP_basic_string_wchar_resize, 8)
void __thiscall MSVCP_basic_string_wchar_resize(
3179 3180
        basic_string_wchar *this, MSVCP_size_t size)
{
3181
    MSVCP_basic_string_wchar_resize_ch(this, size, '\0');
3182 3183 3184 3185 3186 3187
}

/* ?c_str@?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QBEPBGXZ */
/* ?c_str@?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QEBAPEBGXZ */
/* ?data@?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QBEPBGXZ */
/* ?data@?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QEBAPEBGXZ */
3188 3189
DEFINE_THISCALL_WRAPPER(MSVCP_basic_string_wchar_c_str, 4)
const wchar_t* __thiscall MSVCP_basic_string_wchar_c_str(const basic_string_wchar *this)
3190 3191
{
    TRACE("%p\n", this);
3192
    return this->ptr ? this->ptr : basic_string_wchar__Nullstr();
3193 3194 3195 3196 3197 3198
}

/* ?size@?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QBEIXZ */
/* ?size@?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QEBA_KXZ */
/* ?length@?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QBEIXZ */
/* ?length@?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QEBA_KXZ */
3199 3200
DEFINE_THISCALL_WRAPPER(MSVCP_basic_string_wchar_length, 4)
MSVCP_size_t __thiscall MSVCP_basic_string_wchar_length(const basic_string_wchar *this)
3201 3202 3203 3204 3205 3206 3207 3208 3209 3210 3211 3212 3213 3214 3215 3216
{
    TRACE("%p\n", this);
    return this->size;
}

/* ?max_size@?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QBEIXZ */
/* ?max_size@?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QEBA_KXZ */
DEFINE_THISCALL_WRAPPER(basic_string_wchar_max_size, 4)
MSVCP_size_t __thiscall basic_string_wchar_max_size(const basic_string_wchar *this)
{
    TRACE("%p\n", this);
    return MSVCP_allocator_wchar_max_size(NULL)-1;
}

/* ?capacity@?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QBEIXZ */
/* ?capacity@?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QEBA_KXZ */
3217 3218
DEFINE_THISCALL_WRAPPER(MSVCP_basic_string_wchar_capacity, 4)
MSVCP_size_t __thiscall MSVCP_basic_string_wchar_capacity(basic_string_wchar *this)
3219 3220 3221 3222 3223 3224 3225
{
    TRACE("%p\n", this);
    return this->res;
}

/* ?reserve@?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QAEXI@Z */
/* ?reserve@?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QEAAX_K@Z */
3226 3227
DEFINE_THISCALL_WRAPPER(MSVCP_basic_string_wchar_reserve, 8)
void __thiscall MSVCP_basic_string_wchar_reserve(basic_string_wchar *this, MSVCP_size_t size)
3228 3229 3230 3231 3232 3233 3234 3235 3236
{
    MSVCP_size_t len;

    TRACE("%p %ld\n", this, size);

    len = this->size;
    if(len > size)
        return;

3237 3238
    if(basic_string_wchar__Grow(this, size, FALSE))
        basic_string_wchar__Eos(this, len);
3239 3240 3241 3242
}

/* ?empty@?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QBE_NXZ */
/* ?empty@?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QEBA_NXZ */
3243 3244
DEFINE_THISCALL_WRAPPER(MSVCP_basic_string_wchar_empty, 4)
MSVCP_bool __thiscall MSVCP_basic_string_wchar_empty(basic_string_wchar *this)
3245 3246 3247 3248 3249 3250 3251 3252 3253 3254 3255 3256 3257 3258 3259 3260 3261 3262 3263 3264 3265 3266 3267 3268 3269 3270
{
    TRACE("%p\n", this);
    return this->size == 0;
}

/* ?swap@?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QAEXAAV12@@Z */
/* ?swap@?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QEAAXAEAV12@@Z */
DEFINE_THISCALL_WRAPPER(basic_string_wchar_swap, 8)
void __thiscall basic_string_wchar_swap(basic_string_wchar *this, basic_string_wchar *str)
{
    basic_string_wchar tmp;
    TRACE("%p %p\n", this, str);

    tmp = *this;
    *this = *str;
    *str = tmp;
}

/* ?substr@?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QBE?AV12@II@Z */
/* ?substr@?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QEBA?AV12@_K0@Z */
DEFINE_THISCALL_WRAPPER(basic_string_wchar_substr, 16)
basic_string_wchar* __thiscall basic_string_wchar_substr(basic_string_wchar *this,
        basic_string_wchar *ret, MSVCP_size_t off, MSVCP_size_t len)
{
    TRACE("%p %lu %lu\n", this, off, len);

3271
    MSVCP_basic_string_wchar_ctor_substr_alloc(ret, this, off, len, NULL);
3272 3273 3274 3275 3276 3277 3278 3279 3280 3281 3282 3283 3284 3285 3286
    return ret;
}

/* ?copy@?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QBEIPAGII@Z */
/* ?copy@?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QEBA_KPEAG_K1@Z */
DEFINE_THISCALL_WRAPPER(basic_string_wchar_copy, 16)
MSVCP_size_t __thiscall basic_string_wchar_copy(const basic_string_wchar *this,
        wchar_t *dest, MSVCP_size_t count, MSVCP_size_t off)
{
    TRACE("%p %p %lu %lu\n", this, dest, count, off);

    if(off > this->size)
        _Xran();
    if(count > this->size-off)
        count = this->size-off;
3287
    if(this->ptr)
3288
        MSVCP_char_traits_wchar__Copy_s(dest, count, this->ptr+off, count);
3289 3290 3291 3292 3293 3294 3295 3296 3297 3298 3299
    return count;
}

/* ?get_allocator@?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QBE?AV?$allocator@G@2@XZ */
/* ?get_allocator@?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QEBA?AV?$allocator@G@2@XZ */
DEFINE_THISCALL_WRAPPER(basic_string_wchar_get_allocator, 8)
allocator* __thiscall basic_string_wchar_get_allocator(const basic_string_wchar *this, allocator *ret)
{
    TRACE("%p\n", this);
    return ret;
}
3300 3301 3302 3303 3304 3305 3306 3307 3308 3309 3310 3311 3312 3313 3314 3315 3316 3317 3318 3319 3320 3321 3322 3323 3324 3325 3326 3327 3328 3329 3330 3331 3332 3333 3334 3335 3336 3337 3338 3339 3340 3341 3342 3343 3344 3345 3346 3347 3348 3349 3350 3351 3352 3353 3354 3355 3356 3357 3358 3359 3360 3361 3362 3363 3364 3365 3366 3367 3368 3369 3370 3371 3372 3373 3374 3375 3376 3377 3378 3379 3380 3381 3382 3383 3384 3385 3386 3387 3388 3389 3390 3391 3392 3393 3394 3395 3396 3397 3398 3399 3400 3401 3402 3403 3404 3405 3406 3407 3408 3409 3410 3411 3412 3413 3414 3415 3416 3417 3418 3419 3420 3421 3422 3423 3424 3425 3426 3427 3428 3429 3430 3431 3432 3433 3434 3435 3436 3437 3438 3439 3440 3441 3442 3443 3444 3445 3446 3447 3448 3449 3450 3451 3452 3453 3454 3455 3456 3457 3458 3459 3460 3461 3462 3463 3464 3465 3466 3467 3468 3469 3470 3471 3472 3473 3474 3475 3476 3477 3478 3479 3480 3481 3482 3483 3484 3485 3486 3487 3488 3489 3490 3491 3492 3493 3494 3495 3496 3497 3498 3499 3500 3501 3502 3503 3504 3505 3506 3507 3508 3509 3510 3511 3512 3513 3514 3515 3516 3517 3518 3519 3520 3521 3522 3523 3524 3525 3526 3527 3528 3529 3530 3531 3532 3533 3534 3535 3536 3537 3538 3539 3540 3541 3542 3543 3544 3545 3546 3547 3548 3549 3550 3551 3552 3553 3554 3555 3556 3557 3558 3559 3560 3561 3562 3563 3564 3565 3566 3567 3568 3569 3570 3571 3572 3573 3574 3575 3576 3577 3578 3579 3580 3581 3582 3583 3584 3585 3586 3587 3588 3589 3590 3591 3592 3593 3594 3595 3596 3597 3598 3599 3600 3601 3602 3603 3604 3605 3606 3607 3608 3609 3610 3611 3612 3613 3614 3615 3616 3617 3618 3619 3620 3621

/* Old iterator functions */

/* ?_Pdif@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@CAIPBD0@Z */
/* ?_Pdif@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@CA_KPEBD0@Z */
MSVCP_size_t __cdecl basic_string_char__Pdif(const char *i1, const char *i2)
{
    TRACE("(%p %p)\n", i1, i2);
    return !i1 ? 0 : i1-i2;
}

/* ?erase@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAEPADPAD0@Z */
/* ?erase@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QEAAPEADPEAD0@Z */
DEFINE_THISCALL_WRAPPER(basic_string_char_erase_iter, 12)
char* __thiscall basic_string_char_erase_iter(basic_string_char *this, char *beg, char *end)
{
    MSVCP_size_t pos = basic_string_char__Pdif(beg, this->ptr);
    MSVCP_basic_string_char_erase(this, pos, basic_string_char__Pdif(end, beg));
    return basic_string_char__Psum(this->ptr, pos);
}

/* ?replace@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAEAAV12@PAD0PBD1@Z */
/* ?replace@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QEAAAEAV12@PEAD0PEBD1@Z */
DEFINE_THISCALL_WRAPPER(basic_string_char_replace_iter_iter, 20)
basic_string_char* __thiscall basic_string_char_replace_iter_iter(basic_string_char *this,
        char *beg1, char *end1, const char *beg2, const char *end2)
{
    return basic_string_char_replace_cstr_len(this, basic_string_char__Pdif(beg1, this->ptr),
            basic_string_char__Pdif(end1, beg1), beg2, basic_string_char__Pdif(end2, beg2));
}

/* ?replace@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAEAAV12@PAD0ABV12@@Z */
/* ?replace@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QEAAAEAV12@PEAD0AEBV12@@Z */
DEFINE_THISCALL_WRAPPER(basic_string_char_replace_iter_bstr, 16)
basic_string_char* __thiscall basic_string_char_replace_iter_bstr(basic_string_char *this,
        char *beg, char *end, const basic_string_char *str)
{
    return basic_string_char_replace(this, basic_string_char__Pdif(beg, this->ptr),
            basic_string_char__Pdif(end, beg), str);
}

/* ?replace@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAEAAV12@PAD0ID@Z */
/* ?replace@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QEAAAEAV12@PEAD0_KD@Z */
DEFINE_THISCALL_WRAPPER(basic_string_char_replace_iter_chn, 20)
basic_string_char* __thiscall basic_string_char_replace_iter_chn(basic_string_char *this,
        char *beg, char *end, MSVCP_size_t count, char ch)
{
    return basic_string_char_replace_ch(this, basic_string_char__Pdif(beg, this->ptr),
            basic_string_char__Pdif(end, beg), count, ch);
}

/* ?replace@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAEAAV12@PAD0PBD@Z */
/* ?replace@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QEAAAEAV12@PEAD0PEBD@Z */
DEFINE_THISCALL_WRAPPER(basic_string_char_replace_iter_cstr, 16)
basic_string_char* __thiscall basic_string_char_replace_iter_cstr(basic_string_char *this,
        char *beg, char *end, const char *str)
{
    return basic_string_char_replace_cstr(this, basic_string_char__Pdif(beg, this->ptr),
            basic_string_char__Pdif(end, beg), str);
}

/* ?replace@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAEAAV12@PAD0PBDI@Z */
/* ?replace@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QEAAAEAV12@PEAD0PEBD_K@Z */
DEFINE_THISCALL_WRAPPER(basic_string_char_replace_iter_cstr_len, 20)
basic_string_char* __thiscall basic_string_char_replace_iter_cstr_len(basic_string_char *this,
        char *beg, char *end, const char *str, MSVCP_size_t len)
{
    return basic_string_char_replace_cstr_len(this, basic_string_char__Pdif(beg, this->ptr),
            basic_string_char__Pdif(end, beg), str, len);
}

/* ?insert@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAEXPADID@Z */
/* ?insert@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QEAAXPEAD_KD@Z */
DEFINE_THISCALL_WRAPPER(basic_string_char_insert_iter_chn, 16)
void __thiscall basic_string_char_insert_iter_chn(basic_string_char *this,
        char *pos, MSVCP_size_t n, char ch)
{
    basic_string_char_insert_chn(this, basic_string_char__Pdif(pos, this->ptr), n, ch);
}

/* ?insert@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAEPADPADD@Z */
/* ?insert@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QEAAPEADPEADD@Z */
DEFINE_THISCALL_WRAPPER(basic_string_char_insert_iter_ch, 12)
char* __thiscall basic_string_char_insert_iter_ch(basic_string_char *this, char *pos, char ch)
{
    MSVCP_size_t off = basic_string_char__Pdif(pos, this->ptr);
    basic_string_char_insert_chn(this, off, 1, ch);
    return basic_string_char__Psum(this->ptr, off);
}

/* ?begin@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAEPADXZ */
/* ?begin@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QEAAPEADXZ */
/* ?begin@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QBEPBDXZ */
/* ?begin@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QEBAPEBDXZ */
DEFINE_THISCALL_WRAPPER(basic_string_char_begin, 4)
char* __thiscall basic_string_char_begin(basic_string_char *this)
{
    TRACE("(%p)\n", this);
    basic_string_char__Freeze(this);
    return this->ptr;
}

/* ?end@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAEPADXZ */
/* ?end@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QEAAPEADXZ */
/* ?end@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QBEPBDXZ */
/* ?end@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QEBAPEBDXZ */
DEFINE_THISCALL_WRAPPER(basic_string_char_end, 4)
char* __thiscall basic_string_char_end(basic_string_char *this)
{
    TRACE("(%p)\n", this);
    basic_string_char__Freeze(this);
    return this->ptr+this->size;
}

/* ?rbegin@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAE?AV?$reverse_iterator@PADDAADPADH@2@XZ */
/* ?rbegin@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QEAA?AV?$reverse_iterator@PEADDAEADPEAD_J@2@XZ */
/* ?rbegin@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QBE?AV?$reverse_iterator@PBDDABDPBDH@2@XZ */
/* ?rbegin@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QEBA?AV?$reverse_iterator@PEBDDAEBDPEBD_J@2@XZ */
DEFINE_THISCALL_WRAPPER(basic_string_char_rbegin, 8)
String_reverse_iterator_char* __thiscall basic_string_char_rbegin(
        basic_string_char *this, String_reverse_iterator_char *ret)
{
    TRACE("(%p %p)\n", this, ret);
    ret->ptr = basic_string_char_end(this);
    return ret;
}

/* ?rend@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAE?AV?$reverse_iterator@PADDAADPADH@2@XZ */
/* ?rend@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QEAA?AV?$reverse_iterator@PEADDAEADPEAD_J@2@XZ */
/* ?rend@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QBE?AV?$reverse_iterator@PBDDABDPBDH@2@XZ */
/* ?rend@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QEBA?AV?$reverse_iterator@PEBDDAEBDPEBD_J@2@XZ */
DEFINE_THISCALL_WRAPPER(basic_string_char_rend, 8)
String_reverse_iterator_char* __thiscall basic_string_char_rend(
        basic_string_char *this, String_reverse_iterator_char *ret)
{
    TRACE("(%p %p)\n", this, ret);
    ret->ptr = basic_string_char_begin(this);
    return ret;
}

/* ??0?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAE@PBD0ABV?$allocator@D@1@@Z */
/* ??0?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QEAA@PEBD0AEBV?$allocator@D@1@@Z */
DEFINE_THISCALL_WRAPPER(basic_string_char_ctor_iter, 16)
basic_string_char* __thiscall basic_string_char_ctor_iter(basic_string_char *this,
        const char *first, const char *last, allocator *alloc)
{
    TRACE("(%p %p %p %p)\n", this, first, last, alloc);

    basic_string_char__Tidy(this, FALSE);
    MSVCP_basic_string_char_assign_cstr_len(this, first, basic_string_char__Pdif(last, first));
    return this;
}

/* ?insert@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAEXPADPBD1@Z */
/* ?insert@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QEAAXPEADPEBD1@Z */
DEFINE_THISCALL_WRAPPER(basic_string_char_insert_iter, 16)
void __thiscall basic_string_char_insert_iter(basic_string_char *this,
        char *pos, const char *beg, const char *end)
{
    basic_string_char_insert_cstr_len(this, basic_string_char__Pdif(pos, this->ptr),
            beg, basic_string_char__Pdif(end, beg));
}

/* ?_Pdif@?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@CAIPBG0@Z */
/* ?_Pdif@?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@CA_KPEBG0@Z */
MSVCP_size_t __cdecl basic_string_wchar__Pdif(const wchar_t *i1, const wchar_t *i2)
{
    TRACE("(%p %p)\n", i1, i2);
    return !i1 ? 0 : i1-i2;
}

/* ?erase@?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QAEPAGPAG0@Z */
/* ?erase@?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QEAAPEAGPEAG0@Z */
DEFINE_THISCALL_WRAPPER(basic_string_wchar_erase_iter, 12)
wchar_t* __thiscall basic_string_wchar_erase_iter(basic_string_wchar *this, wchar_t *beg, wchar_t *end)
{
    MSVCP_size_t pos = basic_string_wchar__Pdif(beg, this->ptr);
    MSVCP_basic_string_wchar_erase(this, pos, basic_string_wchar__Pdif(end, beg));
    return basic_string_wchar__Psum(this->ptr, pos);
}

/* ??0?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QAE@PBG0ABV?$allocator@G@1@@Z */
/* ??0?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QEAA@PEBG0AEBV?$allocator@G@1@@Z */
DEFINE_THISCALL_WRAPPER(basic_string_wchar_ctor_iter, 16)
basic_string_wchar* __thiscall basic_string_wchar_ctor_iter(basic_string_wchar *this,
        const wchar_t *first, const wchar_t *last, allocator *alloc)
{
    TRACE("(%p %p %p %p)\n", this, first, last, alloc);

    basic_string_wchar__Tidy(this, FALSE);
    MSVCP_basic_string_wchar_assign_cstr_len(this, first, basic_string_wchar__Pdif(last, first));
    return this;
}

/* ?replace@?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QAEAAV12@PAG0PBG1@Z */
/* ?replace@?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QEAAAEAV12@PEAG0PEBG1@Z */
DEFINE_THISCALL_WRAPPER(basic_string_wchar_replace_iter_iter, 20)
basic_string_wchar* __thiscall basic_string_wchar_replace_iter_iter(basic_string_wchar *this,
        wchar_t *beg1, wchar_t *end1, const wchar_t *beg2, const wchar_t *end2)
{
    return basic_string_wchar_replace_cstr_len(this, basic_string_wchar__Pdif(beg1, this->ptr),
            basic_string_wchar__Pdif(end1, beg1), beg2, basic_string_wchar__Pdif(end2, beg2));
}

/* ?replace@?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QAEAAV12@PAG0ABV12@@Z */
/* ?replace@?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QEAAAEAV12@PEAG0AEBV12@@Z */
DEFINE_THISCALL_WRAPPER(basic_string_wchar_replace_iter_bstr, 16)
basic_string_wchar* __thiscall basic_string_wchar_replace_iter_bstr(basic_string_wchar *this,
        wchar_t *beg, wchar_t *end, const basic_string_wchar *str)
{
    return basic_string_wchar_replace(this, basic_string_wchar__Pdif(beg, this->ptr),
            basic_string_wchar__Pdif(end, beg), str);
}

/* ?replace@?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QAEAAV12@PAG0IG@Z */
/* ?replace@?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QEAAAEAV12@PEAG0_KG@Z */
DEFINE_THISCALL_WRAPPER(basic_string_wchar_replace_iter_chn, 20)
basic_string_wchar* __thiscall basic_string_wchar_replace_iter_chn(basic_string_wchar *this,
        wchar_t *beg, wchar_t *end, MSVCP_size_t count, wchar_t ch)
{
    return basic_string_wchar_replace_ch(this, basic_string_wchar__Pdif(beg, this->ptr),
            basic_string_wchar__Pdif(end, beg), count, ch);
}

/* ?replace@?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QAEAAV12@PAG0PBG@Z */
/* ?replace@?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QEAAAEAV12@PEAG0PEBG@Z */
DEFINE_THISCALL_WRAPPER(basic_string_wchar_replace_iter_cstr, 16)
basic_string_wchar* __thiscall basic_string_wchar_replace_iter_cstr(basic_string_wchar *this,
        wchar_t *beg, wchar_t *end, const wchar_t *str)
{
    return basic_string_wchar_replace_cstr(this, basic_string_wchar__Pdif(beg, this->ptr),
            basic_string_wchar__Pdif(end, beg), str);
}

/* ?replace@?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QAEAAV12@PAG0PBGI@Z */
/* ?replace@?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QEAAAEAV12@PEAG0PEBG_K@Z */
DEFINE_THISCALL_WRAPPER(basic_string_wchar_replace_iter_cstr_len, 20)
basic_string_wchar* __thiscall basic_string_wchar_replace_iter_cstr_len(basic_string_wchar *this,
        wchar_t *beg, wchar_t *end, const wchar_t *str, MSVCP_size_t len)
{
    return basic_string_wchar_replace_cstr_len(this, basic_string_wchar__Pdif(beg, this->ptr),
            basic_string_wchar__Pdif(end, beg), str, len);
}

/* ?insert@?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QAEXPAGIG@Z */
/* ?insert@?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QEAAXPEAG_KG@Z */
DEFINE_THISCALL_WRAPPER(basic_string_wchar_insert_iter_chn, 16)
void __thiscall basic_string_wchar_insert_iter_chn(basic_string_wchar *this,
        wchar_t *pos, MSVCP_size_t n, wchar_t ch)
{
    basic_string_wchar_insert_chn(this, basic_string_wchar__Pdif(pos, this->ptr), n, ch);
}

/* ?insert@?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QAEPAGPAGG@Z */
/* ?insert@?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QEAAPEAGPEAGG@Z */
DEFINE_THISCALL_WRAPPER(basic_string_wchar_insert_iter_ch, 12)
wchar_t* __thiscall basic_string_wchar_insert_iter_ch(basic_string_wchar *this, wchar_t *pos, wchar_t ch)
{
    MSVCP_size_t off = basic_string_wchar__Pdif(pos, this->ptr);
    basic_string_wchar_insert_chn(this, off, 1, ch);
    return basic_string_wchar__Psum(this->ptr, off);
}

/* ?begin@?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QAEPAGXZ */
/* ?begin@?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QEAAPEAGXZ */
/* ?begin@?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QBEPBGXZ */
/* ?begin@?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QEBAPEBGXZ */
DEFINE_THISCALL_WRAPPER(basic_string_wchar_begin, 4)
wchar_t* __thiscall basic_string_wchar_begin(basic_string_wchar *this)
{
    TRACE("(%p)\n", this);
    basic_string_wchar__Freeze(this);
    return this->ptr;
}

/* ?end@?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QAEPAGXZ */
/* ?end@?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QEAAPEAGXZ */
/* ?end@?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QBEPBGXZ */
/* ?end@?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QEBAPEBGXZ */
DEFINE_THISCALL_WRAPPER(basic_string_wchar_end, 4)
wchar_t* __thiscall basic_string_wchar_end(basic_string_wchar *this)
{
    TRACE("(%p)\n", this);
    basic_string_wchar__Freeze(this);
    return this->ptr+this->size;
}

/* ?rbegin@?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QAE?AV?$reverse_iterator@PAGGAAGPAGH@2@XZ */
/* ?rbegin@?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QEAA?AV?$reverse_iterator@PEAGGAEAGPEAG_J@2@XZ */
/* ?rbegin@?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QBE?AV?$reverse_iterator@PBGGABGPBGH@2@XZ */
/* ?rbegin@?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QEBA?AV?$reverse_iterator@PEBGGAEBGPEBG_J@2@XZ */
DEFINE_THISCALL_WRAPPER(basic_string_wchar_rbegin, 8)
String_reverse_iterator_wchar* __thiscall basic_string_wchar_rbegin(
        basic_string_wchar *this, String_reverse_iterator_wchar *ret)
{
    TRACE("(%p %p)\n", this, ret);
    ret->ptr = basic_string_wchar_end(this);
    return ret;
}

/* ?rend@?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QAE?AV?$reverse_iterator@PAGGAAGPAGH@2@XZ */
/* ?rend@?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QEAA?AV?$reverse_iterator@PEAGGAEAGPEAG_J@2@XZ */
/* ?rend@?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QBE?AV?$reverse_iterator@PBGGABGPBGH@2@XZ */
/* ?rend@?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QEBA?AV?$reverse_iterator@PEBGGAEBGPEBG_J@2@XZ */
DEFINE_THISCALL_WRAPPER(basic_string_wchar_rend, 8)
String_reverse_iterator_wchar* __thiscall basic_string_wchar_rend(
        basic_string_wchar *this, String_reverse_iterator_wchar *ret)
{
    TRACE("(%p %p)\n", this, ret);
    ret->ptr = basic_string_wchar_begin(this);
    return ret;
}

/* ?insert@?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QAEXPAGPBG1@Z */
/* ?insert@?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QEAAXPEAGPEBG1@Z */
DEFINE_THISCALL_WRAPPER(basic_string_wchar_insert_iter, 16)
void __thiscall basic_string_wchar_insert_iter(basic_string_wchar *this,
        wchar_t *pos, const wchar_t *beg, const wchar_t *end)
{
    basic_string_wchar_insert_cstr_len(this, basic_string_wchar__Pdif(pos, this->ptr),
            beg, basic_string_wchar__Pdif(end, beg));
}