Piotr Caban : msvcp90: Introduce throw_range_error helper.

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


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

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

msvcp90: Introduce throw_range_error helper.

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/details.c   |  3 +--
 dlls/msvcp90/exception.c | 15 ++++++++++-----
 dlls/msvcp90/msvcp90.h   |  1 +
 4 files changed, 12 insertions(+), 8 deletions(-)

diff --git a/dlls/msvcp90/cxx.h b/dlls/msvcp90/cxx.h
index 9d79ca80e21..b8c29921db1 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_FAILURE,
-    EXCEPTION_RANGE_ERROR,
 } exception_type;
 void throw_exception(exception_type, const char *);
 
diff --git a/dlls/msvcp90/details.c b/dlls/msvcp90/details.c
index b7de12e6e90..1515286b4dd 100644
--- a/dlls/msvcp90/details.c
+++ b/dlls/msvcp90/details.c
@@ -475,8 +475,7 @@ void __thiscall _vector_base_v4__Internal_throw_exception(void/*_vector_base_v4*
     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");
+    case 2: throw_range_error("Index is inside segment which failed to be allocated");
     }
 }
 
diff --git a/dlls/msvcp90/exception.c b/dlls/msvcp90/exception.c
index f6a15ecc8d6..f93d92b601d 100644
--- a/dlls/msvcp90/exception.c
+++ b/dlls/msvcp90/exception.c
@@ -1091,14 +1091,19 @@ void throw_exception(exception_type et, const char *str)
         MSVCP_failure_ctor(&e, name);
         _CxxThrowException(&e, &failure_cxx_type);
     }
-    case EXCEPTION_RANGE_ERROR: {
-        range_error e;
-        MSVCP_range_error_ctor(&e, name);
-        _CxxThrowException(&e, &range_error_cxx_type);
-    }
     }
 }
 
+/* Internal: throws range_error exception */
+void DECLSPEC_NORETURN throw_range_error(const char *str)
+{
+    exception_name name = EXCEPTION_NAME(str);
+    range_error e;
+
+    MSVCP_range_error_ctor(&e, name);
+    _CxxThrowException(&e, &range_error_cxx_type);
+}
+
 void init_exception(void *base)
 {
 #ifdef __x86_64__
diff --git a/dlls/msvcp90/msvcp90.h b/dlls/msvcp90/msvcp90.h
index 7452a7f6a99..63ba36f7b38 100644
--- a/dlls/msvcp90/msvcp90.h
+++ b/dlls/msvcp90/msvcp90.h
@@ -669,3 +669,4 @@ 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*);
+void DECLSPEC_NORETURN throw_range_error(const char*);




More information about the wine-cvs mailing list