Commit 00ce4112 authored by Dan Hipschman's avatar Dan Hipschman Committed by Alexandre Julliard

widl: Handle pointers in unions.

Unify write_pointers with write_embedded_types, and handle pointers in unions. Includes tests.
parent b4e8073f
...@@ -24,6 +24,7 @@ ...@@ -24,6 +24,7 @@
#include "server_defines.h" #include "server_defines.h"
#include <stdio.h> #include <stdio.h>
#include <stdlib.h>
#define PORT "4114" #define PORT "4114"
#define PIPE "\\pipe\\wine_rpcrt4_test" #define PIPE "\\pipe\\wine_rpcrt4_test"
...@@ -147,6 +148,7 @@ s_square_sun(sun_t *sun) ...@@ -147,6 +148,7 @@ s_square_sun(sun_t *sun)
case SUN_I: return sun->u.i * sun->u.i; case SUN_I: return sun->u.i * sun->u.i;
case SUN_F1: case SUN_F1:
case SUN_F2: return sun->u.f * sun->u.f; case SUN_F2: return sun->u.f * sun->u.f;
case SUN_PI: return (*sun->u.pi) * (*sun->u.pi);
default: default:
return 0.0; return 0.0;
} }
...@@ -270,6 +272,7 @@ static void ...@@ -270,6 +272,7 @@ static void
union_tests(void) union_tests(void)
{ {
sun_t sun; sun_t sun;
int i;
sun.s = SUN_I; sun.s = SUN_I;
sun.u.i = 9; sun.u.i = 9;
...@@ -282,6 +285,11 @@ union_tests(void) ...@@ -282,6 +285,11 @@ union_tests(void)
sun.s = SUN_F2; sun.s = SUN_F2;
sun.u.f = -2.0; sun.u.f = -2.0;
ok(square_sun(&sun) == 4.0, "RPC square_sun\n"); ok(square_sun(&sun) == 4.0, "RPC square_sun\n");
sun.s = SUN_PI;
sun.u.pi = &i;
i = 11;
ok(square_sun(&sun) == 121.0, "RPC square_sun\n");
} }
static void static void
......
...@@ -61,6 +61,7 @@ interface IServer ...@@ -61,6 +61,7 @@ interface IServer
{ {
[case(SUN_I)] int i; [case(SUN_I)] int i;
[case(SUN_F1, SUN_F2)] float f; [case(SUN_F1, SUN_F2)] float f;
[case(SUN_PI)] int *pi;
} u; } u;
int s; int s;
......
...@@ -22,3 +22,4 @@ ...@@ -22,3 +22,4 @@
#define SUN_I 10 #define SUN_I 10
#define SUN_F1 -2 #define SUN_F1 -2
#define SUN_F2 7 #define SUN_F2 7
#define SUN_PI 399
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment