From 6b7b6f45e16530bbb76d8e0b5f548b81ce1a28fb Mon Sep 17 00:00:00 2001 From: Piotr Caban Date: Fri, 27 Aug 2021 13:48:14 +0200 Subject: [PATCH] msvcp90: Don't use throw_exception helper for length_error exception. Signed-off-by: Piotr Caban Signed-off-by: Alexandre Julliard --- dlls/msvcp60/msvcp.h | 1 + dlls/msvcp60/string.c | 4 +--- dlls/msvcp90/cxx.h | 1 - dlls/msvcp90/exception.c | 14 +++++++------- dlls/msvcp90/msvcp90.h | 1 + dlls/msvcp90/string.c | 4 +--- 6 files changed, 11 insertions(+), 14 deletions(-) diff --git a/dlls/msvcp60/msvcp.h b/dlls/msvcp60/msvcp.h index 53b98f4c449..0c4f4f32280 100644 --- a/dlls/msvcp60/msvcp.h +++ b/dlls/msvcp60/msvcp.h @@ -485,4 +485,5 @@ typedef struct { } complex_double; void WINAPI DECLSPEC_NORETURN _CxxThrowException(void*,const cxx_exception_type*); +void __cdecl DECLSPEC_NORETURN _Xlength_error(const char*); void __cdecl DECLSPEC_NORETURN _Xmem(void); diff --git a/dlls/msvcp60/string.c b/dlls/msvcp60/string.c index f162939bdc0..22cdcd49891 100644 --- a/dlls/msvcp60/string.c +++ b/dlls/msvcp60/string.c @@ -55,10 +55,8 @@ void __cdecl _Xran(void) /* ?_Xlen@std@@YAXXZ */ void __cdecl _Xlen(void) { - static const char msg[] = "string too long"; - TRACE("\n"); - throw_exception(EXCEPTION_LENGTH_ERROR, msg); + _Xlength_error("string too long"); } /* ?compare@?$char_traits@D@std@@SAHPBD0I@Z */ diff --git a/dlls/msvcp90/cxx.h b/dlls/msvcp90/cxx.h index c1000579443..72e96133f8f 100644 --- a/dlls/msvcp90/cxx.h +++ b/dlls/msvcp90/cxx.h @@ -319,7 +319,6 @@ typedef enum __exception_type { EXCEPTION, EXCEPTION_BAD_CAST, EXCEPTION_LOGIC_ERROR, - EXCEPTION_LENGTH_ERROR, EXCEPTION_OUT_OF_RANGE, EXCEPTION_INVALID_ARGUMENT, EXCEPTION_RUNTIME_ERROR, diff --git a/dlls/msvcp90/exception.c b/dlls/msvcp90/exception.c index 748e0ccce3b..face3ea09b0 100644 --- a/dlls/msvcp90/exception.c +++ b/dlls/msvcp90/exception.c @@ -898,10 +898,15 @@ void __cdecl _Xinvalid_argument(const char *str) /* ?_Xlength_error@std@@YAXPBD@Z */ /* ?_Xlength_error@std@@YAXPEBD@Z */ -void __cdecl _Xlength_error(const char *str) +void __cdecl DECLSPEC_NORETURN _Xlength_error(const char *str) { + exception_name name = EXCEPTION_NAME(str); + length_error e; + TRACE("(%s)\n", debugstr_a(str)); - throw_exception(EXCEPTION_LENGTH_ERROR, str); + + MSVCP_length_error_ctor(&e, name); + _CxxThrowException(&e, &length_error_cxx_type); } /* ?_Xout_of_range@std@@YAXPBD@Z */ @@ -1066,11 +1071,6 @@ void throw_exception(exception_type et, const char *str) MSVCP_logic_error_ctor(&e, name); _CxxThrowException(&e, &logic_error_cxx_type); } - case EXCEPTION_LENGTH_ERROR: { - length_error e; - MSVCP_length_error_ctor(&e, name); - _CxxThrowException(&e, &length_error_cxx_type); - } case EXCEPTION_OUT_OF_RANGE: { out_of_range e; MSVCP_out_of_range_ctor(&e, name); diff --git a/dlls/msvcp90/msvcp90.h b/dlls/msvcp90/msvcp90.h index 9954eb9c777..410c406d86c 100644 --- a/dlls/msvcp90/msvcp90.h +++ b/dlls/msvcp90/msvcp90.h @@ -664,4 +664,5 @@ static inline int mbstowcs_wrapper( size_t *ret, wchar_t *wcs, size_t size, cons #endif void WINAPI DECLSPEC_NORETURN _CxxThrowException(void*,const cxx_exception_type*); +void __cdecl DECLSPEC_NORETURN _Xlength_error(const char*); void __cdecl DECLSPEC_NORETURN _Xmem(void); diff --git a/dlls/msvcp90/string.c b/dlls/msvcp90/string.c index ce706e140a3..89aacdd7cb7 100644 --- a/dlls/msvcp90/string.c +++ b/dlls/msvcp90/string.c @@ -454,10 +454,8 @@ unsigned short CDECL MSVCP_char_traits_short_not_eof(const unsigned short *in) /* ?_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); + _Xlength_error("string too long"); } /* ?_Xlen@_String_base@std@@QBEXXZ */ -- 2.11.4.GIT