[Spice-devel] [PATCH vdagent 1/2] vdagent-x11-randr: Fix building warning

Christophe Fergeau cfergeau at redhat.com
Sun Dec 9 23:42:59 PST 2012


Hey,

On Wed, Dec 05, 2012 at 04:01:58PM +0800, Dunrong Huang wrote:
> This patch can be safely applied since it just deletes unused variables.
> 
> Signed-off-by: Dunrong Huang <riegamaths at gmail.com>
> ---
>  src/vdagent-x11-randr.c | 8 +-------
>  1 file changed, 1 insertion(+), 7 deletions(-)
> 
> diff --git a/src/vdagent-x11-randr.c b/src/vdagent-x11-randr.c
> index 2c1819a..e171e7a 100644
> --- a/src/vdagent-x11-randr.c
> +++ b/src/vdagent-x11-randr.c
> @@ -204,9 +204,6 @@ static void delete_mode(struct vdagent_x11 *x11, int output_index, const char* n
>      int m;
>      XRRModeInfo *mode;
>      XRROutputInfo *output_info;
> -    XRRCrtcInfo *crtc_info;
> -    RRCrtc crtc;
> -    int current_mode = -1;
>  
>      output_info = x11->randr.outputs[output_index];
>      if (output_info->ncrtc != 1) {
> @@ -214,9 +211,6 @@ static void delete_mode(struct vdagent_x11 *x11, int output_index, const char* n
>                 "failed to delete mode", output_info->ncrtc);
>          return;
>      }
> -    crtc_info = crtc_from_id(x11, output_info->crtcs[0]);
> -    current_mode = crtc_info->mode;
> -    crtc = output_info->crtc;
>      for (m = 0 ; m < x11->randr.res->nmode; ++m) {
>          mode = &x11->randr.res->modes[m];
>          if (strcmp(mode->name, name) == 0)
> @@ -689,7 +683,7 @@ void vdagent_x11_set_monitor_config(struct vdagent_x11 *x11,
>          if (!xrandr_add_and_set(x11, i, x, y, width, height) &&
>                  mon_config->num_of_monitors == 1) {
>              set_screen_to_best_size(x11, width, height,
> -                                    &primary_w, &primary_h);
> +                                    (int *)&primary_w, (int *)&primary_h);

I'm not a big fan of this change as this will cause issues if sizeof(int)
!= sizeof(uint32_t). However, in the first half of
vdagent_x11_set_monitor_config, primary_w is used with unsigned variables
while in the second half, it's used with signed variables, so I'm not sure
what is the best way to solve this here. I assume you were getting a
warning before this cast?

Christophe
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/spice-devel/attachments/20121210/475ed910/attachment.pgp>


More information about the Spice-devel mailing list