2010-07-20 23:22:59 +02:00
|
|
|
/*
|
|
|
|
* Copyright 2010 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
|
|
|
|
*/
|
|
|
|
|
2010-08-19 12:17:11 +02:00
|
|
|
#include "config.h"
|
|
|
|
|
2010-07-20 23:22:59 +02:00
|
|
|
#include <stdarg.h>
|
|
|
|
|
|
|
|
#include "msvcp90.h"
|
|
|
|
#include "stdio.h"
|
|
|
|
|
|
|
|
#include "windef.h"
|
|
|
|
#include "winbase.h"
|
|
|
|
#include "wine/debug.h"
|
|
|
|
WINE_DEFAULT_DEBUG_CHANNEL(msvcp90);
|
|
|
|
|
|
|
|
/* char_traits<char> */
|
|
|
|
/* ?assign@?$char_traits@D@std@@SAXAADABD@Z */
|
2010-08-16 11:05:39 +02:00
|
|
|
/* ?assign@?$char_traits@D@std@@SAXAEADAEBD@Z */
|
2010-07-20 23:22:59 +02:00
|
|
|
void CDECL MSVCP_char_traits_char_assign(char *ch, const char *assign)
|
|
|
|
{
|
|
|
|
*ch = *assign;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* ?eq@?$char_traits@D@std@@SA_NABD0@Z */
|
2010-08-16 11:05:39 +02:00
|
|
|
/* ?eq@?$char_traits@D@std@@SA_NAEBD0@Z */
|
2010-07-20 23:22:59 +02:00
|
|
|
MSVCP_BOOL CDECL MSVCP_char_traits_char_eq(const char *ch1, const char *ch2)
|
|
|
|
{
|
|
|
|
return *ch1 == *ch2;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* ?lt@?$char_traits@D@std@@SA_NABD0@Z */
|
2010-08-16 11:05:39 +02:00
|
|
|
/* ?lt@?$char_traits@D@std@@SA_NAEBD0@Z */
|
2010-07-20 23:22:59 +02:00
|
|
|
MSVCP_BOOL CDECL MSVCP_char_traits_lt(const char *ch1, const char *ch2)
|
|
|
|
{
|
|
|
|
return *ch1 < *ch2;
|
|
|
|
}
|
|
|
|
|
2010-08-16 11:05:39 +02:00
|
|
|
/* ?compare@?$char_traits@D@std@@SAHPBD0I@Z */
|
|
|
|
/* ?compare@?$char_traits@D@std@@SAHPEBD0_K@Z */
|
2010-07-20 23:22:59 +02:00
|
|
|
int CDECL MSVCP_char_traits_char_compare(
|
2010-08-16 11:05:39 +02:00
|
|
|
const char *s1, const char *s2, size_t count)
|
2010-07-20 23:22:59 +02:00
|
|
|
{
|
|
|
|
int ret = memcmp(s1, s2, count);
|
|
|
|
return (ret>0 ? 1 : (ret<0 ? -1 : 0));
|
|
|
|
}
|
|
|
|
|
|
|
|
/* ?length@?$char_traits@D@std@@SAIPBD@Z */
|
2010-08-16 11:05:39 +02:00
|
|
|
/* ?length@?$char_traits@D@std@@SA_KPEBD@Z */
|
|
|
|
size_t CDECL MSVCP_char_traits_char_length(const char *str)
|
2010-07-20 23:22:59 +02:00
|
|
|
{
|
|
|
|
return strlen(str);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* ?_Copy_s@?$char_traits@D@std@@SAPADPADIPBDI@Z */
|
2010-08-16 11:05:39 +02:00
|
|
|
/* ?_Copy_s@?$char_traits@D@std@@SAPEADPEAD_KPEBD1@Z */
|
2010-07-20 23:22:59 +02:00
|
|
|
char* CDECL MSVCP_char_traits_char__Copy_s(char *dest,
|
2010-08-16 11:05:39 +02:00
|
|
|
size_t size, const char *src, size_t count)
|
2010-07-20 23:22:59 +02:00
|
|
|
{
|
|
|
|
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);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* ?copy@?$char_traits@D@std@@SAPADPADPBDI@Z */
|
2010-08-16 11:05:39 +02:00
|
|
|
/* ?copy@?$char_traits@D@std@@SAPEADPEADPEBD_K@Z */
|
2010-07-20 23:22:59 +02:00
|
|
|
char* CDECL MSVCP_char_traits_char_copy(
|
2010-08-16 11:05:39 +02:00
|
|
|
char *dest, const char *src, size_t count)
|
2010-07-20 23:22:59 +02:00
|
|
|
{
|
|
|
|
return MSVCP_char_traits_char__Copy_s(dest, count, src, count);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* ?find@?$char_traits@D@std@@SAPBDPBDIABD@Z */
|
2010-08-16 11:05:39 +02:00
|
|
|
/* ?find@?$char_traits@D@std@@SAPEBDPEBD_KAEBD@Z */
|
2010-07-20 23:22:59 +02:00
|
|
|
const char * CDECL MSVCP_char_traits_char_find(
|
2010-08-16 11:05:39 +02:00
|
|
|
const char *str, size_t range, const char *c)
|
2010-07-20 23:22:59 +02:00
|
|
|
{
|
|
|
|
return memchr(str, *c, range);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* ?_Move_s@?$char_traits@D@std@@SAPADPADIPBDI@Z */
|
2010-08-16 11:05:39 +02:00
|
|
|
/* ?_Move_s@?$char_traits@D@std@@SAPEADPEAD_KPEBD1@Z */
|
2010-07-20 23:22:59 +02:00
|
|
|
char* CDECL MSVCP_char_traits_char__Move_s(char *dest,
|
2010-08-16 11:05:39 +02:00
|
|
|
size_t size, const char *src, size_t count)
|
2010-07-20 23:22:59 +02:00
|
|
|
{
|
|
|
|
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);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* ?move@?$char_traits@D@std@@SAPADPADPBDI@Z */
|
2010-08-16 11:05:39 +02:00
|
|
|
/* ?move@?$char_traits@D@std@@SAPEADPEADPEBD_K@Z */
|
2010-07-20 23:22:59 +02:00
|
|
|
char* CDECL MSVCP_char_traits_char_move(
|
2010-08-16 11:05:39 +02:00
|
|
|
char *dest, const char *src, size_t count)
|
2010-07-20 23:22:59 +02:00
|
|
|
{
|
|
|
|
return MSVCP_char_traits_char__Move_s(dest, count, src, count);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* ?assign@?$char_traits@D@std@@SAPADPADID@Z */
|
2010-08-16 11:05:39 +02:00
|
|
|
/* ?assign@?$char_traits@D@std@@SAPEADPEAD_KD@Z */
|
|
|
|
char* CDECL MSVCP_char_traits_char_assignn(char *str, size_t num, char c)
|
2010-07-20 23:22:59 +02:00
|
|
|
{
|
|
|
|
return memset(str, c, num);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* ?to_char_type@?$char_traits@D@std@@SADABH@Z */
|
2010-08-16 11:05:39 +02:00
|
|
|
/* ?to_char_type@?$char_traits@D@std@@SADAEBH@Z */
|
2010-07-20 23:22:59 +02:00
|
|
|
char CDECL MSVCP_char_traits_char_to_char_type(const int *i)
|
|
|
|
{
|
|
|
|
return (char)*i;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* ?to_int_type@?$char_traits@D@std@@SAHABD@Z */
|
2010-08-16 11:05:39 +02:00
|
|
|
/* ?to_int_type@?$char_traits@D@std@@SAHAEBD@Z */
|
2010-07-20 23:22:59 +02:00
|
|
|
int CDECL MSVCP_char_traits_char_to_int_type(const char *ch)
|
|
|
|
{
|
|
|
|
return (int)*ch;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* ?eq_int_type@?$char_traits@D@std@@SA_NABH0@Z */
|
2010-08-16 11:05:39 +02:00
|
|
|
/* ?eq_int_type@?$char_traits@D@std@@SA_NAEBH0@Z */
|
2010-07-20 23:22:59 +02:00
|
|
|
MSVCP_BOOL CDECL MSVCP_char_traits_char_eq_int_type(const int *i1, const int *i2)
|
|
|
|
{
|
|
|
|
return *i1 == *i2;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* ?eof@?$char_traits@D@std@@SAHXZ */
|
|
|
|
int CDECL MSVCP_char_traits_char_eof(void)
|
|
|
|
{
|
|
|
|
return EOF;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* ?not_eof@?$char_traits@D@std@@SAHABH@Z */
|
2010-08-16 11:05:39 +02:00
|
|
|
/* ?not_eof@?$char_traits@D@std@@SAHAEBH@Z */
|
2010-07-20 23:22:59 +02:00
|
|
|
int CDECL MSVCP_char_traits_char_not_eof(int *in)
|
|
|
|
{
|
|
|
|
return (*in==EOF ? !EOF : *in);
|
|
|
|
}
|
2010-07-20 23:23:24 +02:00
|
|
|
|
|
|
|
|
|
|
|
/* char_traits<wchar_t> */
|
|
|
|
/* ?assign@?$char_traits@_W@std@@SAXAA_WAB_W@Z */
|
2010-08-16 11:06:01 +02:00
|
|
|
/* ?assign@?$char_traits@_W@std@@SAXAEA_WAEB_W@Z */
|
2010-07-20 23:23:24 +02:00
|
|
|
void CDECL MSVCP_char_traits_wchar_assign(wchar_t *ch,
|
|
|
|
const wchar_t *assign)
|
|
|
|
{
|
|
|
|
*ch = *assign;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* ?eq@?$char_traits@_W@std@@SA_NAB_W0@Z */
|
2010-08-16 11:06:01 +02:00
|
|
|
/* ?eq@?$char_traits@_W@std@@SA_NAEB_W0@Z */
|
2010-07-20 23:23:24 +02:00
|
|
|
MSVCP_BOOL CDECL MSVCP_char_traits_wchar_eq(wchar_t *ch1, wchar_t *ch2)
|
|
|
|
{
|
|
|
|
return *ch1 == *ch2;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* ?lt@?$char_traits@_W@std@@SA_NAB_W0@Z */
|
2010-08-16 11:06:01 +02:00
|
|
|
/* ?lt@?$char_traits@_W@std@@SA_NAEB_W0@Z */
|
2010-07-20 23:23:24 +02:00
|
|
|
MSVCP_BOOL CDECL MSVCP_char_traits_wchar_lt(const wchar_t *ch1,
|
|
|
|
const wchar_t *ch2)
|
|
|
|
{
|
|
|
|
return *ch1 < *ch2;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* ?compare@?$char_traits@_W@std@@SAHPB_W0I@Z */
|
2010-08-16 11:06:01 +02:00
|
|
|
/* ?compare@?$char_traits@_W@std@@SAHPEB_W0_K@Z */
|
2010-07-20 23:23:24 +02:00
|
|
|
int CDECL MSVCP_char_traits_wchar_compare(const wchar_t *s1,
|
2010-08-16 11:06:01 +02:00
|
|
|
const wchar_t *s2, size_t count)
|
2010-07-20 23:23:24 +02:00
|
|
|
{
|
|
|
|
int ret = memcmp(s1, s2, sizeof(wchar_t[count]));
|
|
|
|
return (ret>0 ? 1 : (ret<0 ? -1 : 0));
|
|
|
|
}
|
|
|
|
|
|
|
|
/* ?length@?$char_traits@_W@std@@SAIPB_W@Z */
|
2010-08-16 11:06:01 +02:00
|
|
|
/* ?length@?$char_traits@_W@std@@SA_KPEB_W@Z */
|
|
|
|
size_t CDECL MSVCP_char_traits_wchar_length(const wchar_t *str)
|
2010-07-20 23:23:24 +02:00
|
|
|
{
|
|
|
|
return wcslen((WCHAR*)str);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* ?_Copy_s@?$char_traits@_W@std@@SAPA_WPA_WIPB_WI@Z */
|
2010-08-16 11:06:01 +02:00
|
|
|
/* ?_Copy_s@?$char_traits@_W@std@@SAPEA_WPEA_W_KPEB_W1@Z */
|
2010-07-20 23:23:24 +02:00
|
|
|
wchar_t* CDECL MSVCP_char_traits_wchar__Copy_s(wchar_t *dest,
|
2010-08-16 11:06:01 +02:00
|
|
|
size_t size, const wchar_t *src, size_t count)
|
2010-07-20 23:23:24 +02:00
|
|
|
{
|
|
|
|
if(!dest || !src || size<count) {
|
|
|
|
if(dest && size)
|
|
|
|
dest[0] = '\0';
|
|
|
|
_invalid_parameter(NULL, NULL, NULL, 0, 0);
|
|
|
|
return dest;
|
|
|
|
}
|
|
|
|
|
|
|
|
return memcpy(dest, src, sizeof(wchar_t[count]));
|
|
|
|
}
|
|
|
|
|
|
|
|
/* ?copy@?$char_traits@_W@std@@SAPA_WPA_WPB_WI@Z */
|
2010-08-16 11:06:01 +02:00
|
|
|
/* ?copy@?$char_traits@_W@std@@SAPEA_WPEA_WPEB_W_K@Z */
|
2010-07-20 23:23:24 +02:00
|
|
|
wchar_t* CDECL MSVCP_char_traits_wchar_copy(wchar_t *dest,
|
2010-08-16 11:06:01 +02:00
|
|
|
const wchar_t *src, size_t count)
|
2010-07-20 23:23:24 +02:00
|
|
|
{
|
|
|
|
return MSVCP_char_traits_wchar__Copy_s(dest, count, src, count);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* ?find@?$char_traits@_W@std@@SAPB_WPB_WIAB_W@Z */
|
2010-08-16 11:06:01 +02:00
|
|
|
/* ?find@?$char_traits@_W@std@@SAPEB_WPEB_W_KAEB_W@Z */
|
2010-07-20 23:23:24 +02:00
|
|
|
const wchar_t* CDECL MSVCP_char_traits_wchar_find(
|
2010-08-16 11:06:01 +02:00
|
|
|
const wchar_t *str, size_t range, const wchar_t *c)
|
2010-07-20 23:23:24 +02:00
|
|
|
{
|
2010-08-16 11:06:01 +02:00
|
|
|
size_t i=0;
|
2010-07-20 23:23:24 +02:00
|
|
|
|
|
|
|
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 */
|
2010-08-16 11:06:01 +02:00
|
|
|
/* ?_Move_s@?$char_traits@_W@std@@SAPEA_WPEA_W_KPEB_W1@Z */
|
2010-07-20 23:23:24 +02:00
|
|
|
wchar_t* CDECL MSVCP_char_traits_wchar__Move_s(wchar_t *dest,
|
2010-08-16 11:06:01 +02:00
|
|
|
size_t size, const wchar_t *src, size_t count)
|
2010-07-20 23:23:24 +02:00
|
|
|
{
|
|
|
|
if(!dest || !src || size<count) {
|
|
|
|
if(dest && size)
|
|
|
|
dest[0] = '\0';
|
|
|
|
_invalid_parameter(NULL, NULL, NULL, 0, 0);
|
|
|
|
return dest;
|
|
|
|
}
|
|
|
|
|
|
|
|
return memmove(dest, src, sizeof(WCHAR[count]));
|
|
|
|
}
|
|
|
|
|
|
|
|
/* ?move@?$char_traits@_W@std@@SAPA_WPA_WPB_WI@Z */
|
2010-08-16 11:06:01 +02:00
|
|
|
/* ?move@?$char_traits@_W@std@@SAPEA_WPEA_WPEB_W_K@Z */
|
2010-07-20 23:23:24 +02:00
|
|
|
wchar_t* CDECL MSVCP_char_traits_wchar_move(wchar_t *dest,
|
2010-08-16 11:06:01 +02:00
|
|
|
const wchar_t *src, size_t count)
|
2010-07-20 23:23:24 +02:00
|
|
|
{
|
|
|
|
return MSVCP_char_traits_wchar__Move_s(dest, count, src, count);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* ?assign@?$char_traits@_W@std@@SAPA_WPA_WI_W@Z */
|
2010-08-16 11:06:01 +02:00
|
|
|
/* ?assign@?$char_traits@_W@std@@SAPEA_WPEA_W_K_W@Z */
|
2010-07-20 23:23:24 +02:00
|
|
|
wchar_t* CDECL MSVCP_char_traits_wchar_assignn(wchar_t *str,
|
2010-08-16 11:06:01 +02:00
|
|
|
size_t num, wchar_t c)
|
2010-07-20 23:23:24 +02:00
|
|
|
{
|
2010-08-16 11:06:01 +02:00
|
|
|
size_t i;
|
2010-07-20 23:23:24 +02:00
|
|
|
|
|
|
|
for(i=0; i<num; i++)
|
|
|
|
str[i] = c;
|
|
|
|
|
|
|
|
return str;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* ?to_char_type@?$char_traits@_W@std@@SA_WABG@Z */
|
2010-08-16 11:06:01 +02:00
|
|
|
/* ?to_char_type@?$char_traits@_W@std@@SA_WAEBG@Z */
|
2010-07-20 23:23:24 +02:00
|
|
|
wchar_t CDECL MSVCP_char_traits_wchar_to_char_type(const unsigned short *i)
|
|
|
|
{
|
|
|
|
return *i;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* ?to_int_type@?$char_traits@_W@std@@SAGAB_W@Z */
|
2010-08-16 11:06:01 +02:00
|
|
|
/* ?to_int_type@?$char_traits@_W@std@@SAGAEB_W@Z */
|
2010-07-20 23:23:24 +02:00
|
|
|
unsigned short CDECL MSVCP_char_traits_wchar_to_int_type(const wchar_t *ch)
|
|
|
|
{
|
|
|
|
return *ch;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* ?eq_int_type@?$char_traits@_W@std@@SA_NABG0@Z */
|
2010-08-16 11:06:01 +02:00
|
|
|
/* ?eq_int_type@?$char_traits@_W@std@@SA_NAEBG0@Z */
|
2010-07-20 23:23:24 +02:00
|
|
|
MSVCP_BOOL CDECL MSVCP_char_traits_wchar_eq_int_tpe(const unsigned short *i1,
|
|
|
|
const unsigned short *i2)
|
|
|
|
{
|
|
|
|
return *i1 == *i2;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* ?eof@?$char_traits@_W@std@@SAGXZ */
|
|
|
|
unsigned short CDECL MSVCP_char_traits_wchar_eof(void)
|
|
|
|
{
|
|
|
|
return WEOF;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* ?not_eof@?$char_traits@_W@std@@SAGABG@Z */
|
2010-08-16 11:06:01 +02:00
|
|
|
/* ?not_eof@?$char_traits@_W@std@@SAGAEBG@Z */
|
2010-07-20 23:23:24 +02:00
|
|
|
unsigned short CDECL MSVCP_char_traits_wchar_not_eof(const unsigned short *in)
|
|
|
|
{
|
|
|
|
return (*in==WEOF ? !WEOF : *in);
|
|
|
|
}
|
2010-07-21 11:10:07 +02:00
|
|
|
|
|
|
|
|
|
|
|
/* char_traits<unsigned short> */
|
|
|
|
/* ?assign@?$char_traits@G@std@@SAXAAGABG@Z */
|
2010-08-16 11:06:17 +02:00
|
|
|
/* ?assign@?$char_traits@G@std@@SAXAEAGAEBG@Z */
|
2010-07-21 11:10:07 +02:00
|
|
|
void CDECL MSVCP_char_traits_short_assign(unsigned short *ch,
|
|
|
|
const unsigned short *assign)
|
|
|
|
{
|
|
|
|
*ch = *assign;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* ?eq@?$char_traits@G@std@@SA_NABG0@Z */
|
2010-08-16 11:06:17 +02:00
|
|
|
/* ?eq@?$char_traits@G@std@@SA_NAEBG0@Z */
|
2010-07-21 11:10:07 +02:00
|
|
|
MSVCP_BOOL CDECL MSVCP_char_traits_short_eq(const unsigned short *ch1,
|
|
|
|
const unsigned short *ch2)
|
|
|
|
{
|
|
|
|
return *ch1 == *ch2;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* ?lt@?$char_traits@G@std@@SA_NABG0@Z */
|
2010-08-16 11:06:17 +02:00
|
|
|
/* ?lt@?$char_traits@G@std@@SA_NAEBG0@Z */
|
2010-07-21 11:10:07 +02:00
|
|
|
MSVCP_BOOL CDECL MSVCP_char_traits_short_lt(const unsigned short *ch1,
|
|
|
|
const unsigned short *ch2)
|
|
|
|
{
|
|
|
|
return *ch1 < *ch2;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* ?compare@?$char_traits@G@std@@SAHPBG0I@Z */
|
2010-08-16 11:06:17 +02:00
|
|
|
/* ?compare@?$char_traits@G@std@@SAHPEBG0_K@Z */
|
2010-07-21 11:10:07 +02:00
|
|
|
int CDECL MSVCP_char_traits_short_compare(const unsigned short *s1,
|
2010-08-16 11:06:17 +02:00
|
|
|
const unsigned short *s2, size_t count)
|
2010-07-21 11:10:07 +02:00
|
|
|
{
|
2010-08-16 11:06:17 +02:00
|
|
|
size_t i;
|
2010-07-21 11:10:07 +02:00
|
|
|
|
|
|
|
for(i=0; i<count; i++)
|
|
|
|
if(s1[i] != s2[i])
|
|
|
|
return (s1[i] < s2[i] ? -1 : 1);
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* ?length@?$char_traits@G@std@@SAIPBG@Z */
|
2010-08-16 11:06:17 +02:00
|
|
|
/* ?length@?$char_traits@G@std@@SA_KPEBG@Z */
|
|
|
|
size_t CDECL MSVCP_char_traits_short_length(const unsigned short *str)
|
2010-07-21 11:10:07 +02:00
|
|
|
{
|
2010-08-16 11:06:17 +02:00
|
|
|
size_t len;
|
2010-07-21 11:10:07 +02:00
|
|
|
|
|
|
|
for(len=0; str[len]; len++);
|
|
|
|
|
|
|
|
return len;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* ?_Copy_s@?$char_traits@G@std@@SAPAGPAGIPBGI@Z */
|
2010-08-16 11:06:17 +02:00
|
|
|
/* ?_Copy_s@?$char_traits@G@std@@SAPEAGPEAG_KPEBG1@Z */
|
2010-07-21 11:10:07 +02:00
|
|
|
unsigned short * CDECL MSVCP_char_traits_short__Copy_s(unsigned short *dest,
|
2010-08-16 11:06:17 +02:00
|
|
|
size_t size, const unsigned short *src, size_t count)
|
2010-07-21 11:10:07 +02:00
|
|
|
{
|
|
|
|
if(size<count) {
|
|
|
|
_invalid_parameter(NULL, NULL, NULL, 0, 0);
|
|
|
|
return dest;
|
|
|
|
}
|
|
|
|
|
|
|
|
return memcpy(dest, src, sizeof(unsigned short[count]));
|
|
|
|
}
|
|
|
|
|
|
|
|
/* ?copy@?$char_traits@G@std@@SAPAGPAGPBGI@Z */
|
2010-08-16 11:06:17 +02:00
|
|
|
/* ?copy@?$char_traits@G@std@@SAPEAGPEAGPEBG_K@Z */
|
2010-07-21 11:10:07 +02:00
|
|
|
unsigned short* CDECL MSVCP_char_traits_short_copy(unsigned short *dest,
|
2010-08-16 11:06:17 +02:00
|
|
|
const unsigned short *src, size_t count)
|
2010-07-21 11:10:07 +02:00
|
|
|
{
|
|
|
|
return MSVCP_char_traits_short__Copy_s(dest, count, src, count);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* ?find@?$char_traits@G@std@@SAPBGPBGIABG@Z */
|
2010-08-16 11:06:17 +02:00
|
|
|
/* ?find@?$char_traits@G@std@@SAPEBGPEBG_KAEBG@Z */
|
2010-07-21 11:10:07 +02:00
|
|
|
const unsigned short* CDECL MSVCP_char_traits_short_find(
|
2010-08-16 11:06:17 +02:00
|
|
|
const unsigned short *str, size_t range, const unsigned short *c)
|
2010-07-21 11:10:07 +02:00
|
|
|
{
|
2010-08-16 11:06:17 +02:00
|
|
|
size_t i;
|
2010-07-21 11:10:07 +02:00
|
|
|
|
|
|
|
for(i=0; i<range; i++)
|
|
|
|
if(str[i] == *c)
|
|
|
|
return str+i;
|
|
|
|
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* ?_Move_s@?$char_traits@G@std@@SAPAGPAGIPBGI@Z */
|
2010-08-16 11:06:17 +02:00
|
|
|
/* ?_Move_s@?$char_traits@G@std@@SAPEAGPEAG_KPEBG1@Z */
|
2010-07-21 11:10:07 +02:00
|
|
|
unsigned short* CDECL MSVCP_char_traits_short__Move_s(unsigned short *dest,
|
2010-08-16 11:06:17 +02:00
|
|
|
size_t size, const unsigned short *src, size_t count)
|
2010-07-21 11:10:07 +02:00
|
|
|
{
|
|
|
|
if(size<count) {
|
|
|
|
_invalid_parameter(NULL, NULL, NULL, 0, 0);
|
|
|
|
return dest;
|
|
|
|
}
|
|
|
|
|
|
|
|
return memmove(dest, src, sizeof(unsigned short[count]));
|
|
|
|
}
|
|
|
|
|
|
|
|
/* ?move@?$char_traits@G@std@@SAPAGPAGPBGI@Z */
|
2010-08-16 11:06:17 +02:00
|
|
|
/* ?move@?$char_traits@G@std@@SAPEAGPEAGPEBG_K@Z */
|
2010-07-21 11:10:07 +02:00
|
|
|
unsigned short* CDECL MSVCP_char_traits_short_move(unsigned short *dest,
|
2010-08-16 11:06:17 +02:00
|
|
|
const unsigned short *src, size_t count)
|
2010-07-21 11:10:07 +02:00
|
|
|
{
|
|
|
|
return MSVCP_char_traits_short__Move_s(dest, count, src, count);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* ?assign@?$char_traits@G@std@@SAPAGPAGIG@Z */
|
2010-08-16 11:06:17 +02:00
|
|
|
/* ?assign@?$char_traits@G@std@@SAPEAGPEAG_KG@Z */
|
2010-07-21 11:10:07 +02:00
|
|
|
unsigned short* CDECL MSVCP_char_traits_short_assignn(unsigned short *str,
|
2010-08-16 11:06:17 +02:00
|
|
|
size_t num, unsigned short c)
|
2010-07-21 11:10:07 +02:00
|
|
|
{
|
2010-08-16 11:06:17 +02:00
|
|
|
size_t i;
|
2010-07-21 11:10:07 +02:00
|
|
|
|
|
|
|
for(i=0; i<num; i++)
|
|
|
|
str[i] = c;
|
|
|
|
|
|
|
|
return str;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* ?to_char_type@?$char_traits@G@std@@SAGABG@Z */
|
2010-08-16 11:06:17 +02:00
|
|
|
/* ?to_char_type@?$char_traits@G@std@@SAGAEBG@Z */
|
2010-07-21 11:10:07 +02:00
|
|
|
unsigned short CDECL MSVCP_char_traits_short_to_char_type(const unsigned short *i)
|
|
|
|
{
|
|
|
|
return *i;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* ?to_int_type@?$char_traits@G@std@@SAGABG@Z */
|
2010-08-16 11:06:17 +02:00
|
|
|
/* ?to_int_type@?$char_traits@G@std@@SAGAEBG@Z */
|
2010-07-21 11:10:07 +02:00
|
|
|
unsigned short CDECL MSVCP_char_traits_short_to_int_type(const unsigned short *ch)
|
|
|
|
{
|
|
|
|
return *ch;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* ?eq_int_type@?$char_traits@G@std@@SA_NABG0@Z */
|
2010-08-16 11:06:17 +02:00
|
|
|
/* ?eq_int_type@?$char_traits@G@std@@SA_NAEBG0@Z */
|
2010-07-21 11:10:07 +02:00
|
|
|
MSVCP_BOOL CDECL MSVCP_char_traits_short_eq_int_type(unsigned short *i1,
|
|
|
|
unsigned short *i2)
|
|
|
|
{
|
|
|
|
return *i1 == *i2;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* ?eof@?$char_traits@G@std@@SAGXZ */
|
|
|
|
unsigned short CDECL MSVCP_char_traits_short_eof(void)
|
|
|
|
{
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* ?not_eof@?$char_traits@G@std@@SAGABG@Z */
|
2010-08-16 11:06:17 +02:00
|
|
|
/* ?not_eof@?$char_traits@G@std@@SAGAEBG@Z */
|
2010-07-21 11:10:07 +02:00
|
|
|
unsigned short CDECL MSVCP_char_traits_short_not_eof(const unsigned short *in)
|
|
|
|
{
|
|
|
|
return (*in==(unsigned short)-1 ? 0 : *in);
|
|
|
|
}
|
2010-08-19 12:17:11 +02:00
|
|
|
|
|
|
|
|
2010-08-19 23:49:08 +02:00
|
|
|
/* _String_base */
|
|
|
|
/* ?_Xlen@_String_base@std@@SAXXZ */
|
|
|
|
void CDECL MSVCP__String_base_Xlen(void)
|
|
|
|
{
|
|
|
|
static const char msg[] = "string too long";
|
|
|
|
|
|
|
|
TRACE("\n");
|
|
|
|
throw_exception(EXCEPTION_LENGTH_ERROR, msg);
|
|
|
|
}
|
|
|
|
|
2010-08-19 23:49:18 +02:00
|
|
|
/* ?_Xran@_String_base@std@@SAXXZ */
|
|
|
|
void CDECL MSVCP__String_base_Xran(void)
|
|
|
|
{
|
|
|
|
static const char msg[] = "invalid string position";
|
|
|
|
|
|
|
|
TRACE("\n");
|
|
|
|
throw_exception(EXCEPTION_OUT_OF_RANGE, msg);
|
|
|
|
}
|
|
|
|
|
2010-08-23 16:34:15 +02:00
|
|
|
/* ?_Xinvarg@_String_base@std@@SAXXZ */
|
|
|
|
void CDECL MSVCP__String_base_Xinvarg(void)
|
|
|
|
{
|
|
|
|
static const char msg[] = "invalid string argument";
|
|
|
|
|
|
|
|
TRACE("\n");
|
|
|
|
throw_exception(EXCEPTION_INVALID_ARGUMENT, msg);
|
|
|
|
}
|
|
|
|
|
2010-08-19 23:49:08 +02:00
|
|
|
|
2010-08-19 12:17:11 +02:00
|
|
|
/* basic_string<char, char_traits<char>, allocator<char>> */
|
2010-08-19 12:17:22 +02:00
|
|
|
/* ?npos@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@2IB */
|
2010-08-30 16:35:30 +02:00
|
|
|
/* ?npos@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@2_KB */
|
2010-08-19 12:17:22 +02:00
|
|
|
const size_t MSVCP_basic_string_char_npos = -1;
|
|
|
|
|
2010-08-19 12:17:11 +02:00
|
|
|
/* Internal: basic_string_char_ptr - return pointer to stored string */
|
|
|
|
static char* basic_string_char_ptr(basic_string_char *this)
|
|
|
|
{
|
|
|
|
if(this->res == BUF_SIZE_CHAR-1)
|
|
|
|
return this->data.buf;
|
|
|
|
return this->data.ptr;
|
|
|
|
}
|
|
|
|
|
2010-08-19 12:17:42 +02:00
|
|
|
/* Internal: basic_string_char_const_ptr - returns const pointer to stored string */
|
|
|
|
static const char* basic_string_char_const_ptr(const basic_string_char *this)
|
|
|
|
{
|
|
|
|
if(this->res == BUF_SIZE_CHAR-1)
|
|
|
|
return this->data.buf;
|
|
|
|
return this->data.ptr;
|
|
|
|
}
|
|
|
|
|
2010-08-19 12:17:11 +02:00
|
|
|
/* Internal: basic_string_char_eos - sets string length, puts '\0' on the end */
|
|
|
|
static void basic_string_char_eos(basic_string_char *this, size_t len)
|
|
|
|
{
|
|
|
|
static const char nullbyte = '\0';
|
|
|
|
|
|
|
|
this->size = len;
|
|
|
|
MSVCP_char_traits_char_assign(basic_string_char_ptr(this)+len, &nullbyte);
|
|
|
|
}
|
|
|
|
|
2010-08-19 12:17:42 +02:00
|
|
|
/* Internal: basic_string_char_inside - checks if given pointer points inside stored string */
|
|
|
|
static MSVCP_BOOL basic_string_char_inside(
|
|
|
|
basic_string_char *this, const char *ptr)
|
|
|
|
{
|
|
|
|
char *cstr = basic_string_char_ptr(this);
|
|
|
|
|
|
|
|
return (ptr<cstr || ptr>=cstr+this->size) ? FALSE : TRUE;
|
|
|
|
}
|
|
|
|
|
2010-08-19 12:17:11 +02:00
|
|
|
/* Internal: basic_string_char_tidy - initialize basic_string buffer, deallocates data */
|
|
|
|
/* Caution: new_size have to be smaller than BUF_SIZE_CHAR */
|
|
|
|
static void basic_string_char_tidy(basic_string_char *this,
|
2010-08-30 16:35:30 +02:00
|
|
|
MSVCP_BOOL built, size_t new_size)
|
2010-08-19 12:17:11 +02:00
|
|
|
{
|
|
|
|
if(built && BUF_SIZE_CHAR<=this->res) {
|
|
|
|
char *ptr = this->data.ptr;
|
|
|
|
|
|
|
|
if(new_size > 0)
|
|
|
|
MSVCP_char_traits_char__Copy_s(this->data.buf, BUF_SIZE_CHAR, ptr, new_size);
|
|
|
|
MSVCP_allocator_char_deallocate(this->allocator, ptr, this->res+1);
|
|
|
|
}
|
|
|
|
|
|
|
|
this->res = BUF_SIZE_CHAR-1;
|
|
|
|
basic_string_char_eos(this, new_size);
|
|
|
|
}
|
|
|
|
|
2010-08-19 12:17:42 +02:00
|
|
|
/* Internal: basic_string_char_grow - changes size of internal buffer */
|
|
|
|
static MSVCP_BOOL basic_string_char_grow(
|
|
|
|
basic_string_char *this, size_t new_size, MSVCP_BOOL trim)
|
|
|
|
{
|
|
|
|
if(this->res < new_size) {
|
|
|
|
size_t new_res = new_size;
|
|
|
|
char *ptr;
|
|
|
|
|
|
|
|
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);
|
|
|
|
if(!ptr)
|
|
|
|
ptr = MSVCP_allocator_char_allocate(this->allocator, new_size+1);
|
|
|
|
else
|
|
|
|
new_size = new_res;
|
|
|
|
if(!ptr) {
|
|
|
|
ERR("Out of memory\n");
|
|
|
|
basic_string_char_tidy(this, TRUE, 0);
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
MSVCP_char_traits_char__Copy_s(ptr, new_size,
|
|
|
|
basic_string_char_ptr(this), this->size);
|
|
|
|
basic_string_char_tidy(this, TRUE, 0);
|
|
|
|
this->data.ptr = ptr;
|
|
|
|
this->res = new_size;
|
|
|
|
basic_string_char_eos(this, this->size);
|
|
|
|
} else if(trim && new_size < BUF_SIZE_CHAR)
|
|
|
|
basic_string_char_tidy(this, TRUE,
|
|
|
|
new_size<this->size ? new_size : this->size);
|
|
|
|
else if(new_size == 0)
|
|
|
|
basic_string_char_eos(this, 0);
|
|
|
|
|
|
|
|
return (new_size>0);
|
|
|
|
}
|
|
|
|
|
2010-08-19 12:17:31 +02:00
|
|
|
/* ?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 */
|
|
|
|
DEFINE_THISCALL_WRAPPER(MSVCP_basic_string_char_erase, 12)
|
2010-08-24 16:31:25 +02:00
|
|
|
basic_string_char* __thiscall MSVCP_basic_string_char_erase(
|
2010-08-19 12:17:31 +02:00
|
|
|
basic_string_char *this, size_t pos, size_t len)
|
|
|
|
{
|
2010-09-01 12:22:36 +02:00
|
|
|
TRACE("%p %lu %lu\n", this, (unsigned long)pos, (unsigned long)len);
|
2010-08-19 12:17:31 +02:00
|
|
|
|
|
|
|
if(pos > this->size) {
|
2010-08-19 23:49:18 +02:00
|
|
|
MSVCP__String_base_Xran();
|
2010-08-19 12:17:31 +02:00
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
if(len > this->size-pos)
|
|
|
|
len = this->size-pos;
|
|
|
|
|
|
|
|
if(len) {
|
|
|
|
MSVCP_char_traits_char__Move_s(basic_string_char_ptr(this)+pos,
|
|
|
|
this->res-pos, basic_string_char_ptr(this)+pos+len,
|
|
|
|
this->size-pos-len);
|
|
|
|
basic_string_char_eos(this, this->size-len);
|
|
|
|
}
|
|
|
|
|
|
|
|
return this;
|
|
|
|
}
|
|
|
|
|
2010-08-19 12:17:42 +02:00
|
|
|
/* ?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 */
|
|
|
|
DEFINE_THISCALL_WRAPPER(MSVCP_basic_string_char_assign_substr, 16)
|
2010-08-24 16:31:25 +02:00
|
|
|
basic_string_char* __thiscall MSVCP_basic_string_char_assign_substr(
|
2010-08-19 12:17:42 +02:00
|
|
|
basic_string_char *this, const basic_string_char *assign,
|
|
|
|
size_t pos, size_t len)
|
|
|
|
{
|
2010-09-01 12:22:36 +02:00
|
|
|
TRACE("%p %p %lu %lu\n", this, assign, (unsigned long)pos, (unsigned long)len);
|
2010-08-19 12:17:42 +02:00
|
|
|
|
|
|
|
if(assign->size < pos) {
|
2010-08-19 23:49:18 +02:00
|
|
|
MSVCP__String_base_Xran();
|
2010-08-19 12:17:42 +02:00
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
if(len > assign->size-pos)
|
|
|
|
len = assign->size-pos;
|
|
|
|
|
|
|
|
if(this == assign) {
|
|
|
|
MSVCP_basic_string_char_erase(this, pos+len, MSVCP_basic_string_char_npos);
|
|
|
|
MSVCP_basic_string_char_erase(this, 0, pos);
|
|
|
|
} else if(basic_string_char_grow(this, len, FALSE)) {
|
|
|
|
MSVCP_char_traits_char__Copy_s(basic_string_char_ptr(this),
|
|
|
|
this->res, basic_string_char_const_ptr(assign)+pos, len);
|
|
|
|
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 */
|
2010-09-02 00:35:55 +02:00
|
|
|
/* ??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 */
|
2010-08-19 12:17:42 +02:00
|
|
|
DEFINE_THISCALL_WRAPPER(MSVCP_basic_string_char_assign, 8)
|
2010-08-24 16:31:25 +02:00
|
|
|
basic_string_char* __thiscall MSVCP_basic_string_char_assign(
|
2010-08-19 12:17:42 +02:00
|
|
|
basic_string_char *this, const basic_string_char *assign)
|
|
|
|
{
|
|
|
|
return MSVCP_basic_string_char_assign_substr(this, assign,
|
|
|
|
0, MSVCP_basic_string_char_npos);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* ?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 */
|
|
|
|
DEFINE_THISCALL_WRAPPER(MSVCP_basic_string_char_assign_cstr_len, 12)
|
2010-08-24 16:31:25 +02:00
|
|
|
basic_string_char* __thiscall MSVCP_basic_string_char_assign_cstr_len(
|
2010-08-19 12:17:42 +02:00
|
|
|
basic_string_char *this, const char *str, size_t len)
|
|
|
|
{
|
2010-09-01 12:22:36 +02:00
|
|
|
TRACE("%p %s %lu\n", this, debugstr_a(str), (unsigned long)len);
|
2010-08-19 12:17:42 +02:00
|
|
|
|
|
|
|
if(basic_string_char_inside(this, str))
|
|
|
|
return MSVCP_basic_string_char_assign_substr(this, this,
|
|
|
|
str-basic_string_char_ptr(this), len);
|
|
|
|
else if(basic_string_char_grow(this, len, FALSE)) {
|
|
|
|
MSVCP_char_traits_char__Copy_s(basic_string_char_ptr(this),
|
|
|
|
this->res, str, len);
|
|
|
|
basic_string_char_eos(this, len);
|
|
|
|
}
|
|
|
|
|
|
|
|
return this;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* ?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 */
|
2010-09-25 12:16:20 +02:00
|
|
|
/* ??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 */
|
2010-08-19 12:17:42 +02:00
|
|
|
DEFINE_THISCALL_WRAPPER(MSVCP_basic_string_char_assign_cstr, 8)
|
2010-08-24 16:31:25 +02:00
|
|
|
basic_string_char* __thiscall MSVCP_basic_string_char_assign_cstr(
|
2010-08-19 12:17:42 +02:00
|
|
|
basic_string_char *this, const char *str)
|
|
|
|
{
|
|
|
|
return MSVCP_basic_string_char_assign_cstr_len(this, str,
|
|
|
|
MSVCP_char_traits_char_length(str));
|
|
|
|
}
|
|
|
|
|
2010-08-19 23:48:46 +02:00
|
|
|
/* ?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 */
|
2010-09-02 00:34:02 +02:00
|
|
|
/* ?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 */
|
2010-08-19 23:48:46 +02:00
|
|
|
DEFINE_THISCALL_WRAPPER(MSVCP_basic_string_char_c_str, 4)
|
2010-08-24 16:31:25 +02:00
|
|
|
const char* __thiscall MSVCP_basic_string_char_c_str(basic_string_char *this)
|
2010-08-19 23:48:46 +02:00
|
|
|
{
|
|
|
|
TRACE("%p\n", this);
|
|
|
|
return basic_string_char_const_ptr(this);
|
|
|
|
}
|
|
|
|
|
2010-08-19 12:17:11 +02:00
|
|
|
/* ??0?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAE@XZ */
|
|
|
|
/* ??0?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QEAA@XZ */
|
|
|
|
DEFINE_THISCALL_WRAPPER(MSVCP_basic_string_char_ctor, 4)
|
2010-08-24 16:31:25 +02:00
|
|
|
basic_string_char* __thiscall MSVCP_basic_string_char_ctor(basic_string_char *this)
|
2010-08-19 12:17:11 +02:00
|
|
|
{
|
|
|
|
TRACE("%p\n", this);
|
|
|
|
|
|
|
|
basic_string_char_tidy(this, FALSE, 0);
|
|
|
|
return this;
|
|
|
|
}
|
2010-08-19 12:17:53 +02:00
|
|
|
|
2010-08-19 23:48:17 +02:00
|
|
|
/* ??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 */
|
|
|
|
DEFINE_THISCALL_WRAPPER(MSVCP_basic_string_char_copy_ctor, 8)
|
2010-08-24 16:31:25 +02:00
|
|
|
basic_string_char* __thiscall MSVCP_basic_string_char_copy_ctor(
|
2010-08-19 23:48:17 +02:00
|
|
|
basic_string_char *this, const basic_string_char *copy)
|
|
|
|
{
|
|
|
|
TRACE("%p %p\n", this, copy);
|
|
|
|
|
|
|
|
basic_string_char_tidy(this, FALSE, 0);
|
|
|
|
MSVCP_basic_string_char_assign(this, copy);
|
|
|
|
return this;
|
|
|
|
}
|
|
|
|
|
2010-08-19 23:48:36 +02:00
|
|
|
/* ??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)
|
2010-08-24 16:31:25 +02:00
|
|
|
basic_string_char* __thiscall MSVCP_basic_string_char_ctor_cstr(
|
2010-08-19 23:48:36 +02:00
|
|
|
basic_string_char *this, const char *str)
|
|
|
|
{
|
|
|
|
TRACE("%p %s\n", this, debugstr_a(str));
|
|
|
|
|
|
|
|
basic_string_char_tidy(this, FALSE, 0);
|
|
|
|
MSVCP_basic_string_char_assign_cstr(this, str);
|
|
|
|
return this;
|
|
|
|
}
|
|
|
|
|
2010-08-19 12:17:53 +02:00
|
|
|
/* ??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 */
|
|
|
|
DEFINE_THISCALL_WRAPPER(MSVCP_basic_string_char_dtor, 4)
|
2010-08-24 16:31:25 +02:00
|
|
|
void __thiscall MSVCP_basic_string_char_dtor(basic_string_char *this)
|
2010-08-19 12:17:53 +02:00
|
|
|
{
|
|
|
|
TRACE("%p\n", this);
|
|
|
|
basic_string_char_tidy(this, TRUE, 0);
|
|
|
|
}
|
2010-08-30 16:35:30 +02:00
|
|
|
|
2010-09-02 00:34:57 +02:00
|
|
|
/* ?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 */
|
|
|
|
DEFINE_THISCALL_WRAPPER(MSVCP_basic_string_char_length, 4)
|
|
|
|
size_t __thiscall MSVCP_basic_string_char_length(basic_string_char *this)
|
|
|
|
{
|
|
|
|
TRACE("%p\n", this);
|
|
|
|
return this->size;
|
|
|
|
}
|
|
|
|
|
2010-08-30 16:35:30 +02:00
|
|
|
|
|
|
|
/* basic_string<wchar_t, char_traits<wchar_t>, allocator<wchar_t>> */
|
|
|
|
/* ?npos@?$basic_string@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@2IB */
|
|
|
|
/* ?npos@?$basic_string@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@2_KB */
|
|
|
|
const size_t MSVCP_basic_string_wchar_npos = -1;
|
|
|
|
|
|
|
|
/* Internal: basic_string_wchar_ptr - return pointer to stored string */
|
|
|
|
static wchar_t* basic_string_wchar_ptr(basic_string_wchar *this)
|
|
|
|
{
|
|
|
|
if(this->res == BUF_SIZE_WCHAR-1)
|
|
|
|
return this->data.buf;
|
|
|
|
return this->data.ptr;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Internal: basic_string_wchar_const_ptr - returns const pointer to stored string */
|
|
|
|
static const wchar_t* basic_string_wchar_const_ptr(const basic_string_wchar *this)
|
|
|
|
{
|
|
|
|
if(this->res == BUF_SIZE_WCHAR-1)
|
|
|
|
return this->data.buf;
|
|
|
|
return this->data.ptr;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Internal: basic_string_wchar_eos - sets string length, puts '\0' on the end */
|
|
|
|
static void basic_string_wchar_eos(basic_string_wchar *this, size_t len)
|
|
|
|
{
|
|
|
|
static const wchar_t nullbyte_w = '\0';
|
|
|
|
|
|
|
|
this->size = len;
|
|
|
|
MSVCP_char_traits_wchar_assign(basic_string_wchar_ptr(this)+len, &nullbyte_w);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Internal: basic_string_char_inside - checks if given pointer points inside stored string */
|
|
|
|
static MSVCP_BOOL basic_string_wchar_inside(
|
|
|
|
basic_string_wchar *this, const wchar_t *ptr)
|
|
|
|
{
|
|
|
|
wchar_t *cstr = basic_string_wchar_ptr(this);
|
|
|
|
|
|
|
|
return (ptr<cstr || ptr>=cstr+this->size) ? FALSE : TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Internal: basic_string_char_tidy - initialize basic_string buffer, deallocates data */
|
|
|
|
/* Caution: new_size have to be smaller than BUF_SIZE_WCHAR */
|
|
|
|
static void basic_string_wchar_tidy(basic_string_wchar *this,
|
|
|
|
MSVCP_BOOL built, size_t new_size)
|
|
|
|
{
|
|
|
|
if(built && BUF_SIZE_WCHAR<=this->res) {
|
|
|
|
wchar_t *ptr = this->data.ptr;
|
|
|
|
|
|
|
|
if(new_size > 0)
|
|
|
|
MSVCP_char_traits_wchar__Copy_s(this->data.buf, BUF_SIZE_WCHAR, ptr, new_size);
|
|
|
|
MSVCP_allocator_wchar_deallocate(this->allocator, ptr, this->res+1);
|
|
|
|
}
|
|
|
|
|
|
|
|
this->res = BUF_SIZE_WCHAR-1;
|
|
|
|
basic_string_wchar_eos(this, new_size);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Internal: basic_string_wchar_grow - changes size of internal buffer */
|
|
|
|
static MSVCP_BOOL basic_string_wchar_grow(
|
|
|
|
basic_string_wchar *this, size_t new_size, MSVCP_BOOL trim)
|
|
|
|
{
|
|
|
|
if(this->res < new_size) {
|
|
|
|
size_t new_res = new_size;
|
|
|
|
wchar_t *ptr;
|
|
|
|
|
|
|
|
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);
|
|
|
|
if(!ptr)
|
|
|
|
ptr = MSVCP_allocator_wchar_allocate(this->allocator, new_size+1);
|
|
|
|
else
|
|
|
|
new_size = new_res;
|
|
|
|
if(!ptr) {
|
|
|
|
ERR("Out of memory\n");
|
|
|
|
basic_string_wchar_tidy(this, TRUE, 0);
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
MSVCP_char_traits_wchar__Copy_s(ptr, new_size,
|
|
|
|
basic_string_wchar_ptr(this), this->size);
|
|
|
|
basic_string_wchar_tidy(this, TRUE, 0);
|
|
|
|
this->data.ptr = ptr;
|
|
|
|
this->res = new_size;
|
|
|
|
basic_string_wchar_eos(this, this->size);
|
|
|
|
} else if(trim && new_size < BUF_SIZE_WCHAR)
|
|
|
|
basic_string_wchar_tidy(this, TRUE,
|
|
|
|
new_size<this->size ? new_size : this->size);
|
|
|
|
else if(new_size == 0)
|
|
|
|
basic_string_wchar_eos(this, 0);
|
|
|
|
|
|
|
|
return (new_size>0);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* ?erase@?$basic_string@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@QAEAAV12@II@Z */
|
|
|
|
/* ?erase@?$basic_string@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@QEAAAEAV12@_K0@Z */
|
|
|
|
DEFINE_THISCALL_WRAPPER(MSVCP_basic_string_wchar_erase, 12)
|
|
|
|
basic_string_wchar* __thiscall MSVCP_basic_string_wchar_erase(
|
|
|
|
basic_string_wchar *this, size_t pos, size_t len)
|
|
|
|
{
|
2010-09-01 12:22:36 +02:00
|
|
|
TRACE("%p %lu %lu\n", this, (unsigned long)pos, (unsigned long)len);
|
2010-08-30 16:35:30 +02:00
|
|
|
|
|
|
|
if(pos > this->size) {
|
|
|
|
MSVCP__String_base_Xran();
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
if(len > this->size-pos)
|
|
|
|
len = this->size-pos;
|
|
|
|
|
|
|
|
if(len) {
|
|
|
|
MSVCP_char_traits_wchar__Move_s(basic_string_wchar_ptr(this)+pos,
|
|
|
|
this->res-pos, basic_string_wchar_ptr(this)+pos+len,
|
|
|
|
this->size-pos-len);
|
|
|
|
basic_string_wchar_eos(this, this->size-len);
|
|
|
|
}
|
|
|
|
|
|
|
|
return this;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* ?assign@?$basic_string@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@QAEAAV12@ABV12@II@Z */
|
|
|
|
/* ?assign@?$basic_string@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@QEAAAEAV12@AEBV12@_K1@Z */
|
|
|
|
DEFINE_THISCALL_WRAPPER(MSVCP_basic_string_wchar_assign_substr, 16)
|
|
|
|
basic_string_wchar* __thiscall MSVCP_basic_string_wchar_assign_substr(
|
|
|
|
basic_string_wchar *this, const basic_string_wchar *assign,
|
|
|
|
size_t pos, size_t len)
|
|
|
|
{
|
2010-09-01 12:22:36 +02:00
|
|
|
TRACE("%p %p %lu %lu\n", this, assign, (unsigned long)pos, (unsigned long)len);
|
2010-08-30 16:35:30 +02:00
|
|
|
|
|
|
|
if(assign->size < pos) {
|
|
|
|
MSVCP__String_base_Xran();
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
if(len > assign->size-pos)
|
|
|
|
len = assign->size-pos;
|
|
|
|
|
|
|
|
if(this == assign) {
|
|
|
|
MSVCP_basic_string_wchar_erase(this, pos+len, MSVCP_basic_string_wchar_npos);
|
|
|
|
MSVCP_basic_string_wchar_erase(this, 0, pos);
|
|
|
|
} else if(basic_string_wchar_grow(this, len, FALSE)) {
|
|
|
|
MSVCP_char_traits_wchar__Copy_s(basic_string_wchar_ptr(this),
|
|
|
|
this->res, basic_string_wchar_const_ptr(assign)+pos, len);
|
|
|
|
basic_string_wchar_eos(this, len);
|
|
|
|
}
|
|
|
|
|
|
|
|
return this;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* ?assign@?$basic_string@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@QAEAAV12@ABV12@@Z */
|
|
|
|
/* ?assign@?$basic_string@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@QEAAAEAV12@AEBV12@@Z */
|
2010-09-02 00:35:55 +02:00
|
|
|
/* ??4?$basic_string@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@QAEAAV01@ABV01@@Z */
|
|
|
|
/* ??4?$basic_string@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@QEAAAEAV01@AEBV01@@Z */
|
2010-08-30 16:35:30 +02:00
|
|
|
DEFINE_THISCALL_WRAPPER(MSVCP_basic_string_wchar_assign, 8)
|
|
|
|
basic_string_wchar* __thiscall MSVCP_basic_string_wchar_assign(
|
|
|
|
basic_string_wchar *this, const basic_string_wchar *assign)
|
|
|
|
{
|
|
|
|
return MSVCP_basic_string_wchar_assign_substr(this, assign,
|
|
|
|
0, MSVCP_basic_string_wchar_npos);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* ?assign@?$basic_string@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@QAEAAV12@PB_WI@Z */
|
|
|
|
/* ?assign@?$basic_string@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@QEAAAEAV12@PEB_W_K@Z */
|
|
|
|
DEFINE_THISCALL_WRAPPER(MSVCP_basic_string_wchar_assign_cstr_len, 12)
|
|
|
|
basic_string_wchar* __thiscall MSVCP_basic_string_wchar_assign_cstr_len(
|
|
|
|
basic_string_wchar *this, const wchar_t *str, size_t len)
|
|
|
|
{
|
2010-09-01 12:22:36 +02:00
|
|
|
TRACE("%p %s %lu\n", this, debugstr_w(str), (unsigned long)len);
|
2010-08-30 16:35:30 +02:00
|
|
|
|
|
|
|
if(basic_string_wchar_inside(this, str))
|
|
|
|
return MSVCP_basic_string_wchar_assign_substr(this, this,
|
|
|
|
str-basic_string_wchar_ptr(this), len);
|
|
|
|
else if(basic_string_wchar_grow(this, len, FALSE)) {
|
|
|
|
MSVCP_char_traits_wchar__Copy_s(basic_string_wchar_ptr(this),
|
|
|
|
this->res, str, len);
|
|
|
|
basic_string_wchar_eos(this, len);
|
|
|
|
}
|
|
|
|
|
|
|
|
return this;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* ?assign@?$basic_string@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@QAEAAV12@PB_W@Z */
|
|
|
|
/* ?assign@?$basic_string@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@QEAAAEAV12@PEB_W@Z */
|
|
|
|
DEFINE_THISCALL_WRAPPER(MSVCP_basic_string_wchar_assign_cstr, 8)
|
|
|
|
basic_string_wchar* __thiscall MSVCP_basic_string_wchar_assign_cstr(
|
|
|
|
basic_string_wchar *this, const wchar_t *str)
|
|
|
|
{
|
|
|
|
return MSVCP_basic_string_wchar_assign_cstr_len(this, str,
|
|
|
|
MSVCP_char_traits_wchar_length(str));
|
|
|
|
}
|
|
|
|
|
|
|
|
/* ?c_str@?$basic_string@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@QBEPB_WXZ */
|
|
|
|
/* ?c_str@?$basic_string@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@QEBAPEB_WXZ */
|
2010-09-02 00:34:02 +02:00
|
|
|
/* ?data@?$basic_string@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@QBEPB_WXZ */
|
|
|
|
/* ?data@?$basic_string@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@QEBAPEB_WXZ */
|
2010-08-30 16:35:30 +02:00
|
|
|
DEFINE_THISCALL_WRAPPER(MSVCP_basic_string_wchar_c_str, 4)
|
|
|
|
const wchar_t* __thiscall MSVCP_basic_string_wchar_c_str(basic_string_wchar *this)
|
|
|
|
{
|
|
|
|
TRACE("%p\n", this);
|
|
|
|
return basic_string_wchar_const_ptr(this);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* ??0?$basic_string@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@QAE@XZ */
|
|
|
|
/* ??0?$basic_string@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@QEAA@XZ */
|
|
|
|
DEFINE_THISCALL_WRAPPER(MSVCP_basic_string_wchar_ctor, 4)
|
|
|
|
basic_string_wchar* __thiscall MSVCP_basic_string_wchar_ctor(basic_string_wchar *this)
|
|
|
|
{
|
|
|
|
TRACE("%p\n", this);
|
|
|
|
|
|
|
|
basic_string_wchar_tidy(this, FALSE, 0);
|
|
|
|
return this;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* ??0?$basic_string@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@QAE@ABV01@@Z */
|
|
|
|
/* ??0?$basic_string@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@QEAA@AEBV01@@Z */
|
|
|
|
DEFINE_THISCALL_WRAPPER(MSVCP_basic_string_wchar_copy_ctor, 8)
|
|
|
|
basic_string_wchar* __thiscall MSVCP_basic_string_wchar_copy_ctor(
|
|
|
|
basic_string_wchar *this, const basic_string_wchar *copy)
|
|
|
|
{
|
|
|
|
TRACE("%p %p\n", this, copy);
|
|
|
|
|
|
|
|
basic_string_wchar_tidy(this, FALSE, 0);
|
|
|
|
MSVCP_basic_string_wchar_assign(this, copy);
|
|
|
|
return this;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* ??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 */
|
|
|
|
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)
|
|
|
|
{
|
|
|
|
TRACE("%p %s\n", this, debugstr_w(str));
|
|
|
|
|
|
|
|
basic_string_wchar_tidy(this, FALSE, 0);
|
|
|
|
MSVCP_basic_string_wchar_assign_cstr(this, str);
|
|
|
|
return this;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* ??1?$basic_string@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@QAE@XZ */
|
|
|
|
/* ??1?$basic_string@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@QEAA@XZ */
|
|
|
|
DEFINE_THISCALL_WRAPPER(MSVCP_basic_string_wchar_dtor, 4)
|
|
|
|
void __thiscall MSVCP_basic_string_wchar_dtor(basic_string_wchar *this)
|
|
|
|
{
|
|
|
|
TRACE("%p\n", this);
|
|
|
|
basic_string_wchar_tidy(this, TRUE, 0);
|
|
|
|
}
|
2010-09-02 00:34:57 +02:00
|
|
|
|
|
|
|
/* ?size@?$basic_string@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@QBEIXZ */
|
|
|
|
/* ?size@?$basic_string@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@QEBA_KXZ */
|
|
|
|
/* ?length@?$basic_string@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@QBEIXZ */
|
|
|
|
/* ?length@?$basic_string@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@QEBA_KXZ */
|
|
|
|
DEFINE_THISCALL_WRAPPER(MSVCP_basic_string_wchar_length, 4)
|
|
|
|
size_t __thiscall MSVCP_basic_string_wchar_length(basic_string_wchar *this)
|
|
|
|
{
|
|
|
|
TRACE("%p\n", this);
|
|
|
|
return this->size;
|
|
|
|
}
|