Piotr Caban : msvcp90: Don't use throw_exception helper for invalid_argument exception.

Alexandre Julliard julliard at winehq.org
Fri Aug 27 15:03:34 CDT 2021


Module: wine
Branch: master
Commit: b561d0130529fbceabbcca3091945b3fbdd76705
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=b561d0130529fbceabbcca3091945b3fbdd76705

Author: Piotr Caban <piotr at codeweavers.com>
Date:   Fri Aug 27 13:48:18 2021 +0200

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

Signed-off-by: Piotr Caban <piotr at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/msvcp90/cxx.h       |  1 -
 dlls/msvcp90/exception.c | 14 +++++++-------
 dlls/msvcp90/msvcp90.h   |  1 +
 dlls/msvcp90/string.c    |  4 +---
 4 files changed, 9 insertions(+), 11 deletions(-)

diff --git a/dlls/msvcp90/cxx.h b/dlls/msvcp90/cxx.h
index 72e96133f8f..5bdebb605d6 100644
--- a/dlls/msvcp90/cxx.h
+++ b/dlls/msvcp90/cxx.h
@@ -320,7 +320,6 @@ typedef enum __exception_type {
     EXCEPTION_BAD_CAST,
     EXCEPTION_LOGIC_ERROR,
     EXCEPTION_OUT_OF_RANGE,
-    EXCEPTION_INVALID_ARGUMENT,
     EXCEPTION_RUNTIME_ERROR,
     EXCEPTION_FAILURE,
     EXCEPTION_RANGE_ERROR,
diff --git a/dlls/msvcp90/exception.c b/dlls/msvcp90/exception.c
index face3ea09b0..f635a80a90c 100644
--- a/dlls/msvcp90/exception.c
+++ b/dlls/msvcp90/exception.c
@@ -890,10 +890,15 @@ void __cdecl DECLSPEC_NORETURN _Xmem(void)
 
 /* ?_Xinvalid_argument at std@@YAXPBD at Z */
 /* ?_Xinvalid_argument at std@@YAXPEBD at Z */
-void __cdecl _Xinvalid_argument(const char *str)
+void __cdecl DECLSPEC_NORETURN _Xinvalid_argument(const char *str)
 {
+    exception_name name = EXCEPTION_NAME(str);
+    invalid_argument e;
+
     TRACE("(%s)\n", debugstr_a(str));
-    throw_exception(EXCEPTION_INVALID_ARGUMENT, str);
+
+    MSVCP_invalid_argument_ctor(&e, name);
+    _CxxThrowException(&e, &invalid_argument_cxx_type);
 }
 
 /* ?_Xlength_error at std@@YAXPBD at Z */
@@ -1076,11 +1081,6 @@ void throw_exception(exception_type et, const char *str)
         MSVCP_out_of_range_ctor(&e, name);
         _CxxThrowException(&e, &out_of_range_cxx_type);
     }
-    case EXCEPTION_INVALID_ARGUMENT: {
-        invalid_argument e;
-        MSVCP_invalid_argument_ctor(&e, name);
-        _CxxThrowException(&e, &invalid_argument_cxx_type);
-    }
     case EXCEPTION_RUNTIME_ERROR: {
         runtime_error e;
         MSVCP_runtime_error_ctor(&e, name);
diff --git a/dlls/msvcp90/msvcp90.h b/dlls/msvcp90/msvcp90.h
index 410c406d86c..144bf4d3a9a 100644
--- a/dlls/msvcp90/msvcp90.h
+++ b/dlls/msvcp90/msvcp90.h
@@ -664,5 +664,6 @@ 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 _Xinvalid_argument(const char*);
 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 89aacdd7cb7..7609f913093 100644
--- a/dlls/msvcp90/string.c
+++ b/dlls/msvcp90/string.c
@@ -484,10 +484,8 @@ void __thiscall _String_base__Xran(const void/*_String_base*/ *this)
 /* ?_Xinvarg at _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);
+    _Xinvalid_argument("invalid string argument");
 }
 
 




More information about the wine-cvs mailing list