Robert Shearman : widl: Output the necessary sizing information for other phases.

Alexandre Julliard julliard at wine.codeweavers.com
Fri Mar 31 13:04:55 CST 2006


Module: wine
Branch: refs/heads/master
Commit: 226c8f6b5215ec998fb48ee109d3dae745eb0d6e
URL:    http://source.winehq.org/git/?p=wine.git;a=commit;h=226c8f6b5215ec998fb48ee109d3dae745eb0d6e

Author: Robert Shearman <rob at codeweavers.com>
Date:   Fri Mar 31 12:47:08 2006 +0100

widl: Output the necessary sizing information for other phases.

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(-)

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);




More information about the wine-cvs mailing list