diff options
Diffstat (limited to 'xorg-server/hw')
48 files changed, 626 insertions, 529 deletions
diff --git a/xorg-server/hw/kdrive/ephyr/ephyr.c b/xorg-server/hw/kdrive/ephyr/ephyr.c index 12c708616..da80c9577 100644 --- a/xorg-server/hw/kdrive/ephyr/ephyr.c +++ b/xorg-server/hw/kdrive/ephyr/ephyr.c @@ -1008,6 +1008,29 @@ ephyrProcessButtonRelease(xcb_generic_event_t *xev) KdEnqueuePointerEvent(ephyrMouse, mouseState | KD_MOUSE_DELTA, 0, 0, 0); } +/* Xephyr wants ctrl+shift to grab the window, but that conflicts with + ctrl+alt+shift key combos. Remember the modifier state on key presses and + releases, if mod1 is pressed, we need ctrl, shift and mod1 released + before we allow a shift-ctrl grab activation. + + note: a key event contains the mask _before_ the current key takes + effect, so mod1_was_down will be reset on the first key press after all + three were released, not on the last release. That'd require some more + effort. + */ +static int +ephyrUpdateGrabModifierState(int state) +{ + static int mod1_was_down = 0; + + if ((state & (XCB_MOD_MASK_CONTROL|XCB_MOD_MASK_SHIFT|XCB_MOD_MASK_1)) == 0) + mod1_was_down = 0; + else if (state & XCB_MOD_MASK_1) + mod1_was_down = 1; + + return mod1_was_down; +} + static void ephyrProcessKeyPress(xcb_generic_event_t *xev) { @@ -1018,6 +1041,7 @@ ephyrProcessKeyPress(xcb_generic_event_t *xev) return; } + ephyrUpdateGrabModifierState(key->state); ephyrUpdateModifierState(key->state); KdEnqueueKeyboardEvent(ephyrKbd, key->detail, FALSE); } @@ -1029,6 +1053,7 @@ ephyrProcessKeyRelease(xcb_generic_event_t *xev) xcb_key_release_event_t *key = (xcb_key_release_event_t *)xev; static xcb_key_symbols_t *keysyms; static int grabbed_screen = -1; + int mod1_down = ephyrUpdateGrabModifierState(key->state); if (!keysyms) keysyms = xcb_key_symbols_alloc(conn); @@ -1049,7 +1074,7 @@ ephyrProcessKeyRelease(xcb_generic_event_t *xev) hostx_set_win_title(screen, "(ctrl+shift grabs mouse and keyboard)"); } - else { + else if (!mod1_down) { /* Attempt grab */ xcb_grab_keyboard_cookie_t kbgrabc = xcb_grab_keyboard(conn, diff --git a/xorg-server/hw/kdrive/ephyr/ephyrdriext.c b/xorg-server/hw/kdrive/ephyr/ephyrdriext.c index e2b33db03..8368d1233 100644 --- a/xorg-server/hw/kdrive/ephyr/ephyrdriext.c +++ b/xorg-server/hw/kdrive/ephyr/ephyrdriext.c @@ -1098,7 +1098,6 @@ ProcXF86DRIGetDrawableInfo(register ClientPtr client) if (rep.numClipRects) { if (clipRects) { ScreenPtr pScreen = screenInfo.screens[stuff->screen]; - int i = 0; EPHYR_LOG("clip list of host gl drawable:\n"); for (i = 0; i < rep.numClipRects; i++) { diff --git a/xorg-server/hw/kdrive/src/kinput.c b/xorg-server/hw/kdrive/src/kinput.c index 7d09e282f..a539ca513 100644 --- a/xorg-server/hw/kdrive/src/kinput.c +++ b/xorg-server/hw/kdrive/src/kinput.c @@ -1940,7 +1940,7 @@ _KdEnqueuePointerEvent(KdPointerInfo * pi, int type, int x, int y, int z, } void -KdBlockHandler(ScreenPtr pScreen, void *timeout, void *readmask) +KdBlockHandler(ScreenPtr pScreen, void *timeo, void *readmask) { KdPointerInfo *pi; int myTimeout = 0; @@ -1962,7 +1962,7 @@ KdBlockHandler(ScreenPtr pScreen, void *timeout, void *readmask) myTimeout = 20; } if (myTimeout > 0) - AdjustWaitForDelay(timeout, myTimeout); + AdjustWaitForDelay(timeo, myTimeout); } void diff --git a/xorg-server/hw/kdrive/src/kxv.c b/xorg-server/hw/kdrive/src/kxv.c index 9e76eadf0..445eb605b 100644 --- a/xorg-server/hw/kdrive/src/kxv.c +++ b/xorg-server/hw/kdrive/src/kxv.c @@ -1821,14 +1821,14 @@ KdXVCopyPlanarData(KdScreenInfo * screen, CARD8 *src, CARD8 *dst, int randr, w >>= 1; for (j = 0; j < h; j++) { - CARD32 *dst = (CARD32 *) dst1; + CARD32 *dst32 = (CARD32 *) dst1; CARD8 *s1l = src1; CARD8 *s1r = src1 + srcNext; CARD8 *s2 = src2; CARD8 *s3 = src3; for (i = 0; i < w; i++) { - *dst++ = *s1l | (*s1r << 16) | (*s3 << 8) | (*s2 << 24); + *dst32++ = *s1l | (*s1r << 16) | (*s3 << 8) | (*s2 << 24); s1l += srcRight; s1r += srcRight; s2 += srcRight2; diff --git a/xorg-server/hw/vfb/InitOutput.c b/xorg-server/hw/vfb/InitOutput.c index d10272244..2175ac685 100644 --- a/xorg-server/hw/vfb/InitOutput.c +++ b/xorg-server/hw/vfb/InitOutput.c @@ -899,7 +899,7 @@ void vfbExtensionInit(void) } void -InitOutput(ScreenInfo * screenInfo, int argc, char **argv) +InitOutput(ScreenInfo * screen_info, int argc, char **argv) { int i; int NumFormats = 0; @@ -935,18 +935,18 @@ InitOutput(ScreenInfo * screenInfo, int argc, char **argv) if (vfbPixmapDepths[i]) { if (NumFormats >= MAXFORMATS) FatalError("MAXFORMATS is too small for this server\n"); - screenInfo->formats[NumFormats].depth = i; - screenInfo->formats[NumFormats].bitsPerPixel = vfbBitsPerPixel(i); - screenInfo->formats[NumFormats].scanlinePad = BITMAP_SCANLINE_PAD; + screen_info->formats[NumFormats].depth = i; + screen_info->formats[NumFormats].bitsPerPixel = vfbBitsPerPixel(i); + screen_info->formats[NumFormats].scanlinePad = BITMAP_SCANLINE_PAD; NumFormats++; } } - screenInfo->imageByteOrder = IMAGE_BYTE_ORDER; - screenInfo->bitmapScanlineUnit = BITMAP_SCANLINE_UNIT; - screenInfo->bitmapScanlinePad = BITMAP_SCANLINE_PAD; - screenInfo->bitmapBitOrder = BITMAP_BIT_ORDER; - screenInfo->numPixmapFormats = NumFormats; + screen_info->imageByteOrder = IMAGE_BYTE_ORDER; + screen_info->bitmapScanlineUnit = BITMAP_SCANLINE_UNIT; + screen_info->bitmapScanlinePad = BITMAP_SCANLINE_PAD; + screen_info->bitmapBitOrder = BITMAP_BIT_ORDER; + screen_info->numPixmapFormats = NumFormats; /* initialize screens */ diff --git a/xorg-server/hw/xfree86/common/xf86Config.c b/xorg-server/hw/xfree86/common/xf86Config.c index 5be1693d8..258b22bfe 100644 --- a/xorg-server/hw/xfree86/common/xf86Config.c +++ b/xorg-server/hw/xfree86/common/xf86Config.c @@ -1677,7 +1677,7 @@ configLayout(serverLayoutPtr servlayoutp, XF86ConfLayoutPtr conf_layout, */ static Bool configImpliedLayout(serverLayoutPtr servlayoutp, XF86ConfScreenPtr conf_screen, - XF86ConfigPtr xf86configptr) + XF86ConfigPtr conf_ptr) { MessageType from; XF86ConfScreenPtr s; @@ -1722,7 +1722,7 @@ configImpliedLayout(serverLayoutPtr servlayoutp, XF86ConfScreenPtr conf_screen, memset(&layout, 0, sizeof(layout)); layout.lay_identifier = servlayoutp->id; - if (xf86layoutAddInputDevices(xf86configptr, &layout) > 0) { + if (xf86layoutAddInputDevices(conf_ptr, &layout) > 0) { if (!configInputDevices(&layout, servlayoutp)) return FALSE; from = X_DEFAULT; diff --git a/xorg-server/hw/xfree86/common/xf86Configure.c b/xorg-server/hw/xfree86/common/xf86Configure.c index 1348b2753..30dc5505c 100644 --- a/xorg-server/hw/xfree86/common/xf86Configure.c +++ b/xorg-server/hw/xfree86/common/xf86Configure.c @@ -206,17 +206,17 @@ configureScreenSection(int screennum) ptr->scrn_device_str = tmp; for (i = 0; i < sizeof(depths) / sizeof(depths[0]); i++) { - XF86ConfDisplayPtr display; + XF86ConfDisplayPtr conf_display; - display = calloc(1, sizeof(XF86ConfDisplayRec)); - display->disp_depth = depths[i]; - display->disp_black.red = display->disp_white.red = -1; - display->disp_black.green = display->disp_white.green = -1; - display->disp_black.blue = display->disp_white.blue = -1; + conf_display = calloc(1, sizeof(XF86ConfDisplayRec)); + conf_display->disp_depth = depths[i]; + conf_display->disp_black.red = conf_display->disp_white.red = -1; + conf_display->disp_black.green = conf_display->disp_white.green = -1; + conf_display->disp_black.blue = conf_display->disp_white.blue = -1; ptr->scrn_display_lst = (XF86ConfDisplayPtr) xf86addListItem((glp) ptr-> scrn_display_lst, (glp) - display); + conf_display); } return ptr; @@ -375,7 +375,6 @@ configureLayoutSection(void) aptr->adj_refscreen = NULL; } else { - char *tmp; aptr->adj_where = CONF_ADJ_RIGHTOF; XNFasprintf(&tmp, "Screen%d", scrnum - 1); aptr->adj_refscreen = tmp; @@ -586,24 +585,24 @@ DoConfigure(void) /* Add device, monitor and screen sections for detected devices */ for (screennum = 0; screennum < nDevToConfig; screennum++) { - XF86ConfDevicePtr DevicePtr; - XF86ConfMonitorPtr MonitorPtr; - XF86ConfScreenPtr ScreenPtr; + XF86ConfDevicePtr device_ptr; + XF86ConfMonitorPtr monitor_ptr; + XF86ConfScreenPtr screen_ptr; - DevicePtr = configureDeviceSection(screennum); + device_ptr = configureDeviceSection(screennum); xf86config->conf_device_lst = (XF86ConfDevicePtr) xf86addListItem((glp) xf86config-> conf_device_lst, (glp) - DevicePtr); - MonitorPtr = configureMonitorSection(screennum); - xf86config->conf_monitor_lst = (XF86ConfMonitorPtr) xf86addListItem((glp) xf86config->conf_monitor_lst, (glp) MonitorPtr); - ScreenPtr = configureScreenSection(screennum); + device_ptr); + monitor_ptr = configureMonitorSection(screennum); + xf86config->conf_monitor_lst = (XF86ConfMonitorPtr) xf86addListItem((glp) xf86config->conf_monitor_lst, (glp) monitor_ptr); + screen_ptr = configureScreenSection(screennum); xf86config->conf_screen_lst = (XF86ConfScreenPtr) xf86addListItem((glp) xf86config-> conf_screen_lst, (glp) - ScreenPtr); + screen_ptr); } xf86config->conf_files = configureFilesSection(); @@ -714,27 +713,27 @@ DoConfigure(void) xf86freeScreenList(xf86config->conf_screen_lst); xf86config->conf_screen_lst = NULL; for (j = 0; j < xf86NumScreens; j++) { - XF86ConfMonitorPtr MonitorPtr; - XF86ConfScreenPtr ScreenPtr; + XF86ConfMonitorPtr monitor_ptr; + XF86ConfScreenPtr screen_ptr; ConfiguredMonitor = NULL; if ((*xf86Screens[dev2screen[j]]->PreInit) (xf86Screens[dev2screen[j]], PROBE_DETECT) && ConfiguredMonitor) { - MonitorPtr = configureDDCMonitorSection(j); + monitor_ptr = configureDDCMonitorSection(j); } else { - MonitorPtr = configureMonitorSection(j); + monitor_ptr = configureMonitorSection(j); } - ScreenPtr = configureScreenSection(j); + screen_ptr = configureScreenSection(j); - xf86config->conf_monitor_lst = (XF86ConfMonitorPtr) xf86addListItem((glp) xf86config->conf_monitor_lst, (glp) MonitorPtr); + xf86config->conf_monitor_lst = (XF86ConfMonitorPtr) xf86addListItem((glp) xf86config->conf_monitor_lst, (glp) monitor_ptr); xf86config->conf_screen_lst = (XF86ConfScreenPtr) xf86addListItem((glp) xf86config-> conf_screen_lst, (glp) - ScreenPtr); + screen_ptr); } if (xf86writeConfigFile(filename, xf86config) == 0) { diff --git a/xorg-server/hw/xfree86/common/xf86Helper.c b/xorg-server/hw/xfree86/common/xf86Helper.c index 0916deccf..2c0629d64 100644 --- a/xorg-server/hw/xfree86/common/xf86Helper.c +++ b/xorg-server/hw/xfree86/common/xf86Helper.c @@ -421,7 +421,6 @@ xf86SetDepthBpp(ScrnInfoPtr scrp, int depth, int dummy, int fbbpp, * Check for DefaultDepth and DefaultFbBpp options in the * Device sections. */ - int i; GDevPtr device; Bool found = FALSE; diff --git a/xorg-server/hw/xfree86/common/xf86Init.c b/xorg-server/hw/xfree86/common/xf86Init.c index 7c72aa964..9c8a86a39 100644 --- a/xorg-server/hw/xfree86/common/xf86Init.c +++ b/xorg-server/hw/xfree86/common/xf86Init.c @@ -309,7 +309,7 @@ xf86CreateRootWindow(WindowPtr pWin) int err = Success; ScreenPtr pScreen = pWin->drawable.pScreen; RootWinPropPtr pProp; - CreateWindowProcPtr CreateWindow = (CreateWindowProcPtr) + CreateWindowProcPtr create_window = (CreateWindowProcPtr) dixLookupPrivate(&pScreen->devPrivates, xf86CreateRootWindowKey); DebugF("xf86CreateRootWindow(%p)\n", pWin); @@ -323,7 +323,7 @@ xf86CreateRootWindow(WindowPtr pWin) } /* Unhook this function ... */ - pScreen->CreateWindow = CreateWindow; + pScreen->CreateWindow = create_window; dixSetPrivate(&pScreen->devPrivates, xf86CreateRootWindowKey, NULL); /* ... and call the previous CreateWindow fuction, if any */ diff --git a/xorg-server/hw/xfree86/common/xf86fbman.c b/xorg-server/hw/xfree86/common/xf86fbman.c index dafaad304..db715bd2f 100644 --- a/xorg-server/hw/xfree86/common/xf86fbman.c +++ b/xorg-server/hw/xfree86/common/xf86fbman.c @@ -1122,11 +1122,8 @@ localQueryLargestOffscreenLinear(ScreenPtr pScreen, if (localQueryLargestOffscreenArea(pScreen, &w, &h, gran, FAVOR_WIDTH_THEN_AREA, priority)) { - FBManagerPtr offman; BoxPtr extents; - offman = (FBManagerPtr) dixLookupPrivate(&pScreen->devPrivates, - xf86FBScreenKey); extents = RegionExtents(offman->InitialBoxes); if ((extents->x2 - extents->x1) == w) *size = w * h; diff --git a/xorg-server/hw/xfree86/ddc/interpret_edid.c b/xorg-server/hw/xfree86/ddc/interpret_edid.c index 882a6b201..17a8f81c0 100644 --- a/xorg-server/hw/xfree86/ddc/interpret_edid.c +++ b/xorg-server/hw/xfree86/ddc/interpret_edid.c @@ -332,6 +332,97 @@ xf86ForEachVideoBlock(xf86MonPtr mon, handle_video_fn fn, void *data) } } +static Bool +cea_db_offsets(Uchar *cea, int *start, int *end) +{ + /* Data block offset in CEA extension block */ + *start = CEA_EXT_MIN_DATA_OFFSET; + *end = cea[2]; + if (*end == 0) + *end = CEA_EXT_MAX_DATA_OFFSET; + if (*end < CEA_EXT_MIN_DATA_OFFSET || *end > CEA_EXT_MAX_DATA_OFFSET) + return FALSE; + return TRUE; +} + +static int +cea_db_len(Uchar *db) +{ + return db[0] & 0x1f; +} + +static int +cea_db_tag(Uchar *db) +{ + return db[0] >> 5; +} + +typedef void (*handle_cea_db_fn) (Uchar *, void *); + +static void +cea_for_each_db(xf86MonPtr mon, handle_cea_db_fn fn, void *data) +{ + int i; + + if (!mon) + return; + + if (!(mon->flags & EDID_COMPLETE_RAWDATA)) + return; + + if (!mon->no_sections) + return; + + if (!mon->rawData) + return; + + for (i = 0; i < mon->no_sections; i++) { + int start, end, offset; + Uchar *ext; + + ext = mon->rawData + EDID1_LEN * (i + 1); + if (ext[EXT_TAG] != CEA_EXT) + continue; + + if (!cea_db_offsets(ext, &start, &end)) + continue; + + for (offset = start; + offset < end && offset + cea_db_len(&ext[offset]) < end; + offset += cea_db_len(&ext[offset]) + 1) + fn(&ext[offset], data); + } +} + +struct find_hdmi_block_data { + struct cea_data_block *hdmi; +}; + +static void find_hdmi_block(Uchar *db, void *data) +{ + struct find_hdmi_block_data *result = data; + int oui; + + if (cea_db_tag(db) != CEA_VENDOR_BLK) + return; + + if (cea_db_len(db) < 5) + return; + + oui = (db[3] << 16) | (db[2] << 8) | db[1]; + if (oui == IEEE_ID_HDMI) + result->hdmi = (struct cea_data_block *)db; +} + +struct cea_data_block *xf86MonitorFindHDMIBlock(xf86MonPtr mon) +{ + struct find_hdmi_block_data result = { NULL }; + + cea_for_each_db(mon, find_hdmi_block, &result); + + return result.hdmi; +} + xf86MonPtr xf86InterpretEEDID(int scrnIndex, Uchar * block) { @@ -666,49 +757,5 @@ validate_version(int scrnIndex, struct edid_version *r) Bool xf86MonitorIsHDMI(xf86MonPtr mon) { - int i = 0, version, offset; - char *edid = NULL; - - if (!mon) - return FALSE; - - if (!(mon->flags & EDID_COMPLETE_RAWDATA)) - return FALSE; - - if (!mon->no_sections) - return FALSE; - - edid = (char *) mon->rawData; - if (!edid) - return FALSE; - - /* find the CEA extension block */ - for (i = 1; i <= mon->no_sections; i++) - if (edid[i * 128] == 0x02) - break; - if (i == mon->no_sections + 1) - return FALSE; - edid += (i * 128); - - version = edid[1]; - offset = edid[2]; - if (version < 3 || offset < 4) - return FALSE; - - /* walk the cea data blocks */ - for (i = 4; i < offset; i += (edid[i] & 0x1f) + 1) { - char *x = edid + i; - - /* find a vendor specific block */ - if ((x[0] & 0xe0) >> 5 == 0x03) { - int oui = (x[3] << 16) + (x[2] << 8) + x[1]; - - /* find the HDMI vendor OUI */ - if (oui == 0x000c03) - return TRUE; - } - } - - /* guess it's not HDMI after all */ - return FALSE; + return xf86MonitorFindHDMIBlock(mon) != NULL; } diff --git a/xorg-server/hw/xfree86/ddc/xf86DDC.h b/xorg-server/hw/xfree86/ddc/xf86DDC.h index bdc7648a9..de8e71831 100644 --- a/xorg-server/hw/xfree86/ddc/xf86DDC.h +++ b/xorg-server/hw/xfree86/ddc/xf86DDC.h @@ -98,4 +98,6 @@ typedef void (*handle_video_fn) (struct cea_video_block *, void *); void xf86ForEachVideoBlock(xf86MonPtr, handle_video_fn, void *); +struct cea_data_block *xf86MonitorFindHDMIBlock(xf86MonPtr mon); + #endif diff --git a/xorg-server/hw/xfree86/dri/dri.c b/xorg-server/hw/xfree86/dri/dri.c index 38bfc1def..60339995d 100644 --- a/xorg-server/hw/xfree86/dri/dri.c +++ b/xorg-server/hw/xfree86/dri/dri.c @@ -460,14 +460,14 @@ DRIScreenInit(ScreenPtr pScreen, DRIInfoPtr pDRIInfo, int *pDRMFD) /* Add tags for reserved contexts */ if ((reserved = drmGetReservedContextList(pDRIPriv->drmFD, &reserved_count))) { - int i; + int r; void *tag; - for (i = 0; i < reserved_count; i++) { + for (r = 0; r < reserved_count; r++) { tag = DRICreateContextPrivFromHandle(pScreen, - reserved[i], + reserved[r], DRI_CONTEXT_RESERVED); - drmAddContextTag(pDRIPriv->drmFD, reserved[i], tag); + drmAddContextTag(pDRIPriv->drmFD, reserved[r], tag); } drmFreeReservedContextList(reserved); DRIDrvMsg(pScreen->myNum, X_INFO, @@ -684,9 +684,9 @@ DRICloseScreen(ScreenPtr pScreen) pDRIPriv->wrap.ClipNotify = NULL; } if (pDRIInfo->wrap.AdjustFrame) { - ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen); + ScrnInfoPtr scrn = xf86ScreenToScrn(pScreen); - pScrn->AdjustFrame = pDRIPriv->wrap.AdjustFrame; + scrn->AdjustFrame = pDRIPriv->wrap.AdjustFrame; pDRIPriv->wrap.AdjustFrame = NULL; } diff --git a/xorg-server/hw/xfree86/modes/xf86Crtc.c b/xorg-server/hw/xfree86/modes/xf86Crtc.c index b2eb72e8e..87ba0b74e 100644 --- a/xorg-server/hw/xfree86/modes/xf86Crtc.c +++ b/xorg-server/hw/xfree86/modes/xf86Crtc.c @@ -185,10 +185,10 @@ xf86CrtcSetScreenSubpixelOrder(ScreenPtr pScreen) Bool has_none = FALSE; ScrnInfoPtr scrn = xf86ScreenToScrn(pScreen); xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(scrn); - int c, o; + int icrtc, o; - for (c = 0; c < xf86_config->num_crtc; c++) { - xf86CrtcPtr crtc = xf86_config->crtc[c]; + for (icrtc = 0; icrtc < xf86_config->num_crtc; icrtc++) { + xf86CrtcPtr crtc = xf86_config->crtc[icrtc]; for (o = 0; o < xf86_config->num_output; o++) { xf86OutputPtr output = xf86_config->output[o]; @@ -216,20 +216,20 @@ xf86CrtcSetScreenSubpixelOrder(ScreenPtr pScreen) SubPixelVerticalBGR, }; int rotate; - int c; + int sc; for (rotate = 0; rotate < 4; rotate++) if (crtc->rotation & (1 << rotate)) break; - for (c = 0; c < 4; c++) - if (circle[c] == subpixel_order) + for (sc = 0; sc < 4; sc++) + if (circle[sc] == subpixel_order) break; - c = (c + rotate) & 0x3; - if ((crtc->rotation & RR_Reflect_X) && !(c & 1)) - c ^= 2; - if ((crtc->rotation & RR_Reflect_Y) && (c & 1)) - c ^= 2; - subpixel_order = circle[c]; + sc = (sc + rotate) & 0x3; + if ((crtc->rotation & RR_Reflect_X) && !(sc & 1)) + sc ^= 2; + if ((crtc->rotation & RR_Reflect_Y) && (sc & 1)) + sc ^= 2; + subpixel_order = circle[sc]; break; } } @@ -1673,6 +1673,7 @@ xf86ProbeOutputModes(ScrnInfoPtr scrn, int maxX, int maxY) if (edid_monitor) { struct det_monrec_parameter p; struct disp_features *features = &edid_monitor->features; + struct cea_data_block *hdmi_db; /* if display is not continuous-frequency, don't add default modes */ if (!GTF_SUPPORTED(features->msc)) @@ -1685,6 +1686,16 @@ xf86ProbeOutputModes(ScrnInfoPtr scrn, int maxX, int maxY) p.sync_source = &sync_source; xf86ForEachDetailedBlock(edid_monitor, handle_detailed_monrec, &p); + + /* Look at the CEA HDMI vendor block for the max TMDS freq */ + hdmi_db = xf86MonitorFindHDMIBlock(edid_monitor); + if (hdmi_db && hdmi_db->len >= 7) { + int tmds_freq = hdmi_db->u.vendor.hdmi.max_tmds_clock * 5000; + xf86DrvMsg(scrn->scrnIndex, X_PROBED, + "HDMI max TMDS frequency %dKHz\n", tmds_freq); + if (tmds_freq > max_clock) + max_clock = tmds_freq; + } } if (xf86GetOptValFreq(output->options, OPTION_MIN_CLOCK, @@ -2137,10 +2148,10 @@ xf86TargetPreferred(ScrnInfoPtr scrn, xf86CrtcConfigPtr config, } else { for (mode = output->probed_modes; mode; mode = mode->next) { - Rotation r = output->initial_rotation; + Rotation ir = output->initial_rotation; - if (xf86ModeWidth(mode, r) == pref_width && - xf86ModeHeight(mode, r) == pref_height) { + if (xf86ModeWidth(mode, ir) == pref_width && + xf86ModeHeight(mode, ir) == pref_height) { preferred[o] = mode; match = TRUE; } diff --git a/xorg-server/hw/xfree86/modes/xf86EdidModes.c b/xorg-server/hw/xfree86/modes/xf86EdidModes.c index 4ee862da0..a56f6ba23 100644 --- a/xorg-server/hw/xfree86/modes/xf86EdidModes.c +++ b/xorg-server/hw/xfree86/modes/xf86EdidModes.c @@ -973,11 +973,11 @@ handle_cea_svd(struct cea_video_block *video, void *data) } static DisplayModePtr -DDCModesFromCEAExtension(int scrnIndex, xf86MonPtr MonPtr) +DDCModesFromCEAExtension(int scrnIndex, xf86MonPtr mon_ptr) { DisplayModePtr Modes = NULL; - xf86ForEachVideoBlock(MonPtr, handle_cea_svd, &Modes); + xf86ForEachVideoBlock(mon_ptr, handle_cea_svd, &Modes); return Modes; } diff --git a/xorg-server/hw/xfree86/modes/xf86RandR12.c b/xorg-server/hw/xfree86/modes/xf86RandR12.c index f7a7d44d9..66139dcf0 100644 --- a/xorg-server/hw/xfree86/modes/xf86RandR12.c +++ b/xorg-server/hw/xfree86/modes/xf86RandR12.c @@ -1202,7 +1202,6 @@ xf86RandR12CrtcSet(ScreenPtr pScreen, if (randr_mode) { DisplayModeRec mode; - RRTransformPtr transform = RRCrtcGetTransform(randr_crtc); xf86RandRModeConvert(pScrn, randr_mode, &mode); if (!xf86CrtcSetModeTransform diff --git a/xorg-server/hw/xfree86/os-support/linux/lnx_init.c b/xorg-server/hw/xfree86/os-support/linux/lnx_init.c index e2e8d0826..46438e655 100644 --- a/xorg-server/hw/xfree86/os-support/linux/lnx_init.c +++ b/xorg-server/hw/xfree86/os-support/linux/lnx_init.c @@ -155,6 +155,7 @@ xf86OpenConsole(void) i = 0; while (vcs[i] != NULL) { +#pragma GCC diagnostic ignored "-Wformat-nonliteral" snprintf(vtname, sizeof(vtname), vcs[i], xf86Info.vtno); /* /dev/tty1-64 */ if ((xf86Info.consoleFd = open(vtname, O_RDWR | O_NDELAY, 0)) >= 0) break; diff --git a/xorg-server/hw/xfree86/parser/Configint.h b/xorg-server/hw/xfree86/parser/Configint.h index 62e514201..e85322006 100644 --- a/xorg-server/hw/xfree86/parser/Configint.h +++ b/xorg-server/hw/xfree86/parser/Configint.h @@ -79,6 +79,8 @@ typedef struct { ParserNumType numType; /* used to enforce correct number formatting */ } LexRec, *LexPtr; +extern LexRec xf86_lex_val; + #ifndef TRUE #define TRUE 1 #endif diff --git a/xorg-server/hw/xfree86/parser/DRI.c b/xorg-server/hw/xfree86/parser/DRI.c index e8d26255f..ad053f746 100644 --- a/xorg-server/hw/xfree86/parser/DRI.c +++ b/xorg-server/hw/xfree86/parser/DRI.c @@ -35,7 +35,6 @@ #include "xf86tokens.h" #include "Configint.h" -extern LexRec val; static xf86ConfigSymTabRec DRITab[] = { {ENDSECTION, "endsection"}, @@ -59,24 +58,24 @@ xf86parseDRISection(void) switch (token) { case GROUP: if ((token = xf86getSubToken(&(ptr->dri_comment))) == STRING) - ptr->dri_group_name = val.str; + ptr->dri_group_name = xf86_lex_val.str; else if (token == NUMBER) - ptr->dri_group = val.num; + ptr->dri_group = xf86_lex_val.num; else Error(GROUP_MSG); break; case MODE: if (xf86getSubToken(&(ptr->dri_comment)) != NUMBER) Error(NUMBER_MSG, "Mode"); - if (val.numType != PARSE_OCTAL) - Error(MUST_BE_OCTAL_MSG, val.num); - ptr->dri_mode = val.num; + if (xf86_lex_val.numType != PARSE_OCTAL) + Error(MUST_BE_OCTAL_MSG, xf86_lex_val.num); + ptr->dri_mode = xf86_lex_val.num; break; case EOF_TOKEN: Error(UNEXPECTED_EOF_MSG); break; case COMMENT: - ptr->dri_comment = xf86addComment(ptr->dri_comment, val.str); + ptr->dri_comment = xf86addComment(ptr->dri_comment, xf86_lex_val.str); break; default: Error(INVALID_KEYWORD_MSG, xf86tokenString()); diff --git a/xorg-server/hw/xfree86/parser/Device.c b/xorg-server/hw/xfree86/parser/Device.c index bb1ba88fb..073171f22 100644 --- a/xorg-server/hw/xfree86/parser/Device.c +++ b/xorg-server/hw/xfree86/parser/Device.c @@ -60,7 +60,6 @@ #include "xf86tokens.h" #include "Configint.h" -extern LexRec val; static xf86ConfigSymTabRec DeviceTab[] = { @@ -107,45 +106,45 @@ xf86parseDeviceSection(void) while ((token = xf86getToken(DeviceTab)) != ENDSECTION) { switch (token) { case COMMENT: - ptr->dev_comment = xf86addComment(ptr->dev_comment, val.str); + ptr->dev_comment = xf86addComment(ptr->dev_comment, xf86_lex_val.str); break; case IDENTIFIER: if (xf86getSubToken(&(ptr->dev_comment)) != STRING) Error(QUOTE_MSG, "Identifier"); if (has_ident == TRUE) Error(MULTIPLE_MSG, "Identifier"); - ptr->dev_identifier = val.str; + ptr->dev_identifier = xf86_lex_val.str; has_ident = TRUE; break; case VENDOR: if (xf86getSubToken(&(ptr->dev_comment)) != STRING) Error(QUOTE_MSG, "Vendor"); - ptr->dev_vendor = val.str; + ptr->dev_vendor = xf86_lex_val.str; break; case BOARD: if (xf86getSubToken(&(ptr->dev_comment)) != STRING) Error(QUOTE_MSG, "Board"); - ptr->dev_board = val.str; + ptr->dev_board = xf86_lex_val.str; break; case CHIPSET: if (xf86getSubToken(&(ptr->dev_comment)) != STRING) Error(QUOTE_MSG, "Chipset"); - ptr->dev_chipset = val.str; + ptr->dev_chipset = xf86_lex_val.str; break; case CARD: if (xf86getSubToken(&(ptr->dev_comment)) != STRING) Error(QUOTE_MSG, "Card"); - ptr->dev_card = val.str; + ptr->dev_card = xf86_lex_val.str; break; case DRIVER: if (xf86getSubToken(&(ptr->dev_comment)) != STRING) Error(QUOTE_MSG, "Driver"); - ptr->dev_driver = val.str; + ptr->dev_driver = xf86_lex_val.str; break; case RAMDAC: if (xf86getSubToken(&(ptr->dev_comment)) != STRING) Error(QUOTE_MSG, "Ramdac"); - ptr->dev_ramdac = val.str; + ptr->dev_ramdac = xf86_lex_val.str; break; case DACSPEED: for (i = 0; i < CONF_MAXDACSPEEDS; i++) @@ -154,11 +153,11 @@ xf86parseDeviceSection(void) Error(DACSPEED_MSG, CONF_MAXDACSPEEDS); } else { - ptr->dev_dacSpeeds[0] = (int) (val.realnum * 1000.0 + 0.5); + ptr->dev_dacSpeeds[0] = (int) (xf86_lex_val.realnum * 1000.0 + 0.5); for (i = 1; i < CONF_MAXDACSPEEDS; i++) { if (xf86getSubToken(&(ptr->dev_comment)) == NUMBER) ptr->dev_dacSpeeds[i] = (int) - (val.realnum * 1000.0 + 0.5); + (xf86_lex_val.realnum * 1000.0 + 0.5); else { xf86unGetToken(token); break; @@ -169,44 +168,44 @@ xf86parseDeviceSection(void) case VIDEORAM: if (xf86getSubToken(&(ptr->dev_comment)) != NUMBER) Error(NUMBER_MSG, "VideoRam"); - ptr->dev_videoram = val.num; + ptr->dev_videoram = xf86_lex_val.num; break; case BIOSBASE: if (xf86getSubToken(&(ptr->dev_comment)) != NUMBER) Error(NUMBER_MSG, "BIOSBase"); - ptr->dev_bios_base = val.num; + ptr->dev_bios_base = xf86_lex_val.num; break; case MEMBASE: if (xf86getSubToken(&(ptr->dev_comment)) != NUMBER) Error(NUMBER_MSG, "MemBase"); - ptr->dev_mem_base = val.num; + ptr->dev_mem_base = xf86_lex_val.num; break; case IOBASE: if (xf86getSubToken(&(ptr->dev_comment)) != NUMBER) Error(NUMBER_MSG, "IOBase"); - ptr->dev_io_base = val.num; + ptr->dev_io_base = xf86_lex_val.num; break; case CLOCKCHIP: if (xf86getSubToken(&(ptr->dev_comment)) != STRING) Error(QUOTE_MSG, "ClockChip"); - ptr->dev_clockchip = val.str; + ptr->dev_clockchip = xf86_lex_val.str; break; case CHIPID: if (xf86getSubToken(&(ptr->dev_comment)) != NUMBER) Error(NUMBER_MSG, "ChipID"); - ptr->dev_chipid = val.num; + ptr->dev_chipid = xf86_lex_val.num; break; case CHIPREV: if (xf86getSubToken(&(ptr->dev_comment)) != NUMBER) Error(NUMBER_MSG, "ChipRev"); - ptr->dev_chiprev = val.num; + ptr->dev_chiprev = xf86_lex_val.num; break; case CLOCKS: token = xf86getSubToken(&(ptr->dev_comment)); for (i = ptr->dev_clocks; token == NUMBER && i < CONF_MAXCLOCKS; i++) { - ptr->dev_clock[i] = (int) (val.realnum * 1000.0 + 0.5); + ptr->dev_clock[i] = (int) (xf86_lex_val.realnum * 1000.0 + 0.5); token = xf86getSubToken(&(ptr->dev_comment)); } ptr->dev_clocks = i; @@ -215,7 +214,7 @@ xf86parseDeviceSection(void) case TEXTCLOCKFRQ: if ((token = xf86getSubToken(&(ptr->dev_comment))) != NUMBER) Error(NUMBER_MSG, "TextClockFreq"); - ptr->dev_textclockfreq = (int) (val.realnum * 1000.0 + 0.5); + ptr->dev_textclockfreq = (int) (xf86_lex_val.realnum * 1000.0 + 0.5); break; case OPTION: ptr->dev_option_lst = xf86parseOption(ptr->dev_option_lst); @@ -223,17 +222,17 @@ xf86parseDeviceSection(void) case BUSID: if (xf86getSubToken(&(ptr->dev_comment)) != STRING) Error(QUOTE_MSG, "BusID"); - ptr->dev_busid = val.str; + ptr->dev_busid = xf86_lex_val.str; break; case IRQ: if (xf86getSubToken(&(ptr->dev_comment)) != NUMBER) Error(QUOTE_MSG, "IRQ"); - ptr->dev_irq = val.num; + ptr->dev_irq = xf86_lex_val.num; break; case SCREEN: if (xf86getSubToken(&(ptr->dev_comment)) != NUMBER) Error(NUMBER_MSG, "Screen"); - ptr->dev_screen = val.num; + ptr->dev_screen = xf86_lex_val.num; break; case EOF_TOKEN: Error(UNEXPECTED_EOF_MSG); diff --git a/xorg-server/hw/xfree86/parser/Extensions.c b/xorg-server/hw/xfree86/parser/Extensions.c index ec0bda4c0..b5ba72e5f 100644 --- a/xorg-server/hw/xfree86/parser/Extensions.c +++ b/xorg-server/hw/xfree86/parser/Extensions.c @@ -39,7 +39,6 @@ #include "xf86tokens.h" #include "Configint.h" -extern LexRec val; static xf86ConfigSymTabRec ExtensionsTab[] = { {ENDSECTION, "endsection"}, @@ -66,7 +65,7 @@ xf86parseExtensionsSection(void) break; case COMMENT: ptr->extensions_comment = - xf86addComment(ptr->extensions_comment, val.str); + xf86addComment(ptr->extensions_comment, xf86_lex_val.str); break; default: Error(INVALID_KEYWORD_MSG, xf86tokenString()); diff --git a/xorg-server/hw/xfree86/parser/Files.c b/xorg-server/hw/xfree86/parser/Files.c index a6e18dd2c..24940a9c2 100644 --- a/xorg-server/hw/xfree86/parser/Files.c +++ b/xorg-server/hw/xfree86/parser/Files.c @@ -60,7 +60,6 @@ #include "xf86tokens.h" #include "Configint.h" -extern LexRec val; static xf86ConfigSymTabRec FilesTab[] = { {ENDSECTION, "endsection"}, @@ -89,13 +88,13 @@ xf86parseFilesSection(void) while ((token = xf86getToken(FilesTab)) != ENDSECTION) { switch (token) { case COMMENT: - ptr->file_comment = xf86addComment(ptr->file_comment, val.str); + ptr->file_comment = xf86addComment(ptr->file_comment, xf86_lex_val.str); break; case FONTPATH: if (xf86getSubToken(&(ptr->file_comment)) != STRING) Error(QUOTE_MSG, "FontPath"); j = FALSE; - str = val.str; + str = xf86_lex_val.str; if (ptr->file_fontpath == NULL) { ptr->file_fontpath = calloc(1, 1); i = strlen(str) + 1; @@ -112,13 +111,13 @@ xf86parseFilesSection(void) strcat(ptr->file_fontpath, ","); strcat(ptr->file_fontpath, str); - free(val.str); + free(xf86_lex_val.str); break; case MODULEPATH: if (xf86getSubToken(&(ptr->file_comment)) != STRING) Error(QUOTE_MSG, "ModulePath"); l = FALSE; - str = val.str; + str = xf86_lex_val.str; if (ptr->file_modulepath == NULL) { ptr->file_modulepath = malloc(1); ptr->file_modulepath[0] = '\0'; @@ -137,17 +136,17 @@ xf86parseFilesSection(void) strcat(ptr->file_modulepath, ","); strcat(ptr->file_modulepath, str); - free(val.str); + free(xf86_lex_val.str); break; case LOGFILEPATH: if (xf86getSubToken(&(ptr->file_comment)) != STRING) Error(QUOTE_MSG, "LogFile"); - ptr->file_logfile = val.str; + ptr->file_logfile = xf86_lex_val.str; break; case XKBDIR: if (xf86getSubToken(&(ptr->file_xkbdir)) != STRING) Error(QUOTE_MSG, "XkbDir"); - ptr->file_xkbdir = val.str; + ptr->file_xkbdir = xf86_lex_val.str; break; case EOF_TOKEN: Error(UNEXPECTED_EOF_MSG); diff --git a/xorg-server/hw/xfree86/parser/Flags.c b/xorg-server/hw/xfree86/parser/Flags.c index 326c6b77d..71b50acf7 100644 --- a/xorg-server/hw/xfree86/parser/Flags.c +++ b/xorg-server/hw/xfree86/parser/Flags.c @@ -62,7 +62,6 @@ #include "Xprintf.h" #include "optionstr.h" -extern LexRec val; static xf86ConfigSymTabRec ServerFlagsTab[] = { {ENDSECTION, "endsection"}, @@ -99,7 +98,7 @@ xf86parseFlagsSection(void) switch (token) { case COMMENT: - ptr->flg_comment = xf86addComment(ptr->flg_comment, val.str); + ptr->flg_comment = xf86addComment(ptr->flg_comment, xf86_lex_val.str); break; /* * these old keywords are turned into standard generic options. @@ -135,12 +134,12 @@ xf86parseFlagsSection(void) if (strvalue) { if (tokentype != STRING) Error(QUOTE_MSG, tmp); - valstr = val.str; + valstr = xf86_lex_val.str; } else { if (tokentype != NUMBER) Error(NUMBER_MSG, tmp); - if (asprintf(&valstr, "%d", val.num) == -1) + if (asprintf(&valstr, "%d", xf86_lex_val.num) == -1) valstr = NULL; } } @@ -435,12 +434,12 @@ xf86parseOption(XF86OptionPtr head) return head; } - name = val.str; + name = xf86_lex_val.str; if ((token = xf86getSubToken(&comment)) == STRING) { - option = xf86newOption(name, val.str); + option = xf86newOption(name, xf86_lex_val.str); option->opt_comment = comment; if ((token = xf86getToken(NULL)) == COMMENT) - option->opt_comment = xf86addComment(option->opt_comment, val.str); + option->opt_comment = xf86addComment(option->opt_comment, xf86_lex_val.str); else xf86unGetToken(token); } @@ -448,7 +447,7 @@ xf86parseOption(XF86OptionPtr head) option = xf86newOption(name, NULL); option->opt_comment = comment; if (token == COMMENT) - option->opt_comment = xf86addComment(option->opt_comment, val.str); + option->opt_comment = xf86addComment(option->opt_comment, xf86_lex_val.str); else xf86unGetToken(token); } diff --git a/xorg-server/hw/xfree86/parser/Input.c b/xorg-server/hw/xfree86/parser/Input.c index ff2b9acbc..1bfe5c100 100644 --- a/xorg-server/hw/xfree86/parser/Input.c +++ b/xorg-server/hw/xfree86/parser/Input.c @@ -61,7 +61,6 @@ #include "xf86tokens.h" #include "Configint.h" -extern LexRec val; static xf86ConfigSymTabRec InputTab[] = { @@ -85,25 +84,25 @@ xf86parseInputSection(void) while ((token = xf86getToken(InputTab)) != ENDSECTION) { switch (token) { case COMMENT: - ptr->inp_comment = xf86addComment(ptr->inp_comment, val.str); + ptr->inp_comment = xf86addComment(ptr->inp_comment, xf86_lex_val.str); break; case IDENTIFIER: if (xf86getSubToken(&(ptr->inp_comment)) != STRING) Error(QUOTE_MSG, "Identifier"); if (has_ident == TRUE) Error(MULTIPLE_MSG, "Identifier"); - ptr->inp_identifier = val.str; + ptr->inp_identifier = xf86_lex_val.str; has_ident = TRUE; break; case DRIVER: if (xf86getSubToken(&(ptr->inp_comment)) != STRING) Error(QUOTE_MSG, "Driver"); - if (strcmp(val.str, "keyboard") == 0) { + if (strcmp(xf86_lex_val.str, "keyboard") == 0) { ptr->inp_driver = strdup("kbd"); - free(val.str); + free(xf86_lex_val.str); } else - ptr->inp_driver = val.str; + ptr->inp_driver = xf86_lex_val.str; break; case OPTION: ptr->inp_option_lst = xf86parseOption(ptr->inp_option_lst); diff --git a/xorg-server/hw/xfree86/parser/InputClass.c b/xorg-server/hw/xfree86/parser/InputClass.c index a7f573e70..24a124691 100644 --- a/xorg-server/hw/xfree86/parser/InputClass.c +++ b/xorg-server/hw/xfree86/parser/InputClass.c @@ -33,7 +33,6 @@ #include "xf86tokens.h" #include "Configint.h" -extern LexRec val; static xf86ConfigSymTabRec InputClassTab[] = { @@ -97,25 +96,25 @@ xf86parseInputClassSection(void) while ((token = xf86getToken(InputClassTab)) != ENDSECTION) { switch (token) { case COMMENT: - ptr->comment = xf86addComment(ptr->comment, val.str); + ptr->comment = xf86addComment(ptr->comment, xf86_lex_val.str); break; case IDENTIFIER: if (xf86getSubToken(&(ptr->comment)) != STRING) Error(QUOTE_MSG, "Identifier"); if (has_ident == TRUE) Error(MULTIPLE_MSG, "Identifier"); - ptr->identifier = val.str; + ptr->identifier = xf86_lex_val.str; has_ident = TRUE; break; case DRIVER: if (xf86getSubToken(&(ptr->comment)) != STRING) Error(QUOTE_MSG, "Driver"); - if (strcmp(val.str, "keyboard") == 0) { + if (strcmp(xf86_lex_val.str, "keyboard") == 0) { ptr->driver = strdup("kbd"); - free(val.str); + free(xf86_lex_val.str); } else - ptr->driver = val.str; + ptr->driver = xf86_lex_val.str; break; case OPTION: ptr->option_lst = xf86parseOption(ptr->option_lst); @@ -124,69 +123,69 @@ xf86parseInputClassSection(void) if (xf86getSubToken(&(ptr->comment)) != STRING) Error(QUOTE_MSG, "MatchProduct"); add_group_entry(&ptr->match_product, - xstrtokenize(val.str, TOKEN_SEP)); - free(val.str); + xstrtokenize(xf86_lex_val.str, TOKEN_SEP)); + free(xf86_lex_val.str); break; case MATCH_VENDOR: if (xf86getSubToken(&(ptr->comment)) != STRING) Error(QUOTE_MSG, "MatchVendor"); add_group_entry(&ptr->match_vendor, - xstrtokenize(val.str, TOKEN_SEP)); - free(val.str); + xstrtokenize(xf86_lex_val.str, TOKEN_SEP)); + free(xf86_lex_val.str); break; case MATCH_DEVICE_PATH: if (xf86getSubToken(&(ptr->comment)) != STRING) Error(QUOTE_MSG, "MatchDevicePath"); add_group_entry(&ptr->match_device, - xstrtokenize(val.str, TOKEN_SEP)); - free(val.str); + xstrtokenize(xf86_lex_val.str, TOKEN_SEP)); + free(xf86_lex_val.str); break; case MATCH_OS: if (xf86getSubToken(&(ptr->comment)) != STRING) Error(QUOTE_MSG, "MatchOS"); - add_group_entry(&ptr->match_os, xstrtokenize(val.str, TOKEN_SEP)); - free(val.str); + add_group_entry(&ptr->match_os, xstrtokenize(xf86_lex_val.str, TOKEN_SEP)); + free(xf86_lex_val.str); break; case MATCH_PNPID: if (xf86getSubToken(&(ptr->comment)) != STRING) Error(QUOTE_MSG, "MatchPnPID"); add_group_entry(&ptr->match_pnpid, - xstrtokenize(val.str, TOKEN_SEP)); - free(val.str); + xstrtokenize(xf86_lex_val.str, TOKEN_SEP)); + free(xf86_lex_val.str); break; case MATCH_USBID: if (xf86getSubToken(&(ptr->comment)) != STRING) Error(QUOTE_MSG, "MatchUSBID"); add_group_entry(&ptr->match_usbid, - xstrtokenize(val.str, TOKEN_SEP)); - free(val.str); + xstrtokenize(xf86_lex_val.str, TOKEN_SEP)); + free(xf86_lex_val.str); break; case MATCH_DRIVER: if (xf86getSubToken(&(ptr->comment)) != STRING) Error(QUOTE_MSG, "MatchDriver"); add_group_entry(&ptr->match_driver, - xstrtokenize(val.str, TOKEN_SEP)); - free(val.str); + xstrtokenize(xf86_lex_val.str, TOKEN_SEP)); + free(xf86_lex_val.str); break; case MATCH_TAG: if (xf86getSubToken(&(ptr->comment)) != STRING) Error(QUOTE_MSG, "MatchTag"); - add_group_entry(&ptr->match_tag, xstrtokenize(val.str, TOKEN_SEP)); - free(val.str); + add_group_entry(&ptr->match_tag, xstrtokenize(xf86_lex_val.str, TOKEN_SEP)); + free(xf86_lex_val.str); break; case MATCH_LAYOUT: if (xf86getSubToken(&(ptr->comment)) != STRING) Error(QUOTE_MSG, "MatchLayout"); add_group_entry(&ptr->match_layout, - xstrtokenize(val.str, TOKEN_SEP)); - free(val.str); + xstrtokenize(xf86_lex_val.str, TOKEN_SEP)); + free(xf86_lex_val.str); break; case MATCH_IS_KEYBOARD: if (xf86getSubToken(&(ptr->comment)) != STRING) Error(QUOTE_MSG, "MatchIsKeyboard"); ptr->is_keyboard.set = xf86getBoolValue(&ptr->is_keyboard.val, - val.str); - free(val.str); + xf86_lex_val.str); + free(xf86_lex_val.str); if (!ptr->is_keyboard.set) Error(BOOL_MSG, "MatchIsKeyboard"); break; @@ -194,8 +193,8 @@ xf86parseInputClassSection(void) if (xf86getSubToken(&(ptr->comment)) != STRING) Error(QUOTE_MSG, "MatchIsPointer"); ptr->is_pointer.set = xf86getBoolValue(&ptr->is_pointer.val, - val.str); - free(val.str); + xf86_lex_val.str); + free(xf86_lex_val.str); if (!ptr->is_pointer.set) Error(BOOL_MSG, "MatchIsPointer"); break; @@ -203,16 +202,16 @@ xf86parseInputClassSection(void) if (xf86getSubToken(&(ptr->comment)) != STRING) Error(QUOTE_MSG, "MatchIsJoystick"); ptr->is_joystick.set = xf86getBoolValue(&ptr->is_joystick.val, - val.str); - free(val.str); + xf86_lex_val.str); + free(xf86_lex_val.str); if (!ptr->is_joystick.set) Error(BOOL_MSG, "MatchIsJoystick"); break; case MATCH_IS_TABLET: if (xf86getSubToken(&(ptr->comment)) != STRING) Error(QUOTE_MSG, "MatchIsTablet"); - ptr->is_tablet.set = xf86getBoolValue(&ptr->is_tablet.val, val.str); - free(val.str); + ptr->is_tablet.set = xf86getBoolValue(&ptr->is_tablet.val, xf86_lex_val.str); + free(xf86_lex_val.str); if (!ptr->is_tablet.set) Error(BOOL_MSG, "MatchIsTablet"); break; @@ -220,8 +219,8 @@ xf86parseInputClassSection(void) if (xf86getSubToken(&(ptr->comment)) != STRING) Error(QUOTE_MSG, "MatchIsTouchpad"); ptr->is_touchpad.set = xf86getBoolValue(&ptr->is_touchpad.val, - val.str); - free(val.str); + xf86_lex_val.str); + free(xf86_lex_val.str); if (!ptr->is_touchpad.set) Error(BOOL_MSG, "MatchIsTouchpad"); break; @@ -229,8 +228,8 @@ xf86parseInputClassSection(void) if (xf86getSubToken(&(ptr->comment)) != STRING) Error(QUOTE_MSG, "MatchIsTouchscreen"); ptr->is_touchscreen.set = xf86getBoolValue(&ptr->is_touchscreen.val, - val.str); - free(val.str); + xf86_lex_val.str); + free(xf86_lex_val.str); if (!ptr->is_touchscreen.set) Error(BOOL_MSG, "MatchIsTouchscreen"); break; diff --git a/xorg-server/hw/xfree86/parser/Layout.c b/xorg-server/hw/xfree86/parser/Layout.c index cbd8d247a..7be746f04 100644 --- a/xorg-server/hw/xfree86/parser/Layout.c +++ b/xorg-server/hw/xfree86/parser/Layout.c @@ -65,7 +65,6 @@ /* Needed for auto server layout */ extern int xf86CheckBoolOption(void *optlist, const char *name, int deflt); -extern LexRec val; static xf86ConfigSymTabRec LayoutTab[] = { {ENDSECTION, "endsection"}, @@ -100,14 +99,14 @@ xf86parseLayoutSection(void) while ((token = xf86getToken(LayoutTab)) != ENDSECTION) { switch (token) { case COMMENT: - ptr->lay_comment = xf86addComment(ptr->lay_comment, val.str); + ptr->lay_comment = xf86addComment(ptr->lay_comment, xf86_lex_val.str); break; case IDENTIFIER: if (xf86getSubToken(&(ptr->lay_comment)) != STRING) Error(QUOTE_MSG, "Identifier"); if (has_ident == TRUE) Error(MULTIPLE_MSG, "Identifier"); - ptr->lay_identifier = val.str; + ptr->lay_identifier = xf86_lex_val.str; has_ident = TRUE; break; case INACTIVE: @@ -120,7 +119,7 @@ xf86parseLayoutSection(void) free(iptr); Error(INACTIVE_MSG); } - iptr->inactive_device_str = val.str; + iptr->inactive_device_str = xf86_lex_val.str; ptr->lay_inactive_lst = (XF86ConfInactivePtr) xf86addListItem((glp) ptr->lay_inactive_lst, (glp) iptr); } @@ -138,7 +137,7 @@ xf86parseLayoutSection(void) aptr->adj_y = 0; aptr->adj_refscreen = NULL; if ((token = xf86getSubToken(&(ptr->lay_comment))) == NUMBER) - aptr->adj_scrnum = val.num; + aptr->adj_scrnum = xf86_lex_val.num; else xf86unGetToken(token); token = xf86getSubToken(&(ptr->lay_comment)); @@ -146,7 +145,7 @@ xf86parseLayoutSection(void) free(aptr); Error(SCREEN_MSG); } - aptr->adj_screen_str = val.str; + aptr->adj_screen_str = xf86_lex_val.str; token = xf86getSubTokenWithTab(&(ptr->lay_comment), AdjTab); switch (token) { @@ -186,13 +185,13 @@ xf86parseLayoutSection(void) if (absKeyword) token = xf86getSubToken(&(ptr->lay_comment)); if (token == NUMBER) { - aptr->adj_x = val.num; + aptr->adj_x = xf86_lex_val.num; token = xf86getSubToken(&(ptr->lay_comment)); if (token != NUMBER) { free(aptr); Error(INVALID_SCR_MSG); } - aptr->adj_y = val.num; + aptr->adj_y = xf86_lex_val.num; } else { if (absKeyword) { @@ -213,46 +212,46 @@ xf86parseLayoutSection(void) free(aptr); Error(INVALID_SCR_MSG); } - aptr->adj_refscreen = val.str; + aptr->adj_refscreen = xf86_lex_val.str; if (aptr->adj_where == CONF_ADJ_RELATIVE) { token = xf86getSubToken(&(ptr->lay_comment)); if (token != NUMBER) { free(aptr); Error(INVALID_SCR_MSG); } - aptr->adj_x = val.num; + aptr->adj_x = xf86_lex_val.num; token = xf86getSubToken(&(ptr->lay_comment)); if (token != NUMBER) { free(aptr); Error(INVALID_SCR_MSG); } - aptr->adj_y = val.num; + aptr->adj_y = xf86_lex_val.num; } break; case CONF_ADJ_OBSOLETE: /* top */ - aptr->adj_top_str = val.str; + aptr->adj_top_str = xf86_lex_val.str; /* bottom */ if (xf86getSubToken(&(ptr->lay_comment)) != STRING) { free(aptr); Error(SCREEN_MSG); } - aptr->adj_bottom_str = val.str; + aptr->adj_bottom_str = xf86_lex_val.str; /* left */ if (xf86getSubToken(&(ptr->lay_comment)) != STRING) { free(aptr); Error(SCREEN_MSG); } - aptr->adj_left_str = val.str; + aptr->adj_left_str = xf86_lex_val.str; /* right */ if (xf86getSubToken(&(ptr->lay_comment)) != STRING) { free(aptr); Error(SCREEN_MSG); } - aptr->adj_right_str = val.str; + aptr->adj_right_str = xf86_lex_val.str; } ptr->lay_adjacency_lst = (XF86ConfAdjacencyPtr) @@ -270,10 +269,10 @@ xf86parseLayoutSection(void) free(iptr); Error(INPUTDEV_MSG); } - iptr->iref_inputdev_str = val.str; + iptr->iref_inputdev_str = xf86_lex_val.str; while ((token = xf86getSubToken(&(ptr->lay_comment))) == STRING) { iptr->iref_option_lst = - xf86addNewOption(iptr->iref_option_lst, val.str, NULL); + xf86addNewOption(iptr->iref_option_lst, xf86_lex_val.str, NULL); } xf86unGetToken(token); ptr->lay_input_lst = (XF86ConfInputrefPtr) diff --git a/xorg-server/hw/xfree86/parser/Module.c b/xorg-server/hw/xfree86/parser/Module.c index 243ba9195..e2d9120cb 100644 --- a/xorg-server/hw/xfree86/parser/Module.c +++ b/xorg-server/hw/xfree86/parser/Module.c @@ -60,7 +60,6 @@ #include "xf86tokens.h" #include "Configint.h" -extern LexRec val; static xf86ConfigSymTabRec SubModuleTab[] = { {ENDSUBSECTION, "endsubsection"}, @@ -95,7 +94,7 @@ xf86parseModuleSubSection(XF86LoadPtr head, char *name) while ((token = xf86getToken(SubModuleTab)) != ENDSUBSECTION) { switch (token) { case COMMENT: - ptr->load_comment = xf86addComment(ptr->load_comment, val.str); + ptr->load_comment = xf86addComment(ptr->load_comment, xf86_lex_val.str); break; case OPTION: ptr->load_opt = xf86parseOption(ptr->load_opt); @@ -126,34 +125,34 @@ xf86parseModuleSection(void) while ((token = xf86getToken(ModuleTab)) != ENDSECTION) { switch (token) { case COMMENT: - ptr->mod_comment = xf86addComment(ptr->mod_comment, val.str); + ptr->mod_comment = xf86addComment(ptr->mod_comment, xf86_lex_val.str); break; case LOAD: if (xf86getSubToken(&(ptr->mod_comment)) != STRING) Error(QUOTE_MSG, "Load"); ptr->mod_load_lst = - xf86addNewLoadDirective(ptr->mod_load_lst, val.str, + xf86addNewLoadDirective(ptr->mod_load_lst, xf86_lex_val.str, XF86_LOAD_MODULE, NULL); break; case DISABLE: if (xf86getSubToken(&(ptr->mod_comment)) != STRING) Error(QUOTE_MSG, "Disable"); ptr->mod_disable_lst = - xf86addNewLoadDirective(ptr->mod_disable_lst, val.str, + xf86addNewLoadDirective(ptr->mod_disable_lst, xf86_lex_val.str, XF86_DISABLE_MODULE, NULL); break; case LOAD_DRIVER: if (xf86getSubToken(&(ptr->mod_comment)) != STRING) Error(QUOTE_MSG, "LoadDriver"); ptr->mod_load_lst = - xf86addNewLoadDirective(ptr->mod_load_lst, val.str, + xf86addNewLoadDirective(ptr->mod_load_lst, xf86_lex_val.str, XF86_LOAD_DRIVER, NULL); break; case SUBSECTION: if (xf86getSubToken(&(ptr->mod_comment)) != STRING) Error(QUOTE_MSG, "SubSection"); ptr->mod_load_lst = - xf86parseModuleSubSection(ptr->mod_load_lst, val.str); + xf86parseModuleSubSection(ptr->mod_load_lst, xf86_lex_val.str); break; case EOF_TOKEN: Error(UNEXPECTED_EOF_MSG); @@ -232,7 +231,7 @@ xf86addNewLoadDirective(XF86LoadPtr head, const char *name, int type, new->list.next = NULL; if ((token = xf86getToken(NULL)) == COMMENT) - new->load_comment = xf86addComment(new->load_comment, val.str); + new->load_comment = xf86addComment(new->load_comment, xf86_lex_val.str); else xf86unGetToken(token); diff --git a/xorg-server/hw/xfree86/parser/Monitor.c b/xorg-server/hw/xfree86/parser/Monitor.c index 36b4ebe35..8aebce079 100644 --- a/xorg-server/hw/xfree86/parser/Monitor.c +++ b/xorg-server/hw/xfree86/parser/Monitor.c @@ -60,7 +60,6 @@ #include "xf86tokens.h" #include "Configint.h" -extern LexRec val; static xf86ConfigSymTabRec MonitorTab[] = { {ENDSECTION, "endsection"}, @@ -140,52 +139,52 @@ xf86parseModeLine(void) /* Identifier */ if (xf86getSubToken(&(ptr->ml_comment)) != STRING) Error("ModeLine identifier expected"); - ptr->ml_identifier = val.str; + ptr->ml_identifier = xf86_lex_val.str; /* DotClock */ if (xf86getSubToken(&(ptr->ml_comment)) != NUMBER) Error("ModeLine dotclock expected"); - ptr->ml_clock = (int) (val.realnum * 1000.0 + 0.5); + ptr->ml_clock = (int) (xf86_lex_val.realnum * 1000.0 + 0.5); /* HDisplay */ if (xf86getSubToken(&(ptr->ml_comment)) != NUMBER) Error("ModeLine Hdisplay expected"); - ptr->ml_hdisplay = val.num; + ptr->ml_hdisplay = xf86_lex_val.num; /* HSyncStart */ if (xf86getSubToken(&(ptr->ml_comment)) != NUMBER) Error("ModeLine HSyncStart expected"); - ptr->ml_hsyncstart = val.num; + ptr->ml_hsyncstart = xf86_lex_val.num; /* HSyncEnd */ if (xf86getSubToken(&(ptr->ml_comment)) != NUMBER) Error("ModeLine HSyncEnd expected"); - ptr->ml_hsyncend = val.num; + ptr->ml_hsyncend = xf86_lex_val.num; /* HTotal */ if (xf86getSubToken(&(ptr->ml_comment)) != NUMBER) Error("ModeLine HTotal expected"); - ptr->ml_htotal = val.num; + ptr->ml_htotal = xf86_lex_val.num; /* VDisplay */ if (xf86getSubToken(&(ptr->ml_comment)) != NUMBER) Error("ModeLine Vdisplay expected"); - ptr->ml_vdisplay = val.num; + ptr->ml_vdisplay = xf86_lex_val.num; /* VSyncStart */ if (xf86getSubToken(&(ptr->ml_comment)) != NUMBER) Error("ModeLine VSyncStart expected"); - ptr->ml_vsyncstart = val.num; + ptr->ml_vsyncstart = xf86_lex_val.num; /* VSyncEnd */ if (xf86getSubToken(&(ptr->ml_comment)) != NUMBER) Error("ModeLine VSyncEnd expected"); - ptr->ml_vsyncend = val.num; + ptr->ml_vsyncend = xf86_lex_val.num; /* VTotal */ if (xf86getSubToken(&(ptr->ml_comment)) != NUMBER) Error("ModeLine VTotal expected"); - ptr->ml_vtotal = val.num; + ptr->ml_vtotal = xf86_lex_val.num; token = xf86getSubTokenWithTab(&(ptr->ml_comment), TimingTab); while ((token == TT_INTERLACE) || (token == TT_PHSYNC) || @@ -226,7 +225,7 @@ xf86parseModeLine(void) case TT_HSKEW: if (xf86getSubToken(&(ptr->ml_comment)) != NUMBER) Error(NUMBER_MSG, "Hskew"); - ptr->ml_hskew = val.num; + ptr->ml_hskew = xf86_lex_val.num; ptr->ml_flags |= XF86CONF_HSKEW; break; case TT_BCAST: @@ -235,7 +234,7 @@ xf86parseModeLine(void) case TT_VSCAN: if (xf86getSubToken(&(ptr->ml_comment)) != NUMBER) Error(NUMBER_MSG, "Vscan"); - ptr->ml_vscan = val.num; + ptr->ml_vscan = xf86_lex_val.num; ptr->ml_flags |= XF86CONF_VSCAN; break; case EOF_TOKEN: @@ -265,58 +264,58 @@ xf86parseVerboseMode(void) if (xf86getSubToken(&(ptr->ml_comment)) != STRING) Error("Mode name expected"); - ptr->ml_identifier = val.str; + ptr->ml_identifier = xf86_lex_val.str; while ((token = xf86getToken(ModeTab)) != ENDMODE) { switch (token) { case COMMENT: - ptr->ml_comment = xf86addComment(ptr->ml_comment, val.str); + ptr->ml_comment = xf86addComment(ptr->ml_comment, xf86_lex_val.str); break; case DOTCLOCK: if ((token = xf86getSubToken(&(ptr->ml_comment))) != NUMBER) Error(NUMBER_MSG, "DotClock"); - ptr->ml_clock = (int) (val.realnum * 1000.0 + 0.5); + ptr->ml_clock = (int) (xf86_lex_val.realnum * 1000.0 + 0.5); had_dotclock = 1; break; case HTIMINGS: if (xf86getSubToken(&(ptr->ml_comment)) == NUMBER) - ptr->ml_hdisplay = val.num; + ptr->ml_hdisplay = xf86_lex_val.num; else Error("Horizontal display expected"); if (xf86getSubToken(&(ptr->ml_comment)) == NUMBER) - ptr->ml_hsyncstart = val.num; + ptr->ml_hsyncstart = xf86_lex_val.num; else Error("Horizontal sync start expected"); if (xf86getSubToken(&(ptr->ml_comment)) == NUMBER) - ptr->ml_hsyncend = val.num; + ptr->ml_hsyncend = xf86_lex_val.num; else Error("Horizontal sync end expected"); if (xf86getSubToken(&(ptr->ml_comment)) == NUMBER) - ptr->ml_htotal = val.num; + ptr->ml_htotal = xf86_lex_val.num; else Error("Horizontal total expected"); had_htimings = 1; break; case VTIMINGS: if (xf86getSubToken(&(ptr->ml_comment)) == NUMBER) - ptr->ml_vdisplay = val.num; + ptr->ml_vdisplay = xf86_lex_val.num; else Error("Vertical display expected"); if (xf86getSubToken(&(ptr->ml_comment)) == NUMBER) - ptr->ml_vsyncstart = val.num; + ptr->ml_vsyncstart = xf86_lex_val.num; else Error("Vertical sync start expected"); if (xf86getSubToken(&(ptr->ml_comment)) == NUMBER) - ptr->ml_vsyncend = val.num; + ptr->ml_vsyncend = xf86_lex_val.num; else Error("Vertical sync end expected"); if (xf86getSubToken(&(ptr->ml_comment)) == NUMBER) - ptr->ml_vtotal = val.num; + ptr->ml_vtotal = xf86_lex_val.num; else Error("Vertical total expected"); had_vtimings = 1; @@ -370,13 +369,13 @@ xf86parseVerboseMode(void) if (xf86getSubToken(&(ptr->ml_comment)) != NUMBER) Error("Horizontal skew expected"); ptr->ml_flags |= XF86CONF_HSKEW; - ptr->ml_hskew = val.num; + ptr->ml_hskew = xf86_lex_val.num; break; case VSCAN: if (xf86getSubToken(&(ptr->ml_comment)) != NUMBER) Error("Vertical scan count expected"); ptr->ml_flags |= XF86CONF_VSCAN; - ptr->ml_vscan = val.num; + ptr->ml_vscan = xf86_lex_val.num; break; case EOF_TOKEN: Error(UNEXPECTED_EOF_MSG); @@ -413,25 +412,25 @@ xf86parseMonitorSection(void) while ((token = xf86getToken(MonitorTab)) != ENDSECTION) { switch (token) { case COMMENT: - ptr->mon_comment = xf86addComment(ptr->mon_comment, val.str); + ptr->mon_comment = xf86addComment(ptr->mon_comment, xf86_lex_val.str); break; case IDENTIFIER: if (xf86getSubToken(&(ptr->mon_comment)) != STRING) Error(QUOTE_MSG, "Identifier"); if (has_ident == TRUE) Error(MULTIPLE_MSG, "Identifier"); - ptr->mon_identifier = val.str; + ptr->mon_identifier = xf86_lex_val.str; has_ident = TRUE; break; case VENDOR: if (xf86getSubToken(&(ptr->mon_comment)) != STRING) Error(QUOTE_MSG, "Vendor"); - ptr->mon_vendor = val.str; + ptr->mon_vendor = xf86_lex_val.str; break; case MODEL: if (xf86getSubToken(&(ptr->mon_comment)) != STRING) Error(QUOTE_MSG, "ModelName"); - ptr->mon_modelname = val.str; + ptr->mon_modelname = xf86_lex_val.str; break; case MODE: HANDLE_LIST(mon_modeline_lst, xf86parseVerboseMode, @@ -444,10 +443,10 @@ xf86parseMonitorSection(void) case DISPLAYSIZE: if (xf86getSubToken(&(ptr->mon_comment)) != NUMBER) Error(DISPLAYSIZE_MSG); - ptr->mon_width = val.realnum; + ptr->mon_width = xf86_lex_val.realnum; if (xf86getSubToken(&(ptr->mon_comment)) != NUMBER) Error(DISPLAYSIZE_MSG); - ptr->mon_height = val.realnum; + ptr->mon_height = xf86_lex_val.realnum; break; case HORIZSYNC: @@ -456,7 +455,7 @@ xf86parseMonitorSection(void) do { if (ptr->mon_n_hsync >= CONF_MAX_HSYNC) Error("Sorry. Too many horizontal sync intervals."); - ptr->mon_hsync[ptr->mon_n_hsync].lo = val.realnum; + ptr->mon_hsync[ptr->mon_n_hsync].lo = xf86_lex_val.realnum; switch (token = xf86getSubToken(&(ptr->mon_comment))) { case COMMA: ptr->mon_hsync[ptr->mon_n_hsync].hi = @@ -464,10 +463,10 @@ xf86parseMonitorSection(void) break; case DASH: if (xf86getSubToken(&(ptr->mon_comment)) != NUMBER || - (float) val.realnum < + (float) xf86_lex_val.realnum < ptr->mon_hsync[ptr->mon_n_hsync].lo) Error(HORIZSYNC_MSG); - ptr->mon_hsync[ptr->mon_n_hsync].hi = val.realnum; + ptr->mon_hsync[ptr->mon_n_hsync].hi = xf86_lex_val.realnum; if ((token = xf86getSubToken(&(ptr->mon_comment))) == COMMA) break; ptr->mon_n_hsync++; @@ -491,7 +490,7 @@ xf86parseMonitorSection(void) if (xf86getSubToken(&(ptr->mon_comment)) != NUMBER) Error(VERTREFRESH_MSG); do { - ptr->mon_vrefresh[ptr->mon_n_vrefresh].lo = val.realnum; + ptr->mon_vrefresh[ptr->mon_n_vrefresh].lo = xf86_lex_val.realnum; switch (token = xf86getSubToken(&(ptr->mon_comment))) { case COMMA: ptr->mon_vrefresh[ptr->mon_n_vrefresh].hi = @@ -499,10 +498,10 @@ xf86parseMonitorSection(void) break; case DASH: if (xf86getSubToken(&(ptr->mon_comment)) != NUMBER || - (float) val.realnum < + (float) xf86_lex_val.realnum < ptr->mon_vrefresh[ptr->mon_n_vrefresh].lo) Error(VERTREFRESH_MSG); - ptr->mon_vrefresh[ptr->mon_n_vrefresh].hi = val.realnum; + ptr->mon_vrefresh[ptr->mon_n_vrefresh].hi = xf86_lex_val.realnum; if ((token = xf86getSubToken(&(ptr->mon_comment))) == COMMA) break; ptr->mon_n_vrefresh++; @@ -530,11 +529,11 @@ xf86parseMonitorSection(void) } else { ptr->mon_gamma_red = ptr->mon_gamma_green = - ptr->mon_gamma_blue = val.realnum; + ptr->mon_gamma_blue = xf86_lex_val.realnum; if (xf86getSubToken(&(ptr->mon_comment)) == NUMBER) { - ptr->mon_gamma_green = val.realnum; + ptr->mon_gamma_green = xf86_lex_val.realnum; if (xf86getSubToken(&(ptr->mon_comment)) == NUMBER) { - ptr->mon_gamma_blue = val.realnum; + ptr->mon_gamma_blue = xf86_lex_val.realnum; } else { Error(INVALID_GAMMA_MSG); @@ -558,7 +557,7 @@ xf86parseMonitorSection(void) referenced here */ mptr = calloc(1, sizeof(XF86ConfModesLinkRec)); mptr->list.next = NULL; - mptr->ml_modes_str = val.str; + mptr->ml_modes_str = xf86_lex_val.str; mptr->ml_modes = NULL; ptr->mon_modes_sect_lst = (XF86ConfModesLinkPtr) xf86addListItem((GenericListPtr) ptr->mon_modes_sect_lst, @@ -599,14 +598,14 @@ xf86parseModesSection(void) while ((token = xf86getToken(ModesTab)) != ENDSECTION) { switch (token) { case COMMENT: - ptr->modes_comment = xf86addComment(ptr->modes_comment, val.str); + ptr->modes_comment = xf86addComment(ptr->modes_comment, xf86_lex_val.str); break; case IDENTIFIER: if (xf86getSubToken(&(ptr->modes_comment)) != STRING) Error(QUOTE_MSG, "Identifier"); if (has_ident == TRUE) Error(MULTIPLE_MSG, "Identifier"); - ptr->modes_identifier = val.str; + ptr->modes_identifier = xf86_lex_val.str; has_ident = TRUE; break; case MODE: diff --git a/xorg-server/hw/xfree86/parser/Pointer.c b/xorg-server/hw/xfree86/parser/Pointer.c index ff748d99a..fe60d95aa 100644 --- a/xorg-server/hw/xfree86/parser/Pointer.c +++ b/xorg-server/hw/xfree86/parser/Pointer.c @@ -61,7 +61,6 @@ #include "Configint.h" #include "Xprintf.h" -extern LexRec val; static xf86ConfigSymTabRec PointerTab[] = { {PROTOCOL, "protocol"}, @@ -104,19 +103,19 @@ xf86parsePointerSection(void) while ((token = xf86getToken(PointerTab)) != ENDSECTION) { switch (token) { case COMMENT: - ptr->inp_comment = xf86addComment(ptr->inp_comment, val.str); + ptr->inp_comment = xf86addComment(ptr->inp_comment, xf86_lex_val.str); break; case PROTOCOL: if (xf86getSubToken(&(ptr->inp_comment)) != STRING) Error(QUOTE_MSG, "Protocol"); ptr->inp_option_lst = xf86addNewOption(ptr->inp_option_lst, - strdup("Protocol"), val.str); + strdup("Protocol"), xf86_lex_val.str); break; case PDEVICE: if (xf86getSubToken(&(ptr->inp_comment)) != STRING) Error(QUOTE_MSG, "Device"); ptr->inp_option_lst = xf86addNewOption(ptr->inp_option_lst, - strdup("Device"), val.str); + strdup("Device"), xf86_lex_val.str); break; case EMULATE3: ptr->inp_option_lst = xf86addNewOption(ptr->inp_option_lst, @@ -124,9 +123,9 @@ xf86parsePointerSection(void) NULL); break; case EM3TIMEOUT: - if (xf86getSubToken(&(ptr->inp_comment)) != NUMBER || val.num < 0) + if (xf86getSubToken(&(ptr->inp_comment)) != NUMBER || xf86_lex_val.num < 0) Error(POSITIVE_INT_MSG, "Emulate3Timeout"); - s = xf86uLongToString(val.num); + s = xf86uLongToString(xf86_lex_val.num); ptr->inp_option_lst = xf86addNewOption(ptr->inp_option_lst, strdup("Emulate3Timeout"), s); @@ -136,30 +135,30 @@ xf86parsePointerSection(void) strdup("ChordMiddle"), NULL); break; case PBUTTONS: - if (xf86getSubToken(&(ptr->inp_comment)) != NUMBER || val.num < 0) + if (xf86getSubToken(&(ptr->inp_comment)) != NUMBER || xf86_lex_val.num < 0) Error(POSITIVE_INT_MSG, "Buttons"); - s = xf86uLongToString(val.num); + s = xf86uLongToString(xf86_lex_val.num); ptr->inp_option_lst = xf86addNewOption(ptr->inp_option_lst, strdup("Buttons"), s); break; case BAUDRATE: - if (xf86getSubToken(&(ptr->inp_comment)) != NUMBER || val.num < 0) + if (xf86getSubToken(&(ptr->inp_comment)) != NUMBER || xf86_lex_val.num < 0) Error(POSITIVE_INT_MSG, "BaudRate"); - s = xf86uLongToString(val.num); + s = xf86uLongToString(xf86_lex_val.num); ptr->inp_option_lst = xf86addNewOption(ptr->inp_option_lst, strdup("BaudRate"), s); break; case SAMPLERATE: - if (xf86getSubToken(&(ptr->inp_comment)) != NUMBER || val.num < 0) + if (xf86getSubToken(&(ptr->inp_comment)) != NUMBER || xf86_lex_val.num < 0) Error(POSITIVE_INT_MSG, "SampleRate"); - s = xf86uLongToString(val.num); + s = xf86uLongToString(xf86_lex_val.num); ptr->inp_option_lst = xf86addNewOption(ptr->inp_option_lst, strdup("SampleRate"), s); break; case PRESOLUTION: - if (xf86getSubToken(&(ptr->inp_comment)) != NUMBER || val.num < 0) + if (xf86getSubToken(&(ptr->inp_comment)) != NUMBER || xf86_lex_val.num < 0) Error(POSITIVE_INT_MSG, "Resolution"); - s = xf86uLongToString(val.num); + s = xf86uLongToString(xf86_lex_val.num); ptr->inp_option_lst = xf86addNewOption(ptr->inp_option_lst, strdup("Resolution"), s); break; @@ -174,14 +173,14 @@ xf86parsePointerSection(void) case ZAXISMAPPING: switch (xf86getToken(ZMapTab)) { case NUMBER: - if (val.num < 0) + if (xf86_lex_val.num < 0) Error(ZAXISMAPPING_MSG); - val1 = val.num; + val1 = xf86_lex_val.num; if (xf86getSubToken(&(ptr->inp_comment)) != NUMBER || - val.num < 0) { + xf86_lex_val.num < 0) { Error(ZAXISMAPPING_MSG); } - if (asprintf(&s, "%lu %u", val1, val.num) == -1) + if (asprintf(&s, "%lu %u", val1, xf86_lex_val.num) == -1) s = NULL; break; case XAXIS: diff --git a/xorg-server/hw/xfree86/parser/Screen.c b/xorg-server/hw/xfree86/parser/Screen.c index f294ec490..fecd57c0c 100644 --- a/xorg-server/hw/xfree86/parser/Screen.c +++ b/xorg-server/hw/xfree86/parser/Screen.c @@ -60,7 +60,6 @@ #include "xf86tokens.h" #include "Configint.h" -extern LexRec val; static xf86ConfigSymTabRec DisplayTab[] = { {ENDSUBSECTION, "endsubsection"}, @@ -92,71 +91,71 @@ xf86parseDisplaySubSection(void) while ((token = xf86getToken(DisplayTab)) != ENDSUBSECTION) { switch (token) { case COMMENT: - ptr->disp_comment = xf86addComment(ptr->disp_comment, val.str); + ptr->disp_comment = xf86addComment(ptr->disp_comment, xf86_lex_val.str); break; case VIEWPORT: if (xf86getSubToken(&(ptr->disp_comment)) != NUMBER) Error(VIEWPORT_MSG); - ptr->disp_frameX0 = val.num; + ptr->disp_frameX0 = xf86_lex_val.num; if (xf86getSubToken(&(ptr->disp_comment)) != NUMBER) Error(VIEWPORT_MSG); - ptr->disp_frameY0 = val.num; + ptr->disp_frameY0 = xf86_lex_val.num; break; case VIRTUAL: if (xf86getSubToken(&(ptr->disp_comment)) != NUMBER) Error(VIRTUAL_MSG); - ptr->disp_virtualX = val.num; + ptr->disp_virtualX = xf86_lex_val.num; if (xf86getSubToken(&(ptr->disp_comment)) != NUMBER) Error(VIRTUAL_MSG); - ptr->disp_virtualY = val.num; + ptr->disp_virtualY = xf86_lex_val.num; break; case DEPTH: if (xf86getSubToken(&(ptr->disp_comment)) != NUMBER) Error(NUMBER_MSG, "Display"); - ptr->disp_depth = val.num; + ptr->disp_depth = xf86_lex_val.num; break; case BPP: if (xf86getSubToken(&(ptr->disp_comment)) != NUMBER) Error(NUMBER_MSG, "Display"); - ptr->disp_bpp = val.num; + ptr->disp_bpp = xf86_lex_val.num; break; case VISUAL: if (xf86getSubToken(&(ptr->disp_comment)) != STRING) Error(QUOTE_MSG, "Display"); - ptr->disp_visual = val.str; + ptr->disp_visual = xf86_lex_val.str; break; case WEIGHT: if (xf86getSubToken(&(ptr->disp_comment)) != NUMBER) Error(WEIGHT_MSG); - ptr->disp_weight.red = val.num; + ptr->disp_weight.red = xf86_lex_val.num; if (xf86getSubToken(&(ptr->disp_comment)) != NUMBER) Error(WEIGHT_MSG); - ptr->disp_weight.green = val.num; + ptr->disp_weight.green = xf86_lex_val.num; if (xf86getSubToken(&(ptr->disp_comment)) != NUMBER) Error(WEIGHT_MSG); - ptr->disp_weight.blue = val.num; + ptr->disp_weight.blue = xf86_lex_val.num; break; case BLACK_TOK: if (xf86getSubToken(&(ptr->disp_comment)) != NUMBER) Error(BLACK_MSG); - ptr->disp_black.red = val.num; + ptr->disp_black.red = xf86_lex_val.num; if (xf86getSubToken(&(ptr->disp_comment)) != NUMBER) Error(BLACK_MSG); - ptr->disp_black.green = val.num; + ptr->disp_black.green = xf86_lex_val.num; if (xf86getSubToken(&(ptr->disp_comment)) != NUMBER) Error(BLACK_MSG); - ptr->disp_black.blue = val.num; + ptr->disp_black.blue = xf86_lex_val.num; break; case WHITE_TOK: if (xf86getSubToken(&(ptr->disp_comment)) != NUMBER) Error(WHITE_MSG); - ptr->disp_white.red = val.num; + ptr->disp_white.red = xf86_lex_val.num; if (xf86getSubToken(&(ptr->disp_comment)) != NUMBER) Error(WHITE_MSG); - ptr->disp_white.green = val.num; + ptr->disp_white.green = xf86_lex_val.num; if (xf86getSubToken(&(ptr->disp_comment)) != NUMBER) Error(WHITE_MSG); - ptr->disp_white.blue = val.num; + ptr->disp_white.blue = xf86_lex_val.num; break; case MODES: { @@ -166,7 +165,7 @@ xf86parseDisplaySubSection(void) xf86getSubTokenWithTab(&(ptr->disp_comment), DisplayTab)) == STRING) { mptr = calloc(1, sizeof(XF86ModeRec)); - mptr->mode_name = val.str; + mptr->mode_name = xf86_lex_val.str; mptr->list.next = NULL; ptr->disp_mode_lst = (XF86ModePtr) xf86addListItem((glp) ptr->disp_mode_lst, (glp) mptr); @@ -227,12 +226,12 @@ xf86parseScreenSection(void) while ((token = xf86getToken(ScreenTab)) != ENDSECTION) { switch (token) { case COMMENT: - ptr->scrn_comment = xf86addComment(ptr->scrn_comment, val.str); + ptr->scrn_comment = xf86addComment(ptr->scrn_comment, xf86_lex_val.str); break; case IDENTIFIER: if (xf86getSubToken(&(ptr->scrn_comment)) != STRING) Error(QUOTE_MSG, "Identifier"); - ptr->scrn_identifier = val.str; + ptr->scrn_identifier = xf86_lex_val.str; if (has_ident || has_driver) Error(ONLY_ONE_MSG, "Identifier or Driver"); has_ident = TRUE; @@ -240,7 +239,7 @@ xf86parseScreenSection(void) case OBSDRIVER: if (xf86getSubToken(&(ptr->scrn_comment)) != STRING) Error(QUOTE_MSG, "Driver"); - ptr->scrn_obso_driver = val.str; + ptr->scrn_obso_driver = xf86_lex_val.str; if (has_ident || has_driver) Error(ONLY_ONE_MSG, "Identifier or Driver"); has_driver = TRUE; @@ -248,27 +247,27 @@ xf86parseScreenSection(void) case DEFAULTDEPTH: if (xf86getSubToken(&(ptr->scrn_comment)) != NUMBER) Error(NUMBER_MSG, "DefaultDepth"); - ptr->scrn_defaultdepth = val.num; + ptr->scrn_defaultdepth = xf86_lex_val.num; break; case DEFAULTBPP: if (xf86getSubToken(&(ptr->scrn_comment)) != NUMBER) Error(NUMBER_MSG, "DefaultBPP"); - ptr->scrn_defaultbpp = val.num; + ptr->scrn_defaultbpp = xf86_lex_val.num; break; case DEFAULTFBBPP: if (xf86getSubToken(&(ptr->scrn_comment)) != NUMBER) Error(NUMBER_MSG, "DefaultFbBPP"); - ptr->scrn_defaultfbbpp = val.num; + ptr->scrn_defaultfbbpp = xf86_lex_val.num; break; case MDEVICE: if (xf86getSubToken(&(ptr->scrn_comment)) != STRING) Error(QUOTE_MSG, "Device"); - ptr->scrn_device_str = val.str; + ptr->scrn_device_str = xf86_lex_val.str; break; case MONITOR: if (xf86getSubToken(&(ptr->scrn_comment)) != STRING) Error(QUOTE_MSG, "Monitor"); - ptr->scrn_monitor_str = val.str; + ptr->scrn_monitor_str = xf86_lex_val.str; break; case VIDEOADAPTOR: { @@ -280,13 +279,13 @@ xf86parseScreenSection(void) /* Don't allow duplicates */ for (aptr = ptr->scrn_adaptor_lst; aptr; aptr = (XF86ConfAdaptorLinkPtr) aptr->list.next) - if (xf86nameCompare(val.str, aptr->al_adaptor_str) == 0) + if (xf86nameCompare(xf86_lex_val.str, aptr->al_adaptor_str) == 0) break; if (aptr == NULL) { aptr = calloc(1, sizeof(XF86ConfAdaptorLinkRec)); aptr->list.next = NULL; - aptr->al_adaptor_str = val.str; + aptr->al_adaptor_str = xf86_lex_val.str; ptr->scrn_adaptor_lst = (XF86ConfAdaptorLinkPtr) xf86addListItem((glp) ptr->scrn_adaptor_lst, (glp) aptr); } @@ -295,10 +294,10 @@ xf86parseScreenSection(void) case VIRTUAL: if (xf86getSubToken(&(ptr->scrn_comment)) != NUMBER) Error(VIRTUAL_MSG); - ptr->scrn_virtualX = val.num; + ptr->scrn_virtualX = xf86_lex_val.num; if (xf86getSubToken(&(ptr->scrn_comment)) != NUMBER) Error(VIRTUAL_MSG); - ptr->scrn_virtualY = val.num; + ptr->scrn_virtualY = xf86_lex_val.num; break; case OPTION: ptr->scrn_option_lst = xf86parseOption(ptr->scrn_option_lst); @@ -307,7 +306,7 @@ xf86parseScreenSection(void) if (xf86getSubToken(&(ptr->scrn_comment)) != STRING) Error(QUOTE_MSG, "SubSection"); { - free(val.str); + free(xf86_lex_val.str); HANDLE_LIST(scrn_display_lst, xf86parseDisplaySubSection, XF86ConfDisplayPtr); } diff --git a/xorg-server/hw/xfree86/parser/Vendor.c b/xorg-server/hw/xfree86/parser/Vendor.c index 9b7695c8e..2c870ae7f 100644 --- a/xorg-server/hw/xfree86/parser/Vendor.c +++ b/xorg-server/hw/xfree86/parser/Vendor.c @@ -60,7 +60,6 @@ #include "xf86tokens.h" #include "Configint.h" -extern LexRec val; static xf86ConfigSymTabRec VendorSubTab[] = { {ENDSUBSECTION, "endsubsection"}, @@ -82,14 +81,14 @@ xf86parseVendorSubSection(void) while ((token = xf86getToken(VendorSubTab)) != ENDSUBSECTION) { switch (token) { case COMMENT: - ptr->vs_comment = xf86addComment(ptr->vs_comment, val.str); + ptr->vs_comment = xf86addComment(ptr->vs_comment, xf86_lex_val.str); break; case IDENTIFIER: if (xf86getSubToken(&(ptr->vs_comment))) Error(QUOTE_MSG, "Identifier"); if (has_ident == TRUE) Error(MULTIPLE_MSG, "Identifier"); - ptr->vs_identifier = val.str; + ptr->vs_identifier = xf86_lex_val.str; has_ident = TRUE; break; case OPTION: @@ -135,14 +134,14 @@ xf86parseVendorSection(void) while ((token = xf86getToken(VendorTab)) != ENDSECTION) { switch (token) { case COMMENT: - ptr->vnd_comment = xf86addComment(ptr->vnd_comment, val.str); + ptr->vnd_comment = xf86addComment(ptr->vnd_comment, xf86_lex_val.str); break; case IDENTIFIER: if (xf86getSubToken(&(ptr->vnd_comment)) != STRING) Error(QUOTE_MSG, "Identifier"); if (has_ident == TRUE) Error(MULTIPLE_MSG, "Identifier"); - ptr->vnd_identifier = val.str; + ptr->vnd_identifier = xf86_lex_val.str; has_ident = TRUE; break; case OPTION: diff --git a/xorg-server/hw/xfree86/parser/Video.c b/xorg-server/hw/xfree86/parser/Video.c index 68d611ae7..93209c499 100644 --- a/xorg-server/hw/xfree86/parser/Video.c +++ b/xorg-server/hw/xfree86/parser/Video.c @@ -60,7 +60,6 @@ #include "xf86tokens.h" #include "Configint.h" -extern LexRec val; static xf86ConfigSymTabRec VideoPortTab[] = { {ENDSUBSECTION, "endsubsection"}, @@ -97,14 +96,14 @@ xf86parseVideoPortSubSection(void) while ((token = xf86getToken(VideoPortTab)) != ENDSUBSECTION) { switch (token) { case COMMENT: - ptr->vp_comment = xf86addComment(ptr->vp_comment, val.str); + ptr->vp_comment = xf86addComment(ptr->vp_comment, xf86_lex_val.str); break; case IDENTIFIER: if (xf86getSubToken(&(ptr->vp_comment)) != STRING) Error(QUOTE_MSG, "Identifier"); if (has_ident == TRUE) Error(MULTIPLE_MSG, "Identifier"); - ptr->vp_identifier = val.str; + ptr->vp_identifier = xf86_lex_val.str; has_ident = TRUE; break; case OPTION: @@ -154,12 +153,12 @@ xf86parseVideoAdaptorSection(void) while ((token = xf86getToken(VideoAdaptorTab)) != ENDSECTION) { switch (token) { case COMMENT: - ptr->va_comment = xf86addComment(ptr->va_comment, val.str); + ptr->va_comment = xf86addComment(ptr->va_comment, xf86_lex_val.str); break; case IDENTIFIER: if (xf86getSubToken(&(ptr->va_comment)) != STRING) Error(QUOTE_MSG, "Identifier"); - ptr->va_identifier = val.str; + ptr->va_identifier = xf86_lex_val.str; if (has_ident == TRUE) Error(MULTIPLE_MSG, "Identifier"); has_ident = TRUE; @@ -167,22 +166,22 @@ xf86parseVideoAdaptorSection(void) case VENDOR: if (xf86getSubToken(&(ptr->va_comment)) != STRING) Error(QUOTE_MSG, "Vendor"); - ptr->va_vendor = val.str; + ptr->va_vendor = xf86_lex_val.str; break; case BOARD: if (xf86getSubToken(&(ptr->va_comment)) != STRING) Error(QUOTE_MSG, "Board"); - ptr->va_board = val.str; + ptr->va_board = xf86_lex_val.str; break; case BUSID: if (xf86getSubToken(&(ptr->va_comment)) != STRING) Error(QUOTE_MSG, "BusID"); - ptr->va_busid = val.str; + ptr->va_busid = xf86_lex_val.str; break; case DRIVER: if (xf86getSubToken(&(ptr->va_comment)) != STRING) Error(QUOTE_MSG, "Driver"); - ptr->va_driver = val.str; + ptr->va_driver = xf86_lex_val.str; break; case OPTION: ptr->va_option_lst = xf86parseOption(ptr->va_option_lst); diff --git a/xorg-server/hw/xfree86/parser/read.c b/xorg-server/hw/xfree86/parser/read.c index 6545bcdae..2478b074b 100644 --- a/xorg-server/hw/xfree86/parser/read.c +++ b/xorg-server/hw/xfree86/parser/read.c @@ -60,7 +60,6 @@ #include "xf86tokens.h" #include "Configint.h" -extern LexRec val; static xf86ConfigSymTabRec TopLevelTab[] = { {SECTION, "section"}, @@ -99,7 +98,7 @@ xf86readConfigFile(void) while ((token = xf86getToken(TopLevelTab)) != EOF_TOKEN) { switch (token) { case COMMENT: - ptr->conf_comment = xf86addComment(ptr->conf_comment, val.str); + ptr->conf_comment = xf86addComment(ptr->conf_comment, xf86_lex_val.str); break; case SECTION: if (xf86getSubToken(&(ptr->conf_comment)) != STRING) { @@ -107,101 +106,101 @@ xf86readConfigFile(void) CLEANUP(ptr); return NULL; } - xf86setSection(val.str); - if (xf86nameCompare(val.str, "files") == 0) { - free(val.str); - val.str = NULL; + xf86setSection(xf86_lex_val.str); + if (xf86nameCompare(xf86_lex_val.str, "files") == 0) { + free(xf86_lex_val.str); + xf86_lex_val.str = NULL; HANDLE_RETURN(conf_files, xf86parseFilesSection()); } - else if (xf86nameCompare(val.str, "serverflags") == 0) { - free(val.str); - val.str = NULL; + else if (xf86nameCompare(xf86_lex_val.str, "serverflags") == 0) { + free(xf86_lex_val.str); + xf86_lex_val.str = NULL; HANDLE_RETURN(conf_flags, xf86parseFlagsSection()); } - else if (xf86nameCompare(val.str, "pointer") == 0) { - free(val.str); - val.str = NULL; + else if (xf86nameCompare(xf86_lex_val.str, "pointer") == 0) { + free(xf86_lex_val.str); + xf86_lex_val.str = NULL; HANDLE_LIST(conf_input_lst, xf86parsePointerSection, XF86ConfInputPtr); } - else if (xf86nameCompare(val.str, "videoadaptor") == 0) { - free(val.str); - val.str = NULL; + else if (xf86nameCompare(xf86_lex_val.str, "videoadaptor") == 0) { + free(xf86_lex_val.str); + xf86_lex_val.str = NULL; HANDLE_LIST(conf_videoadaptor_lst, xf86parseVideoAdaptorSection, XF86ConfVideoAdaptorPtr); } - else if (xf86nameCompare(val.str, "device") == 0) { - free(val.str); - val.str = NULL; + else if (xf86nameCompare(xf86_lex_val.str, "device") == 0) { + free(xf86_lex_val.str); + xf86_lex_val.str = NULL; HANDLE_LIST(conf_device_lst, xf86parseDeviceSection, XF86ConfDevicePtr); } - else if (xf86nameCompare(val.str, "monitor") == 0) { - free(val.str); - val.str = NULL; + else if (xf86nameCompare(xf86_lex_val.str, "monitor") == 0) { + free(xf86_lex_val.str); + xf86_lex_val.str = NULL; HANDLE_LIST(conf_monitor_lst, xf86parseMonitorSection, XF86ConfMonitorPtr); } - else if (xf86nameCompare(val.str, "modes") == 0) { - free(val.str); - val.str = NULL; + else if (xf86nameCompare(xf86_lex_val.str, "modes") == 0) { + free(xf86_lex_val.str); + xf86_lex_val.str = NULL; HANDLE_LIST(conf_modes_lst, xf86parseModesSection, XF86ConfModesPtr); } - else if (xf86nameCompare(val.str, "screen") == 0) { - free(val.str); - val.str = NULL; + else if (xf86nameCompare(xf86_lex_val.str, "screen") == 0) { + free(xf86_lex_val.str); + xf86_lex_val.str = NULL; HANDLE_LIST(conf_screen_lst, xf86parseScreenSection, XF86ConfScreenPtr); } - else if (xf86nameCompare(val.str, "inputdevice") == 0) { - free(val.str); - val.str = NULL; + else if (xf86nameCompare(xf86_lex_val.str, "inputdevice") == 0) { + free(xf86_lex_val.str); + xf86_lex_val.str = NULL; HANDLE_LIST(conf_input_lst, xf86parseInputSection, XF86ConfInputPtr); } - else if (xf86nameCompare(val.str, "inputclass") == 0) { - free(val.str); - val.str = NULL; + else if (xf86nameCompare(xf86_lex_val.str, "inputclass") == 0) { + free(xf86_lex_val.str); + xf86_lex_val.str = NULL; HANDLE_LIST(conf_inputclass_lst, xf86parseInputClassSection, XF86ConfInputClassPtr); } - else if (xf86nameCompare(val.str, "module") == 0) { - free(val.str); - val.str = NULL; + else if (xf86nameCompare(xf86_lex_val.str, "module") == 0) { + free(xf86_lex_val.str); + xf86_lex_val.str = NULL; HANDLE_RETURN(conf_modules, xf86parseModuleSection()); } - else if (xf86nameCompare(val.str, "serverlayout") == 0) { - free(val.str); - val.str = NULL; + else if (xf86nameCompare(xf86_lex_val.str, "serverlayout") == 0) { + free(xf86_lex_val.str); + xf86_lex_val.str = NULL; HANDLE_LIST(conf_layout_lst, xf86parseLayoutSection, XF86ConfLayoutPtr); } - else if (xf86nameCompare(val.str, "vendor") == 0) { - free(val.str); - val.str = NULL; + else if (xf86nameCompare(xf86_lex_val.str, "vendor") == 0) { + free(xf86_lex_val.str); + xf86_lex_val.str = NULL; HANDLE_LIST(conf_vendor_lst, xf86parseVendorSection, XF86ConfVendorPtr); } - else if (xf86nameCompare(val.str, "dri") == 0) { - free(val.str); - val.str = NULL; + else if (xf86nameCompare(xf86_lex_val.str, "dri") == 0) { + free(xf86_lex_val.str); + xf86_lex_val.str = NULL; HANDLE_RETURN(conf_dri, xf86parseDRISection()); } - else if (xf86nameCompare(val.str, "extensions") == 0) { - free(val.str); - val.str = NULL; + else if (xf86nameCompare(xf86_lex_val.str, "extensions") == 0) { + free(xf86_lex_val.str); + xf86_lex_val.str = NULL; HANDLE_RETURN(conf_extensions, xf86parseExtensionsSection()); } else { - free(val.str); - val.str = NULL; + free(xf86_lex_val.str); + xf86_lex_val.str = NULL; Error(INVALID_SECTION_MSG, xf86tokenString()); } break; default: - free(val.str); - val.str = NULL; + free(xf86_lex_val.str); + xf86_lex_val.str = NULL; Error(INVALID_KEYWORD_MSG, xf86tokenString()); } } diff --git a/xorg-server/hw/xfree86/parser/scan.c b/xorg-server/hw/xfree86/parser/scan.c index 55a84426d..a6c12957b 100644 --- a/xorg-server/hw/xfree86/parser/scan.c +++ b/xorg-server/hw/xfree86/parser/scan.c @@ -103,7 +103,7 @@ static int numFiles = 0; /* number of config files */ static int curFileIndex = 0; /* index of current config file */ static int pushToken = LOCK_TOKEN; static int eol_seen = 0; /* private state to handle comments */ -LexRec val; +LexRec xf86_lex_val; /* * xf86getNextLine -- @@ -332,7 +332,7 @@ xf86getToken(xf86ConfigSymTabRec * tab) /* XXX no private copy. * Use xf86addComment when setting a comment. */ - val.str = configRBuf; + xf86_lex_val.str = configRBuf; return COMMENT; } @@ -354,15 +354,15 @@ xf86getToken(xf86ConfigSymTabRec * tab) if ((configBuf[configPos] == 'x') || (configBuf[configPos] == 'X')) { base = 16; - val.numType = PARSE_HEX; + xf86_lex_val.numType = PARSE_HEX; } else { base = 8; - val.numType = PARSE_OCTAL; + xf86_lex_val.numType = PARSE_OCTAL; } else { base = 10; - val.numType = PARSE_DECIMAL; + xf86_lex_val.numType = PARSE_DECIMAL; } configRBuf[0] = c; @@ -374,8 +374,8 @@ xf86getToken(xf86ConfigSymTabRec * tab) configRBuf[i++] = c; configPos--; /* GJA -- one too far */ configRBuf[i] = '\0'; - val.num = strtoul(configRBuf, NULL, 0); - val.realnum = atof(configRBuf); + xf86_lex_val.num = strtoul(configRBuf, NULL, 0); + xf86_lex_val.realnum = atof(configRBuf); return NUMBER; } @@ -389,8 +389,8 @@ xf86getToken(xf86ConfigSymTabRec * tab) } while ((c != '\"') && (c != '\n') && (c != '\r') && (c != '\0')); configRBuf[i] = '\0'; - val.str = malloc(strlen(configRBuf) + 1); - strcpy(val.str, configRBuf); /* private copy ! */ + xf86_lex_val.str = malloc(strlen(configRBuf) + 1); + strcpy(xf86_lex_val.str, configRBuf); /* private copy ! */ return STRING; } @@ -452,7 +452,7 @@ xf86getSubToken(char **comment) token = xf86getToken(NULL); if (token == COMMENT) { if (comment) - *comment = xf86addComment(*comment, val.str); + *comment = xf86addComment(*comment, xf86_lex_val.str); } else return token; @@ -468,7 +468,7 @@ xf86getSubTokenWithTab(char **comment, xf86ConfigSymTabRec * tab) token = xf86getToken(tab); if (token == COMMENT) { if (comment) - *comment = xf86addComment(*comment, val.str); + *comment = xf86addComment(*comment, xf86_lex_val.str); } else return token; @@ -1025,7 +1025,7 @@ xf86setSection(const char *section) int xf86getStringToken(xf86ConfigSymTabRec * tab) { - return StringToToken(val.str, tab); + return StringToToken(xf86_lex_val.str, tab); } static int diff --git a/xorg-server/hw/xfree86/x86emu/ops.c b/xorg-server/hw/xfree86/x86emu/ops.c index 8af1df47a..b50badb28 100644 --- a/xorg-server/hw/xfree86/x86emu/ops.c +++ b/xorg-server/hw/xfree86/x86emu/ops.c @@ -11705,38 +11705,38 @@ x86emuOp_opcFF_word_RM(u8 X86EMU_UNUSED(op1)) switch (rh) { case 0: /* inc word ptr ... */ if (M.x86.mode & SYSMODE_PREFIX_DATA) { - u32 destval; + u32 destval32; - destval = fetch_data_long(destoffset); + destval32 = fetch_data_long(destoffset); TRACE_AND_STEP(); - destval = inc_long(destval); - store_data_long(destoffset, destval); + destval32 = inc_long(destval32); + store_data_long(destoffset, destval32); } else { - u16 destval; + u16 destval16; - destval = fetch_data_word(destoffset); + destval16 = fetch_data_word(destoffset); TRACE_AND_STEP(); - destval = inc_word(destval); - store_data_word(destoffset, destval); + destval16 = inc_word(destval16); + store_data_word(destoffset, destval16); } break; case 1: /* dec word ptr ... */ if (M.x86.mode & SYSMODE_PREFIX_DATA) { - u32 destval; + u32 destval32; - destval = fetch_data_long(destoffset); + destval32 = fetch_data_long(destoffset); TRACE_AND_STEP(); - destval = dec_long(destval); - store_data_long(destoffset, destval); + destval32 = dec_long(destval32); + store_data_long(destoffset, destval32); } else { - u16 destval; + u16 destval16; - destval = fetch_data_word(destoffset); + destval16 = fetch_data_word(destoffset); TRACE_AND_STEP(); - destval = dec_word(destval); - store_data_word(destoffset, destval); + destval16 = dec_word(destval16); + store_data_word(destoffset, destval16); } break; case 2: /* call word ptr ... */ @@ -11768,18 +11768,18 @@ x86emuOp_opcFF_word_RM(u8 X86EMU_UNUSED(op1)) break; case 6: /* push word ptr ... */ if (M.x86.mode & SYSMODE_PREFIX_DATA) { - u32 destval; + u32 destval32; - destval = fetch_data_long(destoffset); + destval32 = fetch_data_long(destoffset); TRACE_AND_STEP(); - push_long(destval); + push_long(destval32); } else { - u16 destval; + u16 destval16; - destval = fetch_data_word(destoffset); + destval16 = fetch_data_word(destoffset); TRACE_AND_STEP(); - push_word(destval); + push_word(destval16); } break; } @@ -11790,38 +11790,38 @@ x86emuOp_opcFF_word_RM(u8 X86EMU_UNUSED(op1)) switch (rh) { case 0: if (M.x86.mode & SYSMODE_PREFIX_DATA) { - u32 destval; + u32 destval32; - destval = fetch_data_long(destoffset); + destval32 = fetch_data_long(destoffset); TRACE_AND_STEP(); - destval = inc_long(destval); - store_data_long(destoffset, destval); + destval32 = inc_long(destval32); + store_data_long(destoffset, destval32); } else { - u16 destval; + u16 destval16; - destval = fetch_data_word(destoffset); + destval16 = fetch_data_word(destoffset); TRACE_AND_STEP(); - destval = inc_word(destval); - store_data_word(destoffset, destval); + destval16 = inc_word(destval16); + store_data_word(destoffset, destval16); } break; case 1: if (M.x86.mode & SYSMODE_PREFIX_DATA) { - u32 destval; + u32 destval32; - destval = fetch_data_long(destoffset); + destval32 = fetch_data_long(destoffset); TRACE_AND_STEP(); - destval = dec_long(destval); - store_data_long(destoffset, destval); + destval32 = dec_long(destval32); + store_data_long(destoffset, destval32); } else { - u16 destval; + u16 destval16; - destval = fetch_data_word(destoffset); + destval16 = fetch_data_word(destoffset); TRACE_AND_STEP(); - destval = dec_word(destval); - store_data_word(destoffset, destval); + destval16 = dec_word(destval16); + store_data_word(destoffset, destval16); } break; case 2: /* call word ptr ... */ @@ -11853,18 +11853,18 @@ x86emuOp_opcFF_word_RM(u8 X86EMU_UNUSED(op1)) break; case 6: /* push word ptr ... */ if (M.x86.mode & SYSMODE_PREFIX_DATA) { - u32 destval; + u32 destval32; - destval = fetch_data_long(destoffset); + destval32 = fetch_data_long(destoffset); TRACE_AND_STEP(); - push_long(destval); + push_long(destval32); } else { - u16 destval; + u16 destval16; - destval = fetch_data_word(destoffset); + destval16 = fetch_data_word(destoffset); TRACE_AND_STEP(); - push_word(destval); + push_word(destval16); } break; } @@ -11875,38 +11875,38 @@ x86emuOp_opcFF_word_RM(u8 X86EMU_UNUSED(op1)) switch (rh) { case 0: if (M.x86.mode & SYSMODE_PREFIX_DATA) { - u32 destval; + u32 destval32; - destval = fetch_data_long(destoffset); + destval32 = fetch_data_long(destoffset); TRACE_AND_STEP(); - destval = inc_long(destval); - store_data_long(destoffset, destval); + destval32 = inc_long(destval32); + store_data_long(destoffset, destval32); } else { - u16 destval; + u16 destval16; - destval = fetch_data_word(destoffset); + destval16 = fetch_data_word(destoffset); TRACE_AND_STEP(); - destval = inc_word(destval); - store_data_word(destoffset, destval); + destval16 = inc_word(destval16); + store_data_word(destoffset, destval16); } break; case 1: if (M.x86.mode & SYSMODE_PREFIX_DATA) { - u32 destval; + u32 destval32; - destval = fetch_data_long(destoffset); + destval32 = fetch_data_long(destoffset); TRACE_AND_STEP(); - destval = dec_long(destval); - store_data_long(destoffset, destval); + destval32 = dec_long(destval32); + store_data_long(destoffset, destval32); } else { - u16 destval; + u16 destval16; - destval = fetch_data_word(destoffset); + destval16 = fetch_data_word(destoffset); TRACE_AND_STEP(); - destval = dec_word(destval); - store_data_word(destoffset, destval); + destval16 = dec_word(destval16); + store_data_word(destoffset, destval16); } break; case 2: /* call word ptr ... */ @@ -11938,18 +11938,18 @@ x86emuOp_opcFF_word_RM(u8 X86EMU_UNUSED(op1)) break; case 6: /* push word ptr ... */ if (M.x86.mode & SYSMODE_PREFIX_DATA) { - u32 destval; + u32 destval32; - destval = fetch_data_long(destoffset); + destval32 = fetch_data_long(destoffset); TRACE_AND_STEP(); - push_long(destval); + push_long(destval32); } else { - u16 destval; + u16 destval16; - destval = fetch_data_word(destoffset); + destval16 = fetch_data_word(destoffset); TRACE_AND_STEP(); - push_word(destval); + push_word(destval16); } break; } @@ -11958,38 +11958,38 @@ x86emuOp_opcFF_word_RM(u8 X86EMU_UNUSED(op1)) switch (rh) { case 0: if (M.x86.mode & SYSMODE_PREFIX_DATA) { - u32 *destreg; + u32 *destreg32; - destreg = DECODE_RM_LONG_REGISTER(rl); + destreg32 = DECODE_RM_LONG_REGISTER(rl); DECODE_PRINTF("\n"); TRACE_AND_STEP(); - *destreg = inc_long(*destreg); + *destreg32 = inc_long(*destreg32); } else { - u16 *destreg; + u16 *destreg16; - destreg = DECODE_RM_WORD_REGISTER(rl); + destreg16 = DECODE_RM_WORD_REGISTER(rl); DECODE_PRINTF("\n"); TRACE_AND_STEP(); - *destreg = inc_word(*destreg); + *destreg16 = inc_word(*destreg16); } break; case 1: if (M.x86.mode & SYSMODE_PREFIX_DATA) { - u32 *destreg; + u32 *destreg32; - destreg = DECODE_RM_LONG_REGISTER(rl); + destreg32 = DECODE_RM_LONG_REGISTER(rl); DECODE_PRINTF("\n"); TRACE_AND_STEP(); - *destreg = dec_long(*destreg); + *destreg32 = dec_long(*destreg32); } else { - u16 *destreg; + u16 *destreg16; - destreg = DECODE_RM_WORD_REGISTER(rl); + destreg16 = DECODE_RM_WORD_REGISTER(rl); DECODE_PRINTF("\n"); TRACE_AND_STEP(); - *destreg = dec_word(*destreg); + *destreg16 = dec_word(*destreg16); } break; case 2: /* call word ptr ... */ @@ -12018,20 +12018,20 @@ x86emuOp_opcFF_word_RM(u8 X86EMU_UNUSED(op1)) break; case 6: if (M.x86.mode & SYSMODE_PREFIX_DATA) { - u32 *destreg; + u32 *destreg32; - destreg = DECODE_RM_LONG_REGISTER(rl); + destreg32 = DECODE_RM_LONG_REGISTER(rl); DECODE_PRINTF("\n"); TRACE_AND_STEP(); - push_long(*destreg); + push_long(*destreg32); } else { - u16 *destreg; + u16 *destreg16; - destreg = DECODE_RM_WORD_REGISTER(rl); + destreg16 = DECODE_RM_WORD_REGISTER(rl); DECODE_PRINTF("\n"); TRACE_AND_STEP(); - push_word(*destreg); + push_word(*destreg16); } break; } diff --git a/xorg-server/hw/xnest/Events.c b/xorg-server/hw/xnest/Events.c index 447d5a72b..3ff095bb8 100644 --- a/xorg-server/hw/xnest/Events.c +++ b/xorg-server/hw/xnest/Events.c @@ -64,15 +64,15 @@ SetTimeSinceLastInputEvent(void) } static Bool -xnestExposurePredicate(Display * display, XEvent * event, char *args) +xnestExposurePredicate(Display * dpy, XEvent * event, char *args) { return event->type == Expose || event->type == ProcessedExpose; } static Bool -xnestNotExposurePredicate(Display * display, XEvent * event, char *args) +xnestNotExposurePredicate(Display * dpy, XEvent * event, char *args) { - return !xnestExposurePredicate(display, event, args); + return !xnestExposurePredicate(dpy, event, args); } void diff --git a/xorg-server/hw/xnest/GCOps.c b/xorg-server/hw/xnest/GCOps.c index fa602314b..e1cf9d65f 100644 --- a/xorg-server/hw/xnest/GCOps.c +++ b/xorg-server/hw/xnest/GCOps.c @@ -95,7 +95,7 @@ xnestPutImage(DrawablePtr pDrawable, GCPtr pGC, int depth, int x, int y, } static int -xnestIgnoreErrorHandler (Display *display, +xnestIgnoreErrorHandler (Display *dpy, XErrorEvent *event) { return False; /* return value is ignored */ @@ -127,7 +127,7 @@ xnestGetImage(DrawablePtr pDrawable, int x, int y, int w, int h, } static Bool -xnestBitBlitPredicate(Display * display, XEvent * event, char *args) +xnestBitBlitPredicate(Display * dpy, XEvent * event, char *args) { return event->type == GraphicsExpose || event->type == NoExpose; } diff --git a/xorg-server/hw/xnest/Init.c b/xorg-server/hw/xnest/Init.c index 330b8ca17..d9f490b85 100644 --- a/xorg-server/hw/xnest/Init.c +++ b/xorg-server/hw/xnest/Init.c @@ -46,29 +46,29 @@ is" without express or implied warranty. Bool xnestDoFullGeneration = True; void -InitOutput(ScreenInfo * screenInfo, int argc, char *argv[]) +InitOutput(ScreenInfo * screen_info, int argc, char *argv[]) { int i, j; xnestOpenDisplay(argc, argv); - screenInfo->imageByteOrder = ImageByteOrder(xnestDisplay); - screenInfo->bitmapScanlineUnit = BitmapUnit(xnestDisplay); - screenInfo->bitmapScanlinePad = BitmapPad(xnestDisplay); - screenInfo->bitmapBitOrder = BitmapBitOrder(xnestDisplay); + screen_info->imageByteOrder = ImageByteOrder(xnestDisplay); + screen_info->bitmapScanlineUnit = BitmapUnit(xnestDisplay); + screen_info->bitmapScanlinePad = BitmapPad(xnestDisplay); + screen_info->bitmapBitOrder = BitmapBitOrder(xnestDisplay); - screenInfo->numPixmapFormats = 0; + screen_info->numPixmapFormats = 0; for (i = 0; i < xnestNumPixmapFormats; i++) for (j = 0; j < xnestNumDepths; j++) if ((xnestPixmapFormats[i].depth == 1) || (xnestPixmapFormats[i].depth == xnestDepths[j])) { - screenInfo->formats[screenInfo->numPixmapFormats].depth = + screen_info->formats[screen_info->numPixmapFormats].depth = xnestPixmapFormats[i].depth; - screenInfo->formats[screenInfo->numPixmapFormats].bitsPerPixel = + screen_info->formats[screen_info->numPixmapFormats].bitsPerPixel = xnestPixmapFormats[i].bits_per_pixel; - screenInfo->formats[screenInfo->numPixmapFormats].scanlinePad = + screen_info->formats[screen_info->numPixmapFormats].scanlinePad = xnestPixmapFormats[i].scanline_pad; - screenInfo->numPixmapFormats++; + screen_info->numPixmapFormats++; break; } @@ -80,7 +80,7 @@ InitOutput(ScreenInfo * screenInfo, int argc, char *argv[]) for (i = 0; i < xnestNumScreens; i++) AddScreen(xnestOpenScreen, argc, argv); - xnestNumScreens = screenInfo->numScreens; + xnestNumScreens = screen_info->numScreens; xnestDoFullGeneration = xnestFullGeneration; } diff --git a/xorg-server/hw/xnest/Window.c b/xorg-server/hw/xnest/Window.c index c33cbaa2b..fc87e823e 100644 --- a/xorg-server/hw/xnest/Window.c +++ b/xorg-server/hw/xnest/Window.c @@ -380,7 +380,7 @@ xnestClipNotify(WindowPtr pWin, int dx, int dy) } static Bool -xnestWindowExposurePredicate(Display * display, XEvent * event, XPointer ptr) +xnestWindowExposurePredicate(Display * dpy, XEvent * event, XPointer ptr) { return (event->type == Expose && event->xexpose.window == *(Window *) ptr); } diff --git a/xorg-server/hw/xquartz/GL/indirect.c b/xorg-server/hw/xquartz/GL/indirect.c index 8dabda14d..19b7d86e7 100644 --- a/xorg-server/hw/xquartz/GL/indirect.c +++ b/xorg-server/hw/xquartz/GL/indirect.c @@ -643,10 +643,10 @@ __glFloorLog2(GLuint val) static void *opengl_framework_handle; -static glx_gpa_proc +static glx_func_ptr get_proc_address(const char *sym) { - return (glx_gpa_proc) dlsym(opengl_framework_handle, sym); + return (glx_func_ptr) dlsym(opengl_framework_handle, sym); } static void diff --git a/xorg-server/hw/xquartz/X11Application.m b/xorg-server/hw/xquartz/X11Application.m index 1f9b05dd1..2efbd658b 100644 --- a/xorg-server/hw/xquartz/X11Application.m +++ b/xorg-server/hw/xquartz/X11Application.m @@ -70,6 +70,18 @@ xpbproxy_run(void); static dispatch_queue_t eventTranslationQueue; #endif +#ifndef __has_feature +#define __has_feature(x) 0 +#endif + +#ifndef CF_RETURNS_RETAINED +#if __has_feature(attribute_cf_returns_retained) +#define CF_RETURNS_RETAINED __attribute__((cf_returns_retained)) +#else +#define CF_RETURNS_RETAINED +#endif +#endif + extern Bool noTestExtensions; extern Bool noRenderExtension; extern BOOL serverRunning; @@ -526,6 +538,7 @@ cfrelease(CFAllocatorRef a, const void *b) CFRelease(b); } +CF_RETURNS_RETAINED static CFMutableArrayRef nsarray_to_cfarray(NSArray *in) { diff --git a/xorg-server/hw/xquartz/X11Controller.m b/xorg-server/hw/xquartz/X11Controller.m index 752bda35c..5445c6f3a 100644 --- a/xorg-server/hw/xquartz/X11Controller.m +++ b/xorg-server/hw/xquartz/X11Controller.m @@ -934,7 +934,7 @@ extern char *bundle_id_prefix; == NSAlertDefaultReturn) ? NSTerminateNow : NSTerminateCancel; } -- (void) applicationWillTerminate:(NSNotification *)aNotification +- (void) applicationWillTerminate:(NSNotification *)aNotification _X_NORETURN { int remain; [X11App prefs_synchronize]; diff --git a/xorg-server/hw/xquartz/applewm.c b/xorg-server/hw/xquartz/applewm.c index 4409d4bf6..cc91c9608 100644 --- a/xorg-server/hw/xquartz/applewm.c +++ b/xorg-server/hw/xquartz/applewm.c @@ -378,6 +378,13 @@ ProcAppleWMSetWindowMenu(register ClientPtr client) items = malloc(sizeof(char *) * nitems); shortcuts = malloc(sizeof(char) * nitems); + if (!items || !shortcuts) { + free(items); + free(shortcuts); + + return BadAlloc; + } + max_len = (stuff->length << 2) - sizeof(xAppleWMSetWindowMenuReq); bytes = (char *)&stuff[1]; @@ -391,6 +398,15 @@ ProcAppleWMSetWindowMenu(register ClientPtr client) break; } } + + /* Check if we bailed out of the above loop due to a request that was too long */ + if (j < nitems) { + free(items); + free(shortcuts); + + return BadRequest; + } + X11ApplicationSetWindowMenu(nitems, items, shortcuts); free(items); free(shortcuts); diff --git a/xorg-server/hw/xquartz/darwinfb.h b/xorg-server/hw/xquartz/darwinfb.h index 5de360d75..541128b8e 100644 --- a/xorg-server/hw/xquartz/darwinfb.h +++ b/xorg-server/hw/xquartz/darwinfb.h @@ -26,7 +26,7 @@ */ #ifndef _DARWIN_FB_H -#define _DARWIN_DB_H +#define _DARWIN_FB_H #include "scrnintstr.h" diff --git a/xorg-server/hw/xquartz/mach-startup/stub.c b/xorg-server/hw/xquartz/mach-startup/stub.c index b5a3168ca..756e4ef2d 100644 --- a/xorg-server/hw/xquartz/mach-startup/stub.c +++ b/xorg-server/hw/xquartz/mach-startup/stub.c @@ -353,6 +353,10 @@ main(int argc, char **argv, char **envp) newenvp = (string_array_t)calloc((1 + envpc), sizeof(string_t)); if (!newargv || !newenvp) { + /* Silence the clang static analyzer */ + free(newargv); + free(newenvp); + asl_log(aslc, NULL, ASL_LEVEL_ERR, "Xquartz: Memory allocation failure"); return EXIT_FAILURE; diff --git a/xorg-server/hw/xquartz/quartz.c b/xorg-server/hw/xquartz/quartz.c index 5b977c7f9..bc6c8d048 100644 --- a/xorg-server/hw/xquartz/quartz.c +++ b/xorg-server/hw/xquartz/quartz.c @@ -109,11 +109,14 @@ Bool QuartzAddScreen(int index, ScreenPtr pScreen) { + // The clang static analyzer thinks we leak displayInfo here +#ifndef __clang_analyzer__ // allocate space for private per screen Quartz specific storage QuartzScreenPtr displayInfo = calloc(sizeof(QuartzScreenRec), 1); // QUARTZ_PRIV(pScreen) = displayInfo; dixSetPrivate(&pScreen->devPrivates, quartzScreenKey, displayInfo); +#endif /* __clang_analyzer__ */ // do Quartz mode specific initialization return quartzProcs->AddScreen(index, pScreen); diff --git a/xorg-server/hw/xquartz/xpr/appledri.c b/xorg-server/hw/xquartz/xpr/appledri.c index 9aac07240..77574655b 100644 --- a/xorg-server/hw/xquartz/xpr/appledri.c +++ b/xorg-server/hw/xquartz/xpr/appledri.c @@ -123,6 +123,10 @@ ProcAppleDRIQueryDirectRenderingCapable(register ClientPtr client) rep.length = 0; rep.sequenceNumber = client->sequence; + if (stuff->screen >= screenInfo.numScreens) { + return BadValue; + } + if (!DRIQueryDirectRenderingCapable(screenInfo.screens[stuff->screen], &isCapable)) { return BadValue; @@ -402,6 +406,7 @@ SProcAppleDRIQueryDirectRenderingCapable(register ClientPtr client) { REQUEST(xAppleDRIQueryDirectRenderingCapableReq); swaps(&stuff->length); + REQUEST_SIZE_MATCH(xAppleDRIQueryDirectRenderingCapableReq); swapl(&stuff->screen); return ProcAppleDRIQueryDirectRenderingCapable(client); } @@ -411,6 +416,7 @@ SProcAppleDRIAuthConnection(register ClientPtr client) { REQUEST(xAppleDRIAuthConnectionReq); swaps(&stuff->length); + REQUEST_SIZE_MATCH(xAppleDRIAuthConnectionReq); swapl(&stuff->screen); swapl(&stuff->magic); return ProcAppleDRIAuthConnection(client); @@ -421,6 +427,7 @@ SProcAppleDRICreateSurface(register ClientPtr client) { REQUEST(xAppleDRICreateSurfaceReq); swaps(&stuff->length); + REQUEST_SIZE_MATCH(xAppleDRICreateSurfaceReq); swapl(&stuff->screen); swapl(&stuff->drawable); swapl(&stuff->client_id); @@ -432,6 +439,7 @@ SProcAppleDRIDestroySurface(register ClientPtr client) { REQUEST(xAppleDRIDestroySurfaceReq); swaps(&stuff->length); + REQUEST_SIZE_MATCH(xAppleDRIDestroySurfaceReq); swapl(&stuff->screen); swapl(&stuff->drawable); return ProcAppleDRIDestroySurface(client); @@ -442,6 +450,7 @@ SProcAppleDRICreatePixmap(register ClientPtr client) { REQUEST(xAppleDRICreatePixmapReq); swaps(&stuff->length); + REQUEST_SIZE_MATCH(xAppleDRICreatePixmapReq); swapl(&stuff->screen); swapl(&stuff->drawable); return ProcAppleDRICreatePixmap(client); @@ -452,6 +461,7 @@ SProcAppleDRIDestroyPixmap(register ClientPtr client) { REQUEST(xAppleDRIDestroyPixmapReq); swaps(&stuff->length); + REQUEST_SIZE_MATCH(xAppleDRIDestroyPixmapReq); swapl(&stuff->drawable); return ProcAppleDRIDestroyPixmap(client); } diff --git a/xorg-server/hw/xquartz/xpr/x-hook.c b/xorg-server/hw/xquartz/xpr/x-hook.c index b5d8ab90e..3922bb86c 100644 --- a/xorg-server/hw/xquartz/xpr/x-hook.c +++ b/xorg-server/hw/xquartz/xpr/x-hook.c @@ -70,34 +70,19 @@ X_PFX(hook_remove) (x_list * lst, x_hook_function * fun, void *data) { X_EXTERN void X_PFX(hook_run) (x_list * lst, void *arg) { - x_list *node, *cell; - x_hook_function **fun; - void **data; - int length, i; + x_list *node; if (!lst) return; - length = X_PFX(list_length) (lst); - fun = malloc(sizeof(x_hook_function *) * length); - data = malloc(sizeof(void *) * length); - - if (!fun || !data) { - FatalError("Failed to allocate memory in %s\n", __func__); - } + for (node = lst; node != NULL; node = node->next) { + x_list *cell = node->data; - for (i = 0, node = lst; node != NULL; node = node->next, i++) { - cell = node->data; - fun[i] = CELL_FUN(cell); - data[i] = CELL_DATA(cell); - } + x_hook_function *fun = CELL_FUN(cell); + void *data = CELL_DATA(cell); - for (i = 0; i < length; i++) { - (*fun[i])(arg, data[i]); + (*fun)(arg, data); } - - free(fun); - free(data); } X_EXTERN void |