Commit 9b516abb authored by Piotr Caban's avatar Piotr Caban Committed by Alexandre Julliard

msvcp: Sync implementations.

parent 5b1ee41d
......@@ -447,6 +447,13 @@ const char* __thiscall MSVCP_failure_what(failure *this)
DEFINE_RTTI_DATA2(failure, 0, &runtime_error_rtti_base_descriptor, &exception_rtti_base_descriptor, ".?AVfailure@std@@");
DEFINE_CXX_DATA2(failure, &runtime_error_cxx_type_info, &exception_cxx_type_info, MSVCP_runtime_error_dtor);
/* ?_Nomemory@std@@YAXXZ */
void __cdecl _Nomemory(void)
{
TRACE("()\n");
throw_exception(EXCEPTION_BAD_ALLOC, NULL);
}
#ifndef __GNUC__
void __asm_dummy_vtables(void) {
#endif
......
......@@ -1122,7 +1122,7 @@
@ cdecl -arch=win64 ?_Mutex_ctor@_Mutex@std@@CAXPEAV12@@Z(ptr) mutex_mutex_ctor
@ cdecl -arch=win32 ?_Mutex_dtor@_Mutex@std@@CAXPAV12@@Z(ptr) mutex_mutex_dtor
@ cdecl -arch=win64 ?_Mutex_dtor@_Mutex@std@@CAXPEAV12@@Z(ptr) mutex_mutex_dtor
@ stub ?_Nomemory@std@@YAXXZ
@ cdecl ?_Nomemory@std@@YAXXZ() _Nomemory
@ thiscall -arch=win32 ?_Orphan_all@_Container_base0@std@@QAEXXZ(ptr) Container_base0_Orphan_all
@ cdecl -arch=win64 ?_Orphan_all@_Container_base0@std@@QEAAXXZ(ptr) Container_base0_Orphan_all
@ stub -arch=win32 ?_Orphan_all@_Container_base12@std@@QAEXXZ
......
......@@ -158,7 +158,7 @@ static const MSVCP_size_t MSVCP_basic_string_char_npos = -1;
/* ?_Myptr@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@IEAAPEADXZ */
static char* basic_string_char_ptr(basic_string_char *this)
{
if(this->res == BUF_SIZE_CHAR-1)
if(this->res < BUF_SIZE_CHAR)
return this->data.buf;
return this->data.ptr;
}
......@@ -167,7 +167,7 @@ static char* basic_string_char_ptr(basic_string_char *this)
/* ?_Myptr@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@IEBAPEBDXZ */
static const char* basic_string_char_const_ptr(const basic_string_char *this)
{
if(this->res == BUF_SIZE_CHAR-1)
if(this->res < BUF_SIZE_CHAR)
return this->data.buf;
return this->data.ptr;
}
......@@ -437,7 +437,7 @@ const MSVCP_size_t MSVCP_basic_string_wchar_npos = -1;
/* ?_Myptr@?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@IEAAPEAGXZ */
static wchar_t* basic_string_wchar_ptr(basic_string_wchar *this)
{
if(this->res == BUF_SIZE_WCHAR-1)
if(this->res < BUF_SIZE_WCHAR)
return this->data.buf;
return this->data.ptr;
}
......@@ -448,7 +448,7 @@ static wchar_t* basic_string_wchar_ptr(basic_string_wchar *this)
/* ?_Myptr@?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@IEBAPEBGXZ */
static const wchar_t* basic_string_wchar_const_ptr(const basic_string_wchar *this)
{
if(this->res == BUF_SIZE_WCHAR-1)
if(this->res < BUF_SIZE_WCHAR)
return this->data.buf;
return this->data.ptr;
}
......
......@@ -557,6 +557,13 @@ const char* __thiscall MSVCP_failure_what(failure *this)
DEFINE_RTTI_DATA2(failure, 0, &runtime_error_rtti_base_descriptor, &exception_rtti_base_descriptor, ".?AVfailure@std@@");
DEFINE_CXX_DATA2(failure, &runtime_error_cxx_type_info, &exception_cxx_type_info, MSVCP_logic_error_dtor);
/* ?_Nomemory@std@@YAXXZ */
void __cdecl _Nomemory(void)
{
TRACE("()\n");
throw_exception(EXCEPTION_BAD_ALLOC, NULL);
}
#ifndef __GNUC__
void __asm_dummy_vtables(void) {
#endif
......
......@@ -280,6 +280,30 @@ typedef struct {
void (__cdecl *pfree)(void*);
} strstreambuf;
typedef struct {
basic_ostream_char base;
strstreambuf buf;
/* virtual inheritance
* basic_ios_char basic_ios;
*/
} ostrstream;
typedef struct {
basic_istream_char base;
strstreambuf buf;
/* virtual inheritance
* basic_ios_char basic_ios;
*/
} istrstream;
typedef struct {
basic_iostream_char base;
strstreambuf buf;
/* virtual inheritance
* basic_ios_char basic_ios;
*/
} strstream;
extern const vtable_ptr MSVCP_iosb_vtable;
/* ??_7ios_base@std@@6B@ */
......@@ -471,6 +495,15 @@ extern const vtable_ptr MSVCP_basic_stringstream_short_vtable;
/* ??_7strstreambuf@std@@6B */
extern const vtable_ptr MSVCP_strstreambuf_vtable;
static const int ostrstream_vbtable[] = {0, sizeof(ostrstream)};
extern const vtable_ptr MSVCP_ostrstream_vtable;
static const int istrstream_vbtable[] = {0, sizeof(istrstream)};
static const int strstream_vbtable1[] = {0, sizeof(strstream)};
static const int strstream_vbtable2[] = {0, sizeof(strstream)-FIELD_OFFSET(strstream, base.base2)};
extern const vtable_ptr MSVCP_strstream_vtable;
DEFINE_RTTI_DATA0(iosb, 0, ".?AV?$_Iosb@H@std@@");
DEFINE_RTTI_DATA1(ios_base, 0, &iosb_rtti_base_descriptor, ".?AV?$_Iosb@H@std@@");
DEFINE_RTTI_DATA2(basic_ios_char, 0, &ios_base_rtti_base_descriptor, &iosb_rtti_base_descriptor,
......@@ -619,6 +652,16 @@ DEFINE_RTTI_DATA8(basic_stringstream_short, sizeof(basic_stringstream_wchar),
".?AV?$basic_stringstream@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@");
DEFINE_RTTI_DATA1(strstreambuf, sizeof(strstreambuf),
&basic_streambuf_char_rtti_base_descriptor, ".?AVstrstreambuf@std@@");
DEFINE_RTTI_DATA4(ostrstream, sizeof(ostrstream),
&basic_ostream_char_rtti_base_descriptor, &basic_ios_char_rtti_base_descriptor,
&ios_base_rtti_base_descriptor, &iosb_rtti_base_descriptor,
"?AVostrstream@std@@");
DEFINE_RTTI_DATA8(strstream, sizeof(strstream),
&basic_istream_char_rtti_base_descriptor, &basic_ios_char_rtti_base_descriptor,
&ios_base_rtti_base_descriptor, &iosb_rtti_base_descriptor,
&basic_ostream_char_rtti_base_descriptor, &basic_ios_char_rtti_base_descriptor,
&ios_base_rtti_base_descriptor, &iosb_rtti_base_descriptor,
"?AVstrstream@std@@");
#ifndef __GNUC__
void __asm_dummy_vtables(void) {
......@@ -827,6 +870,10 @@ void __asm_dummy_vtables(void) {
VTABLE_ADD_FUNC(basic_streambuf_char_setbuf)
VTABLE_ADD_FUNC(basic_streambuf_char_sync)
VTABLE_ADD_FUNC(basic_streambuf_char_imbue));
__ASM_VTABLE(ostrstream,
VTABLE_ADD_FUNC(ostrstream_vector_dtor));
__ASM_VTABLE(strstream,
VTABLE_ADD_FUNC(strstream_vector_dtor));
#ifndef __GNUC__
}
#endif
......@@ -11579,6 +11626,23 @@ void __thiscall strstreambuf__Init(strstreambuf *this, streamsize len, char *g,
basic_streambuf_char_setp(&this->base, p, this->seekhigh);
}
/* ??0strstreambuf@std@@QAE@PACH0@Z */
/* ??0strstreambuf@std@@QEAA@PEAC_J0@Z */
/* ??0strstreambuf@std@@QAE@PADH0@Z */
/* ??0strstreambuf@std@@QEAA@PEAD_J0@Z */
/* ??0strstreambuf@std@@QAE@PAEH0@Z */
/* ??0strstreambuf@std@@QEAA@PEAE_J0@Z */
static strstreambuf* strstreambuf_ctor_get_put(strstreambuf *this, char *g, streamsize len, char *p)
{
TRACE("(%p %p %ld %p)\n", this, g, len, p);
basic_streambuf_char_ctor(&this->base);
this->base.vtable = &MSVCP_strstreambuf_vtable;
strstreambuf__Init(this, len, g, p, 0);
return this;
}
/* ?_Tidy@strstreambuf@std@@IAEXXZ */
/* ?_Tidy@strstreambuf@std@@IEAAXXZ */
DEFINE_THISCALL_WRAPPER(strstreambuf__Tidy, 4)
......@@ -11833,6 +11897,180 @@ int __thiscall strstreambuf_underflow(strstreambuf *this)
return (unsigned char)(*gptr);
}
static inline basic_ios_char* ostrstream_to_basic_ios(ostrstream *ptr)
{
return (basic_ios_char*)((char*)ptr+ostrstream_vbtable[1]);
}
static inline ostrstream* ostrstream_from_basic_ios(basic_ios_char *ptr)
{
return (ostrstream*)((char*)ptr-ostrstream_vbtable[1]);
}
/* ??0ostrstream@std@@QAE@PADHH@Z */
DEFINE_THISCALL_WRAPPER(ostrstream_ctor, 20)
ostrstream* __thiscall ostrstream_ctor(ostrstream *this, char *buf, streamsize size, int mode, MSVCP_bool virt_init)
{
basic_ios_char *basic_ios;
TRACE("(%p %p %ld %d %d)\n", this, buf, size, mode, virt_init);
if(virt_init) {
this->base.vbtable = ostrstream_vbtable;
basic_ios = basic_ostream_char_get_basic_ios(&this->base);
basic_ios_char_ctor(basic_ios);
}else {
basic_ios = basic_ostream_char_get_basic_ios(&this->base);
}
strstreambuf_ctor_get_put(&this->buf, buf, size,
buf && (mode & OPENMODE_app) ? buf+strlen(buf) : buf);
basic_ostream_char_ctor(&this->base, &this->buf.base, FALSE, FALSE);
basic_ios->base.vtable = &MSVCP_ostrstream_vtable;
return this;
}
/* ??1ostrstream@std@@UAE@XZ */
/* ??1ostrstream@std@@UEAA@XZ */
DEFINE_THISCALL_WRAPPER(ostrstream_dtor, 4)
void __thiscall ostrstream_dtor(basic_ios_char *base)
{
ostrstream *this = ostrstream_from_basic_ios(base);
TRACE("(%p)\n", this);
basic_ostream_char_dtor(basic_ostream_char_to_basic_ios(&this->base));
strstreambuf_dtor(&this->buf);
}
static void ostrstream_vbase_dtor(ostrstream *this)
{
TRACE("(%p)\n", this);
ostrstream_dtor(ostrstream_to_basic_ios(this));
basic_ios_char_dtor(basic_ostream_char_get_basic_ios(&this->base));
}
DEFINE_THISCALL_WRAPPER(ostrstream_vector_dtor, 8)
ostrstream* __thiscall ostrstream_vector_dtor(basic_ios_char *base, unsigned int flags)
{
ostrstream *this = ostrstream_from_basic_ios(base);
TRACE("(%p %x)\n", this, flags);
if(flags & 2) {
/* we have an array, with the number of elements stored before the first object */
INT_PTR i, *ptr = (INT_PTR *)this-1;
for(i=*ptr-1; i>=0; i--)
ostrstream_vbase_dtor(this+i);
MSVCRT_operator_delete(ptr);
} else {
ostrstream_vbase_dtor(this);
if(flags & 1)
MSVCRT_operator_delete(this);
}
return this;
}
static inline istrstream* istrstream_from_basic_ios(basic_ios_char *ptr)
{
return (istrstream*)((char*)ptr-istrstream_vbtable[1]);
}
/* ??1istrstream@std@@UAE@XZ */
/* ??1istrstream@std@@UEAA@XZ */
DEFINE_THISCALL_WRAPPER(istrstream_dtor, 4)
void __thiscall istrstream_dtor(basic_ios_char *base)
{
istrstream *this = istrstream_from_basic_ios(base);
TRACE("(%p)\n", this);
basic_istream_char_dtor(basic_istream_char_to_basic_ios(&this->base));
strstreambuf_dtor(&this->buf);
}
static inline basic_ios_char* strstream_to_basic_ios(strstream *ptr)
{
return (basic_ios_char*)((char*)ptr+strstream_vbtable1[1]);
}
static inline strstream* strstream_from_basic_ios(basic_ios_char *ptr)
{
return (strstream*)((char*)ptr-strstream_vbtable1[1]);
}
/* ??0strstream@std@@QAE@PADHH@Z */
/* ??0strstream@std@@QEAA@PEAD_JH@Z */
DEFINE_THISCALL_WRAPPER(strstream_ctor, 20)
strstream* __thiscall strstream_ctor(strstream *this, char *buf, streamsize size, int mode, MSVCP_bool virt_init)
{
basic_ios_char *basic_ios;
TRACE("(%p %p %ld %d %d)\n", this, buf, size, mode, virt_init);
if(virt_init) {
this->base.base1.vbtable = strstream_vbtable1;
this->base.base2.vbtable = strstream_vbtable2;
basic_ios = basic_istream_char_get_basic_ios(&this->base.base1);
basic_ios_char_ctor(basic_ios);
}else {
basic_ios = basic_istream_char_get_basic_ios(&this->base.base1);
}
strstreambuf_ctor_get_put(&this->buf, buf, size,
buf && (mode & OPENMODE_app) ? buf+strlen(buf) : buf);
basic_iostream_char_ctor(&this->base, &this->buf.base, FALSE);
basic_ios->base.vtable = &MSVCP_strstream_vtable;
return this;
}
/* ??1strstream@std@@UAE@XZ */
/* ??1strstream@std@@UEAA@XZ */
DEFINE_THISCALL_WRAPPER(strstream_dtor, 4)
void __thiscall strstream_dtor(basic_ios_char *base)
{
strstream *this = strstream_from_basic_ios(base);
TRACE("(%p)\n", this);
basic_iostream_char_dtor(basic_iostream_char_to_basic_ios(&this->base));
strstreambuf_dtor(&this->buf);
}
static void strstream_vbase_dtor(strstream *this)
{
TRACE("(%p)\n", this);
strstream_dtor(strstream_to_basic_ios(this));
basic_ios_char_dtor(basic_istream_char_get_basic_ios(&this->base.base1));
}
DEFINE_THISCALL_WRAPPER(strstream_vector_dtor, 8)
strstream* __thiscall strstream_vector_dtor(basic_ios_char *base, unsigned int flags)
{
strstream *this = strstream_from_basic_ios(base);
TRACE("(%p %x)\n", this, flags);
if(flags & 2) {
/* we have an array, with the number of elements stored before the first object */
INT_PTR i, *ptr = (INT_PTR *)this-1;
for(i=*ptr-1; i>=0; i--)
strstream_vbase_dtor(this+i);
MSVCRT_operator_delete(ptr);
} else {
strstream_vbase_dtor(this);
if(flags & 1)
MSVCRT_operator_delete(this);
}
return this;
}
static void __cdecl setprecision_func(ios_base *base, streamsize prec)
{
ios_base_precision_set(base, prec);
......@@ -12181,6 +12419,8 @@ void init_io(void *base)
init_basic_stringstream_wchar_rtti(base);
init_basic_stringstream_short_rtti(base);
init_strstreambuf_rtti(base);
init_strstream_rtti(base);
init_ostrstream_rtti(base);
#endif
basic_filebuf_char_ctor_file(&filebuf_char_stdin, stdin);
......
......@@ -897,8 +897,8 @@
@ stub -arch=win64 ??0messages_base@std@@QEAA@_K@Z
@ stub -arch=win32 ??0money_base@std@@QAE@I@Z
@ stub -arch=win64 ??0money_base@std@@QEAA@_K@Z
@ stub -arch=win32 ??0ostrstream@std@@QAE@PADHH@Z
@ stub -arch=win64 ??0ostrstream@std@@QEAA@PEAD_JH@Z
@ thiscall -arch=win32 ??0ostrstream@std@@QAE@PADHH@Z(ptr ptr long long long) ostrstream_ctor
@ cdecl -arch=win64 ??0ostrstream@std@@QEAA@PEAD_JH@Z(ptr ptr long long long) ostrstream_ctor
@ thiscall -arch=win32 ??0out_of_range@std@@QAE@ABV01@@Z(ptr ptr) MSVCP_out_of_range_copy_ctor
@ cdecl -arch=win64 ??0out_of_range@std@@QEAA@AEBV01@@Z(ptr ptr) MSVCP_out_of_range_copy_ctor
@ thiscall -arch=win32 ??0out_of_range@std@@QAE@ABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@1@@Z(ptr ptr) MSVCP_out_of_range_ctor_bstr
......@@ -915,8 +915,8 @@
@ cdecl -arch=win64 ??0runtime_error@std@@QEAA@AEBV01@@Z(ptr ptr) MSVCP_runtime_error_copy_ctor
@ thiscall -arch=win32 ??0runtime_error@std@@QAE@ABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@1@@Z(ptr ptr) MSVCP_runtime_error_ctor_bstr
@ cdecl -arch=win64 ??0runtime_error@std@@QEAA@AEBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@1@@Z(ptr ptr) MSVCP_runtime_error_ctor_bstr
@ stub -arch=win32 ??0strstream@std@@QAE@PADHH@Z
@ stub -arch=win64 ??0strstream@std@@QEAA@PEAD_JH@Z
@ thiscall -arch=win32 ??0strstream@std@@QAE@PADHH@Z(ptr ptr long long long) strstream_ctor
@ cdecl -arch=win64 ??0strstream@std@@QEAA@PEAD_JH@Z(ptr ptr long long long) strstream_ctor
@ stub -arch=win32 ??0time_base@std@@QAE@I@Z
@ stub -arch=win64 ??0time_base@std@@QEAA@_K@Z
@ stub -arch=win32 ??0underflow_error@std@@QAE@ABV01@@Z
......@@ -1065,8 +1065,8 @@
@ cdecl -arch=win64 ??1facet@locale@std@@UEAA@XZ(ptr) locale_facet_dtor
@ thiscall -arch=win32 ??1ios_base@std@@UAE@XZ(ptr) ios_base_dtor
@ cdecl -arch=win64 ??1ios_base@std@@UEAA@XZ(ptr) ios_base_dtor
@ stub -arch=win32 ??1istrstream@std@@UAE@XZ
@ stub -arch=win64 ??1istrstream@std@@UEAA@XZ
@ thiscall -arch=win32 ??1istrstream@std@@UAE@XZ(ptr) istrstream_dtor
@ cdecl -arch=win64 ??1istrstream@std@@UEAA@XZ(ptr) istrstream_dtor
@ thiscall -arch=win32 ??1length_error@std@@UAE@XZ(ptr) MSVCP_logic_error_dtor
@ cdecl -arch=win64 ??1length_error@std@@UEAA@XZ(ptr) MSVCP_logic_error_dtor
@ thiscall -arch=win32 ??1locale@std@@QAE@XZ(ptr) locale_dtor
......@@ -1077,8 +1077,8 @@
@ stub -arch=win64 ??1messages_base@std@@UEAA@XZ
@ stub -arch=win32 ??1money_base@std@@UAE@XZ
@ stub -arch=win64 ??1money_base@std@@UEAA@XZ
@ stub -arch=win32 ??1ostrstream@std@@UAE@XZ
@ stub -arch=win64 ??1ostrstream@std@@UEAA@XZ
@ thiscall -arch=win32 ??1ostrstream@std@@UAE@XZ(ptr) ostrstream_dtor
@ cdecl -arch=win64 ??1ostrstream@std@@UEAA@XZ(ptr) ostrstream_dtor
@ thiscall -arch=win32 ??1out_of_range@std@@UAE@XZ(ptr) MSVCP_logic_error_dtor
@ cdecl -arch=win64 ??1out_of_range@std@@UEAA@XZ(ptr) MSVCP_logic_error_dtor
@ stub -arch=win32 ??1overflow_error@std@@UAE@XZ
......@@ -1087,8 +1087,8 @@
@ stub -arch=win64 ??1range_error@std@@UEAA@XZ
@ thiscall -arch=win32 ??1runtime_error@std@@UAE@XZ(ptr) MSVCP_logic_error_dtor
@ cdecl -arch=win64 ??1runtime_error@std@@UEAA@XZ(ptr) MSVCP_logic_error_dtor
@ stub -arch=win32 ??1strstream@std@@UAE@XZ
@ stub -arch=win64 ??1strstream@std@@UEAA@XZ
@ thiscall -arch=win32 ??1strstream@std@@UAE@XZ(ptr) strstream_dtor
@ cdecl -arch=win64 ??1strstream@std@@UEAA@XZ(ptr) strstream_dtor
@ thiscall -arch=win32 ??1strstreambuf@std@@UAE@XZ(ptr) strstreambuf_dtor
@ cdecl -arch=win64 ??1strstreambuf@std@@UEAA@XZ(ptr) strstreambuf_dtor
@ stub -arch=win32 ??1time_base@std@@UAE@XZ
......@@ -2310,7 +2310,7 @@
@ stub ?_Nanv@?$_Ctr@M@std@@SAMM@Z
@ stub ?_Nanv@?$_Ctr@N@std@@SANN@Z
@ stub ?_Nanv@?$_Ctr@O@std@@SAOO@Z
@ stub ?_Nomemory@std@@YAXXZ
@ cdecl ?_Nomemory@std@@YAXXZ() _Nomemory
@ cdecl -arch=win32 ?_Nullstr@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@CAPBDXZ() basic_string_char__Nullstr
@ cdecl -arch=win64 ?_Nullstr@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@CAPEBDXZ() basic_string_char__Nullstr
@ cdecl -arch=win32 ?_Nullstr@?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@CAPBGXZ() basic_string_wchar__Nullstr
......
......@@ -447,6 +447,13 @@ const char* __thiscall MSVCP_failure_what(failure *this)
DEFINE_RTTI_DATA2(failure, 0, &runtime_error_rtti_base_descriptor, &exception_rtti_base_descriptor, ".?AVfailure@std@@");
DEFINE_CXX_DATA2(failure, &runtime_error_cxx_type_info, &exception_cxx_type_info, MSVCP_runtime_error_dtor);
/* ?_Nomemory@std@@YAXXZ */
void __cdecl _Nomemory(void)
{
TRACE("()\n");
throw_exception(EXCEPTION_BAD_ALLOC, NULL);
}
#ifndef __GNUC__
void __asm_dummy_vtables(void) {
#endif
......
......@@ -2326,7 +2326,7 @@
@ stub ?_Nanv@?$_Ctraits@M@std@@SAMM@Z
@ stub ?_Nanv@?$_Ctraits@N@std@@SANN@Z
@ stub ?_Nanv@?$_Ctraits@O@std@@SAOO@Z
@ stub ?_Nomemory@std@@YAXXZ
@ cdecl ?_Nomemory@std@@YAXXZ() _Nomemory
@ thiscall -arch=win32 ?_Osfx@?$basic_ostream@DU?$char_traits@D@std@@@std@@QAEXXZ(ptr) basic_ostream_char__Osfx
@ cdecl -arch=win64 ?_Osfx@?$basic_ostream@DU?$char_traits@D@std@@@std@@QEAAXXZ(ptr) basic_ostream_char__Osfx
@ thiscall -arch=win32 ?_Osfx@?$basic_ostream@GU?$char_traits@G@std@@@std@@QAEXXZ(ptr) basic_ostream_wchar__Osfx
......
......@@ -1528,6 +1528,8 @@ MSVCP_size_t __thiscall MSVCP_basic_string_char_find_cstr_substr(
if(len==0 && pos<=this->size)
return pos;
if(pos>=this->size || len>this->size)
return MSVCP_basic_string_char_npos;
end = basic_string_char_const_ptr(this)+this->size-len+1;
for(p=basic_string_char_const_ptr(this)+pos; p<end; p++) {
......@@ -3381,6 +3383,8 @@ MSVCP_size_t __thiscall MSVCP_basic_string_wchar_find_cstr_substr(
if(len==0 && pos<=this->size)
return pos;
if(pos>=this->size || len>this->size)
return MSVCP_basic_string_wchar_npos;
end = basic_string_wchar_const_ptr(this)+this->size-len+1;
for(p=basic_string_wchar_const_ptr(this)+pos; p<end; p++) {
......
......@@ -529,7 +529,7 @@ const MSVCP_size_t MSVCP_basic_string_char_npos = -1;
DEFINE_THISCALL_WRAPPER(basic_string_char_ptr, 4)
char* __thiscall basic_string_char_ptr(basic_string_char *this)
{
if(this->res == BUF_SIZE_CHAR-1)
if(this->res < BUF_SIZE_CHAR)
return this->data.buf;
return this->data.ptr;
}
......@@ -539,7 +539,7 @@ char* __thiscall basic_string_char_ptr(basic_string_char *this)
DEFINE_THISCALL_WRAPPER(basic_string_char_const_ptr, 4)
const char* __thiscall basic_string_char_const_ptr(const basic_string_char *this)
{
if(this->res == BUF_SIZE_CHAR-1)
if(this->res < BUF_SIZE_CHAR)
return this->data.buf;
return this->data.ptr;
}
......@@ -1562,6 +1562,8 @@ MSVCP_size_t __thiscall MSVCP_basic_string_char_find_cstr_substr(
if(len==0 && pos<=this->size)
return pos;
if(pos>=this->size || len>this->size)
return MSVCP_basic_string_char_npos;
end = basic_string_char_const_ptr(this)+this->size-len+1;
for(p=basic_string_char_const_ptr(this)+pos; p<end; p++) {
......@@ -2335,7 +2337,7 @@ const MSVCP_size_t MSVCP_basic_string_wchar_npos = -1;
DEFINE_THISCALL_WRAPPER(basic_string_wchar_ptr, 4)
wchar_t* __thiscall basic_string_wchar_ptr(basic_string_wchar *this)
{
if(this->res == BUF_SIZE_WCHAR-1)
if(this->res < BUF_SIZE_WCHAR)
return this->data.buf;
return this->data.ptr;
}
......@@ -2347,7 +2349,7 @@ wchar_t* __thiscall basic_string_wchar_ptr(basic_string_wchar *this)
DEFINE_THISCALL_WRAPPER(basic_string_wchar_const_ptr, 4)
const wchar_t* __thiscall basic_string_wchar_const_ptr(const basic_string_wchar *this)
{
if(this->res == BUF_SIZE_WCHAR-1)
if(this->res < BUF_SIZE_WCHAR)
return this->data.buf;
return this->data.ptr;
}
......@@ -3537,6 +3539,8 @@ MSVCP_size_t __thiscall MSVCP_basic_string_wchar_find_cstr_substr(
if(len==0 && pos<=this->size)
return pos;
if(pos>=this->size || len>this->size)
return MSVCP_basic_string_wchar_npos;
end = basic_string_wchar_const_ptr(this)+this->size-len+1;
for(p=basic_string_wchar_const_ptr(this)+pos; p<end; p++) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment