[1/2] kernel32/tests: Fix compilation with PSDK.

Michael Stefaniuc mstefani at redhat.com
Wed Aug 19 06:18:15 CDT 2015


Hello Dmitry,

On 08/19/2015 06:23 AM, Dmitry Timoshkov wrote:
> ---
>  dlls/kernel32/tests/process.c | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/dlls/kernel32/tests/process.c b/dlls/kernel32/tests/process.c
> index 113ec35..a8abdc1 100644
> --- a/dlls/kernel32/tests/process.c
> +++ b/dlls/kernel32/tests/process.c
> @@ -2302,7 +2302,7 @@ static void test_TerminateJobObject(void)
>  
>  static void test_QueryInformationJobObject(void)
>  {
> -    char buf[FIELD_OFFSET(JOBOBJECT_BASIC_PROCESS_ID_LIST, ProcessIdList[5])];
> +    char buf[sizeof(JOBOBJECT_BASIC_PROCESS_ID_LIST) + sizeof(ULONG_PTR) * 5];
this change looks odd.

Using offsetof (or FIELD_OFFSET) is the standard Wine way of getting the
size of a struct with a variable length array. I have done quite a few
patches on Alexandre's request that replace sizeof+sizeof*x with
offsetof. E.g. 14e20162f9448a648f3973a86e03aea17387c040

Last but not least you're not allocating the same amount of memory:
  offsetof(struct, field[n]) == sizeof(struct) + (n-1) * sizeof(field)

bye
	michael



More information about the wine-devel mailing list