meego-w40:xserver-xorg.git
6 years agoVersion 1.11.99.2 (1.12 snapshot 2) xorg-server-1.11.99.2
Keith Packard [Sun, 18 Dec 2011 01:22:45 +0000 (17:22 -0800)]
Version 1.11.99.2 (1.12 snapshot 2)

Signed-off-by: Keith Packard <keithp@keithp.com>
6 years agoxserver: check for elevated privileges not uid=0
Antoine Martin [Fri, 16 Dec 2011 18:36:51 +0000 (01:36 +0700)]
xserver: check for elevated privileges not uid=0

This allows us to run the server as a normal user whilst still
being able to use the -modulepath, -logfile and -config switches
We define a xf86PrivsElevated which will do the checks and cache
the result in case it is called more than once.
Also renamed the paths #defines to match their new meaning.
Original discussion which led to this patch can be found here:
http://lists.freedesktop.org/archives/xorg-devel/2011-September/025853.html

Signed-off-by: Antoine Martin <antoine@nagafix.co.uk>
Tested-by: Michal Suchanek <hramrach at centrum.cz>
Reviewed-by: Jamey Sharp <jamey at minilop.net>
Reviewed-by: Adam Jackson <ajax@redhat.com>
6 years agodmx: fix distcheck failure, missing compsize.h in Makefile.am
Gaetan Nadon [Fri, 9 Dec 2011 12:45:02 +0000 (07:45 -0500)]
dmx: fix distcheck failure, missing compsize.h in Makefile.am

which was added in commit:
dmx: Build fix for -Werror=implicit-function-declaration

Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Gaetan Nadon <memsize@videotron.ca>
Signed-off-by: Keith Packard <keithp@keithp.com>
6 years agoconfigure: split the required modules up
Peter Hutterer [Wed, 14 Dec 2011 00:34:19 +0000 (10:34 +1000)]
configure: split the required modules up

We do the same thing for libraries and optional modules already, and it's
much easier to read when one of them changes

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Reviewed-by: Gaetan Nadon <memsize@videotron.ca>
Signed-off-by: Keith Packard <keithp@keithp.com>
6 years agoMerge remote-tracking branch 'whot/for-keith'
Keith Packard [Wed, 14 Dec 2011 19:40:10 +0000 (11:40 -0800)]
Merge remote-tracking branch 'whot/for-keith'

6 years agoMerge branch 'for-whot' of git://people.freedesktop.org/~alanc/xserver into for-keith
Peter Hutterer [Tue, 13 Dec 2011 04:19:54 +0000 (14:19 +1000)]
Merge branch 'for-whot' of git://people.freedesktop.org/~alanc/xserver into for-keith

6 years agodix: add a MAXEVENTS define for the number of core + extension events
Peter Hutterer [Sat, 10 Dec 2011 21:31:43 +0000 (07:31 +1000)]
dix: add a MAXEVENTS define for the number of core + extension events

Not including GenericEvents

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Walter Harms <wharms@bfs.de>
Reviewed-by: Chase Douglas <chase.douglas@canonical.com>
6 years agodix: move event filter retrieval helpers to inpututils.c
Peter Hutterer [Fri, 9 Dec 2011 08:38:53 +0000 (18:38 +1000)]
dix: move event filter retrieval helpers to inpututils.c

No functional changes

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Reviewed-by: Chase Douglas <chase.douglas@canonical.com>
6 years agodix: switch EventIsDeliverable to take the event type only
Peter Hutterer [Fri, 9 Dec 2011 08:02:49 +0000 (18:02 +1000)]
dix: switch EventIsDeliverable to take the event type only

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Reviewed-by: Chase Douglas <chase.douglas@canonical.com>
6 years agodix: move storing last.valuators into a helper function
Peter Hutterer [Fri, 9 Dec 2011 05:49:04 +0000 (15:49 +1000)]
dix: move storing last.valuators into a helper function

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Chase Douglas <chase.douglas@canonical.com>
6 years agodix: always allocate and set the grab's sync.event
Peter Hutterer [Thu, 8 Dec 2011 05:38:44 +0000 (15:38 +1000)]
dix: always allocate and set the grab's sync.event

Allocate the memory at device creation time and always store the event, even
if we're not frozen. This way we know which event triggered the grab.
Since the event was never freed anyway except on device shutdown, this
doesn't really change things much.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Chase Douglas <chase.douglas@canonical.com>
6 years agoinput: replace GRABTYPE_* with the InputLevel enums
Peter Hutterer [Thu, 8 Dec 2011 04:27:01 +0000 (14:27 +1000)]
input: replace GRABTYPE_* with the InputLevel enums

They achieve the same thing, re-use the more generic InputLevel so we can
convert to/fro easier.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Chase Douglas <chase.douglas@canonical.com>
6 years agoAdd GrabIsPointerGrab and GrabIsKeyboardGrab helpers
Peter Hutterer [Thu, 8 Dec 2011 04:59:06 +0000 (14:59 +1000)]
Add GrabIsPointerGrab and GrabIsKeyboardGrab helpers

No functional changes

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Chase Douglas <chase.douglas@canonical.com>
6 years agodix: move delivery stop condition out of event mask
Peter Hutterer [Thu, 8 Dec 2011 02:00:34 +0000 (12:00 +1000)]
dix: move delivery stop condition out of event mask

Previously, this was only called if there was a mask match, so even if we
had a no-propagate flag set or a stopAt window specified, if no mask
triggered on the window we would recurse up to the root window and
eventually deliver.
Move this, so that the stopAt and do-not-propagate mask is honoured.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Chase Douglas <chase.douglas@canonical.com>
6 years agodix: split out core state and event state setting into helper functions
Peter Hutterer [Thu, 8 Dec 2011 00:22:26 +0000 (10:22 +1000)]
dix: split out core state and event state setting into helper functions

no functional changes.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Chase Douglas <chase.douglas@canonical.com>
6 years agodix: move grab matching code into a helper function
Peter Hutterer [Wed, 7 Dec 2011 04:41:18 +0000 (14:41 +1000)]
dix: move grab matching code into a helper function

No functional changes.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Chase Douglas <chase.douglas@canonical.com>
6 years agodix: split core grab interference check into helper function
Peter Hutterer [Wed, 7 Dec 2011 03:57:25 +0000 (13:57 +1000)]
dix: split core grab interference check into helper function

No functional changes.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Chase Douglas <chase.douglas@canonical.com>
6 years agodix: compare the grab type, not the tempGrab type
Peter Hutterer [Wed, 7 Dec 2011 03:54:28 +0000 (13:54 +1000)]
dix: compare the grab type, not the tempGrab type

No functional change. To get here, GrabMatchesSecond() needs to be TRUE and
for that the two grab types must be identical.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Chase Douglas <chase.douglas@canonical.com>
6 years agodix: remove event type check
Peter Hutterer [Wed, 7 Dec 2011 05:43:31 +0000 (15:43 +1000)]
dix: remove event type check

Can't remember why this is there but we'll need to pass in XI2 events soon,
so this check is obsolete.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Chase Douglas <chase.douglas@canonical.com>
6 years agodix: Split ActivatePassiveGrab() from CheckPassiveGrab()
Chase Douglas [Fri, 25 Nov 2011 21:57:03 +0000 (13:57 -0800)]
dix: Split ActivatePassiveGrab() from CheckPassiveGrab()

The changed logic means we don't require the explicit grab = NULL setting
and early exit anymore. Not 100% of it, but if we see that message pop up in
a log we know it's broken.

Signed-off-by: Chase Douglas <chase.douglas@canonical.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
6 years agodix: Move grab check and activation logic to CheckPassiveGrab()
Chase Douglas [Fri, 18 Nov 2011 01:40:24 +0000 (17:40 -0800)]
dix: Move grab check and activation logic to CheckPassiveGrab()

This is needed for future pointer emulation work.

Signed-off-by: Chase Douglas <chase.douglas@canonical.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
6 years agodix: move EventDeliveryState into a header file, we'll need it elsewhere
Peter Hutterer [Tue, 6 Dec 2011 02:57:38 +0000 (12:57 +1000)]
dix: move EventDeliveryState into a header file, we'll need it elsewhere

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Chase Douglas <chase.douglas@canonical.com>
6 years agoXi: split updating button count and state into helper functions
Peter Hutterer [Tue, 6 Dec 2011 02:04:11 +0000 (12:04 +1000)]
Xi: split updating button count and state into helper functions

Functional change: for a button mapped to 0, the motionHintWindow is not
updated to the NullWindow anymore. Before it got updated unconditionally to
the button mapping. I have no idea what the practical effect of this is, but
I guess it's closer to the correct behaviour: pressing a button that's
logically disabled now does not disrupt the motion hint delivery.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Chase Douglas <chase.douglas@canonical.com>
6 years agoXi: deduplicate button motion mask setting
Peter Hutterer [Tue, 6 Dec 2011 01:40:33 +0000 (11:40 +1000)]
Xi: deduplicate button motion mask setting

No functional changes

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Chase Douglas <chase.douglas@canonical.com>
6 years agodix: deduplicate callers of DeliverDeviceEvents in DeliverGrabbedEvents
Peter Hutterer [Mon, 5 Dec 2011 08:54:30 +0000 (18:54 +1000)]
dix: deduplicate callers of DeliverDeviceEvents in DeliverGrabbedEvents

No functional change.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Chase Douglas <chase.douglas@canonical.com>
6 years agodix: split grab event conversion and delivery into a helper function
Peter Hutterer [Mon, 5 Dec 2011 08:42:05 +0000 (18:42 +1000)]
dix: split grab event conversion and delivery into a helper function

Effective functional change: XI2 events are checked with XACE now.

DeliverOneGrabbedEvent is exported for future use by touch events.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Chase Douglas <chase.douglas@canonical.com>
6 years agodix: replace conversion errors with BUG_WARN_MSG
Peter Hutterer [Mon, 5 Dec 2011 08:29:27 +0000 (18:29 +1000)]
dix: replace conversion errors with BUG_WARN_MSG

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Chase Douglas <chase.douglas@canonical.com>
6 years agodix: deduplicate event delivery code
Peter Hutterer [Mon, 5 Dec 2011 06:46:18 +0000 (16:46 +1000)]
dix: deduplicate event delivery code

Move all the event delivery code into DeliverOneEvent, based on the
InputLevel we're sending to.

Functional change: we now check XI2 events with XACE too.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Chase Douglas <chase.douglas@canonical.com>
6 years agoinclude: Add an InputLevel enum
Chase Douglas [Wed, 7 Dec 2011 10:32:28 +0000 (20:32 +1000)]
include: Add an InputLevel enum

Currently unused, but will be in the future.

Signed-off-by: Chase Douglas <chase.douglas@canonical.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
6 years agoverify_internal_event: preserve constness of data pointer
Alan Coopersmith [Tue, 13 Dec 2011 00:49:33 +0000 (16:49 -0800)]
verify_internal_event: preserve constness of data pointer

All we're using it for is ErrorF calls, so make it a const char *
to stop gcc from warning:

inpututils.c: In function 'verify_internal_event':
inpututils.c:629:9: warning: cast discards qualifiers from pointer target type

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Reviewed-by: Jamey Sharp <jamey@minilop.net>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
6 years agoUse const cast in BitIsOn macro to avoid angering gcc
Alan Coopersmith [Tue, 13 Dec 2011 00:49:33 +0000 (16:49 -0800)]
Use const cast in BitIsOn macro to avoid angering gcc

Fixes gcc warnings such as:
inpututils.c: In function 'valuator_mask_isset':
inpututils.c:498:5: warning: cast discards qualifiers from pointer target type
inpututils.c: In function 'CountBits':
inpututils.c:613:9: warning: cast discards qualifiers from pointer target type

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Reviewed-by: Jamey Sharp <jamey@minilop.net>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
6 years agoFix deconstifying cast warning in xi2_get_type
Alan Coopersmith [Tue, 13 Dec 2011 00:49:32 +0000 (16:49 -0800)]
Fix deconstifying cast warning in xi2_get_type

Since we're just comparing values in the struct, cast it to a
const xGenericEvent * to clear gcc warning of:

events.c: In function 'xi2_get_type':
events.c:193:5: warning: cast discards qualifiers from pointer target type

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Reviewed-by: Jamey Sharp <jamey@minilop.net>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
6 years agoInclude client name if available in PrintDeviceGrabInfo
Alan Coopersmith [Thu, 8 Dec 2011 06:58:45 +0000 (22:58 -0800)]
Include client name if available in PrintDeviceGrabInfo

Also adds missing newline to first line of output.

Before patch:

[3581472.414] (II) Printing all currently active device grabs:
[3581472.414] Active grab 0x1800000 (core) on device 'Virtual core pointer' (2):
      client pid 26174 uid 0 gid 10
[3581472.415]       at 3581469139 (from active grab) (device thawed, state 1)
[3581472.415]         core event mask 0x0
[3581472.415]       owner-events true, kb 1 ptr 1, confine 0, cursor 0x0
[3581472.415] Active grab 0x1800000 (core) on device 'Virtual core keyboard' (3)
:      client pid 26174 uid 0 gid 10
[3581472.415]       at 3581469139 (from active grab) (device thawed, state 1)
[3581472.415]         core event mask 0x3
[3581472.415]       owner-events true, kb 1 ptr 1, confine 0, cursor 0x0
[3581472.415] (II) End list of active device grabs

After patch:
[3581736.601] (II) Printing all currently active device grabs:
[3581736.601] Active grab 0x1600000 (core) on device 'Virtual core pointer' (2):
[3581736.601]       client pid 26741 /usr/bin/xscreensaver -nosplash
[3581736.601]       at 3581735000 (from active grab) (device thawed, state 1)
[3581736.601]         core event mask 0x0
[3581736.601]       owner-events true, kb 1 ptr 1, confine 0, cursor 0x0
[3581736.601] Active grab 0x1600000 (core) on device 'Virtual core keyboard' (3)
:
[3581736.601]       client pid 26741 /usr/bin/xscreensaver -nosplash
[3581736.601]       at 3581735000 (from active grab) (device thawed, state 1)
[3581736.601]         core event mask 0x3
[3581736.601]       owner-events true, kb 1 ptr 1, confine 0, cursor 0x0
[3581736.601] (II) End list of active device grabs

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Reviewed-by: Rami Ylimäki <rami.ylimaki@vincit.fi>
6 years agoxf86 parser: convert Error to a varargs macro to clear gcc format warnings
Alan Coopersmith [Tue, 13 Dec 2011 00:49:35 +0000 (16:49 -0800)]
xf86 parser: convert Error to a varargs macro to clear gcc format warnings

Previously it always passed a format string with exactly one argument,
using NULL when the format string needed none.   Now pass the right number
of arguments to clear gcc warnings of 'too many arguments for format'.

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Reviewed-by: Jamey Sharp <jamey@minilop.net>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
6 years agoAdd some printf format attributes suggested by gcc
Alan Coopersmith [Tue, 13 Dec 2011 00:49:35 +0000 (16:49 -0800)]
Add some printf format attributes suggested by gcc

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Reviewed-by: Jamey Sharp <jamey@minilop.net>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
6 years agoxf86Priv.h: Add some noreturn attributes suggested by gcc
Alan Coopersmith [Tue, 13 Dec 2011 00:49:34 +0000 (16:49 -0800)]
xf86Priv.h: Add some noreturn attributes suggested by gcc

Both functions call exit() at the end and have no other return path.
Also correct comment/heading to reflect commit 6450f6ca7ee0 moving
DoShowOptions into xf86Configure.c.

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Reviewed-by: Jamey Sharp <jamey@minilop.net>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
6 years agoRemove duplicate declarations of KdAdd*Driver in kdrive.h
Alan Coopersmith [Tue, 13 Dec 2011 00:49:34 +0000 (16:49 -0800)]
Remove duplicate declarations of KdAdd*Driver in kdrive.h

Clears gcc warnings in every file that includes kdrive.h:
kdrive.h:507:1: warning: redundant redeclaration of 'KdAddPointerDriver'
kdrive.h:225:6: note: previous declaration of 'KdAddPointerDriver' was here
kdrive.h:510:1: warning: redundant redeclaration of 'KdAddKeyboardDriver'
kdrive.h:284:6: note: previous declaration of 'KdAddKeyboardDriver' was here

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Reviewed-by: Jamey Sharp <jamey@minilop.net>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
6 years agoRemove duplicate declaration of xf86ValidateModesFlags in xf86Modes.h
Alan Coopersmith [Tue, 13 Dec 2011 00:49:34 +0000 (16:49 -0800)]
Remove duplicate declaration of xf86ValidateModesFlags in xf86Modes.h

Clears gcc warning in every file that includes xf86Modes.h:
xf86Modes.h:102:1: warning: redundant redeclaration of 'xf86ValidateModesFlags'
xf86Modes.h:72:1: note: previous declaration of 'xf86ValidateModesFlags' was here

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Reviewed-by: Jamey Sharp <jamey@minilop.net>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
6 years ago_XkbFilterDeviceBtn: move variable declarations to match usage scope
Alan Coopersmith [Tue, 13 Dec 2011 00:49:34 +0000 (16:49 -0800)]
_XkbFilterDeviceBtn: move variable declarations to match usage scope

The main body of this function is an if { } else if { } pair of blocks.
Previously there was int button at the top level scope which is used
only in the first block, and a redeclaration of int button inside the
second block.   Since there's no overlap in the code paths for the
two uses of button, move the one from the outer block into the first
block to help the programmer more quickly determine they are unrelated
usages, and to silence the gcc warning of:

xkbActions.c: In function '_XkbFilterDeviceBtn':
xkbActions.c:999:6: warning: declaration of 'button' shadows a previous local
xkbActions.c:955:6: warning: shadowed declaration is here

For consistency, move DeviceIntPtr dev declarations as well that are
used in the same way.

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Reviewed-by: Jamey Sharp <jamey@minilop.net>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
6 years agoXkbFindSrvLedInfo: remove extraneous name-clashing sli variable
Alan Coopersmith [Tue, 13 Dec 2011 00:49:34 +0000 (16:49 -0800)]
XkbFindSrvLedInfo: remove extraneous name-clashing sli variable

Variable is already defined outside the outer if statement, and
there's no need to redefine inside the if statement.

No point in setting sli before if (dev->kbdfeed->xkb_sli==NULL)
check - if check is true, we immediately set it, if check is false,
we immediately return without further reference or use of it.

The one thing we do with it inside the inner if statement is store
an allocation in it for a brief moment before writing to the final
destination, which is immediately returned to the caller.

In short, there's no benefit to the variable at all in this block,
it just gives the optimizer more code to figure out how to omit.

Fixes gcc warning:
xkbLEDs.c: In function 'XkbFindSrvLedInfo':
xkbLEDs.c:683:19: warning: declaration of 'sli' shadows a previous local
xkbLEDs.c:679:18: warning: shadowed declaration is here

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Reviewed-by: Jamey Sharp <jamey@minilop.net>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
6 years agoKdParseFindNext: Constify delim argument
Alan Coopersmith [Tue, 13 Dec 2011 00:49:34 +0000 (16:49 -0800)]
KdParseFindNext: Constify delim argument

It's only used as input to strchr to find the delimiters, never
written to.

Clears a bunch of gcc warnings of the form:
kdrive.c:323:2: warning: passing argument 2 of 'KdParseFindNext' discards qualifiers from pointer target type
kdrive.c:261:1: note: expected 'char *' but argument is of type 'const char *'

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Reviewed-by: Jamey Sharp <jamey@minilop.net>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
6 years agoConvert KdDoSwitchCmd to use asprintf instead of malloc/strcat/etc.
Alan Coopersmith [Tue, 13 Dec 2011 00:49:34 +0000 (16:49 -0800)]
Convert KdDoSwitchCmd to use asprintf instead of malloc/strcat/etc.

Also fix the reason argument to be const char * to clear several gcc
warnings of:
kdrive.c:151:2: warning: passing argument 1 of 'KdDoSwitchCmd' discards qualifiers from pointer target type
kdrive.c:116:1: note: expected 'char *' but argument is of type 'const char *'

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Reviewed-by: Jamey Sharp <jamey@minilop.net>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
6 years agoDoShowOptions: preserve constness of options list as we walk it
Alan Coopersmith [Tue, 13 Dec 2011 00:49:34 +0000 (16:49 -0800)]
DoShowOptions: preserve constness of options list as we walk it

Since all we do with the option list is walk down the list printing
the names, there's no need to cast away its constness.

Clears gcc warning:
xf86Configure.c: In function 'DoShowOptions':
xf86Configure.c:781:4: warning: cast discards qualifiers from pointer target type

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Reviewed-by: Jamey Sharp <jamey@minilop.net>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
6 years agox86emu: constify debug strings
Alan Coopersmith [Tue, 13 Dec 2011 00:49:34 +0000 (16:49 -0800)]
x86emu: constify debug strings

Strings are all pointers to literal constants, just used as input
to printf calls when debugging is enabled.

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Reviewed-by: Jamey Sharp <jamey@minilop.net>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
6 years agoCompareISOLatin1Lowered: constify arguments
Alan Coopersmith [Tue, 13 Dec 2011 00:49:34 +0000 (16:49 -0800)]
CompareISOLatin1Lowered: constify arguments

Allows callers to avoid deconstifying arguments when calling, fixing
gcc warning:

filter.c: In function 'PictureGetFilterId':
filter.c:59:2: warning: cast discards qualifiers from pointer target type

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Reviewed-by: Jamey Sharp <jamey@minilop.net>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
6 years agoxdmcp.c: fix three small const warnings
Alan Coopersmith [Tue, 13 Dec 2011 00:49:33 +0000 (16:49 -0800)]
xdmcp.c: fix three small const warnings

xdmcp.c:63:36: warning: initialization discards qualifiers from pointer target type

xdmcp.c: In function 'XdmcpRegisterConnection':
xdmcp.c:482:8: warning: cast discards qualifiers from pointer target type
xdmcp.c:482:8: warning: cast discards qualifiers from pointer target type
xdmcp.c:482:8: warning: cast discards qualifiers from pointer target type

xdmcp.c: In function 'get_mcast_options':
xdmcp.c:1596:21: warning: initialization discards qualifiers from pointer target type

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Reviewed-by: Jamey Sharp <jamey@minilop.net>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
6 years agoLockServer: store path to LOCKDIR literal string in a const char *
Alan Coopersmith [Tue, 13 Dec 2011 00:49:33 +0000 (16:49 -0800)]
LockServer: store path to LOCKDIR literal string in a const char *

And instead of initializing to NULL, then resetting to LOCKDIR almost
immediately (before ever using the NULL value), skip directly to setting
it to LOCKDIR.

tmppath variable is only used as input for generating the path name
via calls to strlen, sprintf, etc.

Fixes gcc warning of:
utils.c: In function 'LockServer':
utils.c:259:11: warning: assignment discards qualifiers from pointer target type

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Reviewed-by: Jamey Sharp <jamey@minilop.net>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
6 years agoWriteToClient: preserve constness of buf while extracting length value
Alan Coopersmith [Tue, 13 Dec 2011 00:49:33 +0000 (16:49 -0800)]
WriteToClient: preserve constness of buf while extracting length value

Fixes gcc warning:
io.c: In function 'WriteToClient':
io.c:826:6: warning: cast discards qualifiers from pointer target type

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Reviewed-by: Jamey Sharp <jamey@minilop.net>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
6 years agoOsInit: store "/dev/null" in a const char *
Alan Coopersmith [Tue, 13 Dec 2011 00:49:33 +0000 (16:49 -0800)]
OsInit: store "/dev/null" in a const char *

It's only passed as the input side of a strcpy and as the filename to
fopen, so doesn't need to be non-const.   Fixes gcc warning:

osinit.c: In function 'OsInit':
osinit.c:154:28: warning: initialization discards qualifiers from pointer target type

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Reviewed-by: Jamey Sharp <jamey@minilop.net>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
6 years agoConstify the reason string throughout the authorization check framework
Alan Coopersmith [Tue, 13 Dec 2011 00:49:33 +0000 (16:49 -0800)]
Constify the reason string throughout the authorization check framework

Almost all of the places the string is assigned point to a literal
string constant, so use const char * for those, and const char **
for function calls that return it via an argument.   Fortunately
the top level function, ClientAuthorized, which returns the string
as its return value is called from only one place, ProcEstablishConnection.

ProcEstablishConnection stores either that return value or a string literal
in char *reason.  It only uses reason as an argument to SendConnSetup.
SendConnSetup passes the reason argument to strlen & WriteToClient,
both of which already have const qualifiers on their args.
Thus added const to the reason variable in ProcEstablishConnection
and the reason argument to SendConnSetup.

