Alexandre Julliard : msvcrt: Make pointers to read-only exception descriptors const.

Alexandre Julliard julliard at wine.codeweavers.com
Fri Dec 15 07:21:41 CST 2006


Module: wine
Branch: master
Commit: 8592c4b876c95d86e3b8a608cfd6daea9ef514b8
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=8592c4b876c95d86e3b8a608cfd6daea9ef514b8

Author: Alexandre Julliard <julliard at winehq.org>
Date:   Fri Dec 15 13:41:31 2006 +0100

msvcrt: Make pointers to read-only exception descriptors const.

---

 dlls/msvcrt/cppexcept.c |   28 +++++++++++++++-------------
 dlls/msvcrt/cppexcept.h |   32 ++++++++++++++++----------------
 2 files changed, 31 insertions(+), 29 deletions(-)

diff --git a/dlls/msvcrt/cppexcept.c b/dlls/msvcrt/cppexcept.c
index 52b17a4..c4679c3 100644
--- a/dlls/msvcrt/cppexcept.c
+++ b/dlls/msvcrt/cppexcept.c
@@ -45,8 +45,8 @@ WINE_DEFAULT_DEBUG_CHANNEL(seh);
 
 DWORD CDECL cxx_frame_handler( PEXCEPTION_RECORD rec, cxx_exception_frame* frame,
                                PCONTEXT context, EXCEPTION_REGISTRATION_RECORD** dispatch,
-                               cxx_function_descr *descr, EXCEPTION_REGISTRATION_RECORD* nested_frame,
-                               int nested_trylevel );
+                               const cxx_function_descr *descr,
+                               EXCEPTION_REGISTRATION_RECORD* nested_frame, int nested_trylevel );
 
 /* call a function with a given ebp */
 inline static void *call_ebp_func( void *func, void *ebp )
@@ -112,7 +112,7 @@ static void dump_exception_type( const c
     }
 }
 
