Stefan Weil via <[email protected]> writes:
> Compiler warning:
>
> ../chardev/baum.c:657:25: warning: comparison between pointer and integer
>
> Use brlapi_fileDescriptor instead of int for brlapi_fd and
> BRLAPI_INVALID_FILE_DESCRIPTOR instead of -1.
>
> Signed-off-by: Stefan Weil <[email protected]>
> ---
>
> This is a rather old patch which I now use since more than two years
> to support Braille with QEMU on Windows.
>
> It's a hack (because Windows uses a pointer (64 bit) which is
> assigned to an int (32 bit), but it seems to work.
Would a code comment pointing out the hack be useful?
> Regards,
> Stefan
>
>
> chardev/baum.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/chardev/baum.c b/chardev/baum.c
> index f3e8cd27f0..5c3587dda5 100644
> --- a/chardev/baum.c
> +++ b/chardev/baum.c
> @@ -94,7 +94,7 @@ struct BaumChardev {
> Chardev parent;
>
> brlapi_handle_t *brlapi;
> - int brlapi_fd;
> + brlapi_fileDescriptor brlapi_fd;
> unsigned int x, y;
> bool deferred_init;
>
> @@ -654,7 +654,7 @@ static void baum_chr_open(Chardev *chr,
> baum->brlapi = handle;
>
> baum->brlapi_fd = brlapi__openConnection(handle, NULL, NULL);
> - if (baum->brlapi_fd == -1) {
> + if (baum->brlapi_fd == BRLAPI_INVALID_FILE_DESCRIPTOR) {
> error_setg(errp, "brlapi__openConnection: %s",
> brlapi_strerror(brlapi_error_location()));
> g_free(handle);