Alexandre Julliard : widl: Use ULONG_PTR instead of unsigned long for pointer casts in generated code .

Alexandre Julliard julliard at winehq.org
Tue Dec 16 08:40:29 CST 2008


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

Author: Alexandre Julliard <julliard at winehq.org>
Date:   Mon Dec 15 20:08:39 2008 +0100

widl: Use ULONG_PTR instead of unsigned long for pointer casts in generated code.

---

 tools/widl/proxy.c   |    2 +-
 tools/widl/typegen.c |   16 ++++++++--------
 2 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/tools/widl/proxy.c b/tools/widl/proxy.c
index 95651fc..dc3c1ae 100644
--- a/tools/widl/proxy.c
+++ b/tools/widl/proxy.c
@@ -249,7 +249,7 @@ static void free_variable( const var_t *arg, const char *local_var_prefix )
     iid = get_attrp( arg->attrs, ATTR_IIDIS );
     if( iid )
     {
-      print_proxy( "__frame->_StubMsg.MaxCount = (unsigned long) " );
+      print_proxy( "__frame->_StubMsg.MaxCount = (ULONG_PTR) " );
       write_expr(proxy, iid, 1, 1, NULL, NULL, local_var_prefix);
       print_proxy( ";\n\n" );
     }
diff --git a/tools/widl/typegen.c b/tools/widl/typegen.c
index 051d2e8..9d55d19 100644
--- a/tools/widl/typegen.c
+++ b/tools/widl/typegen.c
@@ -2676,8 +2676,8 @@ void print_phase_basetype(FILE *file, int indent, const char *local_var_prefix,
     }
 
     if (phase == PHASE_MARSHAL)
-        print_file(file, indent, "MIDL_memset(__frame->_StubMsg.Buffer, 0, (0x%x - (long)__frame->_StubMsg.Buffer) & 0x%x);\n", alignment, alignment - 1);
-    print_file(file, indent, "__frame->_StubMsg.Buffer = (unsigned char *)(((long)__frame->_StubMsg.Buffer + %u) & ~0x%x);\n",
+        print_file(file, indent, "MIDL_memset(__frame->_StubMsg.Buffer, 0, (0x%x - (ULONG_PTR)__frame->_StubMsg.Buffer) & 0x%x);\n", alignment, alignment - 1);
+    print_file(file, indent, "__frame->_StubMsg.Buffer = (unsigned char *)(((ULONG_PTR)__frame->_StubMsg.Buffer + %u) & ~0x%x);\n",
                 alignment - 1, alignment - 1);
 
     if (phase == PHASE_MARSHAL)
@@ -2759,14 +2759,14 @@ static void write_parameter_conf_or_var_exprs(FILE *file, int indent, const char
             {
                 if (type->size_is)
                 {
-                    print_file(file, indent, "__frame->_StubMsg.MaxCount = (unsigned long)");
+                    print_file(file, indent, "__frame->_StubMsg.MaxCount = (ULONG_PTR)");
                     write_expr(file, type->size_is, 1, 1, NULL, NULL, local_var_prefix);
                     fprintf(file, ";\n\n");
                 }
                 if (type->length_is)
                 {
-                    print_file(file, indent, "__frame->_StubMsg.Offset = (unsigned long)0;\n"); /* FIXME */
-                    print_file(file, indent, "__frame->_StubMsg.ActualCount = (unsigned long)");
+                    print_file(file, indent, "__frame->_StubMsg.Offset = 0;\n"); /* FIXME */
+                    print_file(file, indent, "__frame->_StubMsg.ActualCount = (ULONG_PTR)");
                     write_expr(file, type->length_is, 1, 1, NULL, NULL, local_var_prefix);
                     fprintf(file, ";\n\n");
                 }
@@ -2777,7 +2777,7 @@ static void write_parameter_conf_or_var_exprs(FILE *file, int indent, const char
         {
             if (is_conformance_needed_for_phase(phase))
             {
-                print_file(file, indent, "__frame->_StubMsg.MaxCount = (unsigned long)");
+                print_file(file, indent, "__frame->_StubMsg.MaxCount = (ULONG_PTR)");
                 write_expr(file, get_attrp(var->attrs, ATTR_SWITCHIS), 1, 1, NULL, NULL, local_var_prefix);
                 fprintf(file, ";\n\n");
             }
@@ -2789,7 +2789,7 @@ static void write_parameter_conf_or_var_exprs(FILE *file, int indent, const char
 
             if (is_conformance_needed_for_phase(phase) && (iid = get_attrp( var->attrs, ATTR_IIDIS )))
             {
-                print_file( file, indent, "__frame->_StubMsg.MaxCount = (unsigned long) " );
+                print_file( file, indent, "__frame->_StubMsg.MaxCount = (ULONG_PTR) " );
                 write_expr( file, iid, 1, 1, NULL, NULL, local_var_prefix );
                 fprintf( file, ";\n\n" );
             }
@@ -3215,7 +3215,7 @@ int write_expr_eval_routines(FILE *file, const char *iface)
         print_file (file, 1, "%s *%s = (%s *)(pStubMsg->StackTop - %u);\n",
                     name, var_name, name, eval->baseoff);
         print_file(file, 1, "pStubMsg->Offset = 0;\n"); /* FIXME */
-        print_file(file, 1, "pStubMsg->MaxCount = (unsigned long)");
+        print_file(file, 1, "pStubMsg->MaxCount = (ULONG_PTR)");
         write_expr(file, eval->expr, 1, 1, var_name_expr, eval->structure, "");
         fprintf(file, ";\n");
         print_file(file, 0, "}\n\n");




More information about the wine-cvs mailing list