From: John Wolfe Date: Tue, 4 May 2021 02:39:40 +0000 (-0700) Subject: vmwgfxctrl: Refactor the 'for' loop index declarations for C89 compatibility. X-Git-Tag: stable-11.3.0~35 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=2693e19a54d93dac0a206bf2634f6e6b908fc8b9;p=thirdparty%2Fopen-vm-tools.git vmwgfxctrl: Refactor the 'for' loop index declarations for C89 compatibility. --- diff --git a/open-vm-tools/vmwgfxctrl/Makefile.am b/open-vm-tools/vmwgfxctrl/Makefile.am index 0b7ff8a37..704ea163e 100644 --- a/open-vm-tools/vmwgfxctrl/Makefile.am +++ b/open-vm-tools/vmwgfxctrl/Makefile.am @@ -21,13 +21,12 @@ if ENABLE_VMWGFXCTRL bin_PROGRAMS = vmwgfxctrl -AM_CFLAGS = -AM_CFLAGS += -I$(top_srcdir)/services/plugins/resolutionSet - vmwgfxctrl_LDADD = vmwgfxctrl_LDADD += @VMTOOLS_LIBS@ vmwgfxctrl_LDADD += @LIBUDEV_LIBS@ +vmwgfxctrl_CFLAGS = -std=gnu89 + vmwgfxctrl_CPPFLAGS = vmwgfxctrl_CPPFLAGS += @VMTOOLS_CPPFLAGS@ vmwgfxctrl_CPPFLAGS += @LIBUDEV_CFLAGS@ diff --git a/open-vm-tools/vmwgfxctrl/main.c b/open-vm-tools/vmwgfxctrl/main.c index 30b92a4c4..b0749dfcc 100644 --- a/open-vm-tools/vmwgfxctrl/main.c +++ b/open-vm-tools/vmwgfxctrl/main.c @@ -41,11 +41,11 @@ */ #include "vm_basic_defs.h" -#include "resolutionDL.h" #include #include #include +#include #include #include #include @@ -53,6 +53,9 @@ #include #include #include +#include +#include +#include /* The DRM device we are looking for */ #define VMWGFXCTRL_VENDOR "0x15ad" @@ -255,6 +258,7 @@ parseRects(uint32_t num_rects, char **argv, struct drm_vmw_rect **rects) { + uint32_t j; /* * The argument string will look something like: * WxH+x+y * count. @@ -272,7 +276,7 @@ parseRects(uint32_t num_rects, return false; } - for (uint32_t j = 0; j < num_rects; ++j) { + for (j = 0; j < num_rects; ++j) { char *p = argv[arg++]; if (sscanf(p, "%ux%u+%d+%d", &(*rects)[j].w, &(*rects)[j].h, &(*rects)[j].x, &(*rects)[j].y) != 4) { @@ -402,6 +406,7 @@ drmModeConnectionToString(drmModeConnection modeConnection) static void printTopology(void) { + int i, j; int fd = vmwgfxOpen(false); if (fd < 0) { fprintf(stderr, "Wasn't able to open the drm device\n"); @@ -424,7 +429,7 @@ printTopology(void) printf(" max_size : [%u, %u]\n", res->max_width, res->max_height); printf("\n"); - for (int i = 0; i < res->count_connectors; i++) { + for (i = 0; i < res->count_connectors; i++) { drmModeConnectorPtr connector = drmModeGetConnector(fd, res->connectors[i]); if (!connector) { printf("Could not get connector %i\n", res->connectors[i]); @@ -447,7 +452,7 @@ printTopology(void) if (connector->count_props) { printf("\tProperties:\n"); } - for (int j = 0; j < connector->count_props; j++) { + for (j = 0; j < connector->count_props; j++) { drmModePropertyPtr props = drmModeGetProperty(fd, connector->props[j]); if (props) { printProperty(fd, j, props, connector->prop_values[j]); @@ -457,7 +462,7 @@ printTopology(void) if (connector->count_modes) { printf("\tModes:\n"); } - for (int j = 0; j < connector->count_modes; j++) { + for (j = 0; j < connector->count_modes; j++) { struct drm_mode_modeinfo *mode = (struct drm_mode_modeinfo *)&connector->modes[j]; printMode(mode, j, false); } @@ -475,7 +480,8 @@ printTopology(void) static void run(int argc, char **argv) { - for (int i = 1; i < argc; ++i) { + int i, j; + for (i = 1; i < argc; ++i) { if (strcmp(argv[i], "--help") == 0) { printf("%s: \n", argv[0]); printf("\t--help prints out the help screen\n"); @@ -497,7 +503,7 @@ run(int argc, char **argv) } printf("Setting topology for %d screens", num_rects); - for (uint32_t j = 0; j < num_rects; ++j) { + for (j = 0; j < num_rects; ++j) { printf(", [%d, %d, %u, %u]", rects[j].x, rects[j].y, rects[j].w, rects[j].h);