Dan Hipschman : widl: Add tests for arrays of pointers.
Alexandre Julliard
julliard at wine.codeweavers.com
Thu Jun 21 09:47:34 CDT 2007
Module: wine
Branch: master
Commit: 4e8c8d03e50a13c62711a3afb1bb424a56a9382a
URL: http://source.winehq.org/git/wine.git/?a=commit;h=4e8c8d03e50a13c62711a3afb1bb424a56a9382a
Author: Dan Hipschman <dsh at linux.ucla.edu>
Date: Wed Jun 20 16:50:44 2007 -0700
widl: Add tests for arrays of pointers.
---
dlls/rpcrt4/tests/server.c | 28 ++++++++++++++++++++++++++++
dlls/rpcrt4/tests/server.idl | 2 ++
tools/widl/typegen.c | 2 +-
3 files changed, 31 insertions(+), 1 deletions(-)
diff --git a/dlls/rpcrt4/tests/server.c b/dlls/rpcrt4/tests/server.c
index 65226db..a0291e0 100644
--- a/dlls/rpcrt4/tests/server.c
+++ b/dlls/rpcrt4/tests/server.c
@@ -257,6 +257,21 @@ s_square_encu(encu_t *eu)
}
}
+int
+s_sum_parr(int *a[3])
+{
+ return s_sum_pcarr(a, 3);
+}
+
+int
+s_sum_pcarr(int *a[], int n)
+{
+ int i, s = 0;
+ for (i = 0; i < n; ++i)
+ s += *a[i];
+ return s;
+}
+
void
s_stop(void)
{
@@ -494,14 +509,27 @@ us_t_UserFree(ULONG *flags, us_t *pus)
static void
pointer_tests(void)
{
+ static int a[] = {1, 2, 3, 4};
static char p1[] = "11";
test_list_t *list = make_list(make_list(make_list(null_list())));
static test_us_t tus = {{p1}};
+ int *pa[4];
ok(test_list_length(list) == 3, "RPC test_list_length\n");
ok(square_puint(p1) == 121, "RPC square_puint\n");
ok(square_test_us(&tus) == 121, "RPC square_test_us\n");
+ pa[0] = &a[0];
+ pa[1] = &a[1];
+ pa[2] = &a[2];
+ ok(sum_parr(pa) == 6, "RPC sum_parr\n");
+
+ pa[0] = &a[0];
+ pa[1] = &a[1];
+ pa[2] = &a[2];
+ pa[3] = &a[3];
+ ok(sum_pcarr(pa, 4) == 10, "RPC sum_pcarr\n");
+
free_list(list);
}
diff --git a/dlls/rpcrt4/tests/server.idl b/dlls/rpcrt4/tests/server.idl
index e7873f5..d409c53 100644
--- a/dlls/rpcrt4/tests/server.idl
+++ b/dlls/rpcrt4/tests/server.idl
@@ -158,5 +158,7 @@ interface IServer
} encu_t;
double square_encu(encu_t *eu);
+ int sum_parr(int *a[3]);
+ int sum_pcarr([size_is(n)] int *a[], int n);
void stop(void);
}
diff --git a/tools/widl/typegen.c b/tools/widl/typegen.c
index 823f6e5..7b3bd13 100644
--- a/tools/widl/typegen.c
+++ b/tools/widl/typegen.c
@@ -1518,7 +1518,7 @@ static size_t write_array_tfs(FILE *file, const attr_list_t *attrs, type_t *type
print_file(file, 2, "0x%x, /* FC_PP */\n", RPC_FC_PP);
print_file(file, 2, "0x%x, /* FC_PAD */\n", RPC_FC_PAD);
*typestring_offset += 2;
- write_pointer_description(file, type->ref, 0, 0, typestring_offset);
+ write_pointer_description(file, type, 0, 0, typestring_offset);
print_file(file, 2, "0x%x, /* FC_END */\n", RPC_FC_END);
*typestring_offset += 1;
}
More information about the wine-cvs
mailing list