• Victor Toso's avatar
    x11-randr: simplest fix for address-of-packed-member · 7976dc31
    Victor Toso authored
    The struct type for width/height is uint32_t while we are trying to
    access and change it with int* - code can be improved a bit in following
    patches but this one fixes the warning by copying the value from the
    struct and copying back new value afterwards.
    
    Also:
    - Moved variables to internal scope;
    - Added braces to inner if;
    
     > src/vdagent/x11-randr.c: In function ‘zero_base_monitors’:
     >     src/vdagent/x11-randr.c:621:28: error: taking address of packed member of
     >     ‘struct VDAgentMonConfig’ may result in an unaligned pointer value
     > [-Werror=address-of-packed-member]
     >   621 |         mon_width = (int *)&mon_config->monitors[i].width;
     >       |                            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     > src/vdagent/x11-randr.c:622:29: error: taking address of packed member of
     >     ‘struct VDAgentMonConfig’ may result in an unaligned pointer value
     >     [-Werror=address-of-packed-member]
     >   622 |         mon_height = (int *)&mon_config->monitors[i].height;
     >       |                             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    Signed-off-by: Victor Toso's avatarVictor Toso <victortoso@redhat.com>
    Acked-by: Frediano Ziglio's avatarFrediano Ziglio <fziglio@redhat.com>
    7976dc31
Name
Last commit
Last update
data Loading commit data...
src Loading commit data...
tests Loading commit data...
.gitignore Loading commit data...
.gitlab-ci.yml Loading commit data...
CHANGELOG.md Loading commit data...
COPYING Loading commit data...
Makefile.am Loading commit data...
README.md Loading commit data...
autogen.sh Loading commit data...
configure.ac Loading commit data...