Commit 7976dc31 authored by Victor Toso's avatar Victor Toso Committed by Frediano Ziglio

x11-randr: simplest fix for address-of-packed-member

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>
parent 70c5908f
Pipeline #49851 failed with stage
in 2 minutes and 31 seconds