]> rtime.felk.cvut.cz Git - frescor/forb.git/commitdiff
forb-idl: Fixed serialization of typedeffed arrays
authorMichal Sojka <sojkam1@fel.cvut.cz>
Fri, 29 Aug 2008 12:38:22 +0000 (14:38 +0200)
committerMichal Sojka <sojkam1@fel.cvut.cz>
Fri, 29 Aug 2008 12:38:22 +0000 (14:38 +0200)
forb-idl/forb-idl-c-utils.c

index 6dcaad1b33daa16d19b4299e32ed5eb9e2a9a529..bcfb1823051c65349addc5ebe1d22c7f88322877 100644 (file)
@@ -23,14 +23,20 @@ forb_cbe_write_ser_var(FILE *of, IDL_tree ts, IDL_tree name,
        int indent = 0, i;
        GString *id = g_string_new("");
        char *serialize = (serialization == SERIALIZE) ? "serialize" : "deserialize";
+       gboolean use_ampersand = TRUE;
 
-       //forb_idl_print_node(ts, 0);
-       
        switch(IDL_NODE_TYPE(name)) {
        case IDLN_IDENT:
                fprintf(of, "  ");
                if (use_name)
                        g_string_assign(id, IDL_IDENT(name).str);
+               
+               if (IDL_NODE_TYPE(forb_cbe_get_typespec(ts)) == IDLN_TYPE_ARRAY)
+                 use_ampersand = FALSE;
+
+/*             printf("%s%s:\n", var_prefix, use_name ? id->str:""); */
+/*             forb_idl_print_node(forb_cbe_get_typespec(ts), 2); */
+       
                break;
        case IDLN_TYPE_ARRAY:
        {
@@ -72,8 +78,8 @@ forb_cbe_write_ser_var(FILE *of, IDL_tree ts, IDL_tree name,
        }
        fprintf(of, "if (!");
        forb_cbe_write_typespec(of, ts);
-       fprintf(of, "_%s(codec, &%s%s)) goto ser_exception;\n",
-               serialize, var_prefix, id->str);
+       fprintf(of, "_%s(codec, %s%s%s)) goto ser_exception;\n",
+               serialize, use_ampersand ? "&":"", var_prefix, id->str);
        if (indent)
                fprintf(of, "  }\n");