msvcp90: Introduce throw_range_error helper.

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:29 +02:00 committed by Alexandre Julliard
parent 503f3462c6
commit 93455491fc
4 changed files with 12 additions and 8 deletions

View File

@ -320,7 +320,6 @@ typedef enum __exception_type {
EXCEPTION_BAD_CAST, EXCEPTION_BAD_CAST,
EXCEPTION_LOGIC_ERROR, EXCEPTION_LOGIC_ERROR,
EXCEPTION_FAILURE, EXCEPTION_FAILURE,
EXCEPTION_RANGE_ERROR,
} exception_type; } exception_type;
void throw_exception(exception_type, const char *); void throw_exception(exception_type, const char *);

View File

@ -475,8 +475,7 @@ void __thiscall _vector_base_v4__Internal_throw_exception(void/*_vector_base_v4*
switch(idx) { switch(idx) {
case 0: _Xout_of_range("Index out of range"); case 0: _Xout_of_range("Index out of range");
case 1: _Xout_of_range("Index out of segments table range"); case 1: _Xout_of_range("Index out of segments table range");
case 2: throw_exception(EXCEPTION_RANGE_ERROR, case 2: throw_range_error("Index is inside segment which failed to be allocated");
"Index is inside segment which failed to be allocated");
} }
} }

View File

@ -1091,13 +1091,18 @@ void throw_exception(exception_type et, const char *str)
MSVCP_failure_ctor(&e, name); MSVCP_failure_ctor(&e, name);
_CxxThrowException(&e, &failure_cxx_type); _CxxThrowException(&e, &failure_cxx_type);
} }
case EXCEPTION_RANGE_ERROR: { }
}
/* Internal: throws range_error exception */
void DECLSPEC_NORETURN throw_range_error(const char *str)
{
exception_name name = EXCEPTION_NAME(str);
range_error e; range_error e;
MSVCP_range_error_ctor(&e, name); MSVCP_range_error_ctor(&e, name);
_CxxThrowException(&e, &range_error_cxx_type); _CxxThrowException(&e, &range_error_cxx_type);
} }
}
}
void init_exception(void *base) void init_exception(void *base)
{ {

View File

@ -669,3 +669,4 @@ void __cdecl DECLSPEC_NORETURN _Xlength_error(const char*);
void __cdecl DECLSPEC_NORETURN _Xmem(void); void __cdecl DECLSPEC_NORETURN _Xmem(void);
void __cdecl DECLSPEC_NORETURN _Xout_of_range(const char*); void __cdecl DECLSPEC_NORETURN _Xout_of_range(const char*);
void __cdecl DECLSPEC_NORETURN _Xruntime_error(const char*); void __cdecl DECLSPEC_NORETURN _Xruntime_error(const char*);
void DECLSPEC_NORETURN throw_range_error(const char*);