kernel32/tests: do not compare handle with zero directly (Smatch)

Michael Stefaniuc mstefani at redhat.com
Thu Jan 14 16:27:40 CST 2010


Andre,

this is actually a false positive in the file_handles Smatch script. Or 
a valid bug requiring an other solution; depending on the point of view.

On 01/14/2010 11:09 PM, André Hentschel wrote:
> ---
>   dlls/kernel32/tests/virtual.c |    2 +-
>   1 files changed, 1 insertions(+), 1 deletions(-)
>
> diff --git a/dlls/kernel32/tests/virtual.c b/dlls/kernel32/tests/virtual.c
> index 5187a97..2931374 100644
> --- a/dlls/kernel32/tests/virtual.c
> +++ b/dlls/kernel32/tests/virtual.c
> @@ -583,7 +583,7 @@ static void test_MapViewOfFile(void)
>           name = "Foo";
file is used as a HFILE before this line and should be checked against 
INVALID_HANDLE_VALUE and not NULL.

>           file = CreateFileMapping( INVALID_HANDLE_VALUE, NULL, PAGE_READWRITE, 0, 4096, name );
file is now a normal HANDLE and should be checked against NULL.

>       }
> -    ok( file != 0, "CreateFileMapping PAGE_READWRITE error %u\n", GetLastError() );
This is ok.

> +    ok( !!file, "CreateFileMapping PAGE_READWRITE error %u\n", GetLastError() );
The real fix is either for me to mark it as a false positives.
Or to make file a HFILE and use an other HANDLE variable for the mmap.

>       SetLastError(0xdeadbeef);
>       mapping = OpenFileMapping( FILE_MAP_READ, FALSE, name );

bye
	michael



More information about the wine-devel mailing list