[prev in list] [next in list] [prev in thread] [next in thread] 

List:       wine-patches
Subject:    [WIDL 13/22] Output the necessary sizing information for other
From:       Robert Shearman <rob () codeweavers ! com>
Date:       2006-03-31 11:47:08
Message-ID: 442D16BC.2090804 () codeweavers ! com
[Download RAW message or body]

ChangeLog:
Output the necessary sizing information for PHASE_BUFFERSIZE and
PHASE_FREE as well as PHASE_MARSHAL. Standardise this rule in a new
function.

   tools/widl/typegen.c |   15 +++++++++++----
   1 files changed, 11 insertions(+), 4 deletions(-)



["36b6827c4ea26f4d0fd1d8e993d32116aa72f183.diff" (text/x-patch)]

36b6827c4ea26f4d0fd1d8e993d32116aa72f183
diff --git a/tools/widl/typegen.c b/tools/widl/typegen.c
index e92985c..096173f 100644
--- a/tools/widl/typegen.c
+++ b/tools/widl/typegen.c
@@ -1412,6 +1412,13 @@ static inline const char *function_from_
     return NULL;
 }
 
+/* returns whether the MaxCount, Offset or ActualCount members need to be
+ * filled in for the specified phase */
+static inline int is_size_needed_for_phase(enum remoting_phase phase)
+{
+    return (phase != PHASE_UNMARSHAL);
+}
+
 void write_remoting_arguments(FILE *file, int indent, const func_t *func,
                               unsigned int *type_offset, enum pass pass,
                               enum remoting_phase phase)
@@ -1468,7 +1475,7 @@ void write_remoting_arguments(FILE *file
                            function_from_phase(phase), var->name, *type_offset);
             else
             {
-                if (size_is && phase != PHASE_UNMARSHAL)
+                if (size_is && is_size_needed_for_phase(phase))
                 {
                     print_file(file, indent, "_StubMsg.MaxCount = (unsigned long)");
                     write_expr(file, size_is, 1);
@@ -1512,7 +1519,7 @@ void write_remoting_arguments(FILE *file
                     array_type = "FixedArray";
                 else if (has_length && !has_size)
                 {
-                    if (phase == PHASE_MARSHAL)
+                    if (is_size_needed_for_phase(phase))
                     {
                         print_file(file, indent, "_StubMsg.Offset = (unsigned long)0;\n"); /* FIXME */
                         print_file(file, indent, "_StubMsg.ActualCount = (unsigned long)");
@@ -1523,7 +1530,7 @@ void write_remoting_arguments(FILE *file
                 }
                 else if (!has_length && has_size)
                 {
-                    if (phase == PHASE_MARSHAL)
+                    if (is_size_needed_for_phase(phase))
                     {
                         print_file(file, indent, "_StubMsg.MaxCount = (unsigned long)");
                         write_expr(file, size_is ? size_is : var->array, 1);
@@ -1533,7 +1540,7 @@ void write_remoting_arguments(FILE *file
                 }
                 else
                 {
-                    if (phase == PHASE_MARSHAL)
+                    if (is_size_needed_for_phase(phase))
                     {
                         print_file(file, indent, "_StubMsg.MaxCount = (unsigned long)");
                         write_expr(file, size_is ? size_is : var->array, 1);






[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic