Windows warnings comparing HANDLE and -1

Bug #1153651 reported by Vladislav Vaintroub on 2013-03-11
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Percona Server moved to https://jira.percona.com/projects/PS
Fix Released
Low
Laurynas Biveinis
5.1
Fix Released
Low
Laurynas Biveinis
5.5
Fix Released
Low
Laurynas Biveinis
5.6
Fix Released
Low
Laurynas Biveinis

Bug Description

Recently merged XtraDB into MariDB 5.5 brings several new warnings (I checked with VS2012, perhaps it happens elsewhere, too)

37>..\..\..\storage\xtradb\log\log0online.c(547): warning C4047: '=' : 'HANDLE' differs in levels of indirection from 'int'
37>..\..\..\storage\xtradb\log\log0online.c(566): warning C4047: '!=' : 'HANDLE' differs in levels of indirection from 'int'
37>..\..\..\storage\xtradb\log\log0online.c(568): warning C4047: '=' : 'HANDLE' differs in levels of indirection from 'int'
37>..\..\..\storage\xtradb\log\log0online.c(765): warning C4047: '!=' : 'HANDLE' differs in levels of indirection from 'int'
37>..\..\..\storage\xtradb\log\log0online.c(767): warning C4047: '=' : 'HANDLE' differs in levels of indirection from 'int'
37>..\..\..\storage\xtradb\log\log0online.c(1669): warning C4047: '=' : 'HANDLE' differs in levels of indirection from 'int'

Looking at lines in question, those are all places that assign os_file_t value -1 or compare os_file_t with -1. However, on Windows os_file_t is HANDLE and HANDLE is basically void*, so comparison like that is invalid.

INVALID_HANDLE_VALUE sounds like a good candidate instead of -1. Maybe, XtraDB can use macros/inline functions like is_valid() or invalidate() to check or assign file handle values (or anything else that would avoid this type of warning in the future)

Related branches

tags: added: bitmap
tags: added: xtradb

Percona now uses JIRA for bug reports so this bug report is migrated to: https://jira.percona.com/browse/PS-1977

To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers