]> granicus.if.org Git - graphviz/commitdiff
gvc: squash -Wconversion warnings in 'gvevent_button_press'
authorMatthew Fernandez <matthew.fernandez@gmail.com>
Tue, 8 Nov 2022 01:56:05 +0000 (17:56 -0800)
committerMatthew Fernandez <matthew.fernandez@gmail.com>
Fri, 11 Nov 2022 01:09:34 +0000 (17:09 -0800)
Squashes the following compiler warnings. We know these are false positives due
to the switch cases in which this code appears.

  gvevent.c:373:23: warning: conversion from ‘int’ to ‘unsigned char’ may change
    value [-Wconversion]
    373 |         job->button = button;
        |                       ^~~~~~
  gvevent.c:378:23: warning: conversion from ‘int’ to ‘unsigned char’ may change
    value [-Wconversion]
    378 |         job->button = button;
        |                       ^~~~~~
  gvevent.c:384:23: warning: conversion from ‘int’ to ‘unsigned char’ may change
    value [-Wconversion]
    384 |         job->button = button;
        |                       ^~~~~~

lib/gvc/gvevent.c

index 61236c458dd5c0559c6febe17c32ad3ee2b2924f..1288dc4cdf509aa463444d13f6ada662fe07e0ab 100644 (file)
@@ -370,18 +370,18 @@ static void gvevent_button_press(GVJ_t * job, int button, pointf pointer)
        gvevent_find_current_obj(job, pointer);
        gvevent_select_current_obj(job);
         job->click = true;
-       job->button = button;
+       job->button = (unsigned char)button;
        job->needs_refresh = true;
        break;
     case 2: /* pan */
         job->click = true;
-       job->button = button;
+       job->button = (unsigned char)button;
        job->needs_refresh = true;
        break;
     case 3: /* insert node or edge */
        gvevent_find_current_obj(job, pointer);
         job->click = true;
-       job->button = button;
+       job->button = (unsigned char)button;
        job->needs_refresh = true;
        break;
     case 4: