aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormarha <marha@users.sourceforge.net>2010-12-10 19:06:59 +0000
committermarha <marha@users.sourceforge.net>2010-12-10 19:06:59 +0000
commit3a20d23b48c1051e1f22295fd886cc7f643417f6 (patch)
tree5192dddd9ecf591de2e22504f7268c2935382d90
parent531a0d974b98074978535f086a73b6b662fa0cea (diff)
downloadvcxsrv-3a20d23b48c1051e1f22295fd886cc7f643417f6.tar.gz
vcxsrv-3a20d23b48c1051e1f22295fd886cc7f643417f6.tar.bz2
vcxsrv-3a20d23b48c1051e1f22295fd886cc7f643417f6.zip
xserver git update 10/12/2010
-rw-r--r--xorg-server/COPYING2
-rw-r--r--xorg-server/composite/compalloc.c2
-rw-r--r--xorg-server/composite/compext.c2
-rw-r--r--xorg-server/composite/compinit.c2
-rw-r--r--xorg-server/composite/compint.h2
-rw-r--r--xorg-server/composite/compoverlay.c2
-rw-r--r--xorg-server/composite/compwindow.c2
-rw-r--r--xorg-server/config/hal.c13
-rw-r--r--xorg-server/config/udev.c14
-rw-r--r--xorg-server/configure.ac4
-rw-r--r--xorg-server/dix/Xserver-dtrace.h.in188
-rw-r--r--xorg-server/dix/Xserver.d116
-rw-r--r--xorg-server/dix/deprecated.c330
-rw-r--r--xorg-server/dix/devices.c17
-rw-r--r--xorg-server/dix/dispatch.c2
-rw-r--r--xorg-server/dix/dixfonts.c4
-rw-r--r--xorg-server/dix/events.c2
-rw-r--r--xorg-server/dix/resource.c2
-rw-r--r--xorg-server/doc/Xserver.man.pre584
-rw-r--r--xorg-server/fb/fbcmap_mi.c248
-rw-r--r--xorg-server/hw/dmx/Makefile.am234
-rw-r--r--xorg-server/hw/dmx/dmx.c10
-rw-r--r--xorg-server/hw/dmx/dmxextension.c14
-rw-r--r--xorg-server/hw/dmx/dmxgcops.c10
-rw-r--r--xorg-server/hw/dmx/dmxpict.c54
-rw-r--r--xorg-server/hw/dmx/dmxwindow.c10
-rw-r--r--xorg-server/hw/dmx/glxProxy/glxcmds.c182
-rw-r--r--xorg-server/hw/dmx/glxProxy/glxext.c6
-rw-r--r--xorg-server/hw/xfree86/common/Makefile.am4
-rw-r--r--xorg-server/hw/xfree86/common/xf86AutoConfig.c4
-rw-r--r--xorg-server/hw/xfree86/common/xf86Config.c13
-rw-r--r--xorg-server/hw/xfree86/common/xf86Configure.c33
-rw-r--r--xorg-server/hw/xfree86/common/xf86Helper.c15
-rw-r--r--xorg-server/hw/xfree86/common/xf86Init.c3
-rw-r--r--xorg-server/hw/xfree86/common/xf86Option.c5
-rw-r--r--xorg-server/hw/xfree86/common/xf86ShowOpts.c10
-rw-r--r--xorg-server/hw/xfree86/common/xf86pciBus.c4
-rw-r--r--xorg-server/hw/xfree86/common/xf86sbusBus.c6
-rw-r--r--xorg-server/hw/xfree86/dixmods/extmod/modinit.c5
-rw-r--r--xorg-server/hw/xfree86/dri/dri.c7
-rw-r--r--xorg-server/hw/xfree86/loader/loadmod.c18
-rw-r--r--xorg-server/hw/xfree86/loader/sdksyms.sh1
-rw-r--r--xorg-server/hw/xfree86/modes/xf86Crtc.c8
-rw-r--r--xorg-server/hw/xfree86/modes/xf86Modes.c4
-rw-r--r--xorg-server/hw/xfree86/modes/xf86cvt.c594
-rw-r--r--xorg-server/hw/xfree86/os-support/solaris/solaris-amd64.S134
-rw-r--r--xorg-server/hw/xfree86/os-support/solaris/solaris-ia32.S134
-rw-r--r--xorg-server/hw/xfree86/os-support/solaris/solaris-sparcv8plus.S276
-rw-r--r--xorg-server/hw/xfree86/os-support/solaris/sun_VTsw.c2
-rw-r--r--xorg-server/hw/xfree86/os-support/solaris/sun_agp.c2
-rw-r--r--xorg-server/hw/xfree86/os-support/solaris/sun_apm.c452
-rw-r--r--xorg-server/hw/xfree86/os-support/solaris/sun_bell.c2
-rw-r--r--xorg-server/hw/xfree86/os-support/solaris/sun_vid.c2
-rw-r--r--xorg-server/hw/xfree86/parser/Flags.c13
-rw-r--r--xorg-server/hw/xfree86/parser/Makefile.am101
-rw-r--r--xorg-server/hw/xfree86/parser/Pointer.c470
-rw-r--r--xorg-server/hw/xfree86/ramdac/Makefile.am38
-rw-r--r--xorg-server/hw/xfree86/utils/cvt/Makefile.am81
-rw-r--r--xorg-server/hw/xfree86/utils/cvt/cvt.c582
-rw-r--r--xorg-server/hw/xfree86/utils/gtf/Makefile.am88
-rw-r--r--xorg-server/hw/xfree86/vbe/vbeModes.c4
-rw-r--r--xorg-server/hw/xfree86/xaa/Makefile.am52
-rw-r--r--xorg-server/hw/xwin/win.h7
-rw-r--r--xorg-server/hw/xwin/windialogs.c5
-rw-r--r--xorg-server/hw/xwin/winerror.c24
-rw-r--r--xorg-server/include/Makefile.am1
-rw-r--r--xorg-server/include/Xprintf.h69
-rw-r--r--xorg-server/include/dix-config.h.in3
-rw-r--r--xorg-server/include/os.h13
-rw-r--r--xorg-server/mi/micmap.c2
-rw-r--r--xorg-server/os/access.c2
-rw-r--r--xorg-server/os/log.c12
-rw-r--r--xorg-server/os/xprintf.c170
-rw-r--r--xorg-server/render/render.c8
-rw-r--r--xorg-server/xfixes/cursor.c2
-rw-r--r--xorg-server/xfixes/xfixes.c2
-rw-r--r--xorg-server/xfixes/xfixesint.h2
-rw-r--r--xorg-server/xkb/ddxList.c43
-rw-r--r--xorg-server/xkb/ddxLoad.c19
79 files changed, 2652 insertions, 2957 deletions
diff --git a/xorg-server/COPYING b/xorg-server/COPYING
index 16b719376..f59f9f956 100644
--- a/xorg-server/COPYING
+++ b/xorg-server/COPYING
@@ -15,11 +15,11 @@ Copyright © 2006 Nokia Corporation
Copyright © 2006-2008 Peter Hutterer
Copyright © 2006 Adam Jackson
Copyright © 2009-2010 NVIDIA Corporation
+Copyright © 1987, 2003-2006, 2008-2010 Oracle and/or its affiliates.
Copyright © 1999 Keith Packard
Copyright © 2007-2009 Red Hat, Inc.
Copyright © 2005-2008 Daniel Stone
Copyright © 2006-2009 Simon Thum
-Copyright © 1987, 2003-2006, 2008-2009 Sun Microsystems, Inc.
Copyright © 2006 Luc Verhaegen
Permission is hereby granted, free of charge, to any person obtaining a
diff --git a/xorg-server/composite/compalloc.c b/xorg-server/composite/compalloc.c
index 293a9fe14..4d0d4ad1c 100644
--- a/xorg-server/composite/compalloc.c
+++ b/xorg-server/composite/compalloc.c
@@ -1,5 +1,5 @@
/*
- * Copyright © 2006 Sun Microsystems, Inc. All rights reserved.
+ * Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
diff --git a/xorg-server/composite/compext.c b/xorg-server/composite/compext.c
index 2ee6f1259..d6f26d688 100644
--- a/xorg-server/composite/compext.c
+++ b/xorg-server/composite/compext.c
@@ -1,5 +1,5 @@
/*
- * Copyright © 2006 Sun Microsystems, Inc. All rights reserved.
+ * Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
diff --git a/xorg-server/composite/compinit.c b/xorg-server/composite/compinit.c
index d3910c4b4..98b8d0565 100644
--- a/xorg-server/composite/compinit.c
+++ b/xorg-server/composite/compinit.c
@@ -1,5 +1,5 @@
/*
- * Copyright © 2006 Sun Microsystems, Inc. All rights reserved.
+ * Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
diff --git a/xorg-server/composite/compint.h b/xorg-server/composite/compint.h
index f78884985..a85d62faa 100644
--- a/xorg-server/composite/compint.h
+++ b/xorg-server/composite/compint.h
@@ -1,5 +1,5 @@
/*
- * Copyright © 2006 Sun Microsystems, Inc. All rights reserved.
+ * Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
diff --git a/xorg-server/composite/compoverlay.c b/xorg-server/composite/compoverlay.c
index 2d81aeb95..55ce3145b 100644
--- a/xorg-server/composite/compoverlay.c
+++ b/xorg-server/composite/compoverlay.c
@@ -1,5 +1,5 @@
/*
- * Copyright © 2006 Sun Microsystems, Inc. All rights reserved.
+ * Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
diff --git a/xorg-server/composite/compwindow.c b/xorg-server/composite/compwindow.c
index 539c1aa23..11df8b39d 100644
--- a/xorg-server/composite/compwindow.c
+++ b/xorg-server/composite/compwindow.c
@@ -1,5 +1,5 @@
/*
- * Copyright © 2006 Sun Microsystems, Inc. All rights reserved.
+ * Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
diff --git a/xorg-server/config/hal.c b/xorg-server/config/hal.c
index dab35ddf7..2aff6f9fd 100644
--- a/xorg-server/config/hal.c
+++ b/xorg-server/config/hal.c
@@ -63,10 +63,8 @@ device_removed(LibHalContext *ctx, const char *udi)
{
char *value;
- value = malloc(strlen(udi) + 5); /* "hal:" + NULL */
- if (!value)
+ if (asprintf (&value, "hal:%s", udi) == -1)
return;
- sprintf(value, "hal:%s", udi);
remove_devices("hal", value);
@@ -200,7 +198,9 @@ device_added(LibHalContext *hal_ctx, const char *udi)
"config/hal: getting usb.product_id on %s "
"returned %04x\n", parent, usb_product);
if (usb_vendor && usb_product)
- attrs.usb_id = Xprintf("%04x:%04x", usb_vendor, usb_product);
+ if (asprintf(&attrs.usb_id, "%04x:%04x", usb_vendor, usb_product)
+ == -1)
+ attrs.usb_id = NULL;
free(parent);
}
@@ -226,12 +226,11 @@ device_added(LibHalContext *hal_ctx, const char *udi)
add_option(&options, "driver", driver);
add_option(&options, "name", name);
- config_info = malloc(strlen(udi) + 5); /* "hal:" and NULL */
- if (!config_info) {
+ if (asprintf (&config_info, "hal:%s", udi) == -1) {
+ config_info = NULL;
LogMessage(X_ERROR, "config/hal: couldn't allocate name\n");
goto unwind;
}
- sprintf(config_info, "hal:%s", udi);
/* Check for duplicate devices */
if (device_is_duplicate(config_info))
diff --git a/xorg-server/config/udev.c b/xorg-server/config/udev.c
index 88222bb01..43e653d2b 100644
--- a/xorg-server/config/udev.c
+++ b/xorg-server/config/udev.c
@@ -108,8 +108,10 @@ device_added(struct udev_device *udev_device)
/* construct USB ID in lowercase hex - "0000:ffff" */
if (product && sscanf(product, "%*x/%4x/%4x/%*x", &usb_vendor, &usb_model) == 2) {
- attrs.usb_id = Xprintf("%04x:%04x", usb_vendor, usb_model);
- if (attrs.usb_id)
+ if (asprintf(&attrs.usb_id, "%04x:%04x", usb_vendor, usb_model)
+ == -1)
+ attrs.usb_id = NULL;
+ else
LOG_PROPERTY(path, "PRODUCT", product);
}
}
@@ -127,9 +129,10 @@ device_added(struct udev_device *udev_device)
LOG_PROPERTY(path, "ID_INPUT.tags", tags_prop);
attrs.tags = xstrtokenize(tags_prop, ",");
- config_info = Xprintf("udev:%s", syspath);
- if (!config_info)
+ if (asprintf(&config_info, "udev:%s", syspath) == -1) {
+ config_info = NULL;
goto unwind;
+ }
if (device_is_duplicate(config_info)) {
LogMessage(X_WARNING, "config/udev: device %s already added. "
@@ -217,8 +220,7 @@ device_removed(struct udev_device *device)
char *value;
const char *syspath = udev_device_get_syspath(device);
- value = Xprintf("udev:%s", syspath);
- if (!value)
+ if (asprintf(&value, "udev:%s", syspath) == -1)
return;
remove_devices("udev", value);
diff --git a/xorg-server/configure.ac b/xorg-server/configure.ac
index ea2803795..1e0820479 100644
--- a/xorg-server/configure.ac
+++ b/xorg-server/configure.ac
@@ -203,7 +203,7 @@ dnl Checks for library functions.
AC_FUNC_VPRINTF
AC_CHECK_FUNCS([geteuid getuid link memmove memset mkstemp strchr strrchr \
strtol getopt getopt_long vsnprintf walkcontext backtrace \
- getisax getzoneid shmctl64 strcasestr ffs])
+ getisax getzoneid shmctl64 strcasestr ffs vasprintf])
AC_FUNC_ALLOCA
dnl Old HAS_* names used in os/*.c.
AC_CHECK_FUNC([getdtablesize],
@@ -1888,7 +1888,7 @@ if test "x$XWIN" = xyes; then
XWIN_SYS_LIBS=-lwinsock2
;;
esac
- XWIN_LIBS="$FB_LIB $MI_LIB $FIXES_LIB $XEXT_LIB $CONFIG_LIB $RANDR_LIB $DBE_LIB $RECORD_LIB $GLX_LIBS $XKB_LIB $XKB_STUB_LIB $COMPOSITE_LIB $DAMAGE_LIB $MIEXT_SYNC_LIB $MIEXT_DAMAGE_LIB $MIEXT_SHADOW_LIB $XI_LIB $OS_LIB"
+ XWIN_LIBS="$FB_LIB $MI_LIB $FIXES_LIB $XEXT_LIB $RANDR_LIB $RENDER_LIB $DBE_LIB $RECORD_LIB $GLX_LIBS $XKB_LIB $XKB_STUB_LIB $COMPOSITE_LIB $DAMAGE_LIB $MIEXT_SYNC_LIB $MIEXT_DAMAGE_LIB $MIEXT_SHADOW_LIB $XI_LIB $OS_LIB"
XWIN_SYS_LIBS="$XWIN_SYS_LIBS $XWINMODULES_LIBS"
AC_SUBST(XWIN_LIBS)
AC_SUBST(XWIN_SERVER_NAME)
diff --git a/xorg-server/dix/Xserver-dtrace.h.in b/xorg-server/dix/Xserver-dtrace.h.in
index fce28362a..dc9419b0d 100644
--- a/xorg-server/dix/Xserver-dtrace.h.in
+++ b/xorg-server/dix/Xserver-dtrace.h.in
@@ -1,94 +1,94 @@
-/* Copyright 2006 Sun Microsystems, Inc. All rights reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice (including the next
- * paragraph) shall be included in all copies or substantial portions of the
- * Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
- * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
- * DEALINGS IN THE SOFTWARE.
- */
-
-/*
- * Generated by dtrace(1M), and then modified for backwards compatibility
- * with older versions of dtrace. Used if dtrace -h fails.
- * (Since _ENABLED support was added after dtrace -h, this assumes if
- * dtrace -h fails, _ENABLED will too.)
- */
-
-#ifndef _XSERVER_DTRACE_H
-#define _XSERVER_DTRACE_H
-
-#include <unistd.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#if _DTRACE_VERSION
-
-#define XSERVER_CLIENT_AUTH(arg0, arg1, arg2, arg3) \
- __dtrace_Xserver___client__auth(arg0, arg1, arg2, arg3)
-#define XSERVER_CLIENT_CONNECT(arg0, arg1) \
- __dtrace_Xserver___client__connect(arg0, arg1)
-#define XSERVER_CLIENT_DISCONNECT(arg0) \
- __dtrace_Xserver___client__disconnect(arg0)
-#define XSERVER_REQUEST_DONE(arg0, arg1, arg2, arg3, arg4) \
- __dtrace_Xserver___request__done(arg0, arg1, arg2, arg3, arg4)
-#define XSERVER_REQUEST_START(arg0, arg1, arg2, arg3, arg4) \
- __dtrace_Xserver___request__start(arg0, arg1, arg2, arg3, arg4)
-#define XSERVER_RESOURCE_ALLOC(arg0, arg1, arg2, arg3) \
- __dtrace_Xserver___resource__alloc(arg0, arg1, arg2, arg3)
-#define XSERVER_RESOURCE_FREE(arg0, arg1, arg2, arg3) \
- __dtrace_Xserver___resource__free(arg0, arg1, arg2, arg3)
-#define XSERVER_SEND_EVENT(arg0, arg1, arg2) \
- __dtrace_Xserver___send__event(arg0, arg1, arg2)
-
-
-extern void __dtrace_Xserver___client__auth(int, string, pid_t, zoneid_t);
-extern void __dtrace_Xserver___client__connect(int, int);
-extern void __dtrace_Xserver___client__disconnect(int);
-extern void __dtrace_Xserver___request__done(string, uint8_t, uint32_t, int, int);
-extern void __dtrace_Xserver___request__start(string, uint8_t, uint16_t, int, void *);
-extern void __dtrace_Xserver___resource__alloc(uint32_t, uint32_t, void *, string);
-extern void __dtrace_Xserver___resource__free(uint32_t, uint32_t, void *, string);
-extern void __dtrace_Xserver___send__event(int, uint8_t, void *);
-
-#else
-
-#define XSERVER_CLIENT_AUTH(arg0, arg1, arg2, arg3)
-#define XSERVER_CLIENT_CONNECT(arg0, arg1)
-#define XSERVER_CLIENT_DISCONNECT(arg0)
-#define XSERVER_REQUEST_DONE(arg0, arg1, arg2, arg3, arg4)
-#define XSERVER_REQUEST_START(arg0, arg1, arg2, arg3, arg4)
-#define XSERVER_RESOURCE_ALLOC(arg0, arg1, arg2, arg3)
-#define XSERVER_RESOURCE_FREE(arg0, arg1, arg2, arg3)
-#define XSERVER_SEND_EVENT(arg0, arg1, arg2)
-
-#endif
-
-#define XSERVER_CLIENT_AUTH_ENABLED() (1)
-#define XSERVER_CLIENT_CONNECT_ENABLED() (1)
-#define XSERVER_CLIENT_DISCONNECT_ENABLED() (1)
-#define XSERVER_REQUEST_DONE_ENABLED() (1)
-#define XSERVER_REQUEST_START_ENABLED() (1)
-#define XSERVER_RESOURCE_ALLOC_ENABLED() (1)
-#define XSERVER_RESOURCE_FREE_ENABLED() (1)
-#define XSERVER_SEND_EVENT_ENABLED() (1)
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _XSERVER_DTRACE_H */
+/* Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ */
+
+/*
+ * Generated by dtrace(1M), and then modified for backwards compatibility
+ * with older versions of dtrace. Used if dtrace -h fails.
+ * (Since _ENABLED support was added after dtrace -h, this assumes if
+ * dtrace -h fails, _ENABLED will too.)
+ */
+
+#ifndef _XSERVER_DTRACE_H
+#define _XSERVER_DTRACE_H
+
+#include <unistd.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#if _DTRACE_VERSION
+
+#define XSERVER_CLIENT_AUTH(arg0, arg1, arg2, arg3) \
+ __dtrace_Xserver___client__auth(arg0, arg1, arg2, arg3)
+#define XSERVER_CLIENT_CONNECT(arg0, arg1) \
+ __dtrace_Xserver___client__connect(arg0, arg1)
+#define XSERVER_CLIENT_DISCONNECT(arg0) \
+ __dtrace_Xserver___client__disconnect(arg0)
+#define XSERVER_REQUEST_DONE(arg0, arg1, arg2, arg3, arg4) \
+ __dtrace_Xserver___request__done(arg0, arg1, arg2, arg3, arg4)
+#define XSERVER_REQUEST_START(arg0, arg1, arg2, arg3, arg4) \
+ __dtrace_Xserver___request__start(arg0, arg1, arg2, arg3, arg4)
+#define XSERVER_RESOURCE_ALLOC(arg0, arg1, arg2, arg3) \
+ __dtrace_Xserver___resource__alloc(arg0, arg1, arg2, arg3)
+#define XSERVER_RESOURCE_FREE(arg0, arg1, arg2, arg3) \
+ __dtrace_Xserver___resource__free(arg0, arg1, arg2, arg3)
+#define XSERVER_SEND_EVENT(arg0, arg1, arg2) \
+ __dtrace_Xserver___send__event(arg0, arg1, arg2)
+
+
+extern void __dtrace_Xserver___client__auth(int, string, pid_t, zoneid_t);
+extern void __dtrace_Xserver___client__connect(int, int);
+extern void __dtrace_Xserver___client__disconnect(int);
+extern void __dtrace_Xserver___request__done(string, uint8_t, uint32_t, int, int);
+extern void __dtrace_Xserver___request__start(string, uint8_t, uint16_t, int, void *);
+extern void __dtrace_Xserver___resource__alloc(uint32_t, uint32_t, void *, string);
+extern void __dtrace_Xserver___resource__free(uint32_t, uint32_t, void *, string);
+extern void __dtrace_Xserver___send__event(int, uint8_t, void *);
+
+#else
+
+#define XSERVER_CLIENT_AUTH(arg0, arg1, arg2, arg3)
+#define XSERVER_CLIENT_CONNECT(arg0, arg1)
+#define XSERVER_CLIENT_DISCONNECT(arg0)
+#define XSERVER_REQUEST_DONE(arg0, arg1, arg2, arg3, arg4)
+#define XSERVER_REQUEST_START(arg0, arg1, arg2, arg3, arg4)
+#define XSERVER_RESOURCE_ALLOC(arg0, arg1, arg2, arg3)
+#define XSERVER_RESOURCE_FREE(arg0, arg1, arg2, arg3)
+#define XSERVER_SEND_EVENT(arg0, arg1, arg2)
+
+#endif
+
+#define XSERVER_CLIENT_AUTH_ENABLED() (1)
+#define XSERVER_CLIENT_CONNECT_ENABLED() (1)
+#define XSERVER_CLIENT_DISCONNECT_ENABLED() (1)
+#define XSERVER_REQUEST_DONE_ENABLED() (1)
+#define XSERVER_REQUEST_START_ENABLED() (1)
+#define XSERVER_RESOURCE_ALLOC_ENABLED() (1)
+#define XSERVER_RESOURCE_FREE_ENABLED() (1)
+#define XSERVER_SEND_EVENT_ENABLED() (1)
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _XSERVER_DTRACE_H */
diff --git a/xorg-server/dix/Xserver.d b/xorg-server/dix/Xserver.d
index 4bc0b9a84..6584ece52 100644
--- a/xorg-server/dix/Xserver.d
+++ b/xorg-server/dix/Xserver.d
@@ -1,58 +1,58 @@
-/* Copyright 2005-2006 Sun Microsystems, Inc. All rights reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice (including the next
- * paragraph) shall be included in all copies or substantial portions of the
- * Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
- * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
- * DEALINGS IN THE SOFTWARE.
- */
-
-/*
- * Xserver dtrace provider definition
- */
-#ifdef __APPLE__
-#define string char *
-#define pid_t uint32_t
-#define zoneid_t uint32_t
-#else
-#include <sys/types.h>
-#endif
-
-provider Xserver {
- /* reqType, data, length, client id, request buffer */
- probe request__start(string, uint8_t, uint16_t, int, void *);
- /* reqType, data, sequence, client id, result */
- probe request__done(string, uint8_t, uint32_t, int, int);
- /* client id, client fd */
- probe client__connect(int, int);
- /* client id, client address, client pid, client zone id */
- probe client__auth(int, string, pid_t, zoneid_t);
- /* client id */
- probe client__disconnect(int);
- /* resource id, resource type, value, resource type name */
- probe resource__alloc(uint32_t, uint32_t, void *, string);
- /* resource id, resource type, value, resource type name */
- probe resource__free(uint32_t, uint32_t, void *, string);
- /* client id, event type, event* */
- probe send__event(int, uint8_t, void *);
-};
-
-#pragma D attributes Unstable/Unstable/Common provider Xserver provider
-#pragma D attributes Private/Private/Unknown provider Xserver module
-#pragma D attributes Private/Private/Unknown provider Xserver function
-#pragma D attributes Unstable/Unstable/Common provider Xserver name
-#pragma D attributes Unstable/Unstable/Common provider Xserver args
-
+/* Copyright (c) 2005-2006, Oracle and/or its affiliates. All rights reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ */
+
+/*
+ * Xserver dtrace provider definition
+ */
+#ifdef __APPLE__
+#define string char *
+#define pid_t uint32_t
+#define zoneid_t uint32_t
+#else
+#include <sys/types.h>
+#endif
+
+provider Xserver {
+ /* reqType, data, length, client id, request buffer */
+ probe request__start(string, uint8_t, uint16_t, int, void *);
+ /* reqType, data, sequence, client id, result */
+ probe request__done(string, uint8_t, uint32_t, int, int);
+ /* client id, client fd */
+ probe client__connect(int, int);
+ /* client id, client address, client pid, client zone id */
+ probe client__auth(int, string, pid_t, zoneid_t);
+ /* client id */
+ probe client__disconnect(int);
+ /* resource id, resource type, value, resource type name */
+ probe resource__alloc(uint32_t, uint32_t, void *, string);
+ /* resource id, resource type, value, resource type name */
+ probe resource__free(uint32_t, uint32_t, void *, string);
+ /* client id, event type, event* */
+ probe send__event(int, uint8_t, void *);
+};
+
+#pragma D attributes Unstable/Unstable/Common provider Xserver provider
+#pragma D attributes Private/Private/Unknown provider Xserver module
+#pragma D attributes Private/Private/Unknown provider Xserver function
+#pragma D attributes Unstable/Unstable/Common provider Xserver name
+#pragma D attributes Unstable/Unstable/Common provider Xserver args
+
diff --git a/xorg-server/dix/deprecated.c b/xorg-server/dix/deprecated.c
index 21d0f574d..b1f4d6c5c 100644
--- a/xorg-server/dix/deprecated.c
+++ b/xorg-server/dix/deprecated.c
@@ -1,165 +1,165 @@
-/***********************************************************
-
-Copyright 1987, 1998 The Open Group
-
-Permission to use, copy, modify, distribute, and sell this software and its
-documentation for any purpose is hereby granted without fee, provided that
-the above copyright notice appear in all copies and that both that
-copyright notice and this permission notice appear in supporting
-documentation.
-
-The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
-AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
-CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-Except as contained in this notice, the name of The Open Group shall not be
-used in advertising or otherwise to promote the sale, use or other dealings
-in this Software without prior written authorization from The Open Group.
-
-
-Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
-
- All Rights Reserved
-
-Permission to use, copy, modify, and distribute this software and its
-documentation for any purpose and without fee is hereby granted,
-provided that the above copyright notice appear in all copies and that
-both that copyright notice and this permission notice appear in
-supporting documentation, and that the name of Digital not be
-used in advertising or publicity pertaining to distribution of the
-software without specific, written prior permission.
-
-DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
-ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
-DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
-ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
-WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
-ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
-SOFTWARE.
-
-******************************************************************/
-
-#ifdef HAVE_DIX_CONFIG_H
-#include <dix-config.h>
-#endif
-
-#include "dix.h"
-#include "misc.h"
-#include "dixstruct.h"
-
-/*
- * These are deprecated compatibility functions and will be marked as such
- * and removed soon!
- *
- * Please use the noted replacements instead.
- */
-
-/* replaced by dixLookupWindow */
-WindowPtr
-SecurityLookupWindow(XID id, ClientPtr client, Mask access_mode)
-{
- WindowPtr pWin;
- int i = dixLookupWindow(&pWin, id, client, access_mode);
- static int warn = 1;
- if (warn > 0 && --warn)
- ErrorF("Warning: LookupWindow()/SecurityLookupWindow() "
- "are deprecated. Please convert your driver/module "
- "to use dixLookupWindow().\n");
- return (i == Success) ? pWin : NULL;
-}
-
-/* replaced by dixLookupWindow */
-WindowPtr
-LookupWindow(XID id, ClientPtr client)
-{
- return SecurityLookupWindow(id, client, DixUnknownAccess);
-}
-
-/* replaced by dixLookupDrawable */
-pointer
-SecurityLookupDrawable(XID id, ClientPtr client, Mask access_mode)
-{
- DrawablePtr pDraw;
- int i = dixLookupDrawable(&pDraw, id, client, M_DRAWABLE, access_mode);
- static int warn = 1;
- if (warn > 0 && --warn)
- ErrorF("Warning: LookupDrawable()/SecurityLookupDrawable() "
- "are deprecated. Please convert your driver/module "
- "to use dixLookupDrawable().\n");
- return (i == Success) ? pDraw : NULL;
-}
-
-/* replaced by dixLookupDrawable */
-pointer
-LookupDrawable(XID id, ClientPtr client)
-{
- return SecurityLookupDrawable(id, client, DixUnknownAccess);
-}
-
-/* replaced by dixLookupClient */
-ClientPtr
-LookupClient(XID id, ClientPtr client)
-{
- ClientPtr pClient;
- int i = dixLookupClient(&pClient, id, client, DixUnknownAccess);
- static int warn = 1;
- if (warn > 0 && --warn)
- ErrorF("Warning: LookupClient() is deprecated. Please convert your "
- "driver/module to use dixLookupClient().\n");
- return (i == Success) ? pClient : NULL;
-}
-
-/* replaced by dixLookupResourceByType */
-pointer
-SecurityLookupIDByType(ClientPtr client, XID id, RESTYPE rtype,
- Mask access_mode)
-{
- pointer retval;
- int i = dixLookupResourceByType(&retval, id, rtype, client, access_mode);
- static int warn = 1;
- if (warn > 0 && --warn)
- ErrorF("Warning: LookupIDByType()/SecurityLookupIDByType() "
- "are deprecated. Please convert your driver/module "
- "to use dixLookupResourceByType().\n");
- return (i == Success) ? retval : NULL;
-}
-
-pointer
-SecurityLookupIDByClass(ClientPtr client, XID id, RESTYPE classes,
- Mask access_mode)
-{
- pointer retval;
- int i = dixLookupResourceByClass(&retval, id, classes, client, access_mode);
- static int warn = 1;
- if (warn > 0 && --warn)
- ErrorF("Warning: LookupIDByClass()/SecurityLookupIDByClass() "
- "are deprecated. Please convert your driver/module "
- "to use dixLookupResourceByClass().\n");
- return (i == Success) ? retval : NULL;
-}
-
-/* replaced by dixLookupResourceByType */
-pointer
-LookupIDByType(XID id, RESTYPE rtype)
-{
- pointer val;
- dixLookupResourceByType(&val, id, rtype, NullClient, DixUnknownAccess);
- return val;
-}
-
-/* replaced by dixLookupResourceByClass */
-pointer
-LookupIDByClass(XID id, RESTYPE classes)
-{
- pointer val;
- dixLookupResourceByClass(&val, id, classes, NullClient, DixUnknownAccess);
- return val;
-}
-
-/* end deprecated functions */
+/***********************************************************
+
+Copyright 1987, 1998 The Open Group
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+
+Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
+
+ All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the name of Digital not be
+used in advertising or publicity pertaining to distribution of the
+software without specific, written prior permission.
+
+DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
+ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+
+******************************************************************/
+
+#ifdef HAVE_DIX_CONFIG_H
+#include <dix-config.h>
+#endif
+
+#include "dix.h"
+#include "misc.h"
+#include "dixstruct.h"
+
+/*
+ * These are deprecated compatibility functions and will be marked as such
+ * and removed soon!
+ *
+ * Please use the noted replacements instead.
+ */
+
+/* replaced by dixLookupWindow */
+WindowPtr
+SecurityLookupWindow(XID id, ClientPtr client, Mask access_mode)
+{
+ WindowPtr pWin;
+ static int warn = 1;
+ dixLookupWindow(&pWin, id, client, access_mode);
+ if (warn > 0 && warn--)
+ ErrorF("Warning: LookupWindow()/SecurityLookupWindow() "
+ "are deprecated. Please convert your driver/module "
+ "to use dixLookupWindow().\n");
+ return pWin;
+}
+
+/* replaced by dixLookupWindow */
+WindowPtr
+LookupWindow(XID id, ClientPtr client)
+{
+ return SecurityLookupWindow(id, client, DixUnknownAccess);
+}
+
+/* replaced by dixLookupDrawable */
+pointer
+SecurityLookupDrawable(XID id, ClientPtr client, Mask access_mode)
+{
+ DrawablePtr pDraw;
+ static int warn = 1;
+ dixLookupDrawable(&pDraw, id, client, M_DRAWABLE, access_mode);
+ if (warn > 0 && warn--)
+ ErrorF("Warning: LookupDrawable()/SecurityLookupDrawable() "
+ "are deprecated. Please convert your driver/module "
+ "to use dixLookupDrawable().\n");
+ return pDraw;
+}
+
+/* replaced by dixLookupDrawable */
+pointer
+LookupDrawable(XID id, ClientPtr client)
+{
+ return SecurityLookupDrawable(id, client, DixUnknownAccess);
+}
+
+/* replaced by dixLookupClient */
+ClientPtr
+LookupClient(XID id, ClientPtr client)
+{
+ ClientPtr pClient;
+ static int warn = 1;
+ dixLookupClient(&pClient, id, client, DixUnknownAccess);
+ if (warn > 0 && warn--)
+ ErrorF("Warning: LookupClient() is deprecated. Please convert your "
+ "driver/module to use dixLookupClient().\n");
+ return pClient;
+}
+
+/* replaced by dixLookupResourceByType */
+pointer
+SecurityLookupIDByType(ClientPtr client, XID id, RESTYPE rtype,
+ Mask access_mode)
+{
+ pointer retval;
+ static int warn = 1;
+ dixLookupResourceByType(&retval, id, rtype, client, access_mode);
+ if (warn > 0 && warn--)
+ ErrorF("Warning: LookupIDByType()/SecurityLookupIDByType() "
+ "are deprecated. Please convert your driver/module "
+ "to use dixLookupResourceByType().\n");
+ return retval;
+}
+
+pointer
+SecurityLookupIDByClass(ClientPtr client, XID id, RESTYPE classes,
+ Mask access_mode)
+{
+ pointer retval;
+ static int warn = 1;
+ dixLookupResourceByClass(&retval, id, classes, client, access_mode);
+ if (warn > 0 && warn--)
+ ErrorF("Warning: LookupIDByClass()/SecurityLookupIDByClass() "
+ "are deprecated. Please convert your driver/module "
+ "to use dixLookupResourceByClass().\n");
+ return retval;
+}
+
+/* replaced by dixLookupResourceByType */
+pointer
+LookupIDByType(XID id, RESTYPE rtype)
+{
+ pointer val;
+ dixLookupResourceByType(&val, id, rtype, NullClient, DixUnknownAccess);
+ return val;
+}
+
+/* replaced by dixLookupResourceByClass */
+pointer
+LookupIDByClass(XID id, RESTYPE classes)
+{
+ pointer val;
+ dixLookupResourceByClass(&val, id, classes, NullClient, DixUnknownAccess);
+ return val;
+}
+
+/* end deprecated functions */
diff --git a/xorg-server/dix/devices.c b/xorg-server/dix/devices.c
index c1b04a8e6..08eb6c1cd 100644
--- a/xorg-server/dix/devices.c
+++ b/xorg-server/dix/devices.c
@@ -2524,9 +2524,11 @@ AllocDevicePair (ClientPtr client, char* name,
if (!pointer)
return BadAlloc;
- pointer->name = calloc(strlen(name) + strlen(" pointer") + 1, sizeof(char));
- strcpy(pointer->name, name);
- strcat(pointer->name, " pointer");
+ if (asprintf(&pointer->name, "%s pointer", name) == -1) {
+ pointer->name = NULL;
+ RemoveDevice(pointer, FALSE);
+ return BadAlloc;
+ }
pointer->public.processInputProc = ProcessOtherEvent;
pointer->public.realInputProc = ProcessOtherEvent;
@@ -2547,9 +2549,12 @@ AllocDevicePair (ClientPtr client, char* name,
return BadAlloc;
}
- keyboard->name = calloc(strlen(name) + strlen(" keyboard") + 1, sizeof(char));
- strcpy(keyboard->name, name);
- strcat(keyboard->name, " keyboard");
+ if (asprintf(&keyboard->name, "%s keyboard", name) == -1) {
+ keyboard->name = NULL;
+ RemoveDevice(keyboard, FALSE);
+ RemoveDevice(pointer, FALSE);
+ return BadAlloc;
+ }
keyboard->public.processInputProc = ProcessOtherEvent;
keyboard->public.realInputProc = ProcessOtherEvent;
diff --git a/xorg-server/dix/dispatch.c b/xorg-server/dix/dispatch.c
index b321e995b..2474c2f3b 100644
--- a/xorg-server/dix/dispatch.c
+++ b/xorg-server/dix/dispatch.c
@@ -75,7 +75,7 @@ Equipment Corporation.
******************************************************************/
/* XSERVER_DTRACE additions:
- * Copyright 2005-2006 Sun Microsystems, Inc. All rights reserved.
+ * Copyright (c) 2005-2006, Oracle and/or its affiliates. All rights reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
diff --git a/xorg-server/dix/dixfonts.c b/xorg-server/dix/dixfonts.c
index bd62cc890..e249e6f55 100644
--- a/xorg-server/dix/dixfonts.c
+++ b/xorg-server/dix/dixfonts.c
@@ -1817,7 +1817,9 @@ SetDefaultFontPath(char *path)
start = end;
}
if (!start) {
- temp_path = Xprintf("%s%sbuilt-ins", path, *path ? "," : "");
+ if (asprintf(&temp_path, "%s%sbuilt-ins", path, *path ? "," : "")
+ == -1)
+ temp_path = NULL;
} else {
temp_path = strdup(path);
}
diff --git a/xorg-server/dix/events.c b/xorg-server/dix/events.c
index d1d6f910a..0667cc293 100644
--- a/xorg-server/dix/events.c
+++ b/xorg-server/dix/events.c
@@ -75,7 +75,7 @@ Equipment Corporation.
******************************************************************/
/*
- * Copyright © 2003-2005 Sun Microsystems, Inc. All rights reserved.
+ * Copyright (c) 2003-2005, Oracle and/or its affiliates. All rights reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
diff --git a/xorg-server/dix/resource.c b/xorg-server/dix/resource.c
index 178935701..bec68753e 100644
--- a/xorg-server/dix/resource.c
+++ b/xorg-server/dix/resource.c
@@ -73,7 +73,7 @@ Equipment Corporation.
******************************************************************/
/* XSERVER_DTRACE additions:
- * Copyright 2005-2006 Sun Microsystems, Inc. All rights reserved.
+ * Copyright (c) 2005-2006, Oracle and/or its affiliates. All rights reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
diff --git a/xorg-server/doc/Xserver.man.pre b/xorg-server/doc/Xserver.man.pre
deleted file mode 100644
index 2fc5541fc..000000000
--- a/xorg-server/doc/Xserver.man.pre
+++ /dev/null
@@ -1,584 +0,0 @@
-.\" $Xorg: Xserver.man,v 1.4 2001/02/09 02:04:07 xorgcvs Exp $
-.\" $XdotOrg: xserver/xorg/doc/Xserver.man.pre,v 1.4 2005/12/23 20:11:12 alanc Exp $
-.\" Copyright 1984 - 1991, 1993, 1994, 1998 The Open Group
-.\"
-.\" Permission to use, copy, modify, distribute, and sell this software and its
-.\" documentation for any purpose is hereby granted without fee, provided that
-.\" the above copyright notice appear in all copies and that both that
-.\" copyright notice and this permission notice appear in supporting
-.\" documentation.
-.\"
-.\" The above copyright notice and this permission notice shall be included
-.\" in all copies or substantial portions of the Software.
-.\"
-.\" THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
-.\" OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-.\" MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
-.\" IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
-.\" OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
-.\" ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
-.\" OTHER DEALINGS IN THE SOFTWARE.
-.\"
-.\" Except as contained in this notice, the name of The Open Group shall
-.\" not be used in advertising or otherwise to promote the sale, use or
-.\" other dealings in this Software without prior written authorization
-.\" from The Open Group.
-.\" $XFree86: xc/programs/Xserver/Xserver.man,v 3.31 2004/01/10 22:27:46 dawes Exp $
-.\" shorthand for double quote that works everywhere.
-.ds q \N'34'
-.TH XSERVER 1 __xorgversion__
-.SH NAME
-Xserver \- X Window System display server
-.SH SYNOPSIS
-.B X
-[option ...]
-.SH DESCRIPTION
-.I X
-is the generic name for the X Window System display server. It is
-frequently a link or a copy of the appropriate server binary for
-driving the most frequently used server on a given machine.
-.SH "STARTING THE SERVER"
-The X server is usually started from the X Display Manager program
-\fIxdm\fP(1) or a similar display manager program.
-This utility is run from the system boot files and takes care of keeping
-the server running, prompting for usernames and passwords, and starting up
-the user sessions.
-.PP
-Installations that run more than one window system may need to use the
-\fIxinit\fP(1) utility instead of a display manager. However, \fIxinit\fP is
-to be considered a tool for building startup scripts and is not
-intended for use by end users. Site administrators are \fBstrongly\fP
-urged to use a display manager, or build other interfaces for novice users.
-.PP
-The X server may also be started directly by the user, though this
-method is usually reserved for testing and is not recommended for
-normal operation. On some platforms, the user must have special
-permission to start the X server, often because access to certain
-devices (e.g. \fI/dev/mouse\fP) is restricted.
-.PP
-When the X server starts up, it typically takes over the display. If
-you are running on a workstation whose console is the display, you may
-not be able to log into the console while the server is running.
-.SH OPTIONS
-Many X servers have device-specific command line options. See the manual
-pages for the individual servers for more details; a list of
-server-specific manual pages is provided in the SEE ALSO section below.
-.PP
-All of the X servers accept the command line options described below.
-Some X servers may have alternative ways of providing the parameters
-described here, but the values provided via the command line options
-should override values specified via other mechanisms.
-.TP 8
-.B :\fIdisplaynumber\fP
-The X server runs as the given \fIdisplaynumber\fP, which by default is 0.
-If multiple X servers are to run simultaneously on a host, each must have
-a unique display number. See the DISPLAY
-NAMES section of the \fIX\fP(__miscmansuffix__) manual page to learn how to
-specify which display number clients should try to use.
-.TP 8
-.B \-a \fInumber\fP
-sets pointer acceleration (i.e. the ratio of how much is reported to how much
-the user actually moved the pointer).
-.TP 8
-.B \-ac
-disables host-based access control mechanisms. Enables access by any host,
-and permits any host to modify the access control list.
-Use with extreme caution.
-This option exists primarily for running test suites remotely.
-.TP 8
-.B \-audit \fIlevel\fP
-sets the audit trail level. The default level is 1, meaning only connection
-rejections are reported. Level 2 additionally reports all successful
-connections and disconnects. Level 4 enables messages from the
-SECURITY extension, if present, including generation and revocation of
-authorizations and violations of the security policy.
-Level 0 turns off the audit trail.
-Audit lines are sent as standard error output.
-.TP 8
-.B \-auth \fIauthorization-file\fP
-specifies a file which contains a collection of authorization records used
-to authenticate access. See also the \fIxdm\fP(1) and
-\fIXsecurity\fP(__miscmansuffix__) manual pages.
-.TP 8
-.B \-br
-sets the default root window to solid black instead of the standard root weave
-pattern. This is the default unless -retro or -wr is specified.
-.TP 8
-.B \-bs
-disables backing store support on all screens.
-.TP 8
-.B \-c
-turns off key-click.
-.TP 8
-.B c \fIvolume\fP
-sets key-click volume (allowable range: 0-100).
-.TP 8
-.B \-cc \fIclass\fP
-sets the visual class for the root window of color screens.
-The class numbers are as specified in the X protocol.
-Not obeyed by all servers.
-.TP 8
-.B \-core
-causes the server to generate a core dump on fatal errors.
-.TP 8
-.B \-deferglyphs \fIwhichfonts\fP
-specifies the types of fonts for which the server should attempt to use
-deferred glyph loading. \fIwhichfonts\fP can be all (all fonts),
-none (no fonts), or 16 (16 bit fonts only).
-.TP 8
-.B \-dpi \fIresolution\fP
-sets the resolution for all screens, in dots per inch.
-To be used when the server cannot determine the screen size(s) from the
-hardware.
-.TP 8
-.B dpms
-enables DPMS (display power management services), where supported. The
-default state is platform and configuration specific.
-.TP 8
-.B \-dpms
-disables DPMS (display power management services). The default state
-is platform and configuration specific.
-.TP 8
-.BI \-extension extensionName
-disables named extension. If an unknown extension name is specified,
-a list of accepted extension names is printed.
-.TP 8
-.BI \+extension extensionName
-enables named extension. If an unknown extension name is specified,
-a list of accepted extension names is printed.
-.TP 8
-.B \-f \fIvolume\fP
-sets feep (bell) volume (allowable range: 0-100).
-.TP 8
-.B \-fc \fIcursorFont\fP
-sets default cursor font.
-.TP 8
-.B \-fn \fIfont\fP
-sets the default font.
-.TP 8
-.B \-fp \fIfontPath\fP
-sets the search path for fonts. This path is a comma separated list
-of directories which the X server searches for font databases.
-See the FONTS section of this manual page for more information and the default
-list.
-.TP 8
-.B \-help
-prints a usage message.
-.TP 8
-.B \-I
-causes all remaining command line arguments to be ignored.
-.TP 8
-.B \-maxbigreqsize \fIsize\fP
-sets the maximum big request to
-.I size
-MB.
-.TP 8
-.B \-nocursor
-disable the display of the pointer cursor.
-.TP 8
-.B \-nolisten \fItrans-type\fP
-disables a transport type. For example, TCP/IP connections can be disabled
-with
-.BR "\-nolisten tcp" .
-This option may be issued multiple times to disable listening to different
-transport types.
-.TP 8
-.B \-noreset
-prevents a server reset when the last client connection is closed. This
-overrides a previous
-.B \-terminate
-command line option.
-.TP 8
-.B \-p \fIminutes\fP
-sets screen-saver pattern cycle time in minutes.
-.TP 8
-.B \-pn
-permits the server to continue running if it fails to establish all of
-its well-known sockets (connection points for clients), but
-establishes at least one. This option is set by default.
-.TP 8
-.B \-nopn
-causes the server to exit if it fails to establish all of its well-known
-sockets (connection points for clients).
-.TP 8
-.B \-r
-turns off auto-repeat.
-.TP 8
-.B r
-turns on auto-repeat.
-.TP 8
-.B -retro
-starts the stipple with the classic stipple and cursor visible. The default
-is to start with a black root window, and to suppress display of the cursor
-until the first time an application calls XDefineCursor(). For the Xorg
-server, this also sets the default for the DontZap option to FALSE. For
-kdrive servers, this implies -zap.
-.TP 8
-.B \-s \fIminutes\fP
-sets screen-saver timeout time in minutes.
-.TP 8
-.B \-su
-disables save under support on all screens.
-.TP 8
-.B \-t \fInumber\fP
-sets pointer acceleration threshold in pixels (i.e. after how many pixels
-pointer acceleration should take effect).
-.TP 8
-.B \-terminate
-causes the server to terminate at server reset, instead of continuing to run.
-This overrides a previous
-.B \-noreset
-command line option.
-.TP 8
-.B \-to \fIseconds\fP
-sets default connection timeout in seconds.
-.TP 8
-.B \-tst
-disables all testing extensions (e.g., XTEST, XTrap, XTestExtension1, RECORD).
-.TP 8
-.B tty\fIxx\fP
-ignored, for servers started the ancient way (from init).
-.TP 8
-.B v
-sets video-off screen-saver preference.
-.TP 8
-.B \-v
-sets video-on screen-saver preference.
-.TP 8
-.B \-wm
-forces the default backing-store of all windows to be WhenMapped. This
-is a backdoor way of getting backing-store to apply to all windows.
-Although all mapped windows will have backing store, the backing store
-attribute value reported by the server for a window will be the last
-value established by a client. If it has never been set by a client,
-the server will report the default value, NotUseful. This behavior is
-required by the X protocol, which allows the server to exceed the
-client's backing store expectations but does not provide a way to tell
-the client that it is doing so.
-.TP 8
-.B \-wr
-sets the default root window to solid white instead of the standard root weave
-pattern.
-.TP 8
-.B \-x \fIextension\fP
-loads the specified extension at init.
-This is a no-op for most implementations.
-.TP 8
-.B [+-]xinerama
-enables(+) or disables(-) the XINERAMA extension. The default state is
-platform and configuration specific.
-.SH SERVER DEPENDENT OPTIONS
-Some X servers accept the following options:
-.TP 8
-.B \-ld \fIkilobytes\fP
-sets the data space limit of the server to the specified number of kilobytes.
-A value of zero makes the data size as large as possible. The default value
-of \-1 leaves the data space limit unchanged.
-.TP 8
-.B \-lf \fIfiles\fP
-sets the number-of-open-files limit of the server to the specified number.
-A value of zero makes the limit as large as possible. The default value
-of \-1 leaves the limit unchanged.
-.TP 8
-.B \-ls \fIkilobytes\fP
-sets the stack space limit of the server to the specified number of kilobytes.
-A value of zero makes the stack size as large as possible. The default value
-of \-1 leaves the stack space limit unchanged.
-.TP 8
-.B \-render
-.BR default | mono | gray | color
-sets the color allocation policy that will be used by the render extension.
-.RS 8
-.TP 8
-.I default
-selects the default policy defined for the display depth of the X
-server.
-.TP 8
-.I mono
-don't use any color cell.
-.TP 8
-.I gray
-use a gray map of 13 color cells for the X render extension.
-.TP 8
-.I color
-use a color cube of at most 4*4*4 colors (that is 64 color cells).
-.RE
-.TP 8
-.B \-dumbSched
-disables smart scheduling on platforms that support the smart scheduler.
-.TP
-.B \-schedInterval \fIinterval\fP
-sets the smart scheduler's scheduling interval to
-.I interval
-milliseconds.
-.SH XDMCP OPTIONS
-X servers that support XDMCP have the following options.
-See the \fIX Display Manager Control Protocol\fP specification for more
-information.
-.TP 8
-.B \-query \fIhostname\fP
-enables XDMCP and sends Query packets to the specified
-.IR hostname .
-.TP 8
-.B \-broadcast
-enable XDMCP and broadcasts BroadcastQuery packets to the network. The
-first responding display manager will be chosen for the session.
-.TP 8
-.B \-multicast [\fIaddress\fP [\fIhop count\fP]]
-Enable XDMCP and multicast BroadcastQuery packets to the network.
-The first responding display manager is chosen for the session. If an
-address is specified, the multicast is sent to that address. If no
-address is specified, the multicast is sent to the default XDMCP IPv6
-multicast group. If a hop count is specified, it is used as the maximum
-hop count for the multicast. If no hop count is specified, the multicast
-is set to a maximum of 1 hop, to prevent the multicast from being routed
-beyond the local network.
-.TP 8
-.B \-indirect \fIhostname\fP
-enables XDMCP and send IndirectQuery packets to the specified
-.IR hostname .
-.TP 8
-.B \-port \fIport-number\fP
-uses the specified \fIport-number\fP for XDMCP packets, instead of the
-default. This option must be specified before any \-query, \-broadcast,
-\-multicast, or \-indirect options.
-.TP 8
-.B \-from \fIlocal-address\fP
-specifies the local address to connect from (useful if the connecting host
-has multiple network interfaces). The \fIlocal-address\fP may be expressed
-in any form acceptable to the host platform's \fIgethostbyname\fP(3)
-implementation.
-.TP 8
-.B \-once
-causes the server to terminate (rather than reset) when the XDMCP session
-ends.
-.TP 8
-.B \-class \fIdisplay-class\fP
-XDMCP has an additional display qualifier used in resource lookup for
-display-specific options. This option sets that value, by default it
-is "MIT-Unspecified" (not a very useful value).
-.TP 8
-.B \-cookie \fIxdm-auth-bits\fP
-When testing XDM-AUTHENTICATION-1, a private key is shared between the
-server and the manager. This option sets the value of that private
-data (not that it is very private, being on the command line!).
-.TP 8
-.B \-displayID \fIdisplay-id\fP
-Yet another XDMCP specific value, this one allows the display manager to
-identify each display so that it can locate the shared key.
-.SH XKEYBOARD OPTIONS
-X servers that support the XKEYBOARD (a.k.a. \*qXKB\*q) extension accept the
-following options. All layout files specified on the command line must be
-located in the XKB base directory or a subdirectory, and specified as the
-relative path from the XKB base directory. The default XKB base directory is
-.IR __projectroot__/lib/X11/xkb .
-.TP 8
-.BR [+-]accessx " [ \fItimeout\fP [ \fItimeout_mask\fP [ \fIfeedback\fP [ \fIoptions_mask\fP ] ] ] ]"
-enables(+) or disables(-) AccessX key sequences.
-.TP 8
-.B \-xkbdir \fIdirectory\fP
-base directory for keyboard layout files. This option is not available
-for setuid X servers (i.e., when the X server's real and effective uids
-are different).
-.TP 8
-.B \-ardelay \fImilliseconds\fP
-sets the autorepeat delay (length of time in milliseconds that a key must
-be depressed before autorepeat starts).
-.TP 8
-.B \-arinterval \fImilliseconds\fP
-sets the autorepeat interval (length of time in milliseconds that should
-elapse between autorepeat-generated keystrokes).
-.TP 8
-.B \-xkbmap \fIfilename\fP
-loads keyboard description in \fIfilename\fP on server startup.
-.SH "NETWORK CONNECTIONS"
-The X server supports client connections via a platform-dependent subset of
-the following transport types: TCP\/IP, Unix Domain sockets, DECnet,
-and several varieties of SVR4 local connections. See the DISPLAY
-NAMES section of the \fIX\fP(__miscmansuffix__) manual page to learn how to
-specify which transport type clients should try to use.
-.SH GRANTING ACCESS
-The X server implements a platform-dependent subset of the following
-authorization protocols: MIT-MAGIC-COOKIE-1, XDM-AUTHORIZATION-1,
-XDM-AUTHORIZATION-2, SUN-DES-1, and MIT-KERBEROS-5. See the
-\fIXsecurity\fP(__miscmansuffix__) manual page for information on the
-operation of these protocols.
-.PP
-Authorization data required by the above protocols is passed to the
-server in a private file named with the \fB\-auth\fP command line
-option. Each time the server is about to accept the first connection
-after a reset (or when the server is starting), it reads this file.
-If this file contains any authorization records, the local host is not
-automatically allowed access to the server, and only clients which
-send one of the authorization records contained in the file in the
-connection setup information will be allowed access. See the
-\fIXau\fP manual page for a description of the binary format of this
-file. See \fIxauth\fP(1) for maintenance of this file, and distribution
-of its contents to remote hosts.
-.PP
-The X server also uses a host-based access control list for deciding
-whether or not to accept connections from clients on a particular machine.
-If no other authorization mechanism is being used,
-this list initially consists of the host on which the server is running as
-well as any machines listed in the file \fI/etc/X\fBn\fI.hosts\fR, where
-\fBn\fP is the display number of the server. Each line of the file should
-contain either an Internet hostname (e.g. expo.lcs.mit.edu) or a DECnet
-hostname in double colon format (e.g. hydra::) or a complete name in the format
-\fIfamily\fP:\fIname\fP as described in the \fIxhost\fP(1) manual page.
-There should be no leading or trailing spaces on any lines. For example:
-.sp
-.in +8
-.nf
-joesworkstation
-corporate.company.com
-star::
-inet:bigcpu
-local:
-.fi
-.in -8
-.PP
-Users can add or remove hosts from this list and enable or disable access
-control using the \fIxhost\fP command from the same machine as the server.
-.PP
-If the X FireWall Proxy (\fIxfwp\fP) is being used without a sitepolicy,
-host-based authorization must be turned on for clients to be able to
-connect to the X server via the \fIxfwp\fP. If \fIxfwp\fP is run without
-a configuration file and thus no sitepolicy is defined, if \fIxfwp\fP
-is using an X server where xhost + has been run to turn off host-based
-authorization checks, when a client tries to connect to this X server
-via \fIxfwp\fP, the X server will deny the connection. See \fIxfwp\fP(1)
-for more information about this proxy.
-.PP
-The X protocol intrinsically does not have any notion of window operation
-permissions or place any restrictions on what a client can do; if a program can
-connect to a display, it has full run of the screen.
-X servers that support the SECURITY extension fare better because clients
-can be designated untrusted via the authorization they use to connect; see
-the \fIxauth\fP(1) manual page for details. Restrictions are imposed
-on untrusted clients that curtail the mischief they can do. See the SECURITY
-extension specification for a complete list of these restrictions.
-.PP
-Sites that have better
-authentication and authorization systems might wish to make
-use of the hooks in the libraries and the server to provide additional
-security models.
-.SH SIGNALS
-The X server attaches special meaning to the following signals:
-.TP 8
-.I SIGHUP
-This signal causes the server to close all existing connections, free all
-resources, and restore all defaults. It is sent by the display manager
-whenever the main user's main application (usually an \fIxterm\fP or window
-manager) exits to force the server to clean up and prepare for the next
-user.
-.TP 8
-.I SIGTERM
-This signal causes the server to exit cleanly.
-.TP 8
-.I SIGUSR1
-This signal is used quite differently from either of the above. When the
-server starts, it checks to see if it has inherited SIGUSR1 as SIG_IGN
-instead of the usual SIG_DFL. In this case, the server sends a SIGUSR1 to
-its parent process after it has set up the various connection schemes.
-\fIXdm\fP uses this feature to recognize when connecting to the server
-is possible.
-.SH FONTS
-The X server can obtain fonts from directories and/or from font servers.
-The list of directories and font servers
-the X server uses when trying to open a font is controlled
-by the \fIfont path\fP.
-.LP
-The default font path is
-__default_font_path__ .
-.LP
-A special kind of directory can be specified using the \fBcatalogue\fP:
-prefix. Directories specified this way can contain symlinks pointing to the
-real font directories. See the FONTPATH.D section for details.
-.LP
-The font path can be set with the \fB\-fp\fP option or by \fIxset\fP(1)
-after the server has started.
-.SH "FONTPATH.D"
-You can specify a special kind of font path in the form \fBcatalogue:<dir>\fR.
-The directory specified after the catalogue: prefix will be scanned for symlinks
-and each symlink destination will be added as a local fontfile FPE.
-.PP
-The symlink can be suffixed by attributes such as '\fBunscaled\fR', which
-will be passed through to the underlying fontfile FPE. The only exception is
-the newly introduced '\fBpri\fR' attribute, which will be used for ordering
-the font paths specified by the symlinks.
-
-An example configuration:
-
-.nf
- 75dpi:unscaled:pri=20 \-> /usr/share/X11/fonts/75dpi
- ghostscript:pri=60 \-> /usr/share/fonts/default/ghostscript
- misc:unscaled:pri=10 \-> /usr/share/X11/fonts/misc
- type1:pri=40 \-> /usr/share/X11/fonts/Type1
- type1:pri=50 \-> /usr/share/fonts/default/Type1
-.fi
-
-This will add /usr/share/X11/fonts/misc as the first FPE with the attribute
-'unscaled', second FPE will be /usr/share/X11/fonts/75dpi, also with
-the attribute unscaled etc. This is functionally equivalent to setting
-the following font path:
-
-.nf
- /usr/share/X11/fonts/misc:unscaled,
- /usr/share/X11/fonts/75dpi:unscaled,
- /usr/share/X11/fonts/Type1,
- /usr/share/fonts/default/Type1,
- /usr/share/fonts/default/ghostscript
-.fi
-
-.SH FILES
-.TP 30
-.I /etc/X\fBn\fP.hosts
-Initial access control list for display number \fBn\fP
-.TP 30
-.IR __datadir__/fonts/X11/misc , __datadir__/fonts/X11/75dpi , __datadir__/fonts/X11/100dpi
-Bitmap font directories
-.TP 30
-.IR __datadir__/fonts/X11/TTF , __datadir__/fonts/X11/Type1
-Outline font directories
-.TP 30
-.I /tmp/.X11-unix/X\fBn\fP
-Unix domain socket for display number \fBn\fP
-.TP 30
-.I /usr/adm/X\fBn\fPmsgs
-Error log file for display number \fBn\fP if run from \fIinit\fP(__adminmansuffix__)
-.TP 30
-.I __projectroot__/lib/X11/xdm/xdm-errors
-Default error log file if the server is run from \fIxdm\fP(1)
-.SH "SEE ALSO"
-General information: \fIX\fP(__miscmansuffix__)
-.PP
-Protocols:
-.I "X Window System Protocol,"
-.I "The X Font Service Protocol,"
-.I "X Display Manager Control Protocol"
-.PP
-Fonts: \fIbdftopcf\fP(1), \fImkfontdir\fP(1), \fImkfontscale\fP(1),
-\fIxfs\fP(1), \fIxlsfonts\fP(1), \fIxfontsel\fP(1), \fIxfd\fP(1),
-.I "X Logical Font Description Conventions"
-.PP
-Security: \fIXsecurity\fP(__miscmansuffix__), \fIxauth\fP(1), \fIXau\fP(1),
-\fIxdm\fP(1), \fIxhost\fP(1), \fIxfwp\fP(1),
-.I "Security Extension Specification"
-.PP
-Starting the server: \fIstartx\fP(1), \fIxdm\fP(1), \fIxinit\fP(1)
-.PP
-Controlling the server once started: \fIxset\fP(1), \fIxsetroot\fP(1),
-\fIxhost\fP(1), \fIxinput\fP(1), \fIxrandr\fP(1)
-.PP
-Server-specific man pages:
-\fIXorg\fP(1), \fIXdmx\fP(1), \fIXephyr\fP(1), \fIXnest\fP(1),
-\fIXvfb\fP(1), \fIXquartz\fP(1), \fIXWin\fP(1).
-.PP
-Server internal documentation:
-.I "Definition of the Porting Layer for the X v11 Sample Server"
-.SH AUTHORS
-The sample server was originally written by Susan Angebranndt, Raymond
-Drewry, Philip Karlton, and Todd Newman, from Digital Equipment
-Corporation, with support from a large cast. It has since been
-extensively rewritten by Keith Packard and Bob Scheifler, from MIT.
-Dave Wiggins took over post-R5 and made substantial improvements.
diff --git a/xorg-server/fb/fbcmap_mi.c b/xorg-server/fb/fbcmap_mi.c
index d75a38fa2..1e567d007 100644
--- a/xorg-server/fb/fbcmap_mi.c
+++ b/xorg-server/fb/fbcmap_mi.c
@@ -1,124 +1,124 @@
-/*
- * Copyright © 1987 Sun Microsystems, Inc. All rights reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice (including the next
- * paragraph) shall be included in all copies or substantial portions of the
- * Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
- * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
- * DEALINGS IN THE SOFTWARE.
- */
-
-/**
- * This version of fbcmap.c is implemented in terms of mi functions.
- * These functions used to be in fbcmap.c and depended upon the symbol
- * XFree86Server being defined.
- */
-
-
-#ifdef HAVE_DIX_CONFIG_H
-#include <dix-config.h>
-#endif
-
-#include <X11/X.h>
-#include "fb.h"
-#include "micmap.h"
-
-int
-fbListInstalledColormaps(ScreenPtr pScreen, Colormap *pmaps)
-{
- return miListInstalledColormaps(pScreen, pmaps);
-}
-
-void
-fbInstallColormap(ColormapPtr pmap)
-{
- miInstallColormap(pmap);
-}
-
-void
-fbUninstallColormap(ColormapPtr pmap)
-{
- miUninstallColormap(pmap);
-}
-
-void
-fbResolveColor(unsigned short *pred,
- unsigned short *pgreen,
- unsigned short *pblue,
- VisualPtr pVisual)
-{
- miResolveColor(pred, pgreen, pblue, pVisual);
-}
-
-Bool
-fbInitializeColormap(ColormapPtr pmap)
-{
- return miInitializeColormap(pmap);
-}
-
-int
-fbExpandDirectColors (ColormapPtr pmap,
- int ndef,
- xColorItem *indefs,
- xColorItem *outdefs)
-{
- return miExpandDirectColors(pmap, ndef, indefs, outdefs);
-}
-
-Bool
-fbCreateDefColormap(ScreenPtr pScreen)
-{
- return miCreateDefColormap(pScreen);
-}
-
-void
-fbClearVisualTypes(void)
-{
- miClearVisualTypes();
-}
-
-Bool
-fbSetVisualTypes (int depth, int visuals, int bitsPerRGB)
-{
- return miSetVisualTypes(depth, visuals, bitsPerRGB, -1);
-}
-
-Bool
-fbSetVisualTypesAndMasks (int depth, int visuals, int bitsPerRGB,
- Pixel redMask, Pixel greenMask, Pixel blueMask)
-{
- return miSetVisualTypesAndMasks(depth, visuals, bitsPerRGB, -1,
- redMask, greenMask, blueMask);
-}
-
-/*
- * Given a list of formats for a screen, create a list
- * of visuals and depths for the screen which coorespond to
- * the set which can be used with this version of fb.
- */
-Bool
-fbInitVisuals (VisualPtr *visualp,
- DepthPtr *depthp,
- int *nvisualp,
- int *ndepthp,
- int *rootDepthp,
- VisualID *defaultVisp,
- unsigned long sizes,
- int bitsPerRGB)
-{
- return miInitVisuals(visualp, depthp, nvisualp, ndepthp, rootDepthp,
- defaultVisp, sizes, bitsPerRGB, -1);
-}
+/*
+ * Copyright (c) 1987, Oracle and/or its affiliates. All rights reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ */
+
+/**
+ * This version of fbcmap.c is implemented in terms of mi functions.
+ * These functions used to be in fbcmap.c and depended upon the symbol
+ * XFree86Server being defined.
+ */
+
+
+#ifdef HAVE_DIX_CONFIG_H
+#include <dix-config.h>
+#endif
+
+#include <X11/X.h>
+#include "fb.h"
+#include "micmap.h"
+
+int
+fbListInstalledColormaps(ScreenPtr pScreen, Colormap *pmaps)
+{
+ return miListInstalledColormaps(pScreen, pmaps);
+}
+
+void
+fbInstallColormap(ColormapPtr pmap)
+{
+ miInstallColormap(pmap);
+}
+
+void
+fbUninstallColormap(ColormapPtr pmap)
+{
+ miUninstallColormap(pmap);
+}
+
+void
+fbResolveColor(unsigned short *pred,
+ unsigned short *pgreen,
+ unsigned short *pblue,
+ VisualPtr pVisual)
+{
+ miResolveColor(pred, pgreen, pblue, pVisual);
+}
+
+Bool
+fbInitializeColormap(ColormapPtr pmap)
+{
+ return miInitializeColormap(pmap);
+}
+
+int
+fbExpandDirectColors (ColormapPtr pmap,
+ int ndef,
+ xColorItem *indefs,
+ xColorItem *outdefs)
+{
+ return miExpandDirectColors(pmap, ndef, indefs, outdefs);
+}
+
+Bool
+fbCreateDefColormap(ScreenPtr pScreen)
+{
+ return miCreateDefColormap(pScreen);
+}
+
+void
+fbClearVisualTypes(void)
+{
+ miClearVisualTypes();
+}
+
+Bool
+fbSetVisualTypes (int depth, int visuals, int bitsPerRGB)
+{
+ return miSetVisualTypes(depth, visuals, bitsPerRGB, -1);
+}
+
+Bool
+fbSetVisualTypesAndMasks (int depth, int visuals, int bitsPerRGB,
+ Pixel redMask, Pixel greenMask, Pixel blueMask)
+{
+ return miSetVisualTypesAndMasks(depth, visuals, bitsPerRGB, -1,
+ redMask, greenMask, blueMask);
+}
+
+/*
+ * Given a list of formats for a screen, create a list
+ * of visuals and depths for the screen which coorespond to
+ * the set which can be used with this version of fb.
+ */
+Bool
+fbInitVisuals (VisualPtr *visualp,
+ DepthPtr *depthp,
+ int *nvisualp,
+ int *ndepthp,
+ int *rootDepthp,
+ VisualID *defaultVisp,
+ unsigned long sizes,
+ int bitsPerRGB)
+{
+ return miInitVisuals(visualp, depthp, nvisualp, ndepthp, rootDepthp,
+ defaultVisp, sizes, bitsPerRGB, -1);
+}
diff --git a/xorg-server/hw/dmx/Makefile.am b/xorg-server/hw/dmx/Makefile.am
index 0d0634628..939e8ec31 100644
--- a/xorg-server/hw/dmx/Makefile.am
+++ b/xorg-server/hw/dmx/Makefile.am
@@ -1,117 +1,117 @@
-DIST_SUBDIRS = input config glxProxy examples doc
-
-SUBDIRS = input config examples
-bin_PROGRAMS = Xdmx
-
-if XINERAMA
-PANORAMIX_SRCS = $(top_srcdir)/Xext/panoramiX.c
-endif
-
-if GLX
-SUBDIRS += glxProxy
-GLX_LIBS = glxProxy/libglxproxy.a
-GLX_SRCS = $(PANORAMIX_SRCS) dmx_glxvisuals.c dmx_glxvisuals.h
-GLX_INCS = -I$(top_srcdir)/hw/xfree86/dixmods/extmod
-GLX_DEFS = @GL_CFLAGS@
-endif
-
-if BUILDDOCS
-SUBDIRS += doc
-endif
-
-AM_CFLAGS = \
- -DHAVE_DMX_CONFIG_H \
- $(DIX_CFLAGS) \
- $(GLX_INCS) \
- $(GLX_DEFS) \
- $(DMX_CFLAGS) \
- @DMXMODULES_CFLAGS@
-
-Xdmx_SOURCES = dmx.c \
- dmxcb.c \
- dmxcb.h \
- dmxclient.h \
- dmxcmap.c \
- dmxcmap.h \
- dmx-config.h \
- dmxcursor.c \
- dmxcursor.h \
- dmxdpms.c \
- dmxdpms.h \
- dmxextension.c \
- dmxextension.h \
- dmxfont.c \
- dmxfont.h \
- dmxgc.c \
- dmxgc.h \
- dmxgcops.c \
- dmxgcops.h \
- dmx.h \
- dmxinit.c \
- dmxinit.h \
- dmxinput.c \
- dmxinput.h \
- dmxlog.c \
- dmxlog.h \
- dmxpict.c \
- dmxpict.h \
- dmxpixmap.c \
- dmxpixmap.h \
- dmxprop.c \
- dmxprop.h \
- dmxscrinit.c \
- dmxscrinit.h \
- dmxshadow.c \
- dmxshadow.h \
- dmxstat.c \
- dmxstat.h \
- dmxsync.c \
- dmxsync.h \
- dmxvisual.c \
- dmxvisual.h \
- dmxwindow.c \
- dmxwindow.h \
- $(top_srcdir)/mi/miinitext.c \
- $(top_srcdir)/fb/fbcmap_mi.c \
- $(GLX_SRCS)
-
-
-#if COMPOSITE
-#Xdmx_SOURCES += fakecw.c
-#endif
-
-XDMX_LIBS = \
- @XDMX_LIBS@ \
- $(GLX_LIBS) \
- input/libdmxinput.a \
- config/libdmxconfig.a
-
-Xdmx_LDFLAGS = $(LD_EXPORT_SYMBOLS_FLAG)
-Xdmx_DEPENDENCIES= $(XDMX_LIBS)
-Xdmx_LDADD = $(XDMX_LIBS) $(XDMX_SYS_LIBS) $(XSERVER_SYS_LIBS)
-
-# Man page
-appmandir = $(APP_MAN_DIR)
-
-appman_PRE = Xdmx.man
-appman_DATA = $(appman_PRE:man=@APP_MAN_SUFFIX@)
-
-CLEANFILES = $(appman_DATA)
-
-# Strings to replace in man pages
-XORGRELSTRING = @PACKAGE_STRING@
- XORGMANNAME = X Version 11
-
-MAN_SUBSTS = \
- -e 's|__vendorversion__|"$(XORGRELSTRING)" "$(XORGMANNAME)"|' \
- -e 's|__miscmansuffix__|$(MISC_MAN_SUFFIX)|g'
-
-SUFFIXES = .$(APP_MAN_SUFFIX) .man
-
-.man.$(APP_MAN_SUFFIX):
- $(AM_V_GEN)$(SED) $(MAN_SUBSTS) < $< > $@
-
-EXTRA_DIST = $(appman_PRE)
-
-relink:
- $(AM_V_at)rm -f Xdmx$(EXEEXT) && $(MAKE) Xdmx$(EXEEXT)
+DIST_SUBDIRS = input config glxProxy examples doc
+
+SUBDIRS = input config examples
+bin_PROGRAMS = Xdmx
+
+if XINERAMA
+PANORAMIX_SRCS = $(top_srcdir)/Xext/panoramiX.c
+endif
+
+if GLX
+SUBDIRS += glxProxy
+GLX_LIBS = glxProxy/libglxproxy.a
+GLX_SRCS = $(PANORAMIX_SRCS) dmx_glxvisuals.c dmx_glxvisuals.h
+GLX_INCS = -I$(top_srcdir)/hw/xfree86/dixmods/extmod
+GLX_DEFS = @GL_CFLAGS@
+endif
+
+if BUILDDOCS
+SUBDIRS += doc
+endif
+
+AM_CFLAGS = \
+ -DHAVE_DMX_CONFIG_H \
+ $(DIX_CFLAGS) \
+ $(GLX_INCS) \
+ $(GLX_DEFS) \
+ $(DMX_CFLAGS) \
+ @DMXMODULES_CFLAGS@
+
+Xdmx_SOURCES = dmx.c \
+ dmxcb.c \
+ dmxcb.h \
+ dmxclient.h \
+ dmxcmap.c \
+ dmxcmap.h \
+ dmx-config.h \
+ dmxcursor.c \
+ dmxcursor.h \
+ dmxdpms.c \
+ dmxdpms.h \
+ dmxextension.c \
+ dmxextension.h \
+ dmxfont.c \
+ dmxfont.h \
+ dmxgc.c \
+ dmxgc.h \
+ dmxgcops.c \
+ dmxgcops.h \
+ dmx.h \
+ dmxinit.c \
+ dmxinit.h \
+ dmxinput.c \
+ dmxinput.h \
+ dmxlog.c \
+ dmxlog.h \
+ dmxpict.c \
+ dmxpict.h \
+ dmxpixmap.c \
+ dmxpixmap.h \
+ dmxprop.c \
+ dmxprop.h \
+ dmxscrinit.c \
+ dmxscrinit.h \
+ dmxshadow.c \
+ dmxshadow.h \
+ dmxstat.c \
+ dmxstat.h \
+ dmxsync.c \
+ dmxsync.h \
+ dmxvisual.c \
+ dmxvisual.h \
+ dmxwindow.c \
+ dmxwindow.h \
+ $(top_srcdir)/mi/miinitext.c \
+ $(top_srcdir)/fb/fbcmap_mi.c \
+ $(GLX_SRCS)
+
+
+#if COMPOSITE
+#Xdmx_SOURCES += fakecw.c
+#endif
+
+XDMX_LIBS = \
+ $(GLX_LIBS) \
+ @XDMX_LIBS@ \
+ input/libdmxinput.a \
+ config/libdmxconfig.a
+
+Xdmx_LDFLAGS = $(LD_EXPORT_SYMBOLS_FLAG)
+Xdmx_DEPENDENCIES= $(XDMX_LIBS)
+Xdmx_LDADD = $(XDMX_LIBS) $(XDMX_SYS_LIBS) $(XSERVER_SYS_LIBS)
+
+# Man page
+appmandir = $(APP_MAN_DIR)
+
+appman_PRE = Xdmx.man
+appman_DATA = $(appman_PRE:man=@APP_MAN_SUFFIX@)
+
+CLEANFILES = $(appman_DATA)
+
+# Strings to replace in man pages
+XORGRELSTRING = @PACKAGE_STRING@
+ XORGMANNAME = X Version 11
+
+MAN_SUBSTS = \
+ -e 's|__vendorversion__|"$(XORGRELSTRING)" "$(XORGMANNAME)"|' \
+ -e 's|__miscmansuffix__|$(MISC_MAN_SUFFIX)|g'
+
+SUFFIXES = .$(APP_MAN_SUFFIX) .man
+
+.man.$(APP_MAN_SUFFIX):
+ $(AM_V_GEN)$(SED) $(MAN_SUBSTS) < $< > $@
+
+EXTRA_DIST = $(appman_PRE)
+
+relink:
+ $(AM_V_at)rm -f Xdmx$(EXEEXT) && $(MAKE) Xdmx$(EXEEXT)
diff --git a/xorg-server/hw/dmx/dmx.c b/xorg-server/hw/dmx/dmx.c
index f380b4b41..5de565f85 100644
--- a/xorg-server/hw/dmx/dmx.c
+++ b/xorg-server/hw/dmx/dmx.c
@@ -231,8 +231,9 @@ static int ProcDMXForceWindowCreation(ClientPtr client)
PanoramiXRes *win;
int i;
- if (!(win = SecurityLookupIDByType(client, stuff->window, XRT_WINDOW,
- DixReadAccess)))
+ if (Success != dixLookupResourceByType((pointer*) &win,
+ stuff->window, XRT_WINDOW,
+ client, DixReadAccess))
return -1; /* BadWindow */
FOR_NSCREENS(i) {
@@ -506,8 +507,9 @@ static int dmxPopulatePanoramiX(ClientPtr client, Window window,
int count = 0;
DMXWindowAttributesRec attr;
- if (!(win = SecurityLookupIDByType(client, window, XRT_WINDOW,
- DixReadAccess)))
+ if (Success != dixLookupResourceByType((pointer*) &win,
+ window, XRT_WINDOW,
+ client, DixReadAccess))
return -1; /* BadWindow */
FOR_NSCREENS(i) {
diff --git a/xorg-server/hw/dmx/dmxextension.c b/xorg-server/hw/dmx/dmxextension.c
index 25a10c015..97f2a04b0 100644
--- a/xorg-server/hw/dmx/dmxextension.c
+++ b/xorg-server/hw/dmx/dmxextension.c
@@ -699,7 +699,8 @@ static void dmxBERestorePixmapImage(pointer value, XID id, RESTYPE type,
PixmapPtr pPix;
int i;
- pPix = (PixmapPtr)LookupIDByType(pXinPix->info[idx].id, RT_PIXMAP);
+ dixLookupResourceByType((pointer*) &pPix, pXinPix->info[idx].id,
+ RT_PIXMAP, NullClient, DixUnknownAccess);
if (pPix != pDst) return; /* Not a match.... Next! */
for (i = 0; i < PanoramiXNumScreens; i++) {
@@ -708,8 +709,8 @@ static void dmxBERestorePixmapImage(pointer value, XID id, RESTYPE type,
if (i == idx) continue; /* Self replication is bad */
- pSrc =
- (PixmapPtr)LookupIDByType(pXinPix->info[i].id, RT_PIXMAP);
+ dixLookupResourceByType((pointer*) &pSrc, pXinPix->info[i].id,
+ RT_PIXMAP, NullClient, DixUnknownAccess);
pSrcPriv = DMX_GET_PIXMAP_PRIV(pSrc);
if (pSrcPriv->pixmap) {
DMXScreenInfo *dmxSrcScreen = &dmxScreens[i];
@@ -1365,7 +1366,8 @@ static void dmxBEFindPixmapImage(pointer value, XID id, RESTYPE type,
PixmapPtr pPix;
int i;
- pPix = (PixmapPtr)LookupIDByType(pXinPix->info[idx].id, RT_PIXMAP);
+ dixLookupResourceByType((pointer*) &pPix, pXinPix->info[idx].id,
+ RT_PIXMAP, NullClient, DixUnknownAccess);
if (pPix != pDst) return; /* Not a match.... Next! */
for (i = 0; i < PanoramiXNumScreens; i++) {
@@ -1374,8 +1376,8 @@ static void dmxBEFindPixmapImage(pointer value, XID id, RESTYPE type,
if (i == idx) continue; /* Self replication is bad */
- pSrc =
- (PixmapPtr)LookupIDByType(pXinPix->info[i].id, RT_PIXMAP);
+ dixLookupResourceByType((pointer*) &pSrc, pXinPix->info[i].id,
+ RT_PIXMAP, NullClient, DixUnknownAccess);
pSrcPriv = DMX_GET_PIXMAP_PRIV(pSrc);
if (pSrcPriv->pixmap) {
FoundPixImage = True;
diff --git a/xorg-server/hw/dmx/dmxgcops.c b/xorg-server/hw/dmx/dmxgcops.c
index 02b45a213..8f4f5c774 100644
--- a/xorg-server/hw/dmx/dmxgcops.c
+++ b/xorg-server/hw/dmx/dmxgcops.c
@@ -523,8 +523,10 @@ static DMXScreenInfo *dmxFindAlternatePixmap(DrawablePtr pDrawable, XID *draw)
if (noPanoramiXExtension) return NULL;
if (pDrawable->type != DRAWABLE_PIXMAP) return NULL;
-
- if (!(pXinPix = (PanoramiXRes *)LookupIDByType(pDrawable->id, XRT_PIXMAP)))
+
+ if (Success != dixLookupResourceByType((pointer*) &pXinPix,
+ pDrawable->id, XRT_PIXMAP,
+ NullClient, DixUnknownAccess))
return NULL;
for (i = 1; i < PanoramiXNumScreens; i++) {
@@ -533,8 +535,8 @@ static DMXScreenInfo *dmxFindAlternatePixmap(DrawablePtr pDrawable, XID *draw)
PixmapPtr pSrc;
dmxPixPrivPtr pSrcPriv;
- pSrc = (PixmapPtr)LookupIDByType(pXinPix->info[i].id,
- RT_PIXMAP);
+ dixLookupResourceByType((pointer*) &pSrc, pXinPix->info[i].id,
+ RT_PIXMAP, NullClient, DixUnknownAccess);
pSrcPriv = DMX_GET_PIXMAP_PRIV(pSrc);
if (pSrcPriv->pixmap) {
*draw = pSrcPriv->pixmap;
diff --git a/xorg-server/hw/dmx/dmxpict.c b/xorg-server/hw/dmx/dmxpict.c
index 25d923f01..3f5cd4a50 100644
--- a/xorg-server/hw/dmx/dmxpict.c
+++ b/xorg-server/hw/dmx/dmxpict.c
@@ -271,9 +271,11 @@ static int dmxProcRenderCreateGlyphSet(ClientPtr client)
/* Look up glyphSet that was just created ???? */
/* Store glyphsets from backends in glyphSet->devPrivate ????? */
/* Make sure we handle all errors here!! */
-
- glyphSet = SecurityLookupIDByType(client, stuff->gsid, GlyphSetType,
- DixDestroyAccess);
+
+ dixLookupResourceByType((pointer*) &glyphSet,
+ stuff->gsid, GlyphSetType,
+ client, DixDestroyAccess);
+
glyphPriv = malloc(sizeof(dmxGlyphPrivRec));
if (!glyphPriv) return BadAlloc;
glyphPriv->glyphSets = NULL;
@@ -314,8 +316,9 @@ static int dmxProcRenderFreeGlyphSet(ClientPtr client)
REQUEST(xRenderFreeGlyphSetReq);
REQUEST_SIZE_MATCH(xRenderFreeGlyphSetReq);
- glyphSet = SecurityLookupIDByType(client, stuff->glyphset, GlyphSetType,
- DixDestroyAccess);
+ dixLookupResourceByType((pointer*) &glyphSet,
+ stuff->glyphset, GlyphSetType,
+ client, DixDestroyAccess);
if (glyphSet && glyphSet->refcnt == 1) {
dmxGlyphPrivPtr glyphPriv = DMX_GET_GLYPH_PRIV(glyphSet);
@@ -357,8 +360,9 @@ static int dmxProcRenderAddGlyphs(ClientPtr client)
CARD8 *bits;
int nbytes;
- glyphSet = SecurityLookupIDByType(client, stuff->glyphset,
- GlyphSetType, DixReadAccess);
+ dixLookupResourceByType((pointer*) &glyphSet,
+ stuff->glyphset, GlyphSetType,
+ client, DixReadAccess);
glyphPriv = DMX_GET_GLYPH_PRIV(glyphSet);
nglyphs = stuff->nglyphs;
@@ -400,8 +404,9 @@ static int dmxProcRenderFreeGlyphs(ClientPtr client)
REQUEST(xRenderFreeGlyphsReq);
REQUEST_AT_LEAST_SIZE(xRenderFreeGlyphsReq);
- glyphSet = SecurityLookupIDByType(client, stuff->glyphset, GlyphSetType,
- DixWriteAccess);
+ dixLookupResourceByType((pointer*) &glyphSet,
+ stuff->glyphset, GlyphSetType,
+ client, DixWriteAccess);
if (glyphSet) {
dmxGlyphPrivPtr glyphPriv = DMX_GET_GLYPH_PRIV(glyphSet);
@@ -472,14 +477,18 @@ static int dmxProcRenderCompositeGlyphs(ClientPtr client)
GlyphSetPtr glyphSet;
dmxGlyphPrivPtr glyphPriv;
- pSrc = SecurityLookupIDByType(client, stuff->src, PictureType,
- DixReadAccess);
+ dixLookupResourceByType((pointer*) &pSrc,
+ stuff->src, PictureType,
+ client, DixReadAccess);
+
pSrcPriv = DMX_GET_PICT_PRIV(pSrc);
if (!pSrcPriv->pict)
return ret;
- pDst = SecurityLookupIDByType(client, stuff->dst, PictureType,
- DixWriteAccess);
+ dixLookupResourceByType((pointer*) &pDst,
+ stuff->dst, PictureType,
+ client, DixWriteAccess);
+
pDstPriv = DMX_GET_PICT_PRIV(pDst);
if (!pDstPriv->pict)
return ret;
@@ -495,8 +504,9 @@ static int dmxProcRenderCompositeGlyphs(ClientPtr client)
return ret;
if (stuff->maskFormat)
- pFmt = SecurityLookupIDByType(client, stuff->maskFormat,
- PictFormatType, DixReadAccess);
+ dixLookupResourceByType((pointer*) &pFmt,
+ stuff->maskFormat, PictFormatType,
+ client, DixReadAccess);
else
pFmt = NULL;
@@ -546,8 +556,9 @@ static int dmxProcRenderCompositeGlyphs(ClientPtr client)
curGlyph = glyphs;
curElt = elts;
- glyphSet = SecurityLookupIDByType(client, stuff->glyphset,
- GlyphSetType, DixReadAccess);
+ dixLookupResourceByType((pointer*) &glyphSet,
+ stuff->glyphset, GlyphSetType,
+ client, DixReadAccess);
glyphPriv = DMX_GET_GLYPH_PRIV(glyphSet);
while (buffer + sizeof(xGlyphElt) < end) {
@@ -555,10 +566,11 @@ static int dmxProcRenderCompositeGlyphs(ClientPtr client)
buffer += sizeof(xGlyphElt);
if (elt->len == 0xff) {
- glyphSet = SecurityLookupIDByType(client,
- *((CARD32 *)buffer),
- GlyphSetType,
- DixReadAccess);
+ dixLookupResourceByType((pointer*) &glyphSet,
+ *((CARD32 *)buffer),
+ GlyphSetType,
+ client,
+ DixReadAccess);
glyphPriv = DMX_GET_GLYPH_PRIV(glyphSet);
buffer += 4;
} else {
diff --git a/xorg-server/hw/dmx/dmxwindow.c b/xorg-server/hw/dmx/dmxwindow.c
index 521f4af7d..ef912b6a3 100644
--- a/xorg-server/hw/dmx/dmxwindow.c
+++ b/xorg-server/hw/dmx/dmxwindow.c
@@ -84,7 +84,8 @@ Window dmxCreateRootWindow(WindowPtr pWindow)
parent = dmxScreen->scrnWin; /* This is our "Screen" window */
visual = dmxScreen->beVisuals[dmxScreen->beDefVisualIndex].visual;
- pCmap = (ColormapPtr)LookupIDByType(wColormap(pWindow), RT_COLORMAP);
+ dixLookupResourceByType((pointer*) &pCmap, wColormap(pWindow),
+ RT_COLORMAP, NullClient, DixUnknownAccess);
pCmapPriv = DMX_GET_COLORMAP_PRIV(pCmap);
mask = CWEventMask | CWBackingStore | CWColormap | CWBorderPixel;
@@ -191,8 +192,8 @@ void dmxGetDefaultWindowAttributes(WindowPtr pWindow,
ColormapPtr pCmap;
dmxColormapPrivPtr pCmapPriv;
- pCmap = (ColormapPtr)LookupIDByType(wColormap(pWindow),
- RT_COLORMAP);
+ dixLookupResourceByType((pointer*) &pCmap, wColormap(pWindow),
+ RT_COLORMAP, NullClient, DixUnknownAccess);
pCmapPriv = DMX_GET_COLORMAP_PRIV(pCmap);
*cmap = pCmapPriv->cmap;
} else {
@@ -545,7 +546,8 @@ static void dmxDoChangeWindowAttributes(WindowPtr pWindow,
ColormapPtr pCmap;
dmxColormapPrivPtr pCmapPriv;
- pCmap = (ColormapPtr)LookupIDByType(wColormap(pWindow), RT_COLORMAP);
+ dixLookupResourceByType((pointer*) &pCmap, wColormap(pWindow),
+ RT_COLORMAP, NullClient, DixUnknownAccess);
pCmapPriv = DMX_GET_COLORMAP_PRIV(pCmap);
attribs->colormap = pCmapPriv->cmap;
}
diff --git a/xorg-server/hw/dmx/glxProxy/glxcmds.c b/xorg-server/hw/dmx/glxProxy/glxcmds.c
index 540fd00cd..74af631ad 100644
--- a/xorg-server/hw/dmx/glxProxy/glxcmds.c
+++ b/xorg-server/hw/dmx/glxProxy/glxcmds.c
@@ -129,7 +129,8 @@ static int CreateContext(__GLXclientState *cl,
if (shareList == None) {
shareglxc = NULL;
} else {
- shareglxc = (__GLXcontext *) LookupIDByType(shareList, __glXContextRes);
+ dixLookupResourceByType((pointer*) &shareglxc, shareList,
+ __glXContextRes, NullClient, DixUnknownAccess);
if (!shareglxc) {
client->errorValue = shareList;
return __glXBadContext;
@@ -420,14 +421,14 @@ int __glXBindSwapBarrierSGIX(__GLXclientState *cl, GLbyte *pc)
rc = dixLookupDrawable(&pDraw, req->drawable, client, 0, DixGetAttrAccess);
if (rc != Success) {
- pGlxPixmap = (__GLXpixmap *) LookupIDByType(req->drawable,
- __glXPixmapRes);
+ dixLookupResourceByType((pointer*) &pGlxPixmap, req->drawable,
+ __glXPixmapRes, NullClient, DixUnknownAccess);
if (pGlxPixmap) pDraw = pGlxPixmap->pDraw;
}
if (!pDraw && __GLX_IS_VERSION_SUPPORTED(1,3) ) {
- pGlxWindow = (__glXWindow *) LookupIDByType(req->drawable,
- __glXWindowRes);
+ dixLookupResourceByType((pointer*) &pGlxWindow, req->drawable,
+ __glXWindowRes, NullClient, DixUnknownAccess);
if (pGlxWindow) pDraw = pGlxWindow->pDraw;
}
@@ -450,14 +451,14 @@ int __glXJoinSwapGroupSGIX(__GLXclientState *cl, GLbyte *pc)
rc = dixLookupDrawable(&pDraw, req->drawable, client, 0, DixManageAccess);
if (rc != Success) {
- pGlxPixmap = (__GLXpixmap *) LookupIDByType(req->drawable,
- __glXPixmapRes);
+ dixLookupResourceByType((pointer*) &pGlxPixmap, req->drawable,
+ __glXPixmapRes, NullClient, DixUnknownAccess);
if (pGlxPixmap) pDraw = pGlxPixmap->pDraw;
}
if (!pDraw && __GLX_IS_VERSION_SUPPORTED(1,3) ) {
- pGlxWindow = (__glXWindow *) LookupIDByType(req->drawable,
- __glXWindowRes);
+ dixLookupResourceByType((pointer*) &pGlxWindow, req->drawable,
+ __glXWindowRes, NullClient, DixUnknownAccess);
if (pGlxWindow) pDraw = pGlxWindow->pDraw;
}
@@ -470,14 +471,16 @@ int __glXJoinSwapGroupSGIX(__GLXclientState *cl, GLbyte *pc)
rc = dixLookupDrawable(&pMember, req->member, client, 0,
DixGetAttrAccess);
if (rc != Success) {
- pGlxPixmap = (__GLXpixmap *) LookupIDByType(req->member,
- __glXPixmapRes);
+ dixLookupResourceByType((pointer*) &pGlxPixmap, req->member,
+ __glXPixmapRes, NullClient,
+ DixUnknownAccess);
if (pGlxPixmap) pMember = pGlxPixmap->pDraw;
}
if (!pMember && __GLX_IS_VERSION_SUPPORTED(1,3) ) {
- pGlxWindow = (__glXWindow *) LookupIDByType(req->member,
- __glXWindowRes);
+ dixLookupResourceByType((pointer*) &pGlxWindow, req->member,
+ __glXWindowRes, NullClient,
+ DixUnknownAccess);
if (pGlxWindow) pMember = pGlxWindow->pDraw;
}
@@ -505,7 +508,8 @@ int __glXDestroyContext(__GLXclientState *cl, GLbyte *pc)
int to_screen = 0;
int s;
- glxc = (__GLXcontext *) LookupIDByType(gcId, __glXContextRes);
+ dixLookupResourceByType((pointer*) &glxc, gcId, __glXContextRes,
+ NullClient, DixUnknownAccess);
if (glxc) {
/*
** Just free the resource; don't actually destroy the context,
@@ -752,7 +756,8 @@ static int MakeCurrent(__GLXclientState *cl,
** Lookup new context. It must not be current for someone else.
*/
if (contextId != None) {
- glxc = (__GLXcontext *) LookupIDByType(contextId, __glXContextRes);
+ dixLookupResourceByType((pointer*) &glxc, contextId, __glXContextRes,
+ NullClient, DixUnknownAccess);
if (!glxc) {
client->errorValue = contextId;
return __glXBadContext;
@@ -802,8 +807,9 @@ static int MakeCurrent(__GLXclientState *cl,
}
if (!pDraw) {
- pGlxPixmap = (__GLXpixmap *) LookupIDByType(drawId,
- __glXPixmapRes);
+ dixLookupResourceByType((pointer*) &pGlxPixmap, drawId,
+ __glXPixmapRes, NullClient,
+ DixUnknownAccess);
if (pGlxPixmap) {
/*
** Check if pixmap and context are similar.
@@ -826,7 +832,9 @@ static int MakeCurrent(__GLXclientState *cl,
}
if (!pDraw && __GLX_IS_VERSION_SUPPORTED(1,3) ) {
- pGlxWindow = (__glXWindow *) LookupIDByType(drawId, __glXWindowRes);
+ dixLookupResourceByType((pointer*) &pGlxWindow, drawId,
+ __glXWindowRes, NullClient,
+ DixUnknownAccess);
if (pGlxWindow) {
/*
** Drawable is a GLXWindow.
@@ -847,7 +855,9 @@ static int MakeCurrent(__GLXclientState *cl,
}
if (!pDraw && __GLX_IS_VERSION_SUPPORTED(1,3) ) {
- pGlxPbuffer = (__glXPbuffer *)LookupIDByType(drawId, __glXPbufferRes);
+ dixLookupResourceByType((pointer*) &pGlxPbuffer, drawId,
+ __glXPbufferRes, NullClient,
+ DixUnknownAccess);
if (pGlxPbuffer) {
if (pGlxPbuffer->pScreen != glxc->pScreen ||
pGlxPbuffer->pFBConfig != glxc->pFBConfig) {
@@ -908,8 +918,9 @@ static int MakeCurrent(__GLXclientState *cl,
}
if (!pReadDraw) {
- pReadGlxPixmap = (__GLXpixmap *) LookupIDByType(readId,
- __glXPixmapRes);
+ dixLookupResourceByType((pointer*) &pReadGlxPixmap, readId,
+ __glXPixmapRes, NullClient,
+ DixUnknownAccess);
if (pReadGlxPixmap) {
/*
** Check if pixmap and context are similar.
@@ -929,8 +940,9 @@ static int MakeCurrent(__GLXclientState *cl,
}
if (!pReadDraw && __GLX_IS_VERSION_SUPPORTED(1,3) ) {
- pGlxReadWindow = (__glXWindow *)
- LookupIDByType(readId, __glXWindowRes);
+ dixLookupResourceByType((pointer*) &pGlxReadWindow, readId,
+ __glXWindowRes, NullClient,
+ DixUnknownAccess);
if (pGlxReadWindow) {
/*
** Drawable is a GLXWindow.
@@ -950,7 +962,9 @@ static int MakeCurrent(__GLXclientState *cl,
}
if (!pReadDraw && __GLX_IS_VERSION_SUPPORTED(1,3) ) {
- pGlxReadPbuffer = (__glXPbuffer *)LookupIDByType(readId, __glXPbufferRes);
+ dixLookupResourceByType((pointer*) &pGlxReadPbuffer, readId,
+ __glXPbufferRes, NullClient,
+ DixUnknownAccess);
if (pGlxReadPbuffer) {
if (pGlxReadPbuffer->pScreen != glxc->pScreen ||
pGlxReadPbuffer->pFBConfig != glxc->pFBConfig) {
@@ -1090,14 +1104,16 @@ static int MakeCurrent(__GLXclientState *cl,
to_screen = screenInfo.numScreens - 1;
if (pDraw && new_reply.writeType != GLX_PBUFFER_TYPE) {
- pXinDraw = (PanoramiXRes *)
- SecurityLookupIDByClass(client, pDraw->id, XRC_DRAWABLE, DixReadAccess);
+ dixLookupResourceByClass((pointer*) &pXinDraw,
+ pDraw->id, XRC_DRAWABLE,
+ client, DixReadAccess);
}
if (pReadDraw && pReadDraw != pDraw &&
new_reply.readType != GLX_PBUFFER_TYPE) {
- pXinReadDraw = (PanoramiXRes *)
- SecurityLookupIDByClass(client, pReadDraw->id, XRC_DRAWABLE, DixReadAccess);
+ dixLookupResourceByClass((pointer*) &pXinReadDraw,
+ pReadDraw->id, XRC_DRAWABLE,
+ client, DixReadAccess);
}
else {
pXinReadDraw = pXinDraw;
@@ -1303,7 +1319,8 @@ int __glXIsDirect(__GLXclientState *cl, GLbyte *pc)
/*
** Find the GL context.
*/
- glxc = (__GLXcontext *) LookupIDByType(req->context, __glXContextRes);
+ dixLookupResourceByType((pointer*) &glxc, req->context, __glXContextRes,
+ NullClient, DixUnknownAccess);
if (!glxc) {
client->errorValue = req->context;
return __glXBadContext;
@@ -1449,12 +1466,14 @@ int __glXCopyContext(__GLXclientState *cl, GLbyte *pc)
/*
** Check that each context exists.
*/
- src = (__GLXcontext *) LookupIDByType(source, __glXContextRes);
+ dixLookupResourceByType((pointer*) &src, source, __glXContextRes,
+ NullClient, DixUnknownAccess);
if (!src) {
client->errorValue = source;
return __glXBadContext;
}
- dst = (__GLXcontext *) LookupIDByType(dest, __glXContextRes);
+ dixLookupResourceByType((pointer*) &dst, dest, __glXContextRes,
+ NullClient, DixUnknownAccess);
if (!dst) {
client->errorValue = dest;
return __glXBadContext;
@@ -1748,8 +1767,9 @@ static int CreateGLXPixmap(__GLXclientState *cl,
from_screen = 0;
to_screen = screenInfo.numScreens - 1;
- pXinDraw = (PanoramiXRes *)
- SecurityLookupIDByClass(client, pDraw->id, XRC_DRAWABLE, DixReadAccess);
+ dixLookupResourceByClass((pointer*) &pXinDraw,
+ pDraw->id, XRC_DRAWABLE,
+ client, DixReadAccess);
}
#endif
@@ -1870,7 +1890,8 @@ int __glXDestroyGLXPixmap(__GLXclientState *cl, GLbyte *pc)
/*
** Check if it's a valid GLX pixmap.
*/
- pGlxPixmap = (__GLXpixmap *)LookupIDByType(glxpixmap, __glXPixmapRes);
+ dixLookupResourceByType((pointer*) &pGlxPixmap, glxpixmap,
+ __glXPixmapRes, NullClient, DixUnknownAccess);
if (!pGlxPixmap) {
client->errorValue = glxpixmap;
return __glXBadPixmap;
@@ -1953,8 +1974,8 @@ int __glXDoSwapBuffers(__GLXclientState *cl, XID drawId, GLXContextTag tag)
}
if (!pDraw) {
- pGlxPixmap = (__GLXpixmap *) LookupIDByType(drawId,
- __glXPixmapRes);
+ dixLookupResourceByType((pointer*) &pGlxPixmap, drawId,
+ __glXPixmapRes, NullClient, DixUnknownAccess);
if (pGlxPixmap) {
/*
** Drawable is a GLX pixmap.
@@ -1965,7 +1986,8 @@ int __glXDoSwapBuffers(__GLXclientState *cl, XID drawId, GLXContextTag tag)
}
if (!pDraw && __GLX_IS_VERSION_SUPPORTED(1,3) ) {
- pGlxWindow = (__glXWindow *) LookupIDByType(drawId, __glXWindowRes);
+ dixLookupResourceByType((pointer*) &pGlxWindow, drawId,
+ __glXWindowRes, NullClient, DixUnknownAccess);
if (pGlxWindow) {
/*
** Drawable is a GLXWindow.
@@ -1994,8 +2016,9 @@ int __glXDoSwapBuffers(__GLXclientState *cl, XID drawId, GLXContextTag tag)
if (!noPanoramiXExtension) {
from_screen = 0;
to_screen = screenInfo.numScreens - 1;
- pXinDraw = (PanoramiXRes *)
- SecurityLookupIDByClass(client, pDraw->id, XRC_DRAWABLE, DixReadAccess);
+ dixLookupResourceByClass((pointer*) &pXinDraw,
+ pDraw->id, XRC_DRAWABLE,
+ client, DixReadAccess);
}
#endif
@@ -2100,8 +2123,8 @@ int __glXSwapBuffers(__GLXclientState *cl, GLbyte *pc)
}
if (!pDraw) {
- pGlxPixmap = (__GLXpixmap *) LookupIDByType(drawId,
- __glXPixmapRes);
+ dixLookupResourceByType((pointer*) &pGlxPixmap, drawId,
+ __glXPixmapRes, NullClient, DixUnknownAccess);
if (pGlxPixmap) {
/*
** Drawable is a GLX pixmap.
@@ -2111,7 +2134,8 @@ int __glXSwapBuffers(__GLXclientState *cl, GLbyte *pc)
}
if (!pDraw && __GLX_IS_VERSION_SUPPORTED(1,3) ) {
- pGlxWindow = (__glXWindow *) LookupIDByType(drawId, __glXWindowRes);
+ dixLookupResourceByType((pointer*) &pGlxWindow, drawId,
+ __glXWindowRes, NullClient, DixUnknownAccess);
if (pGlxWindow) {
/*
** Drawable is a GLXWindow.
@@ -2620,9 +2644,13 @@ int __glXUseXFont(__GLXclientState *cl, GLbyte *pc)
** Font can actually be either the ID of a font or the ID of a GC
** containing a font.
*/
- pFont = (FontPtr)LookupIDByType(req->font, RT_FONT);
+ dixLookupResourceByType((pointer*) &pFont, req->font, RT_FONT,
+ NullClient, DixUnknownAccess);
if (!pFont) {
- GC *pGC = (GC *)LookupIDByType(req->font, RT_GC);
+ GC *pGC;
+ dixLookupResourceByType((pointer*) &pGC, req->font,
+ RT_GC, NullClient,
+ DixUnknownAccess);
if (!pGC) {
client->errorValue = req->font;
return BadFont;
@@ -2873,6 +2901,7 @@ int __glXCreateWindow(__GLXclientState *cl, GLbyte *pc)
VisualPtr pVisual;
VisualID visId;
int i, rc;
+ pointer val;
/*
** Check if windowId is valid
@@ -2938,7 +2967,9 @@ int __glXCreateWindow(__GLXclientState *cl, GLbyte *pc)
/*
** Check if there is already a fbconfig associated with this window
*/
- if ( LookupIDByType(glxwindowId, __glXWindowRes) ) {
+ if (Success == dixLookupResourceByType(&val,
+ glxwindowId, __glXWindowRes,
+ NullClient, DixUnknownAccess)) {
client->errorValue = glxwindowId;
return BadAlloc;
}
@@ -2970,11 +3001,14 @@ int __glXDestroyWindow(__GLXclientState *cl, GLbyte *pc)
ClientPtr client = cl->client;
xGLXDestroyWindowReq *req = (xGLXDestroyWindowReq *) pc;
XID glxwindow = req->glxwindow;
+ pointer val;
/*
** Check if it's a valid GLX window.
*/
- if (!LookupIDByType(glxwindow, __glXWindowRes)) {
+ if (Success != dixLookupResourceByType(&val,
+ glxwindow, __glXWindowRes,
+ NullClient, DixUnknownAccess)) {
client->errorValue = glxwindow;
return __glXBadDrawable;
}
@@ -2998,7 +3032,8 @@ int __glXQueryContext(__GLXclientState *cl, GLbyte *pc)
int nReplyBytes;
req = (xGLXQueryContextReq *)pc;
- ctx = (__GLXcontext *) LookupIDByType(req->context, __glXContextRes);
+ dixLookupResourceByType((pointer*) &ctx, req->context, __glXContextRes,
+ NullClient, DixUnknownAccess);
if (!ctx) {
client->errorValue = req->context;
return __glXBadContext;
@@ -3043,7 +3078,10 @@ int __glXQueryContextInfoEXT(__GLXclientState *cl, GLbyte *pc)
int nReplyBytes;
req = (xGLXQueryContextInfoEXTReq *)pc;
- ctx = (__GLXcontext *) SecurityLookupIDByType(client, req->context, __glXContextRes, DixReadAccess);
+ dixLookupResourceByType((pointer*) &ctx,
+ req->context, __glXContextRes,
+ client, DixReadAccess);
+
if (!ctx) {
client->errorValue = req->context;
return __glXBadContext;
@@ -3208,7 +3246,8 @@ int __glXDestroyPbuffer(__GLXclientState *cl, GLbyte *pc)
/*
** Check if it's a valid Pbuffer
*/
- pGlxPbuffer = (__glXPbuffer *)LookupIDByType(pbuffer, __glXPbufferRes);
+ dixLookupResourceByType((pointer*) &pGlxPbuffer, pbuffer,
+ __glXPbufferRes, NullClient, DixUnknownAccess);
if (!pGlxPbuffer) {
client->errorValue = pbuffer;
return __glXBadPbuffer;
@@ -3280,8 +3319,10 @@ int __glXGetDrawableAttributes(__GLXclientState *cl, GLbyte *pc)
}
if (!pDraw) {
- __GLXpixmap *pGlxPixmap = (__GLXpixmap *) LookupIDByType(drawId,
- __glXPixmapRes);
+ __GLXpixmap *pGlxPixmap;
+ dixLookupResourceByType((pointer*) &pGlxPixmap,
+ drawId, __glXPixmapRes,
+ NullClient, DixUnknownAccess);
if (pGlxPixmap) {
pDraw = pGlxPixmap->pDraw;
screen = pGlxPixmap->pScreen->myNum;
@@ -3290,7 +3331,10 @@ int __glXGetDrawableAttributes(__GLXclientState *cl, GLbyte *pc)
}
if (!pDraw) {
- __glXWindow *pGlxWindow = (__glXWindow *) LookupIDByType(drawId, __glXWindowRes);
+ __glXWindow *pGlxWindow;
+ dixLookupResourceByType((pointer*) &pGlxWindow,
+ drawId, __glXWindowRes,
+ NullClient, DixUnknownAccess);
if (pGlxWindow) {
pDraw = pGlxWindow->pDraw;
screen = pGlxWindow->pScreen->myNum;
@@ -3299,7 +3343,10 @@ int __glXGetDrawableAttributes(__GLXclientState *cl, GLbyte *pc)
}
if (!pDraw) {
- __glXPbuffer *pGlxPbuffer = (__glXPbuffer *)LookupIDByType(drawId, __glXPbufferRes);
+ __glXPbuffer *pGlxPbuffer;
+ dixLookupResourceByType((pointer*) &pGlxPbuffer,
+ drawId, __glXPbufferRes,
+ NullClient, DixUnknownAccess);
if (pGlxPbuffer) {
pDraw = (DrawablePtr)pGlxPbuffer;
screen = pGlxPbuffer->pScreen->myNum;
@@ -3326,9 +3373,9 @@ int __glXGetDrawableAttributes(__GLXclientState *cl, GLbyte *pc)
#ifdef PANORAMIX
if (!noPanoramiXExtension) {
- pXinDraw = (PanoramiXRes *)
- SecurityLookupIDByClass(client, pDraw->id, XRC_DRAWABLE, DixReadAccess);
- if (!pXinDraw) {
+ if (Success != dixLookupResourceByClass((pointer*) &pXinDraw,
+ pDraw->id, XRC_DRAWABLE,
+ client, DixReadAccess)) {
client->errorValue = drawId;
return __glXBadDrawable;
}
@@ -3436,8 +3483,10 @@ int __glXChangeDrawableAttributes(__GLXclientState *cl, GLbyte *pc)
}
if (!pDraw) {
- __GLXpixmap *pGlxPixmap = (__GLXpixmap *) LookupIDByType(drawId,
- __glXPixmapRes);
+ __GLXpixmap *pGlxPixmap;
+ dixLookupResourceByType((pointer*) &pGlxPixmap,
+ drawId, __glXPixmapRes,
+ NullClient, DixUnknownAccess);
if (pGlxPixmap) {
pDraw = pGlxPixmap->pDraw;
screen = pGlxPixmap->pScreen->myNum;
@@ -3446,7 +3495,10 @@ int __glXChangeDrawableAttributes(__GLXclientState *cl, GLbyte *pc)
}
if (!pDraw) {
- __glXWindow *pGlxWindow = (__glXWindow *) LookupIDByType(drawId, __glXWindowRes);
+ __glXWindow *pGlxWindow;
+ dixLookupResourceByType((pointer*) &pGlxWindow,
+ drawId, __glXWindowRes,
+ NullClient, DixUnknownAccess);
if (pGlxWindow) {
pDraw = pGlxWindow->pDraw;
screen = pGlxWindow->pScreen->myNum;
@@ -3455,7 +3507,10 @@ int __glXChangeDrawableAttributes(__GLXclientState *cl, GLbyte *pc)
}
if (!pDraw) {
- __glXPbuffer *pGlxPbuffer = (__glXPbuffer *)LookupIDByType(drawId, __glXPbufferRes);
+ __glXPbuffer *pGlxPbuffer;
+ dixLookupResourceByType((pointer*) &pGlxPbuffer,
+ drawId, __glXPbufferRes,
+ NullClient, DixUnknownAccess);
if (pGlxPbuffer) {
pDraw = (DrawablePtr)pGlxPbuffer;
screen = pGlxPbuffer->pScreen->myNum;
@@ -3482,9 +3537,10 @@ int __glXChangeDrawableAttributes(__GLXclientState *cl, GLbyte *pc)
#ifdef PANORAMIX
if (!noPanoramiXExtension) {
- PanoramiXRes *pXinDraw = (PanoramiXRes *)
- SecurityLookupIDByClass(client, pDraw->id, XRC_DRAWABLE, DixReadAccess);
- if (!pXinDraw) {
+ PanoramiXRes *pXinDraw;
+ if (Success != dixLookupResourceByClass((pointer*) &pXinDraw,
+ pDraw->id, XRC_DRAWABLE,
+ client, DixReadAccess)) {
client->errorValue = drawId;
return __glXBadDrawable;
}
diff --git a/xorg-server/hw/dmx/glxProxy/glxext.c b/xorg-server/hw/dmx/glxProxy/glxext.c
index a90c14906..4da16a77d 100644
--- a/xorg-server/hw/dmx/glxProxy/glxext.c
+++ b/xorg-server/hw/dmx/glxProxy/glxext.c
@@ -186,8 +186,12 @@ void __glXFreeGLXWindow(__glXWindow *pGlxWindow)
{
if (!pGlxWindow->idExists && !pGlxWindow->refcnt) {
WindowPtr pWindow = (WindowPtr) pGlxWindow->pDraw;
+ WindowPtr ret;
- if (LookupIDByType(pWindow->drawable.id, RT_WINDOW) == pWindow) {
+ dixLookupResourceByType((pointer) &ret,
+ pWindow->drawable.id, RT_WINDOW,
+ NullClient, DixUnknownAccess);
+ if (ret == pWindow) {
(*pGlxWindow->pScreen->DestroyWindow)(pWindow);
}
diff --git a/xorg-server/hw/xfree86/common/Makefile.am b/xorg-server/hw/xfree86/common/Makefile.am
index c4067aa62..56caaa5ab 100644
--- a/xorg-server/hw/xfree86/common/Makefile.am
+++ b/xorg-server/hw/xfree86/common/Makefile.am
@@ -24,8 +24,8 @@ BUSSOURCES = xf86pciBus.c xf86fbBus.c xf86noBus.c $(SBUS_SOURCES)
MODEDEFSOURCES = $(srcdir)/vesamodes $(srcdir)/extramodes
xf86DefModeSet.c: $(srcdir)/modeline2c.awk $(MODEDEFSOURCES)
- cat $(MODEDEFSOURCES) | LC_ALL=C $(AWK) -f $(srcdir)/modeline2c.awk > $@
- echo >> $@
+ $(AM_V_GEN)cat $(MODEDEFSOURCES) | LC_ALL=C $(AWK) -f $(srcdir)/modeline2c.awk > $@
+ $(AM_V_GEN)echo >> $@
BUILT_SOURCES = xf86DefModeSet.c
diff --git a/xorg-server/hw/xfree86/common/xf86AutoConfig.c b/xorg-server/hw/xfree86/common/xf86AutoConfig.c
index 14b266d38..384f08103 100644
--- a/xorg-server/hw/xfree86/common/xf86AutoConfig.c
+++ b/xorg-server/hw/xfree86/common/xf86AutoConfig.c
@@ -297,8 +297,8 @@ copyScreen(confScreenPtr oscreen, GDevPtr odev, int i, char *driver)
}
memcpy(cptr, odev, sizeof(GDevRec));
- cptr->identifier = Xprintf("Autoconfigured Video Device %s", driver);
- if (!cptr->identifier) {
+ if (asprintf(&cptr->identifier, "Autoconfigured Video Device %s", driver)
+ == -1) {
free(cptr);
free(nscreen);
return FALSE;
diff --git a/xorg-server/hw/xfree86/common/xf86Config.c b/xorg-server/hw/xfree86/common/xf86Config.c
index c439221f9..4246f6d71 100644
--- a/xorg-server/hw/xfree86/common/xf86Config.c
+++ b/xorg-server/hw/xfree86/common/xf86Config.c
@@ -208,9 +208,7 @@ xf86ValidateFontPath(char *path)
continue;
}
else {
- p1 = xnfalloc(strlen(dir_elem)+strlen(DIR_FILE)+1);
- strcpy(p1, dir_elem);
- strcat(p1, DIR_FILE);
+ XNFasprintf(&p1, "%s%s", dir_elem, DIR_FILE);
flag = stat(p1, &stat_buf);
if (flag == 0)
if (!S_ISREG(stat_buf.st_mode))
@@ -585,12 +583,11 @@ configFiles(XF86ConfFilesPtr fileconf)
else if (fileconf && fileconf->file_fontpath) {
pathFrom = X_CONFIG;
if (xf86Info.useDefaultFontPath) {
- defaultFontPath = Xprintf("%s%s%s",
- fileconf->file_fontpath,
- *temp_path ? "," : "", temp_path);
- if (defaultFontPath != NULL) {
+ if (asprintf(&defaultFontPath, "%s%s%s", fileconf->file_fontpath,
+ *temp_path ? "," : "", temp_path) == -1)
+ defaultFontPath = NULL;
+ else
must_copy = FALSE;
- }
}
else
defaultFontPath = fileconf->file_fontpath;
diff --git a/xorg-server/hw/xfree86/common/xf86Configure.c b/xorg-server/hw/xfree86/common/xf86Configure.c
index 6cce1cdd5..c106f3754 100644
--- a/xorg-server/hw/xfree86/common/xf86Configure.c
+++ b/xorg-server/hw/xfree86/common/xf86Configure.c
@@ -205,12 +205,9 @@ configureScreenSection (int screennum)
int depths[] = { 1, 4, 8, 15, 16, 24/*, 32*/ };
parsePrologue (XF86ConfScreenPtr, XF86ConfScreenRec)
- ptr->scrn_identifier = malloc(18);
- sprintf(ptr->scrn_identifier, "Screen%d", screennum);
- ptr->scrn_monitor_str = malloc(19);
- sprintf(ptr->scrn_monitor_str, "Monitor%d", screennum);
- ptr->scrn_device_str = malloc(16);
- sprintf(ptr->scrn_device_str, "Card%d", screennum);
+ XNFasprintf(&ptr->scrn_identifier, "Screen%d", screennum);
+ XNFasprintf(&ptr->scrn_monitor_str, "Monitor%d", screennum);
+ XNFasprintf(&ptr->scrn_device_str, "Card%d", screennum);
for (i=0; i<sizeof(depths)/sizeof(depths[0]); i++)
{
@@ -256,14 +253,13 @@ optionTypeToString(OptionValueType type)
static XF86ConfDevicePtr
configureDeviceSection (int screennum)
{
- char identifier[16];
OptionInfoPtr p;
int i = 0;
parsePrologue (XF86ConfDevicePtr, XF86ConfDeviceRec)
/* Move device info to parser structure */
- sprintf(identifier, "Card%d", screennum);
- ptr->dev_identifier = strdup(identifier);
+ if (asprintf(&ptr->dev_identifier, "Card%d", screennum) == -1)
+ ptr->dev_identifier = NULL;
ptr->dev_chipset = DevToConfig[screennum].GDev.chipset;
ptr->dev_busid = DevToConfig[screennum].GDev.busID;
ptr->dev_driver = DevToConfig[screennum].GDev.driver;
@@ -306,10 +302,8 @@ configureDeviceSection (int screennum)
int len = strlen(ptr->dev_comment) + strlen(prefix) +
strlen(middle) + strlen(suffix) + 1;
- optname = malloc(strlen(p->name) + 2 + 1);
- if (!optname)
+ if (asprintf(&optname, "\"%s\"", p->name) == -1)
break;
- sprintf(optname, "\"%s\"", p->name);
len += max(20, strlen(optname));
len += strlen(opttype);
@@ -370,16 +364,14 @@ configureLayoutSection (void)
aptr->adj_x = 0;
aptr->adj_y = 0;
aptr->adj_scrnum = scrnum;
- aptr->adj_screen_str = xnfalloc(18);
- sprintf(aptr->adj_screen_str, "Screen%d", scrnum);
+ XNFasprintf(&aptr->adj_screen_str, "Screen%d", scrnum);
if (scrnum == 0) {
aptr->adj_where = CONF_ADJ_ABSOLUTE;
aptr->adj_refscreen = NULL;
}
else {
aptr->adj_where = CONF_ADJ_RIGHTOF;
- aptr->adj_refscreen = xnfalloc(18);
- sprintf(aptr->adj_refscreen, "Screen%d", scrnum - 1);
+ XNFasprintf(&aptr->adj_refscreen, "Screen%d", scrnum - 1);
}
ptr->lay_adjacency_lst =
(XF86ConfAdjacencyPtr)xf86addListItem((glp)ptr->lay_adjacency_lst,
@@ -443,8 +435,7 @@ configureMonitorSection (int screennum)
{
parsePrologue (XF86ConfMonitorPtr, XF86ConfMonitorRec)
- ptr->mon_identifier = malloc(19);
- sprintf(ptr->mon_identifier, "Monitor%d", screennum);
+ XNFasprintf(&ptr->mon_identifier, "Monitor%d", screennum);
ptr->mon_vendor = strdup("Monitor Vendor");
ptr->mon_modelname = strdup("Monitor Model");
@@ -491,11 +482,9 @@ configureDDCMonitorSection (int screennum)
parsePrologue (XF86ConfMonitorPtr, XF86ConfMonitorRec)
- ptr->mon_identifier = malloc(19);
- sprintf(ptr->mon_identifier, "Monitor%d", screennum);
+ XNFasprintf(&ptr->mon_identifier, "Monitor%d", screennum);
ptr->mon_vendor = strdup(ConfiguredMonitor->vendor.name);
- ptr->mon_modelname = malloc(12);
- sprintf(ptr->mon_modelname, "%x", ConfiguredMonitor->vendor.prod_id);
+ XNFasprintf(&ptr->mon_modelname, "%x", ConfiguredMonitor->vendor.prod_id);
/* features in centimetres, we want millimetres */
mon_width = 10 * ConfiguredMonitor->features.hsize ;
diff --git a/xorg-server/hw/xfree86/common/xf86Helper.c b/xorg-server/hw/xfree86/common/xf86Helper.c
index 9b6daaf41..8f61c4c72 100644
--- a/xorg-server/hw/xfree86/common/xf86Helper.c
+++ b/xorg-server/hw/xfree86/common/xf86Helper.c
@@ -1193,9 +1193,13 @@ xf86VIDrvMsgVerb(InputInfoPtr dev, MessageType type, int verb, const char *forma
{
char *msg;
- msg = Xprintf("%s: %s: %s", dev->drv->driverName, dev->name, format);
- LogVMessageVerb(type, verb, msg, args);
- free(msg);
+ if (asprintf(&msg, "%s: %s: %s", dev->drv->driverName, dev->name, format)
+ == -1) {
+ LogVMessageVerb(type, verb, "%s", args);
+ } else {
+ LogVMessageVerb(type, verb, msg, args);
+ free(msg);
+ }
}
/* Print input driver message, with verbose level specified directly */
@@ -1280,11 +1284,8 @@ xf86LogInit(void)
/* Get the log file name */
if (xf86LogFileFrom == X_DEFAULT) {
/* Append the display number and ".log" */
- lf = malloc(strlen(xf86LogFile) + strlen("%s") +
- strlen(LOGSUFFIX) + 1);
- if (!lf)
+ if (asprintf(&lf, "%s%%s" LOGSUFFIX, xf86LogFile) == -1)
FatalError("Cannot allocate space for the log file name\n");
- sprintf(lf, "%s%%s" LOGSUFFIX, xf86LogFile);
xf86LogFile = lf;
}
diff --git a/xorg-server/hw/xfree86/common/xf86Init.c b/xorg-server/hw/xfree86/common/xf86Init.c
index a6740e69f..f3ce3f696 100644
--- a/xorg-server/hw/xfree86/common/xf86Init.c
+++ b/xorg-server/hw/xfree86/common/xf86Init.c
@@ -536,8 +536,7 @@ InitOutput(ScreenInfo *pScreenInfo, int argc, char **argv)
for (i = 0; i < xf86NumScreens; i++) {
if (xf86Screens[i]->name == NULL) {
- xf86Screens[i]->name = xnfalloc(strlen("screen") + 10 + 1);
- sprintf(xf86Screens[i]->name, "screen%d", i);
+ XNFasprintf(&xf86Screens[i]->name, "screen%d", i);
xf86MsgVerb(X_WARNING, 0,
"Screen driver %d has no name set, using `%s'.\n",
i, xf86Screens[i]->name);
diff --git a/xorg-server/hw/xfree86/common/xf86Option.c b/xorg-server/hw/xfree86/common/xf86Option.c
index 97deb1436..d7b294a86 100644
--- a/xorg-server/hw/xfree86/common/xf86Option.c
+++ b/xorg-server/hw/xfree86/common/xf86Option.c
@@ -638,13 +638,10 @@ ParseOptionValue(int scrnIndex, pointer options, OptionInfoPtr p,
newn = n + 2;
} else {
free(n);
- n = malloc(strlen(p->name) + 2 + 1);
- if (!n) {
+ if (asprintf(&n, "No%s", p->name) == -1) {
p->found = FALSE;
return FALSE;
}
- strcpy(n, "No");
- strcat(n, p->name);
newn = n;
}
if ((s = xf86findOptionValue(options, newn)) != NULL) {
diff --git a/xorg-server/hw/xfree86/common/xf86ShowOpts.c b/xorg-server/hw/xfree86/common/xf86ShowOpts.c
index 831e6b787..7aa79eb6a 100644
--- a/xorg-server/hw/xfree86/common/xf86ShowOpts.c
+++ b/xorg-server/hw/xfree86/common/xf86ShowOpts.c
@@ -97,11 +97,8 @@ void DoShowOptions (void) {
);
continue;
}
- pSymbol = malloc(
- strlen(xf86DriverList[i]->driverName) + strlen("ModuleData") + 1
- );
- strcpy (pSymbol, xf86DriverList[i]->driverName);
- strcat (pSymbol, "ModuleData");
+ XNFasprintf(&pSymbol, "%sModuleData",
+ xf86DriverList[i]->driverName);
initData = LoaderSymbol (pSymbol);
if (initData) {
XF86ModuleVersionInfo *vers = initData->vers;
@@ -111,6 +108,9 @@ void DoShowOptions (void) {
);
for (p = pOption; p->name != NULL; p++) {
const char *opttype = optionTypeToSting(p->type);
+ /* XXX: Why overallocate by 2 bytes?
+ * Otherwise, this would be strdup()
+ */
char *optname = malloc(strlen(p->name) + 2 + 1);
if (!optname) {
continue;
diff --git a/xorg-server/hw/xfree86/common/xf86pciBus.c b/xorg-server/hw/xfree86/common/xf86pciBus.c
index aef7d277a..2f04ac12f 100644
--- a/xorg-server/hw/xfree86/common/xf86pciBus.c
+++ b/xorg-server/hw/xfree86/common/xf86pciBus.c
@@ -1347,9 +1347,9 @@ xf86PciConfigureNewDev(void *busData, struct pci_device *pVideo,
pVideo = (struct pci_device *) busData;
- GDev->busID = xnfalloc(16);
xf86FormatPciBusNumber(pVideo->bus, busnum);
- sprintf(GDev->busID, "PCI:%s:%d:%d", busnum, pVideo->dev, pVideo->func);
+ XNFasprintf(&GDev->busID, "PCI:%s:%d:%d",
+ busnum, pVideo->dev, pVideo->func);
GDev->chipID = pVideo->device_id;
GDev->chipRev = pVideo->revision;
diff --git a/xorg-server/hw/xfree86/common/xf86sbusBus.c b/xorg-server/hw/xfree86/common/xf86sbusBus.c
index f9244bca7..c0de88dda 100644
--- a/xorg-server/hw/xfree86/common/xf86sbusBus.c
+++ b/xorg-server/hw/xfree86/common/xf86sbusBus.c
@@ -706,11 +706,9 @@ xf86SbusConfigureNewDev(void *busData, sbusDevicePtr sBus, GDevRec *GDev)
sparcPromClose();
}
if (promPath) {
- GDev->busID = xnfalloc(strlen(promPath) + 6);
- sprintf(GDev->busID, "SBUS:%s", promPath);
+ XNFasprintf(&GDev->busID, "SBUS:%s", promPath);
free(promPath);
} else {
- GDev->busID = xnfalloc(12);
- sprintf(GDev->busID, "SBUS:fb%d", sBus->fbNum);
+ XNFsprintf(&GDev->busID, "SBUS:fb%d", sBus->fbNum);
}
}
diff --git a/xorg-server/hw/xfree86/dixmods/extmod/modinit.c b/xorg-server/hw/xfree86/dixmods/extmod/modinit.c
index c0c17d722..ee3e52855 100644
--- a/xorg-server/hw/xfree86/dixmods/extmod/modinit.c
+++ b/xorg-server/hw/xfree86/dixmods/extmod/modinit.c
@@ -146,11 +146,8 @@ extmodSetup(pointer module, pointer opts, int *errmaj, int *errmin)
for (i = 0; extensionModules[i].name != NULL; i++) {
if (opts) {
char *s;
- s = (char *)malloc(strlen(extensionModules[i].name) + 5);
- if (s) {
+ if (Xasprinf(&s, "omit%s", extensionModules[i].name) != -1) {
pointer o;
- strcpy(s, "omit");
- strcat(s, extensionModules[i].name);
o = xf86FindOption(opts, s);
free(s);
if (o) {
diff --git a/xorg-server/hw/xfree86/dri/dri.c b/xorg-server/hw/xfree86/dri/dri.c
index c2f81b1c6..9ca5ecd0b 100644
--- a/xorg-server/hw/xfree86/dri/dri.c
+++ b/xorg-server/hw/xfree86/dri/dri.c
@@ -2426,13 +2426,10 @@ DRICreatePCIBusID(const struct pci_device * dev)
{
char *busID;
- busID = malloc(20);
- if (busID == NULL)
+ if (asprintf(&busID, "pci:%04x:%02x:%02x.%d",
+ dev->domain, dev->bus, dev->dev, dev->func) == -1)
return NULL;
- snprintf(busID, 20, "pci:%04x:%02x:%02x.%d", dev->domain, dev->bus,
- dev->dev, dev->func);
-
return busID;
}
diff --git a/xorg-server/hw/xfree86/loader/loadmod.c b/xorg-server/hw/xfree86/loader/loadmod.c
index 6fcb06df2..dbc16eab7 100644
--- a/xorg-server/hw/xfree86/loader/loadmod.c
+++ b/xorg-server/hw/xfree86/loader/loadmod.c
@@ -406,22 +406,22 @@ FindModuleInSubdir(const char *dirpath, const char *module)
snprintf(tmpBuf, PATH_MAX, "lib%s.so", module);
if (strcmp(direntry->d_name, tmpBuf) == 0) {
- ret = malloc(strlen(tmpBuf) + strlen(dirpath) + 1);
- sprintf(ret, "%s%s", dirpath, tmpBuf);
+ if (asprintf(&ret, "%s%s", dirpath, tmpBuf) == -1)
+ ret = NULL;
break;
}
snprintf(tmpBuf, PATH_MAX, "%s_drv.so", module);
if (strcmp(direntry->d_name, tmpBuf) == 0) {
- ret = malloc(strlen(tmpBuf) + strlen(dirpath) + 1);
- sprintf(ret, "%s%s", dirpath, tmpBuf);
+ if (asprintf(&ret, "%s%s", dirpath, tmpBuf) == -1)
+ ret = NULL;
break;
}
snprintf(tmpBuf, PATH_MAX, "%s.so", module);
if (strcmp(direntry->d_name, tmpBuf) == 0) {
- ret = malloc(strlen(tmpBuf) + strlen(dirpath) + 1);
- sprintf(ret, "%s%s", dirpath, tmpBuf);
+ if (asprintf(&ret, "%s%s", dirpath, tmpBuf) == -1)
+ ret = NULL;
break;
}
}
@@ -933,16 +933,14 @@ doLoadModule(const char *module, const char *path, const char **subdirlist,
* now check if the special data object <modulename>ModuleData is
* present.
*/
- p = malloc(strlen(name) + strlen("ModuleData") + 1);
- if (!p) {
+ if (asprintf(&p, "%sModuleData", name) == -1) {
+ p = NULL;
if (errmaj)
*errmaj = LDR_NOMEM;
if (errmin)
*errmin = 0;
goto LoadModule_fail;
}
- strcpy(p, name);
- strcat(p, "ModuleData");
initdata = LoaderSymbol(p);
if (initdata) {
ModuleSetupProc setup;
diff --git a/xorg-server/hw/xfree86/loader/sdksyms.sh b/xorg-server/hw/xfree86/loader/sdksyms.sh
index d69ae769e..c25aaf010 100644
--- a/xorg-server/hw/xfree86/loader/sdksyms.sh
+++ b/xorg-server/hw/xfree86/loader/sdksyms.sh
@@ -253,6 +253,7 @@ cat > sdksyms.c << EOF
/* include/Makefile.am */
#include "XIstubs.h"
+#include "Xprintf.h"
#include "closestr.h"
#include "closure.h"
#include "colormap.h"
diff --git a/xorg-server/hw/xfree86/modes/xf86Crtc.c b/xorg-server/hw/xfree86/modes/xf86Crtc.c
index 99658e0ca..b08f57f34 100644
--- a/xorg-server/hw/xfree86/modes/xf86Crtc.c
+++ b/xorg-server/hw/xfree86/modes/xf86Crtc.c
@@ -510,7 +510,6 @@ static void
xf86OutputSetMonitor (xf86OutputPtr output)
{
char *option_name;
- static const char monitor_prefix[] = "monitor-";
char *monitor;
if (!output->name)
@@ -520,11 +519,8 @@ xf86OutputSetMonitor (xf86OutputPtr output)
output->options = xnfalloc (sizeof (xf86OutputOptions));
memcpy (output->options, xf86OutputOptions, sizeof (xf86OutputOptions));
-
- option_name = xnfalloc (strlen (monitor_prefix) +
- strlen (output->name) + 1);
- strcpy (option_name, monitor_prefix);
- strcat (option_name, output->name);
+
+ XNFasprintf(&option_name, "monitor-%s", output->name);
monitor = xf86findOptionValue (output->scrn->options, option_name);
if (!monitor)
monitor = output->name;
diff --git a/xorg-server/hw/xfree86/modes/xf86Modes.c b/xorg-server/hw/xfree86/modes/xf86Modes.c
index 6b34ec11c..335bb43ee 100644
--- a/xorg-server/hw/xfree86/modes/xf86Modes.c
+++ b/xorg-server/hw/xfree86/modes/xf86Modes.c
@@ -132,8 +132,8 @@ xf86SetModeDefaultName(DisplayModePtr mode)
free(mode->name);
- mode->name = XNFprintf("%dx%d%s", mode->HDisplay, mode->VDisplay,
- interlaced ? "i" : "");
+ XNFasprintf(&mode->name, "%dx%d%s", mode->HDisplay, mode->VDisplay,
+ interlaced ? "i" : "");
}
/*
diff --git a/xorg-server/hw/xfree86/modes/xf86cvt.c b/xorg-server/hw/xfree86/modes/xf86cvt.c
index 1da5fe50b..9992fa4c4 100644
--- a/xorg-server/hw/xfree86/modes/xf86cvt.c
+++ b/xorg-server/hw/xfree86/modes/xf86cvt.c
@@ -1,301 +1,293 @@
-/*
- * Copyright 2005-2006 Luc Verhaegen.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
- * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
- * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
- * OTHER DEALINGS IN THE SOFTWARE.
- */
-
-/*
- * The reason for having this function in a file of its own is
- * so that ../utils/cvt/cvt can link to it, and that xf86CVTMode
- * code is shared directly.
- */
-
-#ifdef HAVE_XORG_CONFIG_H
-#include <xorg-config.h>
-#else
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-#endif
-
-#include "xf86.h"
-#include "xf86Modes.h"
-
-#include <string.h>
-
-/*
- * Generate a CVT standard mode from HDisplay, VDisplay and VRefresh.
- *
- * These calculations are stolen from the CVT calculation spreadsheet written
- * by Graham Loveridge. He seems to be claiming no copyright and there seems to
- * be no license attached to this. He apparently just wants to see his name
- * mentioned.
- *
- * This file can be found at http://www.vesa.org/Public/CVT/CVTd6r1.xls
- *
- * Comments and structure corresponds to the comments and structure of the xls.
- * This should ease importing of future changes to the standard (not very
- * likely though).
- *
- * About margins; i'm sure that they are to be the bit between HDisplay and
- * HBlankStart, HBlankEnd and HTotal, VDisplay and VBlankStart, VBlankEnd and
- * VTotal, where the overscan colour is shown. FB seems to call _all_ blanking
- * outside sync "margin" for some reason. Since we prefer seeing proper
- * blanking instead of the overscan colour, and since the Crtc* values will
- * probably get altered after us, we will disable margins altogether. With
- * these calculations, Margins will plainly expand H/VDisplay, and we don't
- * want that. -- libv
- *
- */
-DisplayModePtr
-xf86CVTMode(int HDisplay, int VDisplay, float VRefresh, Bool Reduced,
- Bool Interlaced)
-{
- DisplayModeRec *Mode = xnfcalloc(1, sizeof(DisplayModeRec));
-
- /* 1) top/bottom margin size (% of height) - default: 1.8 */
-#define CVT_MARGIN_PERCENTAGE 1.8
-
- /* 2) character cell horizontal granularity (pixels) - default 8 */
-#define CVT_H_GRANULARITY 8
-
- /* 4) Minimum vertical porch (lines) - default 3 */
-#define CVT_MIN_V_PORCH 3
-
- /* 4) Minimum number of vertical back porch lines - default 6 */
-#define CVT_MIN_V_BPORCH 6
-
- /* Pixel Clock step (kHz) */
-#define CVT_CLOCK_STEP 250
-
- Bool Margins = FALSE;
- float VFieldRate, HPeriod;
- int HDisplayRnd, HMargin;
- int VDisplayRnd, VMargin, VSync;
- float Interlace; /* Please rename this */
-
- /* CVT default is 60.0Hz */
- if (!VRefresh)
- VRefresh = 60.0;
-
- /* 1. Required field rate */
- if (Interlaced)
- VFieldRate = VRefresh * 2;
- else
- VFieldRate = VRefresh;
-
- /* 2. Horizontal pixels */
- HDisplayRnd = HDisplay - (HDisplay % CVT_H_GRANULARITY);
-
- /* 3. Determine left and right borders */
- if (Margins) {
- /* right margin is actually exactly the same as left */
- HMargin = (((float) HDisplayRnd) * CVT_MARGIN_PERCENTAGE / 100.0);
- HMargin -= HMargin % CVT_H_GRANULARITY;
- } else
- HMargin = 0;
-
- /* 4. Find total active pixels */
- Mode->HDisplay = HDisplayRnd + 2*HMargin;
-
- /* 5. Find number of lines per field */
- if (Interlaced)
- VDisplayRnd = VDisplay / 2;
- else
- VDisplayRnd = VDisplay;
-
- /* 6. Find top and bottom margins */
- /* nope. */
- if (Margins)
- /* top and bottom margins are equal again. */
- VMargin = (((float) VDisplayRnd) * CVT_MARGIN_PERCENTAGE / 100.0);
- else
- VMargin = 0;
-
- Mode->VDisplay = VDisplay + 2*VMargin;
-
- /* 7. Interlace */
- if (Interlaced)
- Interlace = 0.5;
- else
- Interlace = 0.0;
-
- /* Determine VSync Width from aspect ratio */
- if (!(VDisplay % 3) && ((VDisplay * 4 / 3) == HDisplay))
- VSync = 4;
- else if (!(VDisplay % 9) && ((VDisplay * 16 / 9) == HDisplay))
- VSync = 5;
- else if (!(VDisplay % 10) && ((VDisplay * 16 / 10) == HDisplay))
- VSync = 6;
- else if (!(VDisplay % 4) && ((VDisplay * 5 / 4) == HDisplay))
- VSync = 7;
- else if (!(VDisplay % 9) && ((VDisplay * 15 / 9) == HDisplay))
- VSync = 7;
- else /* Custom */
- VSync = 10;
-
- if (!Reduced) { /* simplified GTF calculation */
-
- /* 4) Minimum time of vertical sync + back porch interval (µs)
- * default 550.0 */
-#define CVT_MIN_VSYNC_BP 550.0
-
- /* 3) Nominal HSync width (% of line period) - default 8 */
-#define CVT_HSYNC_PERCENTAGE 8
-
- float HBlankPercentage;
- int VSyncAndBackPorch, VBackPorch;
- int HBlank;
-
- /* 8. Estimated Horizontal period */
- HPeriod = ((float) (1000000.0 / VFieldRate - CVT_MIN_VSYNC_BP)) /
- (VDisplayRnd + 2 * VMargin + CVT_MIN_V_PORCH + Interlace);
-
- /* 9. Find number of lines in sync + backporch */
- if (((int)(CVT_MIN_VSYNC_BP / HPeriod) + 1) < (VSync + CVT_MIN_V_PORCH))
- VSyncAndBackPorch = VSync + CVT_MIN_V_PORCH;
- else
- VSyncAndBackPorch = (int)(CVT_MIN_VSYNC_BP / HPeriod) + 1;
-
- /* 10. Find number of lines in back porch */
- VBackPorch = VSyncAndBackPorch - VSync;
-
- /* 11. Find total number of lines in vertical field */
- Mode->VTotal = VDisplayRnd + 2 * VMargin + VSyncAndBackPorch + Interlace
- + CVT_MIN_V_PORCH;
-
- /* 5) Definition of Horizontal blanking time limitation */
- /* Gradient (%/kHz) - default 600 */
-#define CVT_M_FACTOR 600
-
- /* Offset (%) - default 40 */
-#define CVT_C_FACTOR 40
-
- /* Blanking time scaling factor - default 128 */
-#define CVT_K_FACTOR 128
-
- /* Scaling factor weighting - default 20 */
-#define CVT_J_FACTOR 20
-
-#define CVT_M_PRIME CVT_M_FACTOR * CVT_K_FACTOR / 256
-#define CVT_C_PRIME (CVT_C_FACTOR - CVT_J_FACTOR) * CVT_K_FACTOR / 256 + \
- CVT_J_FACTOR
-
- /* 12. Find ideal blanking duty cycle from formula */
- HBlankPercentage = CVT_C_PRIME - CVT_M_PRIME * HPeriod/1000.0;
-
- /* 13. Blanking time */
- if (HBlankPercentage < 20)
- HBlankPercentage = 20;
-
- HBlank = Mode->HDisplay * HBlankPercentage/(100.0 - HBlankPercentage);
- HBlank -= HBlank % (2*CVT_H_GRANULARITY);
-
- /* 14. Find total number of pixels in a line. */
- Mode->HTotal = Mode->HDisplay + HBlank;
-
- /* Fill in HSync values */
- Mode->HSyncEnd = Mode->HDisplay + HBlank / 2;
-
- Mode->HSyncStart = Mode->HSyncEnd -
- (Mode->HTotal * CVT_HSYNC_PERCENTAGE) / 100;
- Mode->HSyncStart += CVT_H_GRANULARITY -
- Mode->HSyncStart % CVT_H_GRANULARITY;
-
- /* Fill in VSync values */
- Mode->VSyncStart = Mode->VDisplay + CVT_MIN_V_PORCH;
- Mode->VSyncEnd = Mode->VSyncStart + VSync;
-
- } else { /* Reduced blanking */
- /* Minimum vertical blanking interval time (µs) - default 460 */
-#define CVT_RB_MIN_VBLANK 460.0
-
- /* Fixed number of clocks for horizontal sync */
-#define CVT_RB_H_SYNC 32.0
-
- /* Fixed number of clocks for horizontal blanking */
-#define CVT_RB_H_BLANK 160.0
-
- /* Fixed number of lines for vertical front porch - default 3 */
-#define CVT_RB_VFPORCH 3
-
- int VBILines;
-
- /* 8. Estimate Horizontal period. */
- HPeriod = ((float) (1000000.0 / VFieldRate - CVT_RB_MIN_VBLANK)) /
- (VDisplayRnd + 2*VMargin);
-
- /* 9. Find number of lines in vertical blanking */
- VBILines = ((float) CVT_RB_MIN_VBLANK) / HPeriod + 1;
-
- /* 10. Check if vertical blanking is sufficient */
- if (VBILines < (CVT_RB_VFPORCH + VSync + CVT_MIN_V_BPORCH))
- VBILines = CVT_RB_VFPORCH + VSync + CVT_MIN_V_BPORCH;
-
- /* 11. Find total number of lines in vertical field */
- Mode->VTotal = VDisplayRnd + 2 * VMargin + Interlace + VBILines;
-
- /* 12. Find total number of pixels in a line */
- Mode->HTotal = Mode->HDisplay + CVT_RB_H_BLANK;
-
- /* Fill in HSync values */
- Mode->HSyncEnd = Mode->HDisplay + CVT_RB_H_BLANK / 2;
- Mode->HSyncStart = Mode->HSyncEnd - CVT_RB_H_SYNC;
-
- /* Fill in VSync values */
- Mode->VSyncStart = Mode->VDisplay + CVT_RB_VFPORCH;
- Mode->VSyncEnd = Mode->VSyncStart + VSync;
- }
-
- /* 15/13. Find pixel clock frequency (kHz for xf86) */
- Mode->Clock = Mode->HTotal * 1000.0 / HPeriod;
- Mode->Clock -= Mode->Clock % CVT_CLOCK_STEP;
-
- /* 16/14. Find actual Horizontal Frequency (kHz) */
- Mode->HSync = ((float) Mode->Clock) / ((float) Mode->HTotal);
-
- /* 17/15. Find actual Field rate */
- Mode->VRefresh = (1000.0 * ((float) Mode->Clock)) /
- ((float) (Mode->HTotal * Mode->VTotal));
-
- /* 18/16. Find actual vertical frame frequency */
- /* ignore - just set the mode flag for interlaced */
- if (Interlaced)
- Mode->VTotal *= 2;
-
- {
- char Name[256];
- Name[0] = 0;
-
- snprintf(Name, 256, "%dx%d", HDisplay, VDisplay);
-
- Mode->name = xnfalloc(strlen(Name) + 1);
- memcpy(Mode->name, Name, strlen(Name) + 1);
- }
-
- if (Reduced)
- Mode->Flags |= V_PHSYNC | V_NVSYNC;
- else
- Mode->Flags |= V_NHSYNC | V_PVSYNC;
-
- if (Interlaced)
- Mode->Flags |= V_INTERLACE;
-
- return Mode;
-}
+/*
+ * Copyright 2005-2006 Luc Verhaegen.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+/*
+ * The reason for having this function in a file of its own is
+ * so that ../utils/cvt/cvt can link to it, and that xf86CVTMode
+ * code is shared directly.
+ */
+
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#else
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+#endif
+
+#include "xf86.h"
+#include "xf86Modes.h"
+
+#include <string.h>
+
+/*
+ * Generate a CVT standard mode from HDisplay, VDisplay and VRefresh.
+ *
+ * These calculations are stolen from the CVT calculation spreadsheet written
+ * by Graham Loveridge. He seems to be claiming no copyright and there seems to
+ * be no license attached to this. He apparently just wants to see his name
+ * mentioned.
+ *
+ * This file can be found at http://www.vesa.org/Public/CVT/CVTd6r1.xls
+ *
+ * Comments and structure corresponds to the comments and structure of the xls.
+ * This should ease importing of future changes to the standard (not very
+ * likely though).
+ *
+ * About margins; i'm sure that they are to be the bit between HDisplay and
+ * HBlankStart, HBlankEnd and HTotal, VDisplay and VBlankStart, VBlankEnd and
+ * VTotal, where the overscan colour is shown. FB seems to call _all_ blanking
+ * outside sync "margin" for some reason. Since we prefer seeing proper
+ * blanking instead of the overscan colour, and since the Crtc* values will
+ * probably get altered after us, we will disable margins altogether. With
+ * these calculations, Margins will plainly expand H/VDisplay, and we don't
+ * want that. -- libv
+ *
+ */
+DisplayModePtr
+xf86CVTMode(int HDisplay, int VDisplay, float VRefresh, Bool Reduced,
+ Bool Interlaced)
+{
+ DisplayModeRec *Mode = xnfcalloc(1, sizeof(DisplayModeRec));
+
+ /* 1) top/bottom margin size (% of height) - default: 1.8 */
+#define CVT_MARGIN_PERCENTAGE 1.8
+
+ /* 2) character cell horizontal granularity (pixels) - default 8 */
+#define CVT_H_GRANULARITY 8
+
+ /* 4) Minimum vertical porch (lines) - default 3 */
+#define CVT_MIN_V_PORCH 3
+
+ /* 4) Minimum number of vertical back porch lines - default 6 */
+#define CVT_MIN_V_BPORCH 6
+
+ /* Pixel Clock step (kHz) */
+#define CVT_CLOCK_STEP 250
+
+ Bool Margins = FALSE;
+ float VFieldRate, HPeriod;
+ int HDisplayRnd, HMargin;
+ int VDisplayRnd, VMargin, VSync;
+ float Interlace; /* Please rename this */
+
+ /* CVT default is 60.0Hz */
+ if (!VRefresh)
+ VRefresh = 60.0;
+
+ /* 1. Required field rate */
+ if (Interlaced)
+ VFieldRate = VRefresh * 2;
+ else
+ VFieldRate = VRefresh;
+
+ /* 2. Horizontal pixels */
+ HDisplayRnd = HDisplay - (HDisplay % CVT_H_GRANULARITY);
+
+ /* 3. Determine left and right borders */
+ if (Margins) {
+ /* right margin is actually exactly the same as left */
+ HMargin = (((float) HDisplayRnd) * CVT_MARGIN_PERCENTAGE / 100.0);
+ HMargin -= HMargin % CVT_H_GRANULARITY;
+ } else
+ HMargin = 0;
+
+ /* 4. Find total active pixels */
+ Mode->HDisplay = HDisplayRnd + 2*HMargin;
+
+ /* 5. Find number of lines per field */
+ if (Interlaced)
+ VDisplayRnd = VDisplay / 2;
+ else
+ VDisplayRnd = VDisplay;
+
+ /* 6. Find top and bottom margins */
+ /* nope. */
+ if (Margins)
+ /* top and bottom margins are equal again. */
+ VMargin = (((float) VDisplayRnd) * CVT_MARGIN_PERCENTAGE / 100.0);
+ else
+ VMargin = 0;
+
+ Mode->VDisplay = VDisplay + 2*VMargin;
+
+ /* 7. Interlace */
+ if (Interlaced)
+ Interlace = 0.5;
+ else
+ Interlace = 0.0;
+
+ /* Determine VSync Width from aspect ratio */
+ if (!(VDisplay % 3) && ((VDisplay * 4 / 3) == HDisplay))
+ VSync = 4;
+ else if (!(VDisplay % 9) && ((VDisplay * 16 / 9) == HDisplay))
+ VSync = 5;
+ else if (!(VDisplay % 10) && ((VDisplay * 16 / 10) == HDisplay))
+ VSync = 6;
+ else if (!(VDisplay % 4) && ((VDisplay * 5 / 4) == HDisplay))
+ VSync = 7;
+ else if (!(VDisplay % 9) && ((VDisplay * 15 / 9) == HDisplay))
+ VSync = 7;
+ else /* Custom */
+ VSync = 10;
+
+ if (!Reduced) { /* simplified GTF calculation */
+
+ /* 4) Minimum time of vertical sync + back porch interval (µs)
+ * default 550.0 */
+#define CVT_MIN_VSYNC_BP 550.0
+
+ /* 3) Nominal HSync width (% of line period) - default 8 */
+#define CVT_HSYNC_PERCENTAGE 8
+
+ float HBlankPercentage;
+ int VSyncAndBackPorch, VBackPorch;
+ int HBlank;
+
+ /* 8. Estimated Horizontal period */
+ HPeriod = ((float) (1000000.0 / VFieldRate - CVT_MIN_VSYNC_BP)) /
+ (VDisplayRnd + 2 * VMargin + CVT_MIN_V_PORCH + Interlace);
+
+ /* 9. Find number of lines in sync + backporch */
+ if (((int)(CVT_MIN_VSYNC_BP / HPeriod) + 1) < (VSync + CVT_MIN_V_PORCH))
+ VSyncAndBackPorch = VSync + CVT_MIN_V_PORCH;
+ else
+ VSyncAndBackPorch = (int)(CVT_MIN_VSYNC_BP / HPeriod) + 1;
+
+ /* 10. Find number of lines in back porch */
+ VBackPorch = VSyncAndBackPorch - VSync;
+
+ /* 11. Find total number of lines in vertical field */
+ Mode->VTotal = VDisplayRnd + 2 * VMargin + VSyncAndBackPorch + Interlace
+ + CVT_MIN_V_PORCH;
+
+ /* 5) Definition of Horizontal blanking time limitation */
+ /* Gradient (%/kHz) - default 600 */
+#define CVT_M_FACTOR 600
+
+ /* Offset (%) - default 40 */
+#define CVT_C_FACTOR 40
+
+ /* Blanking time scaling factor - default 128 */
+#define CVT_K_FACTOR 128
+
+ /* Scaling factor weighting - default 20 */
+#define CVT_J_FACTOR 20
+
+#define CVT_M_PRIME CVT_M_FACTOR * CVT_K_FACTOR / 256
+#define CVT_C_PRIME (CVT_C_FACTOR - CVT_J_FACTOR) * CVT_K_FACTOR / 256 + \
+ CVT_J_FACTOR
+
+ /* 12. Find ideal blanking duty cycle from formula */
+ HBlankPercentage = CVT_C_PRIME - CVT_M_PRIME * HPeriod/1000.0;
+
+ /* 13. Blanking time */
+ if (HBlankPercentage < 20)
+ HBlankPercentage = 20;
+
+ HBlank = Mode->HDisplay * HBlankPercentage/(100.0 - HBlankPercentage);
+ HBlank -= HBlank % (2*CVT_H_GRANULARITY);
+
+ /* 14. Find total number of pixels in a line. */
+ Mode->HTotal = Mode->HDisplay + HBlank;
+
+ /* Fill in HSync values */
+ Mode->HSyncEnd = Mode->HDisplay + HBlank / 2;
+
+ Mode->HSyncStart = Mode->HSyncEnd -
+ (Mode->HTotal * CVT_HSYNC_PERCENTAGE) / 100;
+ Mode->HSyncStart += CVT_H_GRANULARITY -
+ Mode->HSyncStart % CVT_H_GRANULARITY;
+
+ /* Fill in VSync values */
+ Mode->VSyncStart = Mode->VDisplay + CVT_MIN_V_PORCH;
+ Mode->VSyncEnd = Mode->VSyncStart + VSync;
+
+ } else { /* Reduced blanking */
+ /* Minimum vertical blanking interval time (µs) - default 460 */
+#define CVT_RB_MIN_VBLANK 460.0
+
+ /* Fixed number of clocks for horizontal sync */
+#define CVT_RB_H_SYNC 32.0
+
+ /* Fixed number of clocks for horizontal blanking */
+#define CVT_RB_H_BLANK 160.0
+
+ /* Fixed number of lines for vertical front porch - default 3 */
+#define CVT_RB_VFPORCH 3
+
+ int VBILines;
+
+ /* 8. Estimate Horizontal period. */
+ HPeriod = ((float) (1000000.0 / VFieldRate - CVT_RB_MIN_VBLANK)) /
+ (VDisplayRnd + 2*VMargin);
+
+ /* 9. Find number of lines in vertical blanking */
+ VBILines = ((float) CVT_RB_MIN_VBLANK) / HPeriod + 1;
+
+ /* 10. Check if vertical blanking is sufficient */
+ if (VBILines < (CVT_RB_VFPORCH + VSync + CVT_MIN_V_BPORCH))
+ VBILines = CVT_RB_VFPORCH + VSync + CVT_MIN_V_BPORCH;
+
+ /* 11. Find total number of lines in vertical field */
+ Mode->VTotal = VDisplayRnd + 2 * VMargin + Interlace + VBILines;
+
+ /* 12. Find total number of pixels in a line */
+ Mode->HTotal = Mode->HDisplay + CVT_RB_H_BLANK;
+
+ /* Fill in HSync values */
+ Mode->HSyncEnd = Mode->HDisplay + CVT_RB_H_BLANK / 2;
+ Mode->HSyncStart = Mode->HSyncEnd - CVT_RB_H_SYNC;
+
+ /* Fill in VSync values */
+ Mode->VSyncStart = Mode->VDisplay + CVT_RB_VFPORCH;
+ Mode->VSyncEnd = Mode->VSyncStart + VSync;
+ }
+
+ /* 15/13. Find pixel clock frequency (kHz for xf86) */
+ Mode->Clock = Mode->HTotal * 1000.0 / HPeriod;
+ Mode->Clock -= Mode->Clock % CVT_CLOCK_STEP;
+
+ /* 16/14. Find actual Horizontal Frequency (kHz) */
+ Mode->HSync = ((float) Mode->Clock) / ((float) Mode->HTotal);
+
+ /* 17/15. Find actual Field rate */
+ Mode->VRefresh = (1000.0 * ((float) Mode->Clock)) /
+ ((float) (Mode->HTotal * Mode->VTotal));
+
+ /* 18/16. Find actual vertical frame frequency */
+ /* ignore - just set the mode flag for interlaced */
+ if (Interlaced)
+ Mode->VTotal *= 2;
+
+ XNFasprintf(&Mode->name, "%dx%d", HDisplay, VDisplay);
+
+ if (Reduced)
+ Mode->Flags |= V_PHSYNC | V_NVSYNC;
+ else
+ Mode->Flags |= V_NHSYNC | V_PVSYNC;
+
+ if (Interlaced)
+ Mode->Flags |= V_INTERLACE;
+
+ return Mode;
+}
diff --git a/xorg-server/hw/xfree86/os-support/solaris/solaris-amd64.S b/xorg-server/hw/xfree86/os-support/solaris/solaris-amd64.S
index 94ffa40e7..a371f9b66 100644
--- a/xorg-server/hw/xfree86/os-support/solaris/solaris-amd64.S
+++ b/xorg-server/hw/xfree86/os-support/solaris/solaris-amd64.S
@@ -1,67 +1,67 @@
-/ Copyright 2005 Sun Microsystems, Inc. All rights reserved.
-/
-/ Permission is hereby granted, free of charge, to any person obtaining a
-/ copy of this software and associated documentation files (the "Software"),
-/ to deal in the Software without restriction, including without limitation
-/ the rights to use, copy, modify, merge, publish, distribute, sublicense,
-/ and/or sell copies of the Software, and to permit persons to whom the
-/ Software is furnished to do so, subject to the following conditions:
-/
-/ The above copyright notice and this permission notice (including the next
-/ paragraph) shall be included in all copies or substantial portions of the
-/ Software.
-/
-/ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-/ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-/ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
-/ THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-/ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-/ FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
-/ DEALINGS IN THE SOFTWARE.
-
-#ifdef INLINE_ASM
-#define FUNCTION_START(f,n) .inline f,n
-#define FUNCTION_END(f) .end
-#else
-#define _ASM
-#include <sys/asm_linkage.h>
-#define FUNCTION_START(f,n) ENTRY(f)
-#define FUNCTION_END(f) ret; SET_SIZE(f)
-#endif
-
- FUNCTION_START(inb,4)
- movq %rdi, %rdx
- xorq %rax, %rax
- inb (%dx)
- FUNCTION_END(inb)
-
- FUNCTION_START(inw,4)
- movq %rdi, %rdx
- xorq %rax, %rax
- inw (%dx)
- FUNCTION_END(inw)
-
- FUNCTION_START(inl,4)
- movq %rdi, %rdx
- xorq %rax, %rax
- inl (%dx)
- FUNCTION_END(inl)
-
- FUNCTION_START(outb,8)
- movq %rdi, %rdx
- movq %rsi, %rax
- outb (%dx)
- FUNCTION_END(outb)
-
- FUNCTION_START(outw,8)
- movq %rdi, %rdx
- movq %rsi, %rax
- outw (%dx)
- FUNCTION_END(outw)
-
- FUNCTION_START(outl,8)
- movq %rdi, %rdx
- movq %rsi, %rax
- outl (%dx)
- FUNCTION_END(outl)
-
+/ Copyright (c) 2005, Oracle and/or its affiliates. All rights reserved.
+/
+/ Permission is hereby granted, free of charge, to any person obtaining a
+/ copy of this software and associated documentation files (the "Software"),
+/ to deal in the Software without restriction, including without limitation
+/ the rights to use, copy, modify, merge, publish, distribute, sublicense,
+/ and/or sell copies of the Software, and to permit persons to whom the
+/ Software is furnished to do so, subject to the following conditions:
+/
+/ The above copyright notice and this permission notice (including the next
+/ paragraph) shall be included in all copies or substantial portions of the
+/ Software.
+/
+/ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+/ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+/ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+/ THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+/ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+/ FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+/ DEALINGS IN THE SOFTWARE.
+
+#ifdef INLINE_ASM
+#define FUNCTION_START(f,n) .inline f,n
+#define FUNCTION_END(f) .end
+#else
+#define _ASM
+#include <sys/asm_linkage.h>
+#define FUNCTION_START(f,n) ENTRY(f)
+#define FUNCTION_END(f) ret; SET_SIZE(f)
+#endif
+
+ FUNCTION_START(inb,4)
+ movq %rdi, %rdx
+ xorq %rax, %rax
+ inb (%dx)
+ FUNCTION_END(inb)
+
+ FUNCTION_START(inw,4)
+ movq %rdi, %rdx
+ xorq %rax, %rax
+ inw (%dx)
+ FUNCTION_END(inw)
+
+ FUNCTION_START(inl,4)
+ movq %rdi, %rdx
+ xorq %rax, %rax
+ inl (%dx)
+ FUNCTION_END(inl)
+
+ FUNCTION_START(outb,8)
+ movq %rdi, %rdx
+ movq %rsi, %rax
+ outb (%dx)
+ FUNCTION_END(outb)
+
+ FUNCTION_START(outw,8)
+ movq %rdi, %rdx
+ movq %rsi, %rax
+ outw (%dx)
+ FUNCTION_END(outw)
+
+ FUNCTION_START(outl,8)
+ movq %rdi, %rdx
+ movq %rsi, %rax
+ outl (%dx)
+ FUNCTION_END(outl)
+
diff --git a/xorg-server/hw/xfree86/os-support/solaris/solaris-ia32.S b/xorg-server/hw/xfree86/os-support/solaris/solaris-ia32.S
index 4dadf7ffd..0068b06e4 100644
--- a/xorg-server/hw/xfree86/os-support/solaris/solaris-ia32.S
+++ b/xorg-server/hw/xfree86/os-support/solaris/solaris-ia32.S
@@ -1,67 +1,67 @@
-/ Copyright 2004 Sun Microsystems, Inc. All rights reserved.
-/
-/ Permission is hereby granted, free of charge, to any person obtaining a
-/ copy of this software and associated documentation files (the "Software"),
-/ to deal in the Software without restriction, including without limitation
-/ the rights to use, copy, modify, merge, publish, distribute, sublicense,
-/ and/or sell copies of the Software, and to permit persons to whom the
-/ Software is furnished to do so, subject to the following conditions:
-/
-/ The above copyright notice and this permission notice (including the next
-/ paragraph) shall be included in all copies or substantial portions of the
-/ Software.
-/
-/ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-/ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-/ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
-/ THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-/ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-/ FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
-/ DEALINGS IN THE SOFTWARE.
-
-#ifdef INLINE_ASM
-#define FUNCTION_START(f,n) .inline f,n
-#define FUNCTION_END(f) .end
-#else
-#define _ASM
-#include <sys/asm_linkage.h>
-#define FUNCTION_START(f,n) ENTRY(f)
-#define FUNCTION_END(f) ret; SET_SIZE(f)
-#endif
-
- FUNCTION_START(inb,4)
- movl (%esp), %edx
- xorl %eax, %eax
- inb (%dx)
- FUNCTION_END(inb)
-
- FUNCTION_START(inw,4)
- movl (%esp), %edx
- xorl %eax, %eax
- inw (%dx)
- FUNCTION_END(inw)
-
- FUNCTION_START(inl,4)
- movl (%esp), %edx
- xorl %eax, %eax
- inl (%dx)
- FUNCTION_END(inl)
-
- FUNCTION_START(outb,8)
- movl (%esp), %edx
- movl 4(%esp), %eax
- outb (%dx)
- FUNCTION_END(outb)
-
- FUNCTION_START(outw,8)
- movl (%esp), %edx
- movl 4(%esp), %eax
- outw (%dx)
- FUNCTION_END(outw)
-
- FUNCTION_START(outl,8)
- movl (%esp), %edx
- movl 4(%esp), %eax
- outl (%dx)
- FUNCTION_END(outl)
-
+/ Copyright (c) 2004, Oracle and/or its affiliates. All rights reserved.
+/
+/ Permission is hereby granted, free of charge, to any person obtaining a
+/ copy of this software and associated documentation files (the "Software"),
+/ to deal in the Software without restriction, including without limitation
+/ the rights to use, copy, modify, merge, publish, distribute, sublicense,
+/ and/or sell copies of the Software, and to permit persons to whom the
+/ Software is furnished to do so, subject to the following conditions:
+/
+/ The above copyright notice and this permission notice (including the next
+/ paragraph) shall be included in all copies or substantial portions of the
+/ Software.
+/
+/ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+/ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+/ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+/ THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+/ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+/ FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+/ DEALINGS IN THE SOFTWARE.
+
+#ifdef INLINE_ASM
+#define FUNCTION_START(f,n) .inline f,n
+#define FUNCTION_END(f) .end
+#else
+#define _ASM
+#include <sys/asm_linkage.h>
+#define FUNCTION_START(f,n) ENTRY(f)
+#define FUNCTION_END(f) ret; SET_SIZE(f)
+#endif
+
+ FUNCTION_START(inb,4)
+ movl (%esp), %edx
+ xorl %eax, %eax
+ inb (%dx)
+ FUNCTION_END(inb)
+
+ FUNCTION_START(inw,4)
+ movl (%esp), %edx
+ xorl %eax, %eax
+ inw (%dx)
+ FUNCTION_END(inw)
+
+ FUNCTION_START(inl,4)
+ movl (%esp), %edx
+ xorl %eax, %eax
+ inl (%dx)
+ FUNCTION_END(inl)
+
+ FUNCTION_START(outb,8)
+ movl (%esp), %edx
+ movl 4(%esp), %eax
+ outb (%dx)
+ FUNCTION_END(outb)
+
+ FUNCTION_START(outw,8)
+ movl (%esp), %edx
+ movl 4(%esp), %eax
+ outw (%dx)
+ FUNCTION_END(outw)
+
+ FUNCTION_START(outl,8)
+ movl (%esp), %edx
+ movl 4(%esp), %eax
+ outl (%dx)
+ FUNCTION_END(outl)
+
diff --git a/xorg-server/hw/xfree86/os-support/solaris/solaris-sparcv8plus.S b/xorg-server/hw/xfree86/os-support/solaris/solaris-sparcv8plus.S
index 0f6d694fd..3bb8d241c 100644
--- a/xorg-server/hw/xfree86/os-support/solaris/solaris-sparcv8plus.S
+++ b/xorg-server/hw/xfree86/os-support/solaris/solaris-sparcv8plus.S
@@ -1,138 +1,138 @@
-/* Copyright 2004 Sun Microsystems, Inc. All rights reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice (including the next
- * paragraph) shall be included in all copies or substantial portions of the
- * Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
- * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
- * DEALINGS IN THE SOFTWARE.
- */
-
-#ifdef INLINE_ASM
-#define FUNCTION_START(f,n) .inline f,n
-#define FUNCTION_END(f) .end
-#else
-#define _ASM
-#include <sys/asm_linkage.h>
-#define FUNCTION_START(f,n) ENTRY(f)
-#define FUNCTION_END(f) retl; nop; SET_SIZE(f)
-#endif
-
-/* Converted from common/compiler.h gcc inline format to Sun cc inline
- * format by Kenjiro Tsuji
- *
- * The value 0x88 means ASI_PRIMARY_LITTLE.
- * The store or load to/from the address space will be done
- * as little-endian. In the original xrog code, the value
- * is defined as the macro ASI_PL.
- *
- * In the original xorg code, "membar #StoreStore|#StoreLoad"
- * is directly implemented as an instruction "0x8143e00a".
- *
- */
-
- FUNCTION_START(outb, 0)
- stba %o1, [%o0] 0x88
- membar #StoreStore|#StoreLoad
- FUNCTION_END(outb)
-
- FUNCTION_START(outw, 0)
- stha %o1, [%o0] 0x88
- membar #StoreStore|#StoreLoad
- FUNCTION_END(outw)
-
- FUNCTION_START(outl, 0)
- sta %o1, [%o0] 0x88
- membar #StoreStore|#StoreLoad
- FUNCTION_END(outl)
-
- FUNCTION_START(inb, 0)
- lduba [%o0] 0x88, %o0
- FUNCTION_END(inb)
-
- FUNCTION_START(inw, 0)
- lduha [%o0] 0x88, %o0
- FUNCTION_END(inw)
-
- FUNCTION_START(inl, 0)
- lda [%o0] 0x88, %o0
- FUNCTION_END(inl)
-
- FUNCTION_START(xf86ReadMmio8, 0)
- lduba [%o0 + %o1] 0x88, %o0
- FUNCTION_END(xf86ReadMmio8)
-
- FUNCTION_START(xf86ReadMmio16Be, 0)
- lduh [%o0 + %o1], %o0
- FUNCTION_END(xf86ReadMmio16Be)
-
- FUNCTION_START(xf86ReadMmio16Le, 0)
- lduha [%o0 + %o1] 0x88, %o0
- FUNCTION_END(xf86ReadMmio16Le)
-
- FUNCTION_START(xf86ReadMmio32Be, 0)
- ld [%o0 + %o1], %o0
- FUNCTION_END(xf86ReadMmio32Be)
-
- FUNCTION_START(xf86ReadMmio32Le, 0)
- lda [%o0 + %o1] 0x88, %o0
- FUNCTION_END(xf86ReadMmio32Le)
-
- FUNCTION_START(xf86WriteMmio8, 0)
- stba %o2, [%o0 + %o1] 0x88
- membar #StoreStore|#StoreLoad
- FUNCTION_END(xf86WriteMmio8)
-
- FUNCTION_START(xf86WriteMmio16Be, 0)
- sth %o2, [%o0 + %o1]
- membar #StoreStore|#StoreLoad
- FUNCTION_END(xf86WriteMmio16Be)
-
- FUNCTION_START(xf86WriteMmio16Le, 0)
- stha %o2, [%o0 + %o1] 0x88
- membar #StoreStore|#StoreLoad
- FUNCTION_END(xf86WriteMmio16Le)
-
- FUNCTION_START(xf86WriteMmio32Be, 0)
- st %o2, [%o0 + %o1]
- membar #StoreStore|#StoreLoad
- FUNCTION_END(xf86WriteMmio32Be)
-
- FUNCTION_START(xf86WriteMmio32Le, 0)
- sta %o2, [%o0 + %o1] 0x88
- membar #StoreStore|#StoreLoad
- FUNCTION_END(xf86WriteMmio32Le)
-
- FUNCTION_START(xf86WriteMmio8NB, 0)
- add %o0, %o1, %o0
- stba %o2, [%o0] 0x88
- FUNCTION_END(xf86WriteMmio8NB)
-
- FUNCTION_START(xf86WriteMmio16BeNB, 0)
- sth %o2, [%o0 + %o1]
- FUNCTION_END(xf86WriteMmio16BeNB)
-
- FUNCTION_START(xf86WriteMmio16LeNB, 0)
- stha %o2, [%o0 + %o1] 0x88
- FUNCTION_END(xf86WriteMmio16LeNB)
-
- FUNCTION_START(xf86WriteMmio32BeNB, 0)
- st %o2, [%o0 + %o1]
- FUNCTION_END(xf86WriteMmio32BeNB)
-
- FUNCTION_START(xf86WriteMmio32LeNB, 0)
- sta %o2, [%o0 + %o1] 0x88
- FUNCTION_END(xf86WriteMmio32LeNB)
-
+/* Copyright (c) 2004, Oracle and/or its affiliates. All rights reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ */
+
+#ifdef INLINE_ASM
+#define FUNCTION_START(f,n) .inline f,n
+#define FUNCTION_END(f) .end
+#else
+#define _ASM
+#include <sys/asm_linkage.h>
+#define FUNCTION_START(f,n) ENTRY(f)
+#define FUNCTION_END(f) retl; nop; SET_SIZE(f)
+#endif
+
+/* Converted from common/compiler.h gcc inline format to Sun cc inline
+ * format by Kenjiro Tsuji
+ *
+ * The value 0x88 means ASI_PRIMARY_LITTLE.
+ * The store or load to/from the address space will be done
+ * as little-endian. In the original xrog code, the value
+ * is defined as the macro ASI_PL.
+ *
+ * In the original xorg code, "membar #StoreStore|#StoreLoad"
+ * is directly implemented as an instruction "0x8143e00a".
+ *
+ */
+
+ FUNCTION_START(outb, 0)
+ stba %o1, [%o0] 0x88
+ membar #StoreStore|#StoreLoad
+ FUNCTION_END(outb)
+
+ FUNCTION_START(outw, 0)
+ stha %o1, [%o0] 0x88
+ membar #StoreStore|#StoreLoad
+ FUNCTION_END(outw)
+
+ FUNCTION_START(outl, 0)
+ sta %o1, [%o0] 0x88
+ membar #StoreStore|#StoreLoad
+ FUNCTION_END(outl)
+
+ FUNCTION_START(inb, 0)
+ lduba [%o0] 0x88, %o0
+ FUNCTION_END(inb)
+
+ FUNCTION_START(inw, 0)
+ lduha [%o0] 0x88, %o0
+ FUNCTION_END(inw)
+
+ FUNCTION_START(inl, 0)
+ lda [%o0] 0x88, %o0
+ FUNCTION_END(inl)
+
+ FUNCTION_START(xf86ReadMmio8, 0)
+ lduba [%o0 + %o1] 0x88, %o0
+ FUNCTION_END(xf86ReadMmio8)
+
+ FUNCTION_START(xf86ReadMmio16Be, 0)
+ lduh [%o0 + %o1], %o0
+ FUNCTION_END(xf86ReadMmio16Be)
+
+ FUNCTION_START(xf86ReadMmio16Le, 0)
+ lduha [%o0 + %o1] 0x88, %o0
+ FUNCTION_END(xf86ReadMmio16Le)
+
+ FUNCTION_START(xf86ReadMmio32Be, 0)
+ ld [%o0 + %o1], %o0
+ FUNCTION_END(xf86ReadMmio32Be)
+
+ FUNCTION_START(xf86ReadMmio32Le, 0)
+ lda [%o0 + %o1] 0x88, %o0
+ FUNCTION_END(xf86ReadMmio32Le)
+
+ FUNCTION_START(xf86WriteMmio8, 0)
+ stba %o2, [%o0 + %o1] 0x88
+ membar #StoreStore|#StoreLoad
+ FUNCTION_END(xf86WriteMmio8)
+
+ FUNCTION_START(xf86WriteMmio16Be, 0)
+ sth %o2, [%o0 + %o1]
+ membar #StoreStore|#StoreLoad
+ FUNCTION_END(xf86WriteMmio16Be)
+
+ FUNCTION_START(xf86WriteMmio16Le, 0)
+ stha %o2, [%o0 + %o1] 0x88
+ membar #StoreStore|#StoreLoad
+ FUNCTION_END(xf86WriteMmio16Le)
+
+ FUNCTION_START(xf86WriteMmio32Be, 0)
+ st %o2, [%o0 + %o1]
+ membar #StoreStore|#StoreLoad
+ FUNCTION_END(xf86WriteMmio32Be)
+
+ FUNCTION_START(xf86WriteMmio32Le, 0)
+ sta %o2, [%o0 + %o1] 0x88
+ membar #StoreStore|#StoreLoad
+ FUNCTION_END(xf86WriteMmio32Le)
+
+ FUNCTION_START(xf86WriteMmio8NB, 0)
+ add %o0, %o1, %o0
+ stba %o2, [%o0] 0x88
+ FUNCTION_END(xf86WriteMmio8NB)
+
+ FUNCTION_START(xf86WriteMmio16BeNB, 0)
+ sth %o2, [%o0 + %o1]
+ FUNCTION_END(xf86WriteMmio16BeNB)
+
+ FUNCTION_START(xf86WriteMmio16LeNB, 0)
+ stha %o2, [%o0 + %o1] 0x88
+ FUNCTION_END(xf86WriteMmio16LeNB)
+
+ FUNCTION_START(xf86WriteMmio32BeNB, 0)
+ st %o2, [%o0 + %o1]
+ FUNCTION_END(xf86WriteMmio32BeNB)
+
+ FUNCTION_START(xf86WriteMmio32LeNB, 0)
+ sta %o2, [%o0 + %o1] 0x88
+ FUNCTION_END(xf86WriteMmio32LeNB)
+
diff --git a/xorg-server/hw/xfree86/os-support/solaris/sun_VTsw.c b/xorg-server/hw/xfree86/os-support/solaris/sun_VTsw.c
index e297f8c49..d145ac77b 100644
--- a/xorg-server/hw/xfree86/os-support/solaris/sun_VTsw.c
+++ b/xorg-server/hw/xfree86/os-support/solaris/sun_VTsw.c
@@ -1,5 +1,5 @@
/*
- * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
+ * Copyright (c) 2009, Oracle and/or its affiliates. All rights reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
diff --git a/xorg-server/hw/xfree86/os-support/solaris/sun_agp.c b/xorg-server/hw/xfree86/os-support/solaris/sun_agp.c
index 99c3abde5..8c5c45843 100644
--- a/xorg-server/hw/xfree86/os-support/solaris/sun_agp.c
+++ b/xorg-server/hw/xfree86/os-support/solaris/sun_agp.c
@@ -6,7 +6,7 @@
* Copyright © 2000 VA Linux Systems, Inc.
* Copyright © 2001 The XFree86 Project, Inc.
*/
-/* Copyright 2005 Sun Microsystems, Inc. All rights reserved.
+/* Copyright (c) 2005, Oracle and/or its affiliates. All rights reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
diff --git a/xorg-server/hw/xfree86/os-support/solaris/sun_apm.c b/xorg-server/hw/xfree86/os-support/solaris/sun_apm.c
index 23e14f17e..7a5128ffb 100644
--- a/xorg-server/hw/xfree86/os-support/solaris/sun_apm.c
+++ b/xorg-server/hw/xfree86/os-support/solaris/sun_apm.c
@@ -1,226 +1,226 @@
-/* Based on hw/xfree86/os-support/bsd/bsd_apm.c which bore no explicit
- * copyright notice, so is covered by the following notice:
- *
- * Copyright (C) 1994-2003 The XFree86 Project, Inc. All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * THE XFREE86 PROJECT BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
- * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
- * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- *
- * Except as contained in this notice, the name of the XFree86 Project shall
- * not be used in advertising or otherwise to promote the sale, use or other
- * dealings in this Software without prior written authorization from the
- * XFree86 Project.
- */
-
-/* Copyright 2005 Sun Microsystems, Inc. All rights reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice (including the next
- * paragraph) shall be included in all copies or substantial portions of the
- * Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
- * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
- * DEALINGS IN THE SOFTWARE.
- */
-
-#ifdef HAVE_XORG_CONFIG_H
-#include <xorg-config.h>
-#endif
-
-#include <X11/X.h>
-#include "os.h"
-#include "xf86.h"
-#include "xf86Priv.h"
-#define XF86_OS_PRIVS
-#include "xf86_OSproc.h"
-#include "xf86_OSlib.h"
-
-#ifndef PLEASE_FIX_THIS
-#define APM_STANDBY_REQ 0xa01
-#define APM_SUSPEND_REQ 0xa02
-#define APM_NORMAL_RESUME 0xa03
-#define APM_CRIT_RESUME 0xa04
-#define APM_BATTERY_LOW 0xa05
-#define APM_POWER_CHANGE 0xa06
-#define APM_UPDATE_TIME 0xa07
-#define APM_CRIT_SUSPEND_REQ 0xa08
-#define APM_USER_STANDBY_REQ 0xa09
-#define APM_USER_SUSPEND_REQ 0xa0a
-#define APM_SYS_STANDBY_RESUME 0xa0b
-#define APM_IOC_NEXTEVENT 0xa0c
-#define APM_IOC_RESUME 0xa0d
-#define APM_IOC_SUSPEND 0xa0e
-#define APM_IOC_STANDBY 0xa0f
-#endif
-
-typedef struct apm_event_info
-{
- int type;
-} apm_event_info;
-
-/*
- This may be replaced with a better device name
- very soon...
-*/
-#define APM_DEVICE "/dev/srn"
-#define APM_DEVICE1 "/dev/apm"
-
-static pointer APMihPtr = NULL;
-static void sunCloseAPM(void);
-
-static struct {
- u_int apmBsd;
- pmEvent xf86;
-} sunToXF86Array [] = {
- { APM_STANDBY_REQ, XF86_APM_SYS_STANDBY },
- { APM_SUSPEND_REQ, XF86_APM_SYS_SUSPEND },
- { APM_NORMAL_RESUME, XF86_APM_NORMAL_RESUME },
- { APM_CRIT_RESUME, XF86_APM_CRITICAL_RESUME },
- { APM_BATTERY_LOW, XF86_APM_LOW_BATTERY },
- { APM_POWER_CHANGE, XF86_APM_POWER_STATUS_CHANGE },
- { APM_UPDATE_TIME, XF86_APM_UPDATE_TIME },
- { APM_CRIT_SUSPEND_REQ, XF86_APM_CRITICAL_SUSPEND },
- { APM_USER_STANDBY_REQ, XF86_APM_USER_STANDBY },
- { APM_USER_SUSPEND_REQ, XF86_APM_USER_SUSPEND },
- { APM_SYS_STANDBY_RESUME, XF86_APM_STANDBY_RESUME },
-#ifdef APM_CAPABILITY_CHANGE
- { APM_CAPABILITY_CHANGE, XF86_APM_CAPABILITY_CHANGED },
-#endif
-};
-
-#define numApmEvents (sizeof(sunToXF86Array) / sizeof(sunToXF86Array[0]))
-
-static pmEvent
-sunToXF86(int type)
-{
- int i;
-
- for (i = 0; i < numApmEvents; i++) {
- if (type == sunToXF86Array[i].apmBsd) {
- return sunToXF86Array[i].xf86;
- }
- }
- return XF86_APM_UNKNOWN;
-}
-
-/*
- * APM events can be requested direclty from /dev/apm
- */
-static int
-sunPMGetEventFromOS(int fd, pmEvent *events, int num)
-{
- struct apm_event_info sunEvent;
- int i;
-
- for (i = 0; i < num; i++) {
-
- if (ioctl(fd, APM_IOC_NEXTEVENT, &sunEvent) < 0) {
- if (errno != EAGAIN) {
- xf86Msg(X_WARNING, "sunPMGetEventFromOS: APM_IOC_NEXTEVENT"
- " %s\n", strerror(errno));
- }
- break;
- }
- events[i] = sunToXF86(sunEvent.type);
- }
- xf86Msg(X_WARNING, "Got some events\n");
- return i;
-}
-
-static pmWait
-sunPMConfirmEventToOs(int fd, pmEvent event)
-{
- switch (event) {
-/* XXX: NOT CURRENTLY RETURNED FROM OS */
- case XF86_APM_SYS_STANDBY:
- case XF86_APM_USER_STANDBY:
- if (ioctl( fd, APM_IOC_STANDBY, NULL ) == 0)
- return PM_WAIT; /* should we stop the Xserver in standby, too? */
- else
- return PM_NONE;
- case XF86_APM_SYS_SUSPEND:
- case XF86_APM_CRITICAL_SUSPEND:
- case XF86_APM_USER_SUSPEND:
- xf86Msg(X_WARNING, "Got SUSPENDED\n");
- if (ioctl( fd, APM_IOC_SUSPEND, NULL ) == 0)
- return PM_CONTINUE;
- else {
- xf86Msg(X_WARNING, "sunPMConfirmEventToOs: APM_IOC_SUSPEND"
- " %s\n", strerror(errno));
- return PM_FAILED;
- }
- case XF86_APM_STANDBY_RESUME:
- case XF86_APM_NORMAL_RESUME:
- case XF86_APM_CRITICAL_RESUME:
- case XF86_APM_STANDBY_FAILED:
- case XF86_APM_SUSPEND_FAILED:
- xf86Msg(X_WARNING, "Got RESUME\n");
- if (ioctl( fd, APM_IOC_RESUME, NULL ) == 0)
- return PM_CONTINUE;
- else {
- xf86Msg(X_WARNING, "sunPMConfirmEventToOs: APM_IOC_RESUME"
- " %s\n", strerror(errno));
- return PM_FAILED;
- }
- default:
- return PM_NONE;
- }
-}
-
-PMClose
-xf86OSPMOpen(void)
-{
- int fd;
-
- if (APMihPtr || !xf86Info.pmFlag) {
- return NULL;
- }
-
- if ((fd = open(APM_DEVICE, O_RDWR)) == -1) {
- if ((fd = open(APM_DEVICE1, O_RDWR)) == -1) {
- return NULL;
- }
- }
- xf86PMGetEventFromOs = sunPMGetEventFromOS;
- xf86PMConfirmEventToOs = sunPMConfirmEventToOs;
- APMihPtr = xf86AddGeneralHandler(fd, xf86HandlePMEvents, NULL);
- return sunCloseAPM;
-}
-
-static void
-sunCloseAPM(void)
-{
- int fd;
-
- if (APMihPtr) {
- fd = xf86RemoveGeneralHandler(APMihPtr);
- close(fd);
- APMihPtr = NULL;
- }
-}
+/* Based on hw/xfree86/os-support/bsd/bsd_apm.c which bore no explicit
+ * copyright notice, so is covered by the following notice:
+ *
+ * Copyright (C) 1994-2003 The XFree86 Project, Inc. All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE XFREE86 PROJECT BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
+ * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ *
+ * Except as contained in this notice, the name of the XFree86 Project shall
+ * not be used in advertising or otherwise to promote the sale, use or other
+ * dealings in this Software without prior written authorization from the
+ * XFree86 Project.
+ */
+
+/* Copyright (c) 2005, Oracle and/or its affiliates. All rights reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ */
+
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#include <X11/X.h>
+#include "os.h"
+#include "xf86.h"
+#include "xf86Priv.h"
+#define XF86_OS_PRIVS
+#include "xf86_OSproc.h"
+#include "xf86_OSlib.h"
+
+#ifndef PLEASE_FIX_THIS
+#define APM_STANDBY_REQ 0xa01
+#define APM_SUSPEND_REQ 0xa02
+#define APM_NORMAL_RESUME 0xa03
+#define APM_CRIT_RESUME 0xa04
+#define APM_BATTERY_LOW 0xa05
+#define APM_POWER_CHANGE 0xa06
+#define APM_UPDATE_TIME 0xa07
+#define APM_CRIT_SUSPEND_REQ 0xa08
+#define APM_USER_STANDBY_REQ 0xa09
+#define APM_USER_SUSPEND_REQ 0xa0a
+#define APM_SYS_STANDBY_RESUME 0xa0b
+#define APM_IOC_NEXTEVENT 0xa0c
+#define APM_IOC_RESUME 0xa0d
+#define APM_IOC_SUSPEND 0xa0e
+#define APM_IOC_STANDBY 0xa0f
+#endif
+
+typedef struct apm_event_info
+{
+ int type;
+} apm_event_info;
+
+/*
+ This may be replaced with a better device name
+ very soon...
+*/
+#define APM_DEVICE "/dev/srn"
+#define APM_DEVICE1 "/dev/apm"
+
+static pointer APMihPtr = NULL;
+static void sunCloseAPM(void);
+
+static struct {
+ u_int apmBsd;
+ pmEvent xf86;
+} sunToXF86Array [] = {
+ { APM_STANDBY_REQ, XF86_APM_SYS_STANDBY },
+ { APM_SUSPEND_REQ, XF86_APM_SYS_SUSPEND },
+ { APM_NORMAL_RESUME, XF86_APM_NORMAL_RESUME },
+ { APM_CRIT_RESUME, XF86_APM_CRITICAL_RESUME },
+ { APM_BATTERY_LOW, XF86_APM_LOW_BATTERY },
+ { APM_POWER_CHANGE, XF86_APM_POWER_STATUS_CHANGE },
+ { APM_UPDATE_TIME, XF86_APM_UPDATE_TIME },
+ { APM_CRIT_SUSPEND_REQ, XF86_APM_CRITICAL_SUSPEND },
+ { APM_USER_STANDBY_REQ, XF86_APM_USER_STANDBY },
+ { APM_USER_SUSPEND_REQ, XF86_APM_USER_SUSPEND },
+ { APM_SYS_STANDBY_RESUME, XF86_APM_STANDBY_RESUME },
+#ifdef APM_CAPABILITY_CHANGE
+ { APM_CAPABILITY_CHANGE, XF86_APM_CAPABILITY_CHANGED },
+#endif
+};
+
+#define numApmEvents (sizeof(sunToXF86Array) / sizeof(sunToXF86Array[0]))
+
+static pmEvent
+sunToXF86(int type)
+{
+ int i;
+
+ for (i = 0; i < numApmEvents; i++) {
+ if (type == sunToXF86Array[i].apmBsd) {
+ return sunToXF86Array[i].xf86;
+ }
+ }
+ return XF86_APM_UNKNOWN;
+}
+
+/*
+ * APM events can be requested direclty from /dev/apm
+ */
+static int
+sunPMGetEventFromOS(int fd, pmEvent *events, int num)
+{
+ struct apm_event_info sunEvent;
+ int i;
+
+ for (i = 0; i < num; i++) {
+
+ if (ioctl(fd, APM_IOC_NEXTEVENT, &sunEvent) < 0) {
+ if (errno != EAGAIN) {
+ xf86Msg(X_WARNING, "sunPMGetEventFromOS: APM_IOC_NEXTEVENT"
+ " %s\n", strerror(errno));
+ }
+ break;
+ }
+ events[i] = sunToXF86(sunEvent.type);
+ }
+ xf86Msg(X_WARNING, "Got some events\n");
+ return i;
+}
+
+static pmWait
+sunPMConfirmEventToOs(int fd, pmEvent event)
+{
+ switch (event) {
+/* XXX: NOT CURRENTLY RETURNED FROM OS */
+ case XF86_APM_SYS_STANDBY:
+ case XF86_APM_USER_STANDBY:
+ if (ioctl( fd, APM_IOC_STANDBY, NULL ) == 0)
+ return PM_WAIT; /* should we stop the Xserver in standby, too? */
+ else
+ return PM_NONE;
+ case XF86_APM_SYS_SUSPEND:
+ case XF86_APM_CRITICAL_SUSPEND:
+ case XF86_APM_USER_SUSPEND:
+ xf86Msg(X_WARNING, "Got SUSPENDED\n");
+ if (ioctl( fd, APM_IOC_SUSPEND, NULL ) == 0)
+ return PM_CONTINUE;
+ else {
+ xf86Msg(X_WARNING, "sunPMConfirmEventToOs: APM_IOC_SUSPEND"
+ " %s\n", strerror(errno));
+ return PM_FAILED;
+ }
+ case XF86_APM_STANDBY_RESUME:
+ case XF86_APM_NORMAL_RESUME:
+ case XF86_APM_CRITICAL_RESUME:
+ case XF86_APM_STANDBY_FAILED:
+ case XF86_APM_SUSPEND_FAILED:
+ xf86Msg(X_WARNING, "Got RESUME\n");
+ if (ioctl( fd, APM_IOC_RESUME, NULL ) == 0)
+ return PM_CONTINUE;
+ else {
+ xf86Msg(X_WARNING, "sunPMConfirmEventToOs: APM_IOC_RESUME"
+ " %s\n", strerror(errno));
+ return PM_FAILED;
+ }
+ default:
+ return PM_NONE;
+ }
+}
+
+PMClose
+xf86OSPMOpen(void)
+{
+ int fd;
+
+ if (APMihPtr || !xf86Info.pmFlag) {
+ return NULL;
+ }
+
+ if ((fd = open(APM_DEVICE, O_RDWR)) == -1) {
+ if ((fd = open(APM_DEVICE1, O_RDWR)) == -1) {
+ return NULL;
+ }
+ }
+ xf86PMGetEventFromOs = sunPMGetEventFromOS;
+ xf86PMConfirmEventToOs = sunPMConfirmEventToOs;
+ APMihPtr = xf86AddGeneralHandler(fd, xf86HandlePMEvents, NULL);
+ return sunCloseAPM;
+}
+
+static void
+sunCloseAPM(void)
+{
+ int fd;
+
+ if (APMihPtr) {
+ fd = xf86RemoveGeneralHandler(APMihPtr);
+ close(fd);
+ APMihPtr = NULL;
+ }
+}
diff --git a/xorg-server/hw/xfree86/os-support/solaris/sun_bell.c b/xorg-server/hw/xfree86/os-support/solaris/sun_bell.c
index e064c9733..8cd4de25b 100644
--- a/xorg-server/hw/xfree86/os-support/solaris/sun_bell.c
+++ b/xorg-server/hw/xfree86/os-support/solaris/sun_bell.c
@@ -1,4 +1,4 @@
-/* Copyright 2004-2005 Sun Microsystems, Inc. All rights reserved.
+/* Copyright (c) 2004-2005, Oracle and/or its affiliates. All rights reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
diff --git a/xorg-server/hw/xfree86/os-support/solaris/sun_vid.c b/xorg-server/hw/xfree86/os-support/solaris/sun_vid.c
index 1991289fd..b7b7c0ed7 100644
--- a/xorg-server/hw/xfree86/os-support/solaris/sun_vid.c
+++ b/xorg-server/hw/xfree86/os-support/solaris/sun_vid.c
@@ -22,7 +22,7 @@
* OF THIS SOFTWARE.
*
*/
-/* Copyright 2008 Sun Microsystems, Inc. All rights reserved.
+/* Copyright (c) 2008, Oracle and/or its affiliates. All rights reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
diff --git a/xorg-server/hw/xfree86/parser/Flags.c b/xorg-server/hw/xfree86/parser/Flags.c
index cdd023222..17e079a8c 100644
--- a/xorg-server/hw/xfree86/parser/Flags.c
+++ b/xorg-server/hw/xfree86/parser/Flags.c
@@ -61,8 +61,8 @@
#include "xf86Parser.h"
#include "xf86tokens.h"
#include "Configint.h"
-#include <math.h>
#include <X11/Xfuncproto.h>
+#include "Xprintf.h"
extern LexRec val;
@@ -143,9 +143,8 @@ xf86parseFlagsSection (void)
} else {
if (tokentype != NUMBER)
Error (NUMBER_MSG, tmp);
- valstr = malloc(16);
- if (valstr)
- sprintf(valstr, "%d", val.num);
+ if (asprintf(&valstr, "%d", val.num) == -1)
+ valstr = NULL;
}
}
ptr->flg_option_lst = xf86addNewOption
@@ -426,13 +425,9 @@ char *
xf86uLongToString(unsigned long i)
{
char *s;
- int l;
- l = ceil(log10((double)i) + 2.5);
- s = malloc(l);
- if (!s)
+ if (asprintf(&s, "%lu", i) == -1)
return NULL;
- sprintf(s, "%lu", i);
return s;
}
diff --git a/xorg-server/hw/xfree86/parser/Makefile.am b/xorg-server/hw/xfree86/parser/Makefile.am
index caf7079d4..6fe7b87c1 100644
--- a/xorg-server/hw/xfree86/parser/Makefile.am
+++ b/xorg-server/hw/xfree86/parser/Makefile.am
@@ -1,50 +1,51 @@
-if INSTALL_LIBXF86CONFIG
-noinst_LTLIBRARIES = libxf86config_internal.la
-lib_LIBRARIES = libxf86config.a
-LIBHEADERS = \
- xf86Optrec.h \
- xf86Parser.h
-else
-noinst_LTLIBRARIES = libxf86config_internal.la
-endif
-
-INTERNAL_SOURCES= \
- Device.c \
- Files.c \
- Flags.c \
- Input.c \
- InputClass.c \
- Layout.c \
- Module.c \
- Video.c \
- Monitor.c \
- Pointer.c \
- Screen.c \
- Vendor.c \
- read.c \
- scan.c \
- write.c \
- DRI.c \
- Extensions.c
-
-libxf86config_internal_la_SOURCES = \
- $(INTERNAL_SOURCES)
-
-libxf86config_a_SOURCES = \
- $(INTERNAL_SOURCES)
-libxf86config_a_CFLAGS = $(AM_CFLAGS)
-
-AM_CFLAGS = $(DIX_CFLAGS) $(XORG_CFLAGS) \
- -DSYSCONFDIR=\"$(sysconfdir)\" \
- -DDATADIR=\"$(datadir)\"
-
-EXTRA_DIST = \
- Configint.h \
- configProcs.h \
- xf86Optrec.h \
- xf86Parser.h \
- xf86tokens.h
-
-sdk_HEADERS = \
- xf86Parser.h \
- xf86Optrec.h
+if INSTALL_LIBXF86CONFIG
+noinst_LTLIBRARIES = libxf86config_internal.la
+lib_LIBRARIES = libxf86config.a
+LIBHEADERS = \
+ xf86Optrec.h \
+ xf86Parser.h
+else
+noinst_LTLIBRARIES = libxf86config_internal.la
+endif
+
+INTERNAL_SOURCES= \
+ Device.c \
+ Files.c \
+ Flags.c \
+ Input.c \
+ InputClass.c \
+ Layout.c \
+ Module.c \
+ Video.c \
+ Monitor.c \
+ Pointer.c \
+ Screen.c \
+ Vendor.c \
+ read.c \
+ scan.c \
+ write.c \
+ DRI.c \
+ Extensions.c
+
+libxf86config_internal_la_SOURCES = \
+ $(INTERNAL_SOURCES)
+
+libxf86config_a_SOURCES = \
+ $(TOP_SRCDIR)/os/xprintf.c \
+ $(INTERNAL_SOURCES)
+libxf86config_a_CFLAGS = $(AM_CFLAGS)
+
+AM_CFLAGS = $(DIX_CFLAGS) $(XORG_CFLAGS) \
+ -DSYSCONFDIR=\"$(sysconfdir)\" \
+ -DDATADIR=\"$(datadir)\"
+
+EXTRA_DIST = \
+ Configint.h \
+ configProcs.h \
+ xf86Optrec.h \
+ xf86Parser.h \
+ xf86tokens.h
+
+sdk_HEADERS = \
+ xf86Parser.h \
+ xf86Optrec.h
diff --git a/xorg-server/hw/xfree86/parser/Pointer.c b/xorg-server/hw/xfree86/parser/Pointer.c
index 56a26ba74..5e4db442e 100644
--- a/xorg-server/hw/xfree86/parser/Pointer.c
+++ b/xorg-server/hw/xfree86/parser/Pointer.c
@@ -1,237 +1,233 @@
-/*
- *
- * Copyright (c) 1997 Metro Link Incorporated
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
- * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
- * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- *
- * Except as contained in this notice, the name of the Metro Link shall not be
- * used in advertising or otherwise to promote the sale, use or other dealings
- * in this Software without prior written authorization from Metro Link.
- *
- */
-/*
- * Copyright (c) 1997-2003 by The XFree86 Project, Inc.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
- * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
- * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
- * OTHER DEALINGS IN THE SOFTWARE.
- *
- * Except as contained in this notice, the name of the copyright holder(s)
- * and author(s) shall not be used in advertising or otherwise to promote
- * the sale, use or other dealings in this Software without prior written
- * authorization from the copyright holder(s) and author(s).
- */
-
-
-/* View/edit this file with tab stops set to 4 */
-
-#ifdef HAVE_XORG_CONFIG_H
-#include <xorg-config.h>
-#endif
-
-#include "xf86Parser.h"
-#include "xf86tokens.h"
-#include "Configint.h"
-
-extern LexRec val;
-
-static xf86ConfigSymTabRec PointerTab[] =
-{
- {PROTOCOL, "protocol"},
- {EMULATE3, "emulate3buttons"},
- {EM3TIMEOUT, "emulate3timeout"},
- {ENDSUBSECTION, "endsubsection"},
- {ENDSECTION, "endsection"},
- {PDEVICE, "device"},
- {PDEVICE, "port"},
- {BAUDRATE, "baudrate"},
- {SAMPLERATE, "samplerate"},
- {CLEARDTR, "cleardtr"},
- {CLEARRTS, "clearrts"},
- {CHORDMIDDLE, "chordmiddle"},
- {PRESOLUTION, "resolution"},
- {DEVICE_NAME, "devicename"},
- {ALWAYSCORE, "alwayscore"},
- {PBUTTONS, "buttons"},
- {ZAXISMAPPING, "zaxismapping"},
- {-1, ""},
-};
-
-static xf86ConfigSymTabRec ZMapTab[] =
-{
- {XAXIS, "x"},
- {YAXIS, "y"},
- {-1, ""},
-};
-
-#define CLEANUP xf86freeInputList
-
-XF86ConfInputPtr
-xf86parsePointerSection (void)
-{
- char *s, *s1, *s2;
- int l;
- int token;
- parsePrologue (XF86ConfInputPtr, XF86ConfInputRec)
-
- while ((token = xf86getToken (PointerTab)) != ENDSECTION)
- {
- switch (token)
- {
- case COMMENT:
- ptr->inp_comment = xf86addComment(ptr->inp_comment, 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);
- 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);
- break;
- case EMULATE3:
- ptr->inp_option_lst = xf86addNewOption(ptr->inp_option_lst,
- strdup("Emulate3Buttons"),
- NULL);
- break;
- case EM3TIMEOUT:
- if (xf86getSubToken (&(ptr->inp_comment)) != NUMBER || val.num < 0)
- Error (POSITIVE_INT_MSG, "Emulate3Timeout");
- s = xf86uLongToString(val.num);
- ptr->inp_option_lst = xf86addNewOption(ptr->inp_option_lst,
- strdup("Emulate3Timeout"),
- s);
- break;
- case CHORDMIDDLE:
- ptr->inp_option_lst = xf86addNewOption(ptr->inp_option_lst,
- strdup("ChordMiddle"),
- NULL);
- break;
- case PBUTTONS:
- if (xf86getSubToken (&(ptr->inp_comment)) != NUMBER || val.num < 0)
- Error (POSITIVE_INT_MSG, "Buttons");
- s = xf86uLongToString(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)
- Error (POSITIVE_INT_MSG, "BaudRate");
- s = xf86uLongToString(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)
- Error (POSITIVE_INT_MSG, "SampleRate");
- s = xf86uLongToString(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)
- Error (POSITIVE_INT_MSG, "Resolution");
- s = xf86uLongToString(val.num);
- ptr->inp_option_lst = xf86addNewOption(ptr->inp_option_lst,
- strdup("Resolution"), s);
- break;
- case CLEARDTR:
- ptr->inp_option_lst = xf86addNewOption(ptr->inp_option_lst,
- strdup("ClearDTR"), NULL);
- break;
- case CLEARRTS:
- ptr->inp_option_lst = xf86addNewOption(ptr->inp_option_lst,
- strdup("ClearRTS"), NULL);
- break;
- case ZAXISMAPPING:
- switch (xf86getToken(ZMapTab)) {
- case NUMBER:
- if (val.num < 0)
- Error (ZAXISMAPPING_MSG, NULL);
- s1 = xf86uLongToString(val.num);
- if (xf86getSubToken (&(ptr->inp_comment)) != NUMBER || val.num < 0) {
- free(s1);
- Error (ZAXISMAPPING_MSG, NULL);
- }
- s2 = xf86uLongToString(val.num);
- l = strlen(s1) + 1 + strlen(s2) + 1;
- s = malloc(l);
- sprintf(s, "%s %s", s1, s2);
- free(s1);
- free(s2);
- break;
- case XAXIS:
- s = strdup("x");
- break;
- case YAXIS:
- s = strdup("y");
- break;
- default:
- Error (ZAXISMAPPING_MSG, NULL);
- break;
- }
- ptr->inp_option_lst = xf86addNewOption(ptr->inp_option_lst,
- strdup("ZAxisMapping"),
- s);
- break;
- case ALWAYSCORE:
- break;
- case EOF_TOKEN:
- Error (UNEXPECTED_EOF_MSG, NULL);
- break;
- default:
- Error (INVALID_KEYWORD_MSG, xf86tokenString ());
- break;
- }
- }
-
- ptr->inp_identifier = strdup(CONF_IMPLICIT_POINTER);
- ptr->inp_driver = strdup("mouse");
- ptr->inp_option_lst = xf86addNewOption(ptr->inp_option_lst,
- strdup("CorePointer"), NULL);
-
-#ifdef DEBUG
- printf ("Pointer section parsed\n");
-#endif
-
- return ptr;
-}
-
-#undef CLEANUP
-
+/*
+ *
+ * Copyright (c) 1997 Metro Link Incorporated
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
+ * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ *
+ * Except as contained in this notice, the name of the Metro Link shall not be
+ * used in advertising or otherwise to promote the sale, use or other dealings
+ * in this Software without prior written authorization from Metro Link.
+ *
+ */
+/*
+ * Copyright (c) 1997-2003 by The XFree86 Project, Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ *
+ * Except as contained in this notice, the name of the copyright holder(s)
+ * and author(s) shall not be used in advertising or otherwise to promote
+ * the sale, use or other dealings in this Software without prior written
+ * authorization from the copyright holder(s) and author(s).
+ */
+
+
+/* View/edit this file with tab stops set to 4 */
+
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#include "xf86Parser.h"
+#include "xf86tokens.h"
+#include "Configint.h"
+#include "Xprintf.h"
+
+extern LexRec val;
+
+static xf86ConfigSymTabRec PointerTab[] =
+{
+ {PROTOCOL, "protocol"},
+ {EMULATE3, "emulate3buttons"},
+ {EM3TIMEOUT, "emulate3timeout"},
+ {ENDSUBSECTION, "endsubsection"},
+ {ENDSECTION, "endsection"},
+ {PDEVICE, "device"},
+ {PDEVICE, "port"},
+ {BAUDRATE, "baudrate"},
+ {SAMPLERATE, "samplerate"},
+ {CLEARDTR, "cleardtr"},
+ {CLEARRTS, "clearrts"},
+ {CHORDMIDDLE, "chordmiddle"},
+ {PRESOLUTION, "resolution"},
+ {DEVICE_NAME, "devicename"},
+ {ALWAYSCORE, "alwayscore"},
+ {PBUTTONS, "buttons"},
+ {ZAXISMAPPING, "zaxismapping"},
+ {-1, ""},
+};
+
+static xf86ConfigSymTabRec ZMapTab[] =
+{
+ {XAXIS, "x"},
+ {YAXIS, "y"},
+ {-1, ""},
+};
+
+#define CLEANUP xf86freeInputList
+
+XF86ConfInputPtr
+xf86parsePointerSection (void)
+{
+ char *s;
+ unsigned long val1;
+ int token;
+ parsePrologue (XF86ConfInputPtr, XF86ConfInputRec)
+
+ while ((token = xf86getToken (PointerTab)) != ENDSECTION)
+ {
+ switch (token)
+ {
+ case COMMENT:
+ ptr->inp_comment = xf86addComment(ptr->inp_comment, 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);
+ 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);
+ break;
+ case EMULATE3:
+ ptr->inp_option_lst = xf86addNewOption(ptr->inp_option_lst,
+ strdup("Emulate3Buttons"),
+ NULL);
+ break;
+ case EM3TIMEOUT:
+ if (xf86getSubToken (&(ptr->inp_comment)) != NUMBER || val.num < 0)
+ Error (POSITIVE_INT_MSG, "Emulate3Timeout");
+ s = xf86uLongToString(val.num);
+ ptr->inp_option_lst = xf86addNewOption(ptr->inp_option_lst,
+ strdup("Emulate3Timeout"),
+ s);
+ break;
+ case CHORDMIDDLE:
+ ptr->inp_option_lst = xf86addNewOption(ptr->inp_option_lst,
+ strdup("ChordMiddle"),
+ NULL);
+ break;
+ case PBUTTONS:
+ if (xf86getSubToken (&(ptr->inp_comment)) != NUMBER || val.num < 0)
+ Error (POSITIVE_INT_MSG, "Buttons");
+ s = xf86uLongToString(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)
+ Error (POSITIVE_INT_MSG, "BaudRate");
+ s = xf86uLongToString(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)
+ Error (POSITIVE_INT_MSG, "SampleRate");
+ s = xf86uLongToString(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)
+ Error (POSITIVE_INT_MSG, "Resolution");
+ s = xf86uLongToString(val.num);
+ ptr->inp_option_lst = xf86addNewOption(ptr->inp_option_lst,
+ strdup("Resolution"), s);
+ break;
+ case CLEARDTR:
+ ptr->inp_option_lst = xf86addNewOption(ptr->inp_option_lst,
+ strdup("ClearDTR"), NULL);
+ break;
+ case CLEARRTS:
+ ptr->inp_option_lst = xf86addNewOption(ptr->inp_option_lst,
+ strdup("ClearRTS"), NULL);
+ break;
+ case ZAXISMAPPING:
+ switch (xf86getToken(ZMapTab)) {
+ case NUMBER:
+ if (val.num < 0)
+ Error (ZAXISMAPPING_MSG, NULL);
+ val1 = val.num;
+ if (xf86getSubToken (&(ptr->inp_comment)) != NUMBER || val.num < 0) {
+ Error (ZAXISMAPPING_MSG, NULL);
+ }
+ if (asprintf(&s, "%ul %ul", val1, val.num) == -1)
+ s = NULL;
+ break;
+ case XAXIS:
+ s = strdup("x");
+ break;
+ case YAXIS:
+ s = strdup("y");
+ break;
+ default:
+ Error (ZAXISMAPPING_MSG, NULL);
+ break;
+ }
+ ptr->inp_option_lst = xf86addNewOption(ptr->inp_option_lst,
+ strdup("ZAxisMapping"),
+ s);
+ break;
+ case ALWAYSCORE:
+ break;
+ case EOF_TOKEN:
+ Error (UNEXPECTED_EOF_MSG, NULL);
+ break;
+ default:
+ Error (INVALID_KEYWORD_MSG, xf86tokenString ());
+ break;
+ }
+ }
+
+ ptr->inp_identifier = strdup(CONF_IMPLICIT_POINTER);
+ ptr->inp_driver = strdup("mouse");
+ ptr->inp_option_lst = xf86addNewOption(ptr->inp_option_lst,
+ strdup("CorePointer"), NULL);
+
+#ifdef DEBUG
+ printf ("Pointer section parsed\n");
+#endif
+
+ return ptr;
+}
+
+#undef CLEANUP
+
diff --git a/xorg-server/hw/xfree86/ramdac/Makefile.am b/xorg-server/hw/xfree86/ramdac/Makefile.am
index 98e367c88..e6f8ed552 100644
--- a/xorg-server/hw/xfree86/ramdac/Makefile.am
+++ b/xorg-server/hw/xfree86/ramdac/Makefile.am
@@ -1,19 +1,19 @@
-noinst_LTLIBRARIES = libramdac.la
-
-libramdac_la_SOURCES = xf86RamDac.c xf86RamDacCmap.c \
- xf86Cursor.c xf86HWCurs.c IBM.c BT.c TI.c \
- xf86BitOrder.c
-
-sdk_HEADERS = BT.h IBM.h TI.h xf86Cursor.h xf86RamDac.h
-
-DISTCLEANFILES = xf86BitOrder.c
-EXTRA_DIST = BTPriv.h IBMPriv.h TIPriv.h xf86CursorPriv.h xf86RamDacPriv.h \
- CURSOR.NOTES
-
-AM_CFLAGS = -DXAAReverseBitOrder=xf86ReverseBitOrder -DRAMDAC_MODULE \
- $(DIX_CFLAGS) $(XORG_CFLAGS)
-INCLUDES = $(XORG_INCS)
-
-xf86BitOrder.c:
- echo "#define XAAReverseBitOrder xf86ReverseBitOrder" > $@
- echo "#include \"$(srcdir)/../xaa/xaaBitOrder.c\"" >> $@
+noinst_LTLIBRARIES = libramdac.la
+
+libramdac_la_SOURCES = xf86RamDac.c xf86RamDacCmap.c \
+ xf86Cursor.c xf86HWCurs.c IBM.c BT.c TI.c \
+ xf86BitOrder.c
+
+sdk_HEADERS = BT.h IBM.h TI.h xf86Cursor.h xf86RamDac.h
+
+DISTCLEANFILES = xf86BitOrder.c
+EXTRA_DIST = BTPriv.h IBMPriv.h TIPriv.h xf86CursorPriv.h xf86RamDacPriv.h \
+ CURSOR.NOTES
+
+AM_CFLAGS = -DXAAReverseBitOrder=xf86ReverseBitOrder -DRAMDAC_MODULE \
+ $(DIX_CFLAGS) $(XORG_CFLAGS)
+INCLUDES = $(XORG_INCS)
+
+xf86BitOrder.c:
+ $(AM_V_GEN)echo "#define XAAReverseBitOrder xf86ReverseBitOrder" > $@
+ $(AM_V_GEN)echo "#include \"$(srcdir)/../xaa/xaaBitOrder.c\"" >> $@
diff --git a/xorg-server/hw/xfree86/utils/cvt/Makefile.am b/xorg-server/hw/xfree86/utils/cvt/Makefile.am
index 6b99cbd5f..7f8364f86 100644
--- a/xorg-server/hw/xfree86/utils/cvt/Makefile.am
+++ b/xorg-server/hw/xfree86/utils/cvt/Makefile.am
@@ -1,39 +1,42 @@
-# Copyright 2005 Sun Microsystems, Inc. All rights reserved.
-#
-# Permission is hereby granted, free of charge, to any person obtaining a
-# copy of this software and associated documentation files (the "Software"),
-# to deal in the Software without restriction, including without limitation
-# the rights to use, copy, modify, merge, publish, distribute, sublicense,
-# and/or sell copies of the Software, and to permit persons to whom the
-# Software is furnished to do so, subject to the following conditions:
-#
-# The above copyright notice and this permission notice (including the next
-# paragraph) shall be included in all copies or substantial portions of the
-# Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
-# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
-# DEALINGS IN THE SOFTWARE.
-#
-
-bin_PROGRAMS = cvt
-
-INCLUDES = $(XORG_INCS) \
- -I$(top_srcdir)/hw/xfree86/ddc \
- -I$(top_srcdir)/hw/xfree86/parser
-
-# gah
-cvt_SOURCES = cvt.c $(top_srcdir)/hw/xfree86/modes/xf86cvt.c
-cvt_CFLAGS = $(DIX_CFLAGS) $(XORG_CFLAGS)
-
-man1_MANS = cvt.man
-
-CLEANFILES = $(man1_MANS)
-
-include $(top_srcdir)/cpprules.in
-
-EXTRA_DIST = cvt.man.pre
+# Copyright (c) 2005, Oracle and/or its affiliates. All rights reserved.
+#
+# Permission is hereby granted, free of charge, to any person obtaining a
+# copy of this software and associated documentation files (the "Software"),
+# to deal in the Software without restriction, including without limitation
+# the rights to use, copy, modify, merge, publish, distribute, sublicense,
+# and/or sell copies of the Software, and to permit persons to whom the
+# Software is furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice (including the next
+# paragraph) shall be included in all copies or substantial portions of the
+# Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+# DEALINGS IN THE SOFTWARE.
+#
+
+bin_PROGRAMS = cvt
+
+INCLUDES = $(XORG_INCS) \
+ -I$(top_srcdir)/hw/xfree86/ddc \
+ -I$(top_srcdir)/hw/xfree86/parser
+
+# gah
+cvt_SOURCES = cvt.c \
+ $(top_srcdir)/hw/xfree86/modes/xf86cvt.c \
+ $(top_srcdir)/os/xprintf.c
+
+cvt_CFLAGS = $(DIX_CFLAGS) $(XORG_CFLAGS)
+
+man1_MANS = cvt.man
+
+CLEANFILES = $(man1_MANS)
+
+include $(top_srcdir)/cpprules.in
+
+EXTRA_DIST = cvt.man.pre
diff --git a/xorg-server/hw/xfree86/utils/cvt/cvt.c b/xorg-server/hw/xfree86/utils/cvt/cvt.c
index cf0a479f2..1ff38118b 100644
--- a/xorg-server/hw/xfree86/utils/cvt/cvt.c
+++ b/xorg-server/hw/xfree86/utils/cvt/cvt.c
@@ -1,282 +1,300 @@
-/*
- * Copyright 2005-2006 Luc Verhaegen.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
- * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
- * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
- * OTHER DEALINGS IN THE SOFTWARE.
- *
- */
-
-/* Standalone VESA CVT standard timing modelines generator. */
-
-#include "xf86.h"
-
-/* xnfalloc implementation used by the server code we built in */
-pointer
-XNFalloc(unsigned long n)
-{
- pointer r;
-
- r = malloc(n);
- if (!r) {
- perror("malloc failed");
- exit(1);
- }
- return r;
-}
-
-/* xnfcalloc implementation used by the server code we built in */
-pointer
-XNFcalloc(unsigned long n)
-{
- pointer r;
-
- r = calloc(1, n);
- if (!r) {
- perror("calloc failed");
- exit(1);
- }
- return r;
-}
-
-/*
- * Quickly check wether this is a CVT standard mode.
- */
-static Bool
-CVTCheckStandard(int HDisplay, int VDisplay, float VRefresh, Bool Reduced,
- Bool Verbose)
-{
- Bool IsCVT = TRUE;
-
- if ((!(VDisplay % 3) && ((VDisplay * 4 / 3) == HDisplay)) ||
- (!(VDisplay % 9) && ((VDisplay * 16 / 9) == HDisplay)) ||
- (!(VDisplay % 10) && ((VDisplay * 16 / 10) == HDisplay)) ||
- (!(VDisplay % 4) && ((VDisplay * 5 / 4) == HDisplay)) ||
- (!(VDisplay % 9) && ((VDisplay * 15 / 9) == HDisplay)))
- ;
- else {
- if (Verbose)
- fprintf(stderr, "Warning: Aspect Ratio is not CVT standard.\n");
- IsCVT = FALSE;
- }
-
- if ((VRefresh != 50.0) && (VRefresh != 60.0) &&
- (VRefresh != 75.0) && (VRefresh != 85.0)) {
- if (Verbose)
- fprintf(stderr, "Warning: Refresh Rate is not CVT standard "
- "(50, 60, 75 or 85Hz).\n");
- IsCVT = FALSE;
- }
-
- return IsCVT;
-}
-
-
-/*
- * I'm not documenting --interlaced for obvious reasons, even though I did
- * implement it. I also can't deny having looked at gtf here.
- */
-static void
-PrintUsage(char *Name)
-{
- fprintf(stderr, "\n");
- fprintf(stderr, "usage: %s [-v|--verbose] [-r|--reduced] X Y [refresh]\n",
- Name);
- fprintf(stderr, "\n");
- fprintf(stderr, " -v|--verbose : Warn about CVT standard adherance.\n");
- fprintf(stderr, " -r|--reduced : Create a mode with reduced blanking "
- "(default: normal blanking).\n");
- fprintf(stderr, " X : Desired horizontal resolution "
- "(multiple of 8, required).\n");
- fprintf(stderr, " Y : Desired vertical resolution (required).\n");
- fprintf(stderr, " refresh : Desired refresh rate (default: 60.0Hz).\n");
- fprintf(stderr, "\n");
-
- fprintf(stderr, "Calculates VESA CVT (Coordinated Video Timing) modelines"
- " for use with X.\n");
-}
-
-
-/*
- *
- */
-static void
-PrintComment(DisplayModeRec *Mode, Bool CVT, Bool Reduced)
-{
- printf("# %dx%d %.2f Hz ", Mode->HDisplay, Mode->VDisplay, Mode->VRefresh);
-
- if (CVT) {
- printf("(CVT %.2fM",
- ((float) Mode->HDisplay * Mode->VDisplay) / 1000000.0);
-
- if (!(Mode->VDisplay % 3) &&
- ((Mode->VDisplay * 4 / 3) == Mode->HDisplay))
- printf("3");
- else if (!(Mode->VDisplay % 9) &&
- ((Mode->VDisplay * 16 / 9) == Mode->HDisplay))
- printf("9");
- else if (!(Mode->VDisplay % 10) &&
- ((Mode->VDisplay * 16 / 10) == Mode->HDisplay))
- printf("A");
- else if (!(Mode->VDisplay % 4) &&
- ((Mode->VDisplay * 5 / 4) == Mode->HDisplay))
- printf("4");
- else if (!(Mode->VDisplay % 9) &&
- ((Mode->VDisplay * 15 / 9) == Mode->HDisplay))
- printf("9");
-
- if (Reduced)
- printf("-R");
-
- printf(") ");
- } else
- printf("(CVT) ");
-
- printf("hsync: %.2f kHz; ", Mode->HSync);
- printf("pclk: %.2f MHz", ((float ) Mode->Clock) / 1000.0);
-
- printf("\n");
-}
-
-
-/*
- * Originally grabbed from xf86Mode.c.
- *
- * Ignoring the actual Mode->name, as the user will want something solid
- * to grab hold of.
- */
-static void
-PrintModeline(DisplayModePtr Mode, int HDisplay, int VDisplay, float VRefresh,
- Bool Reduced)
-{
- if (Reduced)
- printf("Modeline \"%dx%dR\" ", HDisplay, VDisplay);
- else
- printf("Modeline \"%dx%d_%.2f\" ", HDisplay, VDisplay, VRefresh);
-
- printf("%6.2f %i %i %i %i %i %i %i %i", Mode->Clock/1000., Mode->HDisplay,
- Mode->HSyncStart, Mode->HSyncEnd, Mode->HTotal, Mode->VDisplay,
- Mode->VSyncStart, Mode->VSyncEnd, Mode->VTotal);
-
- if (Mode->Flags & V_INTERLACE)
- printf(" interlace");
- if (Mode->Flags & V_PHSYNC)
- printf(" +hsync");
- if (Mode->Flags & V_NHSYNC)
- printf(" -hsync");
- if (Mode->Flags & V_PVSYNC)
- printf(" +vsync");
- if (Mode->Flags & V_NVSYNC)
- printf(" -vsync");
-
- printf("\n");
-}
-
-
-/*
- *
- */
-int
-main (int argc, char *argv[])
-{
- DisplayModeRec *Mode;
- int HDisplay = 0, VDisplay = 0;
- float VRefresh = 0.0;
- Bool Reduced = FALSE, Verbose = FALSE, IsCVT;
- Bool Interlaced = FALSE;
- int n;
-
- if ((argc < 3) || (argc > 7)) {
- PrintUsage(argv[0]);
- return 1;
- }
-
- /* This doesn't filter out bad flags properly. Bad flags get passed down
- * to atoi/atof, which then return 0, so that these variables can get
- * filled next time round. So this is just a cosmetic problem.
- */
- for (n = 1; n < argc; n++) {
- if (!strcmp(argv[n], "-r") || !strcmp(argv[n], "--reduced"))
- Reduced = TRUE;
- else if (!strcmp(argv[n], "-i") || !strcmp(argv[n], "--interlaced"))
- Interlaced = TRUE;
- else if (!strcmp(argv[n], "-v") || !strcmp(argv[n], "--verbose"))
- Verbose = TRUE;
- else if (!strcmp(argv[n], "-h") || !strcmp(argv[n], "--help")) {
- PrintUsage(argv[0]);
- return 0;
- } else if (!HDisplay) {
- HDisplay = atoi(argv[n]);
- if (!HDisplay) {
- PrintUsage(argv[0]);
- return 1;
- }
- }
- else if (!VDisplay) {
- VDisplay = atoi(argv[n]);
- if (!VDisplay) {
- PrintUsage(argv[0]);
- return 1;
- }
- }
- else if (!VRefresh) {
- VRefresh = atof(argv[n]);
- if (!VRefresh) {
- PrintUsage(argv[0]);
- return 1;
- }
- }
- else {
- PrintUsage(argv[0]);
- return 1;
- }
- }
-
- if (!HDisplay || !VDisplay) {
- PrintUsage(argv[0]);
- return 0;
- }
-
- /* Default to 60.0Hz */
- if (!VRefresh)
- VRefresh = 60.0;
-
- /* Horizontal timing is always a multiple of 8: round up. */
- if (HDisplay & 0x07) {
- HDisplay &= ~0x07;
- HDisplay += 8;
- }
-
- if (Reduced) {
- if ((VRefresh / 60.0) != floor(VRefresh / 60.0)) {
- fprintf(stderr,
- "\nERROR: Multiple of 60Hz refresh rate required for "
- " reduced blanking.\n");
- PrintUsage(argv[0]);
- return 0;
- }
- }
-
- IsCVT = CVTCheckStandard(HDisplay, VDisplay, VRefresh, Reduced, Verbose);
-
- Mode = xf86CVTMode(HDisplay, VDisplay, VRefresh, Reduced, Interlaced);
-
- PrintComment(Mode, IsCVT, Reduced);
- PrintModeline(Mode, HDisplay, VDisplay, VRefresh, Reduced);
-
- return 0;
-}
+/*
+ * Copyright 2005-2006 Luc Verhaegen.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ *
+ */
+
+/* Standalone VESA CVT standard timing modelines generator. */
+
+#include "xf86.h"
+
+/* Error implementation used by the server code we built in */
+void
+Error(const char *str)
+{
+ perror(str);
+}
+
+/* FatalError implementation used by the server code we built in */
+void
+FatalError(const char *f, ...)
+{
+ va_list args;
+ va_start(args, f);
+ vfprintf(stderr, f, args);
+ va_end(args);
+ exit(1);
+}
+
+/* xnfalloc implementation used by the server code we built in */
+pointer
+XNFalloc(unsigned long n)
+{
+ pointer r;
+
+ r = malloc(n);
+ if (!r) {
+ perror("malloc failed");
+ exit(1);
+ }
+ return r;
+}
+
+/* xnfcalloc implementation used by the server code we built in */
+pointer
+XNFcalloc(unsigned long n)
+{
+ pointer r;
+
+ r = calloc(1, n);
+ if (!r) {
+ perror("calloc failed");
+ exit(1);
+ }
+ return r;
+}
+
+/*
+ * Quickly check wether this is a CVT standard mode.
+ */
+static Bool
+CVTCheckStandard(int HDisplay, int VDisplay, float VRefresh, Bool Reduced,
+ Bool Verbose)
+{
+ Bool IsCVT = TRUE;
+
+ if ((!(VDisplay % 3) && ((VDisplay * 4 / 3) == HDisplay)) ||
+ (!(VDisplay % 9) && ((VDisplay * 16 / 9) == HDisplay)) ||
+ (!(VDisplay % 10) && ((VDisplay * 16 / 10) == HDisplay)) ||
+ (!(VDisplay % 4) && ((VDisplay * 5 / 4) == HDisplay)) ||
+ (!(VDisplay % 9) && ((VDisplay * 15 / 9) == HDisplay)))
+ ;
+ else {
+ if (Verbose)
+ fprintf(stderr, "Warning: Aspect Ratio is not CVT standard.\n");
+ IsCVT = FALSE;
+ }
+
+ if ((VRefresh != 50.0) && (VRefresh != 60.0) &&
+ (VRefresh != 75.0) && (VRefresh != 85.0)) {
+ if (Verbose)
+ fprintf(stderr, "Warning: Refresh Rate is not CVT standard "
+ "(50, 60, 75 or 85Hz).\n");
+ IsCVT = FALSE;
+ }
+
+ return IsCVT;
+}
+
+
+/*
+ * I'm not documenting --interlaced for obvious reasons, even though I did
+ * implement it. I also can't deny having looked at gtf here.
+ */
+static void
+PrintUsage(char *Name)
+{
+ fprintf(stderr, "\n");
+ fprintf(stderr, "usage: %s [-v|--verbose] [-r|--reduced] X Y [refresh]\n",
+ Name);
+ fprintf(stderr, "\n");
+ fprintf(stderr, " -v|--verbose : Warn about CVT standard adherance.\n");
+ fprintf(stderr, " -r|--reduced : Create a mode with reduced blanking "
+ "(default: normal blanking).\n");
+ fprintf(stderr, " X : Desired horizontal resolution "
+ "(multiple of 8, required).\n");
+ fprintf(stderr, " Y : Desired vertical resolution (required).\n");
+ fprintf(stderr, " refresh : Desired refresh rate (default: 60.0Hz).\n");
+ fprintf(stderr, "\n");
+
+ fprintf(stderr, "Calculates VESA CVT (Coordinated Video Timing) modelines"
+ " for use with X.\n");
+}
+
+
+/*
+ *
+ */
+static void
+PrintComment(DisplayModeRec *Mode, Bool CVT, Bool Reduced)
+{
+ printf("# %dx%d %.2f Hz ", Mode->HDisplay, Mode->VDisplay, Mode->VRefresh);
+
+ if (CVT) {
+ printf("(CVT %.2fM",
+ ((float) Mode->HDisplay * Mode->VDisplay) / 1000000.0);
+
+ if (!(Mode->VDisplay % 3) &&
+ ((Mode->VDisplay * 4 / 3) == Mode->HDisplay))
+ printf("3");
+ else if (!(Mode->VDisplay % 9) &&
+ ((Mode->VDisplay * 16 / 9) == Mode->HDisplay))
+ printf("9");
+ else if (!(Mode->VDisplay % 10) &&
+ ((Mode->VDisplay * 16 / 10) == Mode->HDisplay))
+ printf("A");
+ else if (!(Mode->VDisplay % 4) &&
+ ((Mode->VDisplay * 5 / 4) == Mode->HDisplay))
+ printf("4");
+ else if (!(Mode->VDisplay % 9) &&
+ ((Mode->VDisplay * 15 / 9) == Mode->HDisplay))
+ printf("9");
+
+ if (Reduced)
+ printf("-R");
+
+ printf(") ");
+ } else
+ printf("(CVT) ");
+
+ printf("hsync: %.2f kHz; ", Mode->HSync);
+ printf("pclk: %.2f MHz", ((float ) Mode->Clock) / 1000.0);
+
+ printf("\n");
+}
+
+
+/*
+ * Originally grabbed from xf86Mode.c.
+ *
+ * Ignoring the actual Mode->name, as the user will want something solid
+ * to grab hold of.
+ */
+static void
+PrintModeline(DisplayModePtr Mode, int HDisplay, int VDisplay, float VRefresh,
+ Bool Reduced)
+{
+ if (Reduced)
+ printf("Modeline \"%dx%dR\" ", HDisplay, VDisplay);
+ else
+ printf("Modeline \"%dx%d_%.2f\" ", HDisplay, VDisplay, VRefresh);
+
+ printf("%6.2f %i %i %i %i %i %i %i %i", Mode->Clock/1000., Mode->HDisplay,
+ Mode->HSyncStart, Mode->HSyncEnd, Mode->HTotal, Mode->VDisplay,
+ Mode->VSyncStart, Mode->VSyncEnd, Mode->VTotal);
+
+ if (Mode->Flags & V_INTERLACE)
+ printf(" interlace");
+ if (Mode->Flags & V_PHSYNC)
+ printf(" +hsync");
+ if (Mode->Flags & V_NHSYNC)
+ printf(" -hsync");
+ if (Mode->Flags & V_PVSYNC)
+ printf(" +vsync");
+ if (Mode->Flags & V_NVSYNC)
+ printf(" -vsync");
+
+ printf("\n");
+}
+
+
+/*
+ *
+ */
+int
+main (int argc, char *argv[])
+{
+ DisplayModeRec *Mode;
+ int HDisplay = 0, VDisplay = 0;
+ float VRefresh = 0.0;
+ Bool Reduced = FALSE, Verbose = FALSE, IsCVT;
+ Bool Interlaced = FALSE;
+ int n;
+
+ if ((argc < 3) || (argc > 7)) {
+ PrintUsage(argv[0]);
+ return 1;
+ }
+
+ /* This doesn't filter out bad flags properly. Bad flags get passed down
+ * to atoi/atof, which then return 0, so that these variables can get
+ * filled next time round. So this is just a cosmetic problem.
+ */
+ for (n = 1; n < argc; n++) {
+ if (!strcmp(argv[n], "-r") || !strcmp(argv[n], "--reduced"))
+ Reduced = TRUE;
+ else if (!strcmp(argv[n], "-i") || !strcmp(argv[n], "--interlaced"))
+ Interlaced = TRUE;
+ else if (!strcmp(argv[n], "-v") || !strcmp(argv[n], "--verbose"))
+ Verbose = TRUE;
+ else if (!strcmp(argv[n], "-h") || !strcmp(argv[n], "--help")) {
+ PrintUsage(argv[0]);
+ return 0;
+ } else if (!HDisplay) {
+ HDisplay = atoi(argv[n]);
+ if (!HDisplay) {
+ PrintUsage(argv[0]);
+ return 1;
+ }
+ }
+ else if (!VDisplay) {
+ VDisplay = atoi(argv[n]);
+ if (!VDisplay) {
+ PrintUsage(argv[0]);
+ return 1;
+ }
+ }
+ else if (!VRefresh) {
+ VRefresh = atof(argv[n]);
+ if (!VRefresh) {
+ PrintUsage(argv[0]);
+ return 1;
+ }
+ }
+ else {
+ PrintUsage(argv[0]);
+ return 1;
+ }
+ }
+
+ if (!HDisplay || !VDisplay) {
+ PrintUsage(argv[0]);
+ return 0;
+ }
+
+ /* Default to 60.0Hz */
+ if (!VRefresh)
+ VRefresh = 60.0;
+
+ /* Horizontal timing is always a multiple of 8: round up. */
+ if (HDisplay & 0x07) {
+ HDisplay &= ~0x07;
+ HDisplay += 8;
+ }
+
+ if (Reduced) {
+ if ((VRefresh / 60.0) != floor(VRefresh / 60.0)) {
+ fprintf(stderr,
+ "\nERROR: Multiple of 60Hz refresh rate required for "
+ " reduced blanking.\n");
+ PrintUsage(argv[0]);
+ return 0;
+ }
+ }
+
+ IsCVT = CVTCheckStandard(HDisplay, VDisplay, VRefresh, Reduced, Verbose);
+
+ Mode = xf86CVTMode(HDisplay, VDisplay, VRefresh, Reduced, Interlaced);
+
+ PrintComment(Mode, IsCVT, Reduced);
+ PrintModeline(Mode, HDisplay, VDisplay, VRefresh, Reduced);
+
+ return 0;
+}
diff --git a/xorg-server/hw/xfree86/utils/gtf/Makefile.am b/xorg-server/hw/xfree86/utils/gtf/Makefile.am
index d1a6d611c..0852541bd 100644
--- a/xorg-server/hw/xfree86/utils/gtf/Makefile.am
+++ b/xorg-server/hw/xfree86/utils/gtf/Makefile.am
@@ -1,44 +1,44 @@
-# Copyright 2005 Sun Microsystems, Inc. All rights reserved.
-#
-# Permission is hereby granted, free of charge, to any person obtaining a
-# copy of this software and associated documentation files (the "Software"),
-# to deal in the Software without restriction, including without limitation
-# the rights to use, copy, modify, merge, publish, distribute, sublicense,
-# and/or sell copies of the Software, and to permit persons to whom the
-# Software is furnished to do so, subject to the following conditions:
-#
-# The above copyright notice and this permission notice (including the next
-# paragraph) shall be included in all copies or substantial portions of the
-# Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
-# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
-# DEALINGS IN THE SOFTWARE.
-#
-
-bin_PROGRAMS = gtf
-
-gtf_SOURCES = gtf.c
-gtf_CFLAGS = $(XORG_CFLAGS)
-gtf_LDADD = -lm
-
-appmandir = $(APP_MAN_DIR)
-
-appman_PRE = gtf.man
-appman_DATA = $(appman_PRE:man=@APP_MAN_SUFFIX@)
-
-include $(top_srcdir)/cpprules.in
-
-EXTRA_DIST = gtf.man.pre
-BUILT_SOURCES = $(appman_PRE)
-CLEANFILES = $(appman_PRE) $(appman_DATA)
-
-SUFFIXES += .$(APP_MAN_SUFFIX) .man
-
-.man.$(APP_MAN_SUFFIX):
- -$(AM_V_at)rm -f $@
- $(AM_V_at)$(LN_S) $< $@
+# Copyright (c) 2005, Oracle and/or its affiliates. All rights reserved.
+#
+# Permission is hereby granted, free of charge, to any person obtaining a
+# copy of this software and associated documentation files (the "Software"),
+# to deal in the Software without restriction, including without limitation
+# the rights to use, copy, modify, merge, publish, distribute, sublicense,
+# and/or sell copies of the Software, and to permit persons to whom the
+# Software is furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice (including the next
+# paragraph) shall be included in all copies or substantial portions of the
+# Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+# DEALINGS IN THE SOFTWARE.
+#
+
+bin_PROGRAMS = gtf
+
+gtf_SOURCES = gtf.c
+gtf_CFLAGS = $(XORG_CFLAGS)
+gtf_LDADD = -lm
+
+appmandir = $(APP_MAN_DIR)
+
+appman_PRE = gtf.man
+appman_DATA = $(appman_PRE:man=@APP_MAN_SUFFIX@)
+
+include $(top_srcdir)/cpprules.in
+
+EXTRA_DIST = gtf.man.pre
+BUILT_SOURCES = $(appman_PRE)
+CLEANFILES = $(appman_PRE) $(appman_DATA)
+
+SUFFIXES += .$(APP_MAN_SUFFIX) .man
+
+.man.$(APP_MAN_SUFFIX):
+ -$(AM_V_at)rm -f $@
+ $(AM_V_at)$(LN_S) $< $@
diff --git a/xorg-server/hw/xfree86/vbe/vbeModes.c b/xorg-server/hw/xfree86/vbe/vbeModes.c
index 5b69b0096..9ccbe6b51 100644
--- a/xorg-server/hw/xfree86/vbe/vbeModes.c
+++ b/xorg-server/hw/xfree86/vbe/vbeModes.c
@@ -356,8 +356,8 @@ VBESetModeNames(DisplayModePtr pMode)
pMode->VDisplay > 10000 || pMode->VDisplay < 0) {
pMode->name = strdup("BADMODE");
} else {
- pMode->name = xnfalloc(4 + 1 + 4 + 1);
- sprintf(pMode->name, "%dx%d", pMode->HDisplay, pMode->VDisplay);
+ XNFasprintf(&pMode->name, "%dx%d",
+ pMode->HDisplay, pMode->VDisplay);
}
}
pMode = pMode->next;
diff --git a/xorg-server/hw/xfree86/xaa/Makefile.am b/xorg-server/hw/xfree86/xaa/Makefile.am
index ccba713a6..fcbc53a73 100644
--- a/xorg-server/hw/xfree86/xaa/Makefile.am
+++ b/xorg-server/hw/xfree86/xaa/Makefile.am
@@ -25,40 +25,40 @@ libxaa_la_SOURCES = xaaInit.c xaaGC.c xaaInitAccel.c xaaFallback.c \
$(LSB_FIRST) $(MSB_FIRST) $(LSB_FIXED) $(MSB_FIXED) \
$(LSB_3_FIRST) $(MSB_3_FIRST) $(LSB_3_FIXED) $(MSB_3_FIXED)
${POLYSEG}:
- echo "#define POLYSEGMENT" > $@
- echo '#include "$(srcdir)/${@:s-%=%}"' >> $@
+ $(AM_V_GEN)echo "#define POLYSEGMENT" > $@
+ $(AM_V_GEN)echo '#include "$(srcdir)/${@:s-%=%}"' >> $@
${LSB_FIRST}:
- echo "#define LSBFIRST" > $@
- echo '#include "$(srcdir)/${@:l-%=%}"' >> $@
+ $(AM_V_GEN)echo "#define LSBFIRST" > $@
+ $(AM_V_GEN)echo '#include "$(srcdir)/${@:l-%=%}"' >> $@
${LSB_3_FIRST}:
- echo "#define LSBFIRST" > $@
- echo "#define TRIPLE_BITS" >> $@
- echo '#include "$(srcdir)/${@:l3-%=%}"' >> $@
+ $(AM_V_GEN)echo "#define LSBFIRST" > $@
+ $(AM_V_GEN)echo "#define TRIPLE_BITS" >> $@
+ $(AM_V_GEN)echo '#include "$(srcdir)/${@:l3-%=%}"' >> $@
${LSB_FIXED}:
- echo "#define LSBFIRST" > $@
- echo "#define FIXEDBASE" >> $@
- echo '#include "$(srcdir)/${@:lf-%=%}"' >> $@
+ $(AM_V_GEN)echo "#define LSBFIRST" > $@
+ $(AM_V_GEN)echo "#define FIXEDBASE" >> $@
+ $(AM_V_GEN)echo '#include "$(srcdir)/${@:lf-%=%}"' >> $@
${LSB_3_FIXED}:
- echo "#define LSBFIRST" > $@
- echo "#define TRIPLE_BITS" >> $@
- echo "#define FIXEDBASE" >> $@
- echo '#include "$(srcdir)/${@:lf3-%=%}"' >> $@
+ $(AM_V_GEN)echo "#define LSBFIRST" > $@
+ $(AM_V_GEN)echo "#define TRIPLE_BITS" >> $@
+ $(AM_V_GEN)echo "#define FIXEDBASE" >> $@
+ $(AM_V_GEN)echo '#include "$(srcdir)/${@:lf3-%=%}"' >> $@
${MSB_FIRST}:
- echo "#define MSBFIRST" > $@
- echo '#include "$(srcdir)/${@:m-%=%}"' >> $@
+ $(AM_V_GEN)echo "#define MSBFIRST" > $@
+ $(AM_V_GEN)echo '#include "$(srcdir)/${@:m-%=%}"' >> $@
${MSB_3_FIRST}:
- echo "#define MSBFIRST" > $@
- echo "#define TRIPLE_BITS" >> $@
- echo '#include "$(srcdir)/${@:m3-%=%}"' >> $@
+ $(AM_V_GEN)echo "#define MSBFIRST" > $@
+ $(AM_V_GEN)echo "#define TRIPLE_BITS" >> $@
+ $(AM_V_GEN)echo '#include "$(srcdir)/${@:m3-%=%}"' >> $@
${MSB_FIXED}:
- echo "#define MSBFIRST" > $@
- echo "#define FIXEDBASE" >> $@
- echo '#include "$(srcdir)/${@:mf-%=%}"' >> $@
+ $(AM_V_GEN)echo "#define MSBFIRST" > $@
+ $(AM_V_GEN)echo "#define FIXEDBASE" >> $@
+ $(AM_V_GEN)echo '#include "$(srcdir)/${@:mf-%=%}"' >> $@
${MSB_3_FIXED}:
- echo "#define MSBFIRST" > $@
- echo "#define TRIPLE_BITS" >> $@
- echo "#define FIXEDBASE" >> $@
- echo '#include "$(srcdir)/${@:mf3-%=%}"' >> $@
+ $(AM_V_GEN)echo "#define MSBFIRST" > $@
+ $(AM_V_GEN)echo "#define TRIPLE_BITS" >> $@
+ $(AM_V_GEN)echo "#define FIXEDBASE" >> $@
+ $(AM_V_GEN)echo '#include "$(srcdir)/${@:mf3-%=%}"' >> $@
DISTCLEANFILES = $(POLYSEG) \
$(LSB_FIRST) $(LSB_FIXED) $(MSB_FIRST) $(MSB_FIXED) \
diff --git a/xorg-server/hw/xwin/win.h b/xorg-server/hw/xwin/win.h
index 253f194e0..e790d2d73 100644
--- a/xorg-server/hw/xwin/win.h
+++ b/xorg-server/hw/xwin/win.h
@@ -221,9 +221,10 @@ if (fDebugProcMsg) \
{ \
char *pszTemp; \
int iLength; \
- pszTemp = Xprintf (str, ##__VA_ARGS__); \
- MessageBox (NULL, pszTemp, szFunctionName, MB_OK); \
- free(pszTemp); \
+ if (asprintf (&pszTemp, str, ##__VA_ARGS__) != -1) { \
+ MessageBox (NULL, pszTemp, szFunctionName, MB_OK); \
+ free (pszTemp); \
+ } \
}
#else
#define DEBUG_MSG(str,...)
diff --git a/xorg-server/hw/xwin/windialogs.c b/xorg-server/hw/xwin/windialogs.c
index d040af59a..8c648e84a 100644
--- a/xorg-server/hw/xwin/windialogs.c
+++ b/xorg-server/hw/xwin/windialogs.c
@@ -341,11 +341,10 @@ winExitDlgProc (HWND hDialog, UINT message,
winInitDialog (hDialog);
/* Format the connected clients string */
- pszConnectedClients = Xprintf (CONNECTED_CLIENTS_FORMAT,
+ if (asprintf (&pszConnectedClients, CONNECTED_CLIENTS_FORMAT,
(s_pScreenPriv->iConnectedClients == 1) ? "is" : "are",
s_pScreenPriv->iConnectedClients,
- (s_pScreenPriv->iConnectedClients == 1) ? "" : "s");
- if (!pszConnectedClients)
+ (s_pScreenPriv->iConnectedClients == 1) ? "" : "s") == -1)
return TRUE;
diff --git a/xorg-server/hw/xwin/winerror.c b/xorg-server/hw/xwin/winerror.c
index 1ee8c572f..988c5952e 100644
--- a/xorg-server/hw/xwin/winerror.c
+++ b/xorg-server/hw/xwin/winerror.c
@@ -101,12 +101,15 @@ winMessageBoxF (const char *pszError, UINT uType, ...)
char * pszErrorF = NULL;
char * pszMsgBox = NULL;
va_list args;
+ int size;
va_start(args, uType);
- pszErrorF = Xvprintf(pszError, args);
+ size = vasprintf (&pszErrorF, pszError, args);
va_end(args);
- if (!pszErrorF)
+ if (size == -1) {
+ pszErrorF = NULL;
goto winMessageBoxF_Cleanup;
+ }
#define MESSAGEBOXF \
"%s\n" \
@@ -117,15 +120,18 @@ winMessageBoxF (const char *pszError, UINT uType, ...)
"XWin was started with the following command-line:\n\n" \
"%s\n"
- pszMsgBox = Xprintf (MESSAGEBOXF,
- pszErrorF, XVENDORNAME,
- XORG_VERSION_MAJOR, XORG_VERSION_MINOR, XORG_VERSION_PATCH, XORG_VERSION_SNAP, XORG_VERSION_CURRENT,
- BUILDERADDR,
- BUILDERSTRING,
- g_pszCommandLine);
+ size = asprintf (&pszMsgBox, MESSAGEBOXF,
+ pszErrorF, XVENDORNAME,
+ XORG_VERSION_MAJOR, XORG_VERSION_MINOR, XORG_VERSION_PATCH,
+ XORG_VERSION_SNAP, XORG_VERSION_CURRENT,
+ BUILDERADDR,
+ BUILDERSTRING,
+ g_pszCommandLine);
- if (!pszMsgBox)
+ if (size == -1) {
+ pszMsgBox = NULL;
goto winMessageBoxF_Cleanup;
+ }
/* Display the message box string */
MessageBox (NULL,
diff --git a/xorg-server/include/Makefile.am b/xorg-server/include/Makefile.am
index 78a25ccd9..2b5ee4ddb 100644
--- a/xorg-server/include/Makefile.am
+++ b/xorg-server/include/Makefile.am
@@ -1,6 +1,7 @@
if XORG
sdk_HEADERS = \
XIstubs.h \
+ Xprintf.h \
callback.h \
closestr.h \
closure.h \
diff --git a/xorg-server/include/Xprintf.h b/xorg-server/include/Xprintf.h
new file mode 100644
index 000000000..1d2882993
--- /dev/null
+++ b/xorg-server/include/Xprintf.h
@@ -0,0 +1,69 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ */
+
+#ifndef XPRINTF_H
+#define XPRINTF_H
+
+#include <stdio.h>
+#include <stdarg.h>
+#include <X11/Xfuncproto.h>
+
+#ifndef _X_RESTRICT_KYWD
+# if defined(restrict) /* assume autoconf set it correctly */ || \
+ (defined(__STDC__) && (__STDC_VERSION__ - 0 >= 199901L)) /* C99 */
+# define _X_RESTRICT_KYWD restrict
+# elif defined(__GNUC__) && !defined(__STRICT_ANSI__) /* gcc w/C89+extensions */
+# define _X_RESTRICT_KYWD __restrict__
+# else
+# define _X_RESTRICT_KYWD
+# endif
+#endif
+
+/*
+ * These functions provide a portable implementation of the common (but not
+ * yet universal) asprintf & vasprintf routines to allocate a buffer big
+ * enough to sprintf the arguments to. The XNF variants terminate the server
+ * if the allocation fails.
+ * The buffer allocated is returned in the pointer provided in the first
+ * argument. The return value is the size of the allocated buffer, or -1
+ * on failure.
+ */
+extern _X_EXPORT int Xasprintf (char **ret,
+ const char * _X_RESTRICT_KYWD fmt,
+ ...) _X_ATTRIBUTE_PRINTF(2,3);
+extern _X_EXPORT int Xvasprintf (char **ret,
+ const char * _X_RESTRICT_KYWD fmt,
+ va_list va) _X_ATTRIBUTE_PRINTF(2,0);
+extern _X_EXPORT int XNFasprintf (char **ret,
+ const char * _X_RESTRICT_KYWD fmt,
+ ...) _X_ATTRIBUTE_PRINTF(2,3);
+extern _X_EXPORT int XNFvasprintf (char **ret,
+ const char * _X_RESTRICT_KYWD fmt,
+ va_list va) _X_ATTRIBUTE_PRINTF(2,0);
+
+#if !defined(HAVE_ASPRINTF) && !defined(HAVE_VASPRINTF)
+# define asprintf Xasprintf
+# define vasprintf Xvasprintf
+#endif
+
+#endif /* XPRINTF_H */
diff --git a/xorg-server/include/dix-config.h.in b/xorg-server/include/dix-config.h.in
index 63a770f1e..64eb296c8 100644
--- a/xorg-server/include/dix-config.h.in
+++ b/xorg-server/include/dix-config.h.in
@@ -243,6 +243,9 @@
/* Define to 1 if you have the `vprintf' function. */
#undef HAVE_VPRINTF
+/* Define to 1 if you have the `vasprintf' function. */
+#undef HAVE_VASPRINTF
+
/* Support IPv6 for TCP connections */
#undef IPv6
diff --git a/xorg-server/include/os.h b/xorg-server/include/os.h
index 59c057c44..87e786e1f 100644
--- a/xorg-server/include/os.h
+++ b/xorg-server/include/os.h
@@ -51,6 +51,7 @@ SOFTWARE.
#include "misc.h"
#include <stdarg.h>
+#include <string.h>
#define SCREEN_SAVER_ON 0
#define SCREEN_SAVER_OFF 1
@@ -263,10 +264,14 @@ extern _X_EXPORT char *Xstrdup(const char *s);
*/
extern _X_EXPORT char *XNFstrdup(const char *s);
-extern _X_EXPORT char *Xprintf(const char *fmt, ...) _X_ATTRIBUTE_PRINTF(1,2);
-extern _X_EXPORT char *Xvprintf(const char *fmt, va_list va);
-extern _X_EXPORT char *XNFprintf(const char *fmt, ...) _X_ATTRIBUTE_PRINTF(1,2);
-extern _X_EXPORT char *XNFvprintf(const char *fmt, va_list va);
+/* Include new X*asprintf API */
+#include "Xprintf.h"
+
+/* Older api deprecated in favor of the asprintf versions */
+extern _X_EXPORT char *Xprintf(const char *fmt, ...) _X_ATTRIBUTE_PRINTF(1,2) _X_DEPRECATED;
+extern _X_EXPORT char *Xvprintf(const char *fmt, va_list va)_X_ATTRIBUTE_PRINTF(1,0) _X_DEPRECATED;
+extern _X_EXPORT char *XNFprintf(const char *fmt, ...) _X_ATTRIBUTE_PRINTF(1,2) _X_DEPRECATED;
+extern _X_EXPORT char *XNFvprintf(const char *fmt, va_list va)_X_ATTRIBUTE_PRINTF(1,0) _X_DEPRECATED;
typedef void (*OsSigHandlerPtr)(int /* sig */);
typedef int (*OsSigWrapperPtr)(int /* sig */);
diff --git a/xorg-server/mi/micmap.c b/xorg-server/mi/micmap.c
index 12aa6a2e5..87d4248d0 100644
--- a/xorg-server/mi/micmap.c
+++ b/xorg-server/mi/micmap.c
@@ -1,5 +1,5 @@
/*
- * Copyright © 1987 Sun Microsystems, Inc. All rights reserved.
+ * Copyright (c) 1987, Oracle and/or its affiliates. All rights reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
diff --git a/xorg-server/os/access.c b/xorg-server/os/access.c
index 32692f836..0266cc44a 100644
--- a/xorg-server/os/access.c
+++ b/xorg-server/os/access.c
@@ -54,7 +54,7 @@ SOFTWARE.
******************************************************************/
/*
- * Copyright © 2004 Sun Microsystems, Inc. All rights reserved.
+ * Copyright (c) 2004, Oracle and/or its affiliates. All rights reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
diff --git a/xorg-server/os/log.c b/xorg-server/os/log.c
index 2495b9066..adcf16244 100644
--- a/xorg-server/os/log.c
+++ b/xorg-server/os/log.c
@@ -177,10 +177,8 @@ LogInit(const char *fname, const char *backup)
char *logFileName = NULL;
if (fname && *fname) {
- logFileName = malloc(strlen(fname) + strlen(display) + 1);
- if (!logFileName)
+ if (asprintf(&logFileName, fname, display) == -1)
FatalError("Cannot allocate space for the log file name\n");
- sprintf(logFileName, fname, display);
if (backup && *backup) {
struct stat buf;
@@ -189,13 +187,9 @@ LogInit(const char *fname, const char *backup)
char *suffix;
char *oldLog;
- oldLog = malloc(strlen(logFileName) + strlen(backup) +
- strlen(display) + 1);
- suffix = malloc(strlen(backup) + strlen(display) + 1);
- if (!oldLog || !suffix)
+ if ((asprintf(&suffix, backup, display) == -1) ||
+ (asprintf(&oldLog, "%s%s", logFileName, suffix) == -1))
FatalError("Cannot allocate space for the log file name\n");
- sprintf(suffix, backup, display);
- sprintf(oldLog, "%s%s", logFileName, suffix);
free(suffix);
if (rename(logFileName, oldLog) == -1) {
FatalError("Cannot move old log file \"%s\" to \"%s\"\n",
diff --git a/xorg-server/os/xprintf.c b/xorg-server/os/xprintf.c
index 5a42df2d1..218c3c91f 100644
--- a/xorg-server/os/xprintf.c
+++ b/xorg-server/os/xprintf.c
@@ -1,6 +1,13 @@
-/*
- * printf routines which xalloc their buffer
- */
+/**
+ * @file
+ *
+ * @section DESCRIPTION
+ *
+ * These functions provide a portable implementation of the common (but not
+ * yet universal) asprintf & vasprintf routines to allocate a buffer big
+ * enough to sprintf the arguments to. The XNF variants terminate the server
+ * if the allocation fails.
+ */
/*
* Copyright (c) 2004 Alexander Gottwald
*
@@ -26,6 +33,29 @@
* holders shall not be used in advertising or otherwise to promote the sale,
* use or other dealings in this Software without prior written authorization.
*/
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ */
+
#ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h>
#endif
@@ -35,6 +65,13 @@
#include <stdarg.h>
#include <stdio.h>
+#ifdef asprintf
+# undef asprintf
+#endif
+#ifdef vasprintf
+# undef vasprintf
+#endif
+
#ifndef va_copy
# ifdef __va_copy
# define va_copy __va_copy
@@ -42,11 +79,23 @@
# error "no working va_copy was found"
# endif
#endif
-
-char *
-Xvprintf(const char *format, va_list va)
+
+/**
+ * Varargs sprintf that allocates a string buffer the right size for
+ * the pattern & data provided and prints the requested data to it.
+ *
+ * @param ret Pointer to which the newly allocated buffer is written
+ * (contents undefined on error)
+ * @param format printf style format string
+ * @param va variable argument list
+ * @return size of allocated buffer, or -1 on error.
+ */
+int
+Xvasprintf(char **ret, const char * _X_RESTRICT_KYWD format, va_list va)
{
- char *ret;
+#ifdef HAVE_VASPRINTF
+ return vasprintf(ret, format, va);
+#else
int size;
va_list va2;
@@ -54,12 +103,94 @@ Xvprintf(const char *format, va_list va)
size = vsnprintf(NULL, 0, format, va2);
va_end(va2);
- ret = (char *)malloc(size + 1);
- if (ret == NULL)
- return NULL;
+ *ret = malloc(size + 1);
+ if (*ret == NULL)
+ return -1;
- vsnprintf(ret, size + 1, format, va);
+ vsnprintf(*ret, size + 1, format, va);
ret[size] = 0;
+ return size;
+#endif
+}
+
+#ifndef HAVE_VASPRINTF
+# define vasprintf Xvasprintf
+#endif
+
+/**
+ * sprintf that allocates a string buffer the right size for
+ * the pattern & data provided and prints the requested data to it.
+ *
+ * @param ret Pointer to which the newly allocated buffer is written
+ * (contents undefined on error)
+ * @param format printf style format string
+ * @param ... arguments for specified format
+ * @return size of allocated buffer, or -1 on error.
+ */
+int
+Xasprintf(char ** ret, const char * _X_RESTRICT_KYWD format, ...)
+{
+ int size;
+ va_list va;
+ va_start(va, format);
+ size = vasprintf(ret, format, va);
+ va_end(va);
+ return size;
+}
+
+/**
+ * Varargs sprintf that allocates a string buffer the right size for
+ * the pattern & data provided and prints the requested data to it.
+ * On failure, issues a FatalError message and aborts the server.
+ *
+ * @param ret Pointer to which the newly allocated buffer is written
+ * (contents undefined on error)
+ * @param format printf style format string
+ * @param va variable argument list
+ * @return size of allocated buffer
+ */
+int
+XNFvasprintf(char **ret, const char * _X_RESTRICT_KYWD format, va_list va)
+{
+ int size = vasprintf(ret, format, va);
+ if ((size == -1) || (*ret == NULL)) {
+ Error("XNFvasprintf");
+ FatalError("XNFvasprintf failed");
+ }
+ return size;
+}
+
+/**
+ * sprintf that allocates a string buffer the right size for
+ * the pattern & data provided and prints the requested data to it.
+ * On failure, issues a FatalError message and aborts the server.
+ *
+ * @param ret Pointer to which the newly allocated buffer is written
+ * (contents undefined on error)
+ * @param format printf style format string
+ * @param ... arguments for specified format
+ * @return size of allocated buffer
+ */
+int
+XNFasprintf(char ** ret, const char * _X_RESTRICT_KYWD format, ...)
+{
+ int size;
+ va_list va;
+ va_start(va, format);
+ size = XNFvasprintf(ret, format, va);
+ va_end(va);
+ return size;
+}
+
+/* Old api, now deprecated, may be removed in the future */
+char *
+Xvprintf(const char *format, va_list va)
+{
+ char *ret;
+
+ if (vasprintf(&ret, format, va) == -1)
+ ret = NULL;
+
return ret;
}
@@ -68,7 +199,8 @@ char *Xprintf(const char *format, ...)
char *ret;
va_list va;
va_start(va, format);
- ret = Xvprintf(format, va);
+ if (vasprintf(&ret, format, va) == -1)
+ ret = NULL;
va_end(va);
return ret;
}
@@ -77,19 +209,9 @@ char *
XNFvprintf(const char *format, va_list va)
{
char *ret;
- int size;
- va_list va2;
-
- va_copy(va2, va);
- size = vsnprintf(NULL, 0, format, va2);
- va_end(va2);
- ret = (char *)xnfalloc(size + 1);
- if (ret == NULL)
- return NULL;
+ XNFvasprintf(&ret, format, va);
- vsnprintf(ret, size + 1, format, va);
- ret[size] = 0;
return ret;
}
@@ -98,7 +220,7 @@ char *XNFprintf(const char *format, ...)
char *ret;
va_list va;
va_start(va, format);
- ret = XNFvprintf(format, va);
+ XNFvasprintf(&ret, format, va);
va_end(va);
return ret;
}
diff --git a/xorg-server/render/render.c b/xorg-server/render/render.c
index a9cbfef8b..dd143d6a7 100644
--- a/xorg-server/render/render.c
+++ b/xorg-server/render/render.c
@@ -47,6 +47,11 @@
#include "xace.h"
#include "protocol-versions.h"
+#ifdef PANORAMIX
+#include "panoramiX.h"
+#include "panoramiXsrv.h"
+#endif
+
#if HAVE_STDINT_H
#include <stdint.h>
#elif !defined(UINT32_MAX)
@@ -2651,9 +2656,6 @@ SProcRenderDispatch (ClientPtr client)
}
#ifdef PANORAMIX
-#include "panoramiX.h"
-#include "panoramiXsrv.h"
-
#define VERIFY_XIN_PICTURE(pPicture, pid, client, mode) {\
int rc = dixLookupResourceByType((pointer *)&(pPicture), pid,\
XRT_PICTURE, client, mode);\
diff --git a/xorg-server/xfixes/cursor.c b/xorg-server/xfixes/cursor.c
index d84574970..488688b17 100644
--- a/xorg-server/xfixes/cursor.c
+++ b/xorg-server/xfixes/cursor.c
@@ -1,5 +1,5 @@
/*
- * Copyright © 2006 Sun Microsystems, Inc. All rights reserved.
+ * Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
diff --git a/xorg-server/xfixes/xfixes.c b/xorg-server/xfixes/xfixes.c
index 67b34f346..80f212273 100644
--- a/xorg-server/xfixes/xfixes.c
+++ b/xorg-server/xfixes/xfixes.c
@@ -1,5 +1,5 @@
/*
- * Copyright © 2006 Sun Microsystems, Inc. All rights reserved.
+ * Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
diff --git a/xorg-server/xfixes/xfixesint.h b/xorg-server/xfixes/xfixesint.h
index 7824ac6ee..a2a8e4163 100644
--- a/xorg-server/xfixes/xfixesint.h
+++ b/xorg-server/xfixes/xfixesint.h
@@ -1,5 +1,5 @@
/*
- * Copyright © 2006 Sun Microsystems, Inc. All rights reserved.
+ * Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
diff --git a/xorg-server/xkb/ddxList.c b/xorg-server/xkb/ddxList.c
index 16bca16db..e62078de8 100644
--- a/xorg-server/xkb/ddxList.c
+++ b/xorg-server/xkb/ddxList.c
@@ -156,34 +156,45 @@ char tmpname[PATH_MAX];
#endif
if (XkbBaseDirectory!=NULL) {
if ((list->pattern[what][0]=='*')&&(list->pattern[what][1]=='\0')) {
- buf = Xprintf("%s/%s.dir",XkbBaseDirectory,componentDirs[what]);
- in= fopen(buf,"r");
+ if (asprintf(&buf, "%s/%s.dir", XkbBaseDirectory,
+ componentDirs[what]) == -1)
+ buf = NULL;
+ else
+ in = fopen(buf,"r");
}
if (!in) {
haveDir= FALSE;
free(buf);
- buf = Xprintf(
- "'%s/xkbcomp' '-R%s/%s' -w %ld -l -vlfhpR '%s'" W32_tmparg,
- XkbBinDirectory,XkbBaseDirectory,componentDirs[what],(long)
- ((xkbDebugFlags<2)?1:((xkbDebugFlags>10)?10:xkbDebugFlags)),
- file W32_tmpfile
- );
+ if (asprintf
+ (&buf,
+ "'%s/xkbcomp' '-R%s/%s' -w %ld -l -vlfhpR '%s'" W32_tmparg,
+ XkbBinDirectory, XkbBaseDirectory, componentDirs[what],
+ (long) ((xkbDebugFlags < 2) ? 1 :
+ ((xkbDebugFlags > 10) ? 10 : xkbDebugFlags)),
+ file W32_tmpfile
+ ) == -1)
+ buf = NULL;
}
}
else {
if ((list->pattern[what][0]=='*')&&(list->pattern[what][1]=='\0')) {
- buf = Xprintf("%s.dir",componentDirs[what]);
- in= fopen(buf,"r");
+ if (asprintf(&buf, "%s.dir", componentDirs[what]) == -1)
+ buf = NULL;
+ else
+ in = fopen(buf,"r");
}
if (!in) {
haveDir= FALSE;
free(buf);
- buf = Xprintf(
- "xkbcomp -R%s -w %ld -l -vlfhpR '%s'" W32_tmparg,
- componentDirs[what],(long)
- ((xkbDebugFlags<2)?1:((xkbDebugFlags>10)?10:xkbDebugFlags)),
- file W32_tmpfile
- );
+ if (asprintf
+ (&buf,
+ "xkbcomp -R%s -w %ld -l -vlfhpR '%s'" W32_tmparg,
+ componentDirs[what],
+ (long) ((xkbDebugFlags < 2) ? 1 :
+ ((xkbDebugFlags > 10) ? 10 : xkbDebugFlags)),
+ file W32_tmpfile
+ ) == -1)
+ buf = NULL;
}
}
status= Success;
diff --git a/xorg-server/xkb/ddxLoad.c b/xorg-server/xkb/ddxLoad.c
index 03de218ab..cde181c64 100644
--- a/xorg-server/xkb/ddxLoad.c
+++ b/xorg-server/xkb/ddxLoad.c
@@ -210,7 +210,8 @@ XkbDDXCompileKeymapByNames( XkbDescPtr xkb,
#endif
if (XkbBaseDirectory != NULL) {
- xkbbasedirflag = Xprintf("\"-R%s\"", XkbBaseDirectory);
+ if (asprintf(&xkbbasedirflag, "\"-R%s\"", XkbBaseDirectory) == -1)
+ xkbbasedirflag = NULL;
}
if (XkbBinDirectory != NULL) {
@@ -225,14 +226,16 @@ XkbDDXCompileKeymapByNames( XkbDescPtr xkb,
}
}
- buf = Xprintf("\"%s%sxkbcomp\" -w %d %s -xkm \"%s\" "
+ if (asprintf(&buf,
+ "\"%s%sxkbcomp\" -w %d %s -xkm \"%s\" "
"-em1 %s -emp %s -eml %s \"%s%s.xkm\"",
- xkbbindir, xkbbindirsep,
- ( (xkbDebugFlags < 2) ? 1 :
- ((xkbDebugFlags > 10) ? 10 : (int)xkbDebugFlags) ),
- xkbbasedirflag ? xkbbasedirflag : "", xkmfile,
- PRE_ERROR_MSG, ERROR_PREFIX, POST_ERROR_MSG1,
- xkm_output_dir, keymap);
+ xkbbindir, xkbbindirsep,
+ ((xkbDebugFlags < 2) ? 1 :
+ ((xkbDebugFlags > 10) ? 10 : (int) xkbDebugFlags)),
+ xkbbasedirflag ? xkbbasedirflag : "", xkmfile,
+ PRE_ERROR_MSG, ERROR_PREFIX, POST_ERROR_MSG1,
+ xkm_output_dir, keymap) == -1)
+ buf = NULL;
free(xkbbasedirflag);