msvcp90: Don't use throw_exception helper for out_of_range exception.

Signed-off-by: Piotr Caban <piotr@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Piotr Caban 2021-08-27 13:48:24 +02:00 committed by Alexandre Julliard
parent 73c4ae66c2
commit 503f3462c6
8 changed files with 18 additions and 26 deletions

View File

@ -487,3 +487,4 @@ typedef struct {
void WINAPI DECLSPEC_NORETURN _CxxThrowException(void*,const cxx_exception_type*);
void __cdecl DECLSPEC_NORETURN _Xlength_error(const char*);
void __cdecl DECLSPEC_NORETURN _Xmem(void);
void __cdecl DECLSPEC_NORETURN _Xout_of_range(const char*);

View File

@ -46,10 +46,8 @@ typedef struct {
/* ?_Xran@std@@YAXXZ */
void __cdecl _Xran(void)
{
static const char msg[] = "invalid string position";
TRACE("\n");
throw_exception(EXCEPTION_OUT_OF_RANGE, msg);
_Xout_of_range("invalid string position");
}
/* ?_Xlen@std@@YAXXZ */

View File

@ -319,7 +319,6 @@ typedef enum __exception_type {
EXCEPTION,
EXCEPTION_BAD_CAST,
EXCEPTION_LOGIC_ERROR,
EXCEPTION_OUT_OF_RANGE,
EXCEPTION_FAILURE,
EXCEPTION_RANGE_ERROR,
} exception_type;

View File

@ -470,19 +470,14 @@ size_t __cdecl _vector_base_v4__Segment_index_of(size_t x)
DEFINE_THISCALL_WRAPPER(_vector_base_v4__Internal_throw_exception, 8)
void __thiscall _vector_base_v4__Internal_throw_exception(void/*_vector_base_v4*/ *this, size_t idx)
{
static const struct {
exception_type type;
const char *msg;
} exceptions[] = {
{ EXCEPTION_OUT_OF_RANGE, "Index out of range" },
{ EXCEPTION_OUT_OF_RANGE, "Index out of segments table range" },
{ EXCEPTION_RANGE_ERROR, "Index is inside segment which failed to be allocated" },
};
TRACE("(%p %Iu)\n", this, idx);
if(idx < ARRAY_SIZE(exceptions))
throw_exception(exceptions[idx].type, exceptions[idx].msg);
switch(idx) {
case 0: _Xout_of_range("Index out of range");
case 1: _Xout_of_range("Index out of segments table range");
case 2: throw_exception(EXCEPTION_RANGE_ERROR,
"Index is inside segment which failed to be allocated");
}
}
#ifdef _WIN64

View File

@ -916,10 +916,15 @@ void __cdecl DECLSPEC_NORETURN _Xlength_error(const char *str)
/* ?_Xout_of_range@std@@YAXPBD@Z */
/* ?_Xout_of_range@std@@YAXPEBD@Z */
void __cdecl _Xout_of_range(const char *str)
void __cdecl DECLSPEC_NORETURN _Xout_of_range(const char *str)
{
exception_name name = EXCEPTION_NAME(str);
out_of_range e;
TRACE("(%s)\n", debugstr_a(str));
throw_exception(EXCEPTION_OUT_OF_RANGE, str);
MSVCP_out_of_range_ctor(&e, name);
_CxxThrowException(&e, &out_of_range_cxx_type);
}
/* ?_Xruntime_error@std@@YAXPBD@Z */
@ -1081,11 +1086,6 @@ void throw_exception(exception_type et, const char *str)
MSVCP_logic_error_ctor(&e, name);
_CxxThrowException(&e, &logic_error_cxx_type);
}
case EXCEPTION_OUT_OF_RANGE: {
out_of_range e;
MSVCP_out_of_range_ctor(&e, name);
_CxxThrowException(&e, &out_of_range_cxx_type);
}
case EXCEPTION_FAILURE: {
failure e;
MSVCP_failure_ctor(&e, name);

View File

@ -1613,7 +1613,7 @@ ctype_base* __thiscall ctype_base_vector_dtor(ctype_base *this, unsigned int fla
/* ?_Xran@ctype_base@std@@KAXXZ */
void __cdecl ctype_base__Xran(void)
{
throw_exception(EXCEPTION_OUT_OF_RANGE, "out of range in ctype<T>");
_Xout_of_range("out of range in ctype<T>");
}
/* ?id@?$ctype@D@std@@2V0locale@2@A */

View File

@ -667,4 +667,5 @@ void WINAPI DECLSPEC_NORETURN _CxxThrowException(void*,const cxx_exception_type*
void __cdecl DECLSPEC_NORETURN _Xinvalid_argument(const char*);
void __cdecl DECLSPEC_NORETURN _Xlength_error(const char*);
void __cdecl DECLSPEC_NORETURN _Xmem(void);
void __cdecl DECLSPEC_NORETURN _Xout_of_range(const char*);
void __cdecl DECLSPEC_NORETURN _Xruntime_error(const char*);

View File

@ -468,10 +468,8 @@ void __thiscall _String_base__Xlen(const void/*_String_base*/ *this)
/* ?_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);
_Xout_of_range("invalid string position");
}
/* ?_Xran@_String_base@std@@QBEXXZ */