Fixes gcc warnings:
dispatch.c: In function 'ProcEstablishConnection':
dispatch.c:3711:9: warning: assignment discards qualifiers from pointer target type
auth.c: In function 'CheckAuthorization':
auth.c:218:14: warning: assignment discards qualifiers from pointer target type
auth.c:220:20: warning: assignment discards qualifiers from pointer target type
connection.c: In function 'ClientAuthorized':
connection.c:683:3: warning: return discards qualifiers from pointer target type
mitauth.c: In function 'MitCheckCookie':
mitauth.c:88:13: warning: assignment discards qualifiers from pointer target type
xdmauth.c:259:14: warning: assignment discards qualifiers from pointer target type
xdmauth.c:270:14: warning: assignment discards qualifiers from pointer target type
xdmauth.c:277:11: warning: assignment discards qualifiers from pointer target type
xdmauth.c:293:15: warning: assignment discards qualifiers from pointer target type
xdmauth.c:313:14: warning: assignment discards qualifiers from pointer target type
xdmauth.c:322:11: warning: assignment discards qualifiers from pointer target type
rpcauth.c: In function 'SecureRPCCheck':
rpcauth.c:136:10: warning: assignment discards qualifiers from pointer target type

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Reviewed-by: Jamey Sharp <jamey@minilop.net>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
6 years agoConstify string for authorization protocol names
Alan Coopersmith [Tue, 13 Dec 2011 00:49:33 +0000 (16:49 -0800)]
Constify string for authorization protocol names

gcc was warning from storing string constants in a char *name field:
auth.c:64:1: warning: initialization discards qualifiers from pointer target type
auth.c:72:1: warning: initialization discards qualifiers from pointer target type
auth.c:81:1: warning: initialization discards qualifiers from pointer target type

Making the field const requires changing AuthorizationFromID to take
a const char ** pointer for the name argument which it sets to point
to the matching name entry.

Changing that argument requires changing its sole caller in the security
extension to pass the address of a const char * variable to it, which it
can do, since the only thing it does with the returned name is to pass
it back to the RemoveAuthorization function that already expects a const
char *name.

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Reviewed-by: Jamey Sharp <jamey@minilop.net>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
6 years agoos/access.c: replace acmp & acopy macros with memcmp & memcpy calls
Alan Coopersmith [Tue, 13 Dec 2011 00:49:33 +0000 (16:49 -0800)]
os/access.c: replace acmp & acopy macros with memcmp & memcpy calls

No need to cast to char * now that all supported platforms use C89-standard
void * argument types, so just drop the casts from acmp & acopy macros,
which clears the gcc warnings for places const pointers were cast non-const:

access.c: In function 'DefineSelf':
access.c:786:3: warning: cast discards qualifiers from pointer target type
access.c:795:6: warning: cast discards qualifiers from pointer target type
access.c: In function 'NewHost':
access.c:1293:9: warning: cast discards qualifiers from pointer target type
access.c:1298:6: warning: cast discards qualifiers from pointer target type
access.c:1309:5: warning: cast discards qualifiers from pointer target type

Without the casts, acmp & acopy are just a funny way to write memcmp
& memmove, so drop the macros and inline the calls, taking care to
swap the first two arguments to memmove since it had swapped them.

Since all the calls to memmove end up being to non-overlapping memory
(mostly copying from an existing pointer to a newly allocated one),
replace those with memcpy.

And finally, don't actually call memcpy to copy 0 bytes from one place
to another, since that's just a waste of a perfectly good function call.

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Reviewed-by: Jamey Sharp <jamey@minilop.net>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
6 years agoxres.c: Preserve constness of string returned by LookupResourceName
Alan Coopersmith [Tue, 13 Dec 2011 00:49:33 +0000 (16:49 -0800)]
xres.c: Preserve constness of string returned by LookupResourceName

MakeAtom now accepts a const char * so we don't need to cast down to
char * anymore.   Fixes gcc warning of:

xres.c: In function 'ProcXResQueryClientResources':
xres.c:155:6: warning: cast discards qualifiers from pointer target type

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Reviewed-by: Jamey Sharp <jamey@minilop.net>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
6 years agoconstify strings in resource name registry
Alan Coopersmith [Tue, 13 Dec 2011 00:49:33 +0000 (16:49 -0800)]
constify strings in resource name registry

LookupResourceName already returned a const char *, so just needed
to change the variable we're storing the list in to be a const char **
and then add const to the name argument to RegisterResourceName
(which just stores name in the array) and CreateNewResourceType
(which just passes name to RegisterResourceName).

Clears a bunch of gcc warnings of the form:
registry.c:319:5: warning: passing argument 2 of 'RegisterResourceName' discards qualifiers from pointer target type
registry.c:200:1: note: expected 'char *' but argument is of type 'const char *'

and from all the extensions:
damageext.c: In function 'DamageExtensionInit':
damageext.c:490:5: warning: passing argument 2 of 'CreateNewResourceType' discards qualifiers from pointer target type
../include/resource.h:159:26: note: expected 'char *' but argument is of type 'const char *'

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Reviewed-by: Jamey Sharp <jamey@minilop.net>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
6 years agoCheckForEmptyMask does not need to declare int n twice
Alan Coopersmith [Fri, 9 Dec 2011 18:08:55 +0000 (10:08 -0800)]
CheckForEmptyMask does not need to declare int n twice

Just use the existing n variable again in the ARGB_CURSOR loop
instead of creating another one.

Fixes gcc -Wshadow warning:
cursor.c: In function 'CheckForEmptyMask':
cursor.c:155:6: warning: declaration of 'n' shadows a previous local
cursor.c:146:9: warning: shadowed declaration is here

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Reviewed-by: Jamey Sharp <jamey@minilop.net>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
6 years agoEven more correctly free config file names
Alan Coopersmith [Sat, 10 Dec 2011 18:01:18 +0000 (10:01 -0800)]
Even more correctly free config file names

If we didn't go into the if (!autoconfig) { } block, the filename,
dirname, and sysdirname pointers were never initialized, but we
freed them outside the block, leading to potential memory corruption.

Move the frees inside the block where they're initialized to avoid this.

To avoid similar problems, move the declarations of the variables that
are only used in this block inside the block.

Regression introduced by commit 3d635fe84d6de53e2f74203b10e89f7851fe3fc1

Found by gcc warning:
xf86Config.c: In function 'xf86HandleConfigFile':
xf86Config.c:2303:11: warning: 'filename' may be used uninitialized in this function
xf86Config.c:2303:22: warning: 'dirname' may be used uninitialized in this function
xf86Config.c:2303:32: warning: 'sysdirname' may be used uninitialized in this function

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Reviewed-by: Paulo Zanoni <paulo.r.zanoni@intel.com>
6 years agoxf86RegisterRootWindowProperty is confused about xnfcalloc
Alan Coopersmith [Thu, 8 Dec 2011 03:06:05 +0000 (19:06 -0800)]
xf86RegisterRootWindowProperty is confused about xnfcalloc

It will never return NULL, so don't try to handle a NULL condition,
since that just confuses programmers and static analyzers.

It uses calloc, so all the allocated memory is cleared, so there's
no point looping over the memory to manually initialize it NULL.

And just because it's annoying, it doesn't need to be the only
place in this file to do if (NULL==...) instead of if (... == NULL).

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Reviewed-by: Paulo Zanoni <paulo.r.zanoni@intel.com>
6 years agoChange GetXI2/XI/CoreType to just take a type argument
Peter Hutterer [Wed, 7 Dec 2011 04:14:10 +0000 (14:14 +1000)]
Change GetXI2/XI/CoreType to just take a type argument

Avoids the dummy-event dance if we have an event type and need to get the
matching XI2 type.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Chase Douglas <chase.douglas@canonical.com>
6 years agoinclude: add GetXI2MaskByte and GetXI2EventFilterMask to headers
Peter Hutterer [Fri, 28 Oct 2011 02:55:55 +0000 (12:55 +1000)]
include: add GetXI2MaskByte and GetXI2EventFilterMask to headers

This is needed for touch event processing.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Chase Douglas <chase.douglas@canonical.com>
6 years agoChange disable_clientpointer return type to void
Alan Coopersmith [Fri, 9 Dec 2011 05:52:07 +0000 (21:52 -0800)]
Change disable_clientpointer return type to void

It doesn't return anything, nor does it's caller expect it to.

Fixes Solaris Studio compiler error:
"xichangehierarchy.c", line 214: Function has no return statement : disable_clientpointer

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Keith Packard <keithp@keithp.com>
6 years agoMerge remote-tracking branch 'whot/for-keith'
Keith Packard [Fri, 9 Dec 2011 04:57:26 +0000 (20:57 -0800)]
Merge remote-tracking branch 'whot/for-keith'

6 years agoinclude: add BUG_WARN_MSG for custom error message on bug condition
Peter Hutterer [Mon, 5 Dec 2011 04:02:51 +0000 (14:02 +1000)]
include: add BUG_WARN_MSG for custom error message on bug condition

__BUG_WARN_MSG is a simple helper to enable call with and without varargs. I
couldn't find a way to otherwise do this without getting gcc warnings.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Chase Douglas <chase.douglas@canonical.com>
6 years agoxfree86: include xorg-config.h from xaalocal.h
Peter Hutterer [Fri, 11 Nov 2011 06:25:30 +0000 (16:25 +1000)]
xfree86: include xorg-config.h from xaalocal.h

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Alan Coopersmith <alan.coopersmith@oracle.com>
6 years agoXi: rename "state" to "corestate" in ProcessDeviceEvents
Peter Hutterer [Mon, 5 Dec 2011 01:55:58 +0000 (11:55 +1000)]
Xi: rename "state" to "corestate" in ProcessDeviceEvents

'state' is shadowed by the XKB 'state' as well (which feeds into the event
too), so rename this one to clarify that this is the core event state only.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Chase Douglas <chase.douglas@canonical.com>
6 years agoXi: check button mapping value _before_ assigning it
Peter Hutterer [Fri, 2 Dec 2011 05:47:58 +0000 (15:47 +1000)]
Xi: check button mapping value _before_ assigning it

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Chase Douglas <chase.douglas@canonical.com>
6 years agoXi: skip superfluous cast
Peter Hutterer [Mon, 5 Dec 2011 01:26:30 +0000 (11:26 +1000)]
Xi: skip superfluous cast

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Chase Douglas <chase.douglas@canonical.com>
6 years agoxfixes: don't dereference a NULL cursor
Peter Hutterer [Tue, 29 Nov 2011 23:06:06 +0000 (09:06 +1000)]
xfixes: don't dereference a NULL cursor

If the new cursor is the NULL cursor, don't dereference it and use zeros
instead.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Jeremy Huddleston <jeremyhu@apple.com>
6 years agoXi: when removing a device, reset ClientPointers where needed
Peter Hutterer [Tue, 29 Nov 2011 06:15:37 +0000 (16:15 +1000)]
Xi: when removing a device, reset ClientPointers where needed

if a client had the to-be-removed device as ClientPointer, reset to NULL.

Fixes #43165

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Jeremy Huddleston <jeremyhu@apple.com>
6 years agodix: use BUG_WARN for input mask size issues
Peter Hutterer [Wed, 9 Nov 2011 04:45:02 +0000 (14:45 +1000)]
dix: use BUG_WARN for input mask size issues

Yes, we're likely corrupting memory here but really this is unlikely to be
triggered other than a real bug in the server. In which case a stacktrace is
going to be more useful than any silent error handling.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Chase Douglas <chase.douglas@canonical.com>
6 years agoxfree86: bump the input ABI
Peter Hutterer [Fri, 9 Dec 2011 00:48:05 +0000 (10:48 +1000)]
xfree86: bump the input ABI

The last few patches broke the ABI, bump it for convenience.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
6 years agoinput: swap the server over to use the XI2mask struct
Peter Hutterer [Fri, 4 Nov 2011 01:29:01 +0000 (11:29 +1000)]
input: swap the server over to use the XI2mask struct

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Chase Douglas <chase.douglas@canonical.com>
6 years agoAdd a new XI2Mask struct and a few helper functions.
Peter Hutterer [Thu, 3 Nov 2011 03:39:59 +0000 (13:39 +1000)]
Add a new XI2Mask struct and a few helper functions.

The current XI2 mask handling is handy for copying (fixed size arrays) but a
pain to deal with otherwise. Add a struct for XI2 masks and the required
accessors.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Chase Douglas <chase.douglas@canonical.com>
6 years agodix: switch the dev->deviceGrab.activeGrab from GrabRec to GrabPtr
Peter Hutterer [Fri, 4 Nov 2011 04:16:37 +0000 (14:16 +1000)]
dix: switch the dev->deviceGrab.activeGrab from GrabRec to GrabPtr

This breaks the input ABI.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Chase Douglas <chase.douglas@canonical.com>
6 years agodix: allocate temporary grabs on the heap
Peter Hutterer [Fri, 4 Nov 2011 00:47:27 +0000 (10:47 +1000)]
dix: allocate temporary grabs on the heap

Once grabs start having nested memory locations, we can't just use the
GrabRec on the stack anymore, we need to alloc/copy/free the grabs.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Chase Douglas <chase.douglas@canonical.com>
6 years agodix: add CopyGrab() function
Peter Hutterer [Fri, 4 Nov 2011 00:44:31 +0000 (10:44 +1000)]
dix: add CopyGrab() function

Not really needed at this point, but will be once touch support is added.
Since grabs are now expected to be allocated/freed with AllocGrab and
FreeGrab, CopyGrab must increase the refcount and duplicate the modifier
masks. Until the callers are switched to use FreeGrab, this introduces
memleaks.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Chase Douglas <chase.douglas@canonical.com>
6 years agodix: add AllocGrab helper function
Peter Hutterer [Thu, 3 Nov 2011 06:12:09 +0000 (16:12 +1000)]
dix: add AllocGrab helper function

Not needed since the GrabRec is a self-contained struct but will be needed
for the xi2 input mask rework.
FreeGrab already exists, make it available to other callers.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Chase Douglas <chase.douglas@canonical.com>
6 years agodix: switch the syncEvent queue to a struct list
Peter Hutterer [Mon, 21 Nov 2011 19:41:12 +0000 (11:41 -0800)]
dix: switch the syncEvent queue to a struct list

No effective functionality change, just cleanup to make this code slightly
more sane.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Chase Douglas <chase.douglas@canonical.com>
6 years agotest: update .gitignore with xfree86 and sort alphabetically
Gaetan Nadon [Thu, 1 Dec 2011 21:24:32 +0000 (16:24 -0500)]
test: update .gitignore with xfree86 and sort alphabetically

Reviewed-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Signed-off-by: Gaetan Nadon <memsize@videotron.ca>
Signed-off-by: Keith Packard <keithp@keithp.com>
6 years agoMerge remote-tracking branch 'airlied/reviewed-fixes'
Keith Packard [Wed, 7 Dec 2011 20:42:17 +0000 (12:42 -0800)]
Merge remote-tracking branch 'airlied/reviewed-fixes'

6 years agoMerge remote-tracking branch 'alanc/master'
Keith Packard [Wed, 7 Dec 2011 20:27:23 +0000 (12:27 -0800)]
Merge remote-tracking branch 'alanc/master'

6 years agohw/xfree86: fix segfault in config parser when config dir is missing
Keith Packard [Wed, 7 Dec 2011 20:13:37 +0000 (12:13 -0800)]
hw/xfree86: fix segfault in config parser when config dir is missing

Treat a scandir error from a missing (or unusable) directory return as
if it simply returned no files at all, which is what we want.

cc: Paulo Zanoni <przanoni@gmail.com>
Signed-off-by: Keith Packard <keithp@keithp.com>
6 years agokdrive: drop screen crossing code.
Dave Airlie [Mon, 28 Nov 2011 16:37:59 +0000 (16:37 +0000)]
kdrive: drop screen crossing code.

The only kdrive server we probably care about anymore is Xephyr,
and this screen enable/disable code totally breaks it in multi-screen mode.

When you are in one screen the other stops updating.

Fixes https://bugzilla.redhat.com/show_bug.cgi?id=757457

Signed-off-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
6 years agohal: free tmp_val in one missing case
Dave Airlie [Thu, 20 Oct 2011 09:48:26 +0000 (10:48 +0100)]
hal: free tmp_val in one missing case

Pointed out by coverity scan.

Signed-off-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Daniel Stone <daniel@fooishbar.org>
6 years agoxv: test correct number of requests. (v2)
Dave Airlie [Thu, 20 Oct 2011 10:00:43 +0000 (11:00 +0100)]
xv: test correct number of requests. (v2)

Pointed out by coverity.

v2: fix swapped as well, as pointed out by Alan

Signed-off-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Alan Coopersmith <alan.coopersmith@oracle.com>
6 years agoxaa: avoid possible freed pointer reuse in epilogue
Dave Airlie [Wed, 19 Oct 2011 15:57:13 +0000 (16:57 +0100)]
xaa: avoid possible freed pointer reuse in epilogue

If the pGCPriv->flags == 2, then we try to assign the freed pGCPriv->XAAOps
avoid this by clearing the flags in to be destroyed pGCPriv.

Reported by coverity.

Signed-off-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Jeremy Huddleston <jeremyhu@apple.com>
6 years agoXi: avoid overrun of callback array.
Dave Airlie [Wed, 19 Oct 2011 15:22:31 +0000 (16:22 +0100)]
Xi: avoid overrun of callback array.

This code had an off-by-one and would allow writing one past the end of
the callbacks array.

Pointed out by coverity.

Signed-off-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Jeremy Huddleston <jeremyhu@apple.com>
6 years agoxext: don't free uninitialised pointer when malloc fails. (v2)
Dave Airlie [Wed, 19 Oct 2011 15:21:26 +0000 (16:21 +0100)]
xext: don't free uninitialised pointer when malloc fails. (v2)

Initialise the pAttr->values to values so if the values allocation
fails it just ends up as free(NULL).

Pointed out by coverity.

v2: use Alan's suggestion.

Signed-off-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Reviewed-by: Jeremy Huddleston <jeremyhu@apple.com>
6 years agofbdevhw: iterate over all modes that match a mode. (v3)
Adam Jackson [Thu, 28 Apr 2011 03:34:28 +0000 (13:34 +1000)]
fbdevhw: iterate over all modes that match a mode. (v3)

So on RHEL5 anaconda sets an xorg.conf with a fixed 800x600 mode in it,
we run radeonfb and fbdev since ati won't work in userspace due to domain
issues in the older codebase.

On certain pseries blades the built-in KVM can't accept an 800x600-43 mode,
it requires the 800x600-60 mode, so we have to have the kernel radeonfb
driver reject the 800x600-43 mode when it sees it. However then fbdev
doesn't try any of the other 800x600 modes in the modelist, and we end up
getting a default 640x480 mode we don't want.

This patch changes the mode validation loop to continue on with the other modes
that match to find one that works.

v2: move code around to avoid extra loop, after comment from Jamey.
v3: move loop setup back into loop as per Jeremy's review.

Signed-off-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Jamey Sharp <jamey@minilop.net>
Reviewed-by: Jeremy Huddleston <jeremyhu@apple.com>
6 years agoinclude: rename "foos" to "list_of_foos" in the struct list documentation
Peter Hutterer [Thu, 1 Dec 2011 22:52:53 +0000 (08:52 +1000)]
include: rename "foos" to "list_of_foos" in the struct list documentation

Makes things a little easier to read.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Chase Douglas <chase.douglas@canonical.com>
6 years agoinclude: update struct list documentation to use one set of structs only
Peter Hutterer [Thu, 1 Dec 2011 22:51:24 +0000 (08:51 +1000)]
include: update struct list documentation to use one set of structs only

The example at the top of the file used a struct bar and a list of struct
foos. Use those two throughout instead of a different struct foo for the
examples and for the API documentation.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Chase Douglas <chase.douglas@canonical.com>
6 years agoinclude: a new list element does not need initialization, state so
Peter Hutterer [Thu, 1 Dec 2011 22:51:04 +0000 (08:51 +1000)]
include: a new list element does not need initialization, state so

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Chase Douglas <chase.douglas@canonical.com>
6 years agoinclude: point to the tests in list.c as examples
Peter Hutterer [Thu, 1 Dec 2011 22:43:45 +0000 (08:43 +1000)]
include: point to the tests in list.c as examples

Even with the documentation, the list.c tests are the best examples.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Chase Douglas <chase.douglas@canonical.com>
6 years agoinclude: add list_last_entry to get the tail of a list
Peter Hutterer [Thu, 1 Dec 2011 04:12:11 +0000 (14:12 +1000)]
include: add list_last_entry to get the tail of a list

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Chase Douglas <chase.douglas@canonical.com>
6 years agoinclude: add list_append()
Peter Hutterer [Thu, 1 Dec 2011 03:35:50 +0000 (13:35 +1000)]
include: add list_append()

The existing list_add() prepends to the list, but in some cases we need the
list ordered in the way we append the elements.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Chase Douglas <chase.douglas@canonical.com>
6 years agoautoconf: the minimum required level for autoconf is 2.60
Gaetan Nadon [Sun, 4 Dec 2011 02:23:51 +0000 (21:23 -0500)]
autoconf: the minimum required level for autoconf is 2.60

The toolchain requirements are documented here:
http://www.x.org/wiki/ModularDevelopersGuide#Required_Tools

Note that autoconf features only found in versions later
than 2.60 must not be used.

Signed-off-by: Gaetan Nadon <memsize@videotron.ca>
Reviewed-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
6 years agoautoconf: remove redundant AC_PROG_MAKE_SET
Gaetan Nadon [Sun, 4 Dec 2011 02:23:21 +0000 (21:23 -0500)]
autoconf: remove redundant AC_PROG_MAKE_SET

Already included during Automake initialization.

After the patch, no change:
configure:3893: checking whether make sets $(MAKE)
configure:3915: result: yes

Signed-off-by: Gaetan Nadon <memsize@videotron.ca>
Reviewed-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
6 years agoFix builds of Xnest & Xephyr with Solaris Studio compilers
Alan Coopersmith [Fri, 2 Dec 2011 08:09:07 +0000 (00:09 -0800)]
Fix builds of Xnest & Xephyr with Solaris Studio compilers

Required in order to build with Studio cc now that xorg-macros is
setting -errwarn=E_FUNC_HAS_NO_RETURN_STMT since a bug in the Solaris
system headers causes the noreturn attribute to not be correctly
applied to the exit() prototype in <stdlib.h> when building with
Studio instead of gcc.

Otherwise compiler exits with errors:
"Display.c", line 65: Function has no return statement : x_io_error_handler
"hostx.c", line 341: Function has no return statement : x_io_error_handler

Uses Studio-specific pragma instead of adding another exit() prototype
with a noreturn attribute to avoid causing gcc to warn about having
a redundant prototype for the exit() function.

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Reviewed-by: Mikhail Gusarov <dottedmag@dottedmag.net>
6 years agoLoaderOpen returns either a valid pointer or NULL, so don't check for < 0
Alan Coopersmith [Fri, 2 Dec 2011 07:45:42 +0000 (23:45 -0800)]
LoaderOpen returns either a valid pointer or NULL, so don't check for < 0

Fixes Sun cc warning that was recently elevated to error by the
stricter default CFLAGS changes to xorg-macros:

"loadmod.c", line 914: improper pointer/integer combination: op "<"

Should have been changed when commit ab7f057ce9df4e905b12 changed the
LoaderOpen return type from int to void *.

Changes log message when file is found but dlopen() fails from:
 (EE) LoadModule: Module dbe does not have a dbeModuleData data object.
 (EE) Failed to load module "dbe" (invalid module, 0)
to:
 (EE) Failed to load module "dbe" (loader failed, 7)

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Reviewed-by: Adam Jackson <ajax@redhat.com>
6 years agoFix gcc warnings about redundant declarations of fallback functions
Alan Coopersmith [Thu, 1 Dec 2011 07:01:34 +0000 (23:01 -0800)]
Fix gcc warnings about redundant declarations of fallback functions

Ensure ffs, strndup, strlcat, etc. aren't defined by our headers
if they're already defined in the system headers.

This does export the HAVE_FFS, HAVE_STRNDUP, etc. definitions to drivers,
but if you built the Xserver with a libc that had those, and then build
the drivers with a less capable libc, you're going to have problems anyway,
and this should solve some reported problems with conflicts between our
strndup definition and gcc magic for it.

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Reviewed-by: Adam Jackson <ajax@redhat.com>
6 years agoMove to autoconf standard function name checks & defines
Alan Coopersmith [Thu, 1 Dec 2011 06:20:09 +0000 (22:20 -0800)]
Move to autoconf standard function name checks & defines

Replace multiple methods of checking for functions with AC_CHECK_FUNCS
Replace multiple methods of selecting fallback funcs with AC_REPLACE_FUNCS
Replace HAS_* and NEED_* #defines with autogenerated HAVE_*

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Reviewed-by: Adam Jackson <ajax@redhat.com>
Reviewed-by: Mikhail Gusarov <dottedmag@dottedmag.net>
Reviewed-by: Gaetan Nadon <memsize@videotron.ca>