-static void dump_function_descr( const cxx_function_descr *descr, const cxx_exception_type *info )
+static void dump_function_descr( const cxx_function_descr *descr )
 {
     UINT i;
     int j;
@@ -133,7 +133,7 @@ static void dump_function_descr( const c
                  descr->tryblock[i].catchblock_count );
         for (j = 0; j < descr->tryblock[i].catchblock_count; j++)
         {
-            catchblock_info *ptr = &descr->tryblock[i].catchblock[j];
+            const catchblock_info *ptr = &descr->tryblock[i].catchblock[j];
             TRACE( "        %d: flags %x offset %d handler %p type %p %s\n",
                      j, ptr->flags, ptr->offset, ptr->handler,
                      ptr->type_info, dbgstr_type_info( ptr->type_info ) );
@@ -142,7 +142,8 @@ static void dump_function_descr( const c
 }
 
 /* check if the exception type is caught by a given catch block, and return the type that matched */
-static const cxx_type_info *find_caught_type( cxx_exception_type *exc_type, catchblock_info *catchblock )
+static const cxx_type_info *find_caught_type( cxx_exception_type *exc_type,
+                                              const catchblock_info *catchblock )
 {
     UINT i;
 
@@ -168,7 +169,7 @@ static const cxx_type_info *find_caught_
 
 /* copy the exception object where the catch block wants it */
 static void copy_exception( void *object, cxx_exception_frame *frame,
-                            catchblock_info *catchblock, const cxx_type_info *type )
+                            const catchblock_info *catchblock, const cxx_type_info *type )
 {
     void **dest_ptr;
 
@@ -197,7 +198,7 @@ static void copy_exception( void *object
 }
 
 /* unwind the local function up to a given trylevel */
-static void cxx_local_unwind( cxx_exception_frame* frame, cxx_function_descr *descr, int last_level)
+static void cxx_local_unwind( cxx_exception_frame* frame, const cxx_function_descr *descr, int last_level)
 {
     void (*handler)();
     int trylevel = frame->trylevel;
@@ -227,7 +228,7 @@ struct catch_func_nested_frame
     EXCEPTION_REGISTRATION_RECORD frame;     /* standard exception frame */
     EXCEPTION_RECORD             *prev_rec;  /* previous record to restore in thread data */
     cxx_exception_frame          *cxx_frame; /* frame of parent exception */
-    cxx_function_descr           *descr;     /* descriptor of parent exception */
+    const cxx_function_descr     *descr;     /* descriptor of parent exception */
     int                           trylevel;  /* current try level */
     EXCEPTION_RECORD             *rec;       /* rec associated with frame */
 };
@@ -276,7 +277,7 @@ static DWORD catch_function_nested_handl
 /* find and call the appropriate catch block for an exception */
 /* returns the address to continue execution to after the catch block was called */
 inline static void call_catch_block( PEXCEPTION_RECORD rec, cxx_exception_frame *frame,
-                                     cxx_function_descr *descr, int nested_trylevel,
+                                     const cxx_function_descr *descr, int nested_trylevel,
                                      cxx_exception_type *info )
 {
     UINT i;
@@ -289,7 +290,7 @@ inline static void call_catch_block( PEX
 
     for (i = 0; i < descr->tryblock_count; i++)
     {
-        tryblock_info *tryblock = &descr->tryblock[i];
+        const tryblock_info *tryblock = &descr->tryblock[i];
 
         if (trylevel < tryblock->start_level) continue;
         if (trylevel > tryblock->end_level) continue;
@@ -297,7 +298,7 @@ inline static void call_catch_block( PEX
         /* got a try block */
         for (j = 0; j < tryblock->catchblock_count; j++)
         {
-            catchblock_info *catchblock = &tryblock->catchblock[j];
+            const catchblock_info *catchblock = &tryblock->catchblock[j];
             if(info)
             {
                 const cxx_type_info *type = find_caught_type( info, catchblock );
@@ -357,7 +358,8 @@ inline static void call_catch_block( PEX
  */
 DWORD CDECL cxx_frame_handler( PEXCEPTION_RECORD rec, cxx_exception_frame* frame,
                                PCONTEXT context, EXCEPTION_REGISTRATION_RECORD** dispatch,
-                               cxx_function_descr *descr, EXCEPTION_REGISTRATION_RECORD* nested_frame,
+                               const cxx_function_descr *descr,
+                               EXCEPTION_REGISTRATION_RECORD* nested_frame,
                                int nested_trylevel )
 {
     cxx_exception_type *exc_type;
@@ -390,7 +392,7 @@ DWORD CDECL cxx_frame_handler( PEXCEPTIO
             TRACE("handling C++ exception rec %p frame %p trylevel %d descr %p nested_frame %p\n",
                   rec, frame, frame->trylevel, descr, nested_frame );
             dump_exception_type( exc_type );
-            dump_function_descr( descr, exc_type );
+            dump_function_descr( descr );
         }
     }
     else
diff --git a/dlls/msvcrt/cppexcept.h b/dlls/msvcrt/cppexcept.h
index 8482cc7..d4c8068 100644
--- a/dlls/msvcrt/cppexcept.h
+++ b/dlls/msvcrt/cppexcept.h
@@ -53,10 +53,10 @@ typedef struct __cxx_exception_frame
 /* info about a single catch {} block */
 typedef struct __catchblock_info
 {
-    UINT       flags;         /* flags (see below) */
-    type_info *type_info;     /* C++ type caught by this block */
-    int        offset;        /* stack offset to copy exception object to */
-    void     (*handler)();    /* catch block handler code */
+    UINT             flags;         /* flags (see below) */
+    const type_info *type_info;     /* C++ type caught by this block */
+    int              offset;        /* stack offset to copy exception object to */
+    void           (*handler)();    /* catch block handler code */
 } catchblock_info;
 #define TYPE_FLAG_CONST      1
 #define TYPE_FLAG_VOLATILE   2
@@ -65,11 +65,11 @@ typedef struct __catchblock_info
 /* info about a single try {} block */
 typedef struct __tryblock_info
 {
-    int              start_level;      /* start trylevel of that block */
-    int              end_level;        /* end trylevel of that block */
-    int              catch_level;      /* initial trylevel of the catch block */
-    int              catchblock_count; /* count of catch blocks in array */
-    catchblock_info *catchblock;       /* array of catch blocks */
+    int                    start_level;      /* start trylevel of that block */
+    int                    end_level;        /* end trylevel of that block */
+    int                    catch_level;      /* initial trylevel of the catch block */
+    int                    catchblock_count; /* count of catch blocks in array */
+    const catchblock_info *catchblock;       /* array of catch blocks */
 } tryblock_info;
 
 /* info about the unwind handler for a given trylevel */
@@ -82,12 +82,12 @@ typedef struct __unwind_info
 /* descriptor of all try blocks of a given function */
 typedef struct __cxx_function_descr
 {
-    UINT           magic;          /* must be CXX_FRAME_MAGIC */
-    UINT           unwind_count;   /* number of unwind handlers */
-    unwind_info   *unwind_table;   /* array of unwind handlers */
-    UINT           tryblock_count; /* number of try blocks */
-    tryblock_info *tryblock;       /* array of try blocks */
-    UINT           unknown[3];
+    UINT                 magic;          /* must be CXX_FRAME_MAGIC */
+    UINT                 unwind_count;   /* number of unwind handlers */
+    const unwind_info   *unwind_table;   /* array of unwind handlers */
+    UINT                 tryblock_count; /* number of try blocks */
+    const tryblock_info *tryblock;       /* array of try blocks */
+    UINT                 unknown[3];
 } cxx_function_descr;
 
 typedef void (*cxx_copy_ctor)(void);
@@ -121,7 +121,7 @@ typedef struct __cxx_type_info_table
 
 typedef DWORD (*cxx_exc_custom_handler)( PEXCEPTION_RECORD, cxx_exception_frame*,
                                          PCONTEXT, EXCEPTION_REGISTRATION_RECORD**,
-                                         cxx_function_descr*, int nested_trylevel,
+                                         const cxx_function_descr*, int nested_trylevel,
                                          EXCEPTION_REGISTRATION_RECORD *nested_frame, DWORD unknown3 );
 
 /* type information for an exception object */




More information about the wine-cvs mailing list