From d8c2f8501307a9c0c65601e897e7d919e42ba0b3 Mon Sep 17 00:00:00 2001 From: Deepak Singh Rawat Date: Mon, 7 Aug 2017 15:57:56 -0700 Subject: vmware: Fix build warnings Due to following commit in xserver there were build warnings, as variables now declared const. d89b42bda46d36fc0879611cc3b3566957ce36d0 e1e01d2e33c632e395d7e396f73fba8ae606b15a Added a compat header file. Signed-off-by: Deepak Rawat Reviewed-by: Brian Paul Reviewed-by: Thomas Hellstrom :q --- saa/Makefile.am | 2 +- saa/saa_priv.h | 7 ++++--- src/common_compat.h | 11 +++++++++++ src/vmware.c | 15 +++++++++------ src/vmwaremodes.c | 3 ++- vmwgfx/vmwgfx_driver.c | 9 +++++---- 6 files changed, 32 insertions(+), 15 deletions(-) create mode 100644 src/common_compat.h diff --git a/saa/Makefile.am b/saa/Makefile.am index 48c9734..b812815 100644 --- a/saa/Makefile.am +++ b/saa/Makefile.am @@ -2,7 +2,7 @@ if BUILD_VMWGFX noinst_LTLIBRARIES = libsaa.la -libsaa_la_CFLAGS = $(CWARNFLAGS) $(XORG_CFLAGS) +libsaa_la_CFLAGS = $(CWARNFLAGS) $(XORG_CFLAGS) -I$(top_srcdir)/src libsaa_la_LDFLAGS = -static libsaa_la_SOURCES = \ saa.c \ diff --git a/saa/saa_priv.h b/saa/saa_priv.h index 5d81453..9065fbe 100644 --- a/saa/saa_priv.h +++ b/saa/saa_priv.h @@ -59,14 +59,15 @@ #include "glyphstr.h" #endif #include "damage.h" +#include "common_compat.h" #define SAA_INVALID_ADDRESS \ ((void *) ((unsigned long) 0xFFFFFFFF - 1024*1024)) struct saa_gc_priv { /* GC values from the layer below. */ - GCOps *saved_ops; - GCFuncs *saved_funcs; + CONST_ABI_18_0 GCOps *saved_ops; + CONST_ABI_18_0 GCFuncs *saved_funcs; }; struct saa_screen_priv { @@ -127,7 +128,7 @@ do { \ } #define saa_swap(priv, real, mem) {\ - void *tmp = (priv)->saved_##mem; \ + CONST_ABI_18_0 void *tmp = (priv)->saved_##mem; \ (priv)->saved_##mem = (real)->mem; \ (real)->mem = tmp; \ } diff --git a/src/common_compat.h b/src/common_compat.h new file mode 100644 index 0000000..d7b4867 --- /dev/null +++ b/src/common_compat.h @@ -0,0 +1,11 @@ +#ifndef _COMMON_COMPAT_H_ +#define _COMMOM_COMPAT_H_ + +#if (GET_ABI_MAJOR(ABI_VIDEODRV_VERSION) >= 18) +#define CONST_ABI_18_0 const +#else +#define CONST_ABI_18_0 +#endif + +#endif + diff --git a/src/vmware.c b/src/vmware.c index 12f12ed..1af20d8 100644 --- a/src/vmware.c +++ b/src/vmware.c @@ -36,6 +36,7 @@ char rcsId_vmware[] = #include "svga_modes.h" #include "vmware_bootstrap.h" #include "vmware_common.h" +#include "common_compat.h" #ifndef HAVE_XORG_SERVER_1_5_0 #include @@ -1222,12 +1223,14 @@ VMWAREAddDisplayMode(ScrnInfoPtr pScrn, int height) { DisplayModeRec *mode; + char * modeName; mode = malloc(sizeof(DisplayModeRec)); memset(mode, 0, sizeof *mode); - mode->name = malloc(strlen(name) + 1); - strcpy(mode->name, name); + modeName = malloc(strlen(name) + 1); + strcpy(modeName, name); + mode->name = modeName; mode->status = MODE_OK; mode->type = M_T_DEFAULT; mode->HDisplay = width; @@ -1324,7 +1327,7 @@ VMWAREScreenInit(SCREEN_INIT_ARGS_DECL) if (useXinerama && xf86IsOptionSet(options, OPTION_GUI_LAYOUT)) { - char *topology = xf86GetOptValString(options, OPTION_GUI_LAYOUT); + CONST_ABI_18_0 char *topology = xf86GetOptValString(options, OPTION_GUI_LAYOUT); if (topology) { pVMWARE->xineramaState = VMWAREParseTopologyString(pScrn, topology, @@ -1332,11 +1335,11 @@ VMWAREScreenInit(SCREEN_INIT_ARGS_DECL) pVMWARE->xineramaStatic = pVMWARE->xineramaState != NULL; - free(topology); + free((void *)topology); } } else if (useXinerama && xf86IsOptionSet(options, OPTION_STATIC_XINERAMA)) { - char *topology = xf86GetOptValString(options, OPTION_STATIC_XINERAMA); + CONST_ABI_18_0 char *topology = xf86GetOptValString(options, OPTION_STATIC_XINERAMA); if (topology) { pVMWARE->xineramaState = VMWAREParseTopologyString(pScrn, topology, @@ -1345,7 +1348,7 @@ VMWAREScreenInit(SCREEN_INIT_ARGS_DECL) pVMWARE->xineramaStatic = pVMWARE->xineramaState != NULL; - free(topology); + free((void *)topology); } } diff --git a/src/vmwaremodes.c b/src/vmwaremodes.c index 41a9b4f..1d296ac 100644 --- a/src/vmwaremodes.c +++ b/src/vmwaremodes.c @@ -40,6 +40,7 @@ #endif #include "vm_basic_types.h" #include "vmware.h" +#include "common_compat.h" #ifndef M_T_DRIVER # define M_T_DRIVER 0x40 /* Supplied by the driver (EDID, etc) */ @@ -83,7 +84,7 @@ vmwareAddDefaultMode(ScrnInfoPtr pScrn, uint32 dwidth, uint32 dheight) DisplayModeRec dynamic = { MODEPREFIX, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, MODESUFFIX }; unsigned dispModeCount = 0; - char **dispModeList; + CONST_ABI_18_0 char **dispModeList; char *dynModeName; char name[80]; VMWAREPtr pVMWARE = VMWAREPTR(pScrn); diff --git a/vmwgfx/vmwgfx_driver.c b/vmwgfx/vmwgfx_driver.c index b9ee1db..967dec9 100644 --- a/vmwgfx/vmwgfx_driver.c +++ b/vmwgfx/vmwgfx_driver.c @@ -68,6 +68,7 @@ #include "../src/vmware_bootstrap.h" #include "../src/vmware_common.h" #include "vmwgfx_hosted.h" +#include "common_compat.h" /* * We can't incude svga_types.h due to conflicting types for Bool. @@ -410,23 +411,23 @@ vmwgfx_pre_init_mode(ScrnInfoPtr pScrn, int flags) } if (xf86IsOptionSet(ms->Options, OPTION_GUI_LAYOUT)) { - char *topology = + CONST_ABI_18_0 char *topology = xf86GetOptValString(ms->Options, OPTION_GUI_LAYOUT); ret = FALSE; if (topology) { ret = vmwgfx_set_topology(pScrn, topology, "gui"); - free(topology); + free((void *)topology); } } else if (xf86IsOptionSet(ms->Options, OPTION_STATIC_XINERAMA)) { - char *topology = + CONST_ABI_18_0 char *topology = xf86GetOptValString(ms->Options, OPTION_STATIC_XINERAMA); ret = FALSE; if (topology) { ret = vmwgfx_set_topology(pScrn, topology, "static Xinerama"); - free(topology); + free((void *)topology); } } -- cgit v1.2.3