[PATCH xserver] mi: remove deprecated miPointerAbsoluteCursor from design doc

2011-11-01 Thread Gaetan Nadon
Function was removed from the code by commit f5409aa026

Reviewed-by: Jeremy Huddleston jerem...@apple.com
Signed-off-by: Gaetan Nadon mems...@videotron.ca
---
 hw/dmx/doc/dmx.xml |9 +
 1 files changed, 1 insertions(+), 8 deletions(-)

diff --git a/hw/dmx/doc/dmx.xml b/hw/dmx/doc/dmx.xml
index ce472c2..845eec9 100644
--- a/hw/dmx/doc/dmx.xml
+++ b/hw/dmx/doc/dmx.xml
@@ -967,17 +967,10 @@ event queue.  It is simply passed the event to be queued.
 /para
 
 paraThe cursor position should be updated when motion events are
-enqueued, by calling either miPointerAbsoluteCursor() or
-miPointerDeltaCursor():
+enqueued by calling miPointerDeltaCursor():
 
 variablelist
 varlistentry
-termmiPointerAbsoluteCursor()/term
-listitem
-paraThis MI function is used to move the
-cursor to the absolute coordinates provided.
-/para/listitem/varlistentry
-varlistentry
 termmiPointerDeltaCursor()/term
 listitem
 paraThis MI function is used to move the cursor
-- 
1.7.4.1

___
xorg-devel@lists.x.org: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: http://lists.x.org/mailman/listinfo/xorg-devel


[PATCH 1/5] dix: don't InitXTestDevices if there's no XTest extension

2011-11-01 Thread przanoni
From: Paulo Zanoni paulo.r.zan...@intel.com

Signed-off-by: Paulo Zanoni paulo.r.zan...@intel.com
---
 dix/devices.c |5 -
 1 files changed, 4 insertions(+), 1 deletions(-)

diff --git a/dix/devices.c b/dix/devices.c
index 673a360..9d67c06 100644
--- a/dix/devices.c
+++ b/dix/devices.c
@@ -681,7 +681,10 @@ InitCoreDevices(void)
 !EnableDevice(inputInfo.keyboard, TRUE))
 FatalError(Failed to enable core devices.);
 
-InitXTestDevices();
+#ifdef XTEST
+if (!noTestExtensions)
+   InitXTestDevices();
+#endif
 }
 
 /**
-- 
1.7.7

___
xorg-devel@lists.x.org: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: http://lists.x.org/mailman/listinfo/xorg-devel


[PATCH 2/5] Correctly free config file names

2011-11-01 Thread przanoni
From: Paulo Zanoni paulo.r.zan...@intel.com

We call xf86penConfigDirFiles twice, so we overwrite the configDirPath
variable, losing the pointer. If we move the pointer management to the
upper layer (the function callers), they will be able to call these
functions as many times as they want, but they'll have to free those
returned values.

4,097 bytes in 1 blocks are definitely lost in loss record 625 of 632
   at 0x4C2779D: malloc (in vgpreload_memcheck-amd64-linux.so)
   by 0x4D7899: DoSubstitution (scan.c:615)
   by 0x4D87B0: OpenConfigDir (scan.c:845)
   by 0x4D8A2D: xf86openConfigDirFiles (scan.c:955)
   by 0x49031F: xf86HandleConfigFile (xf86Config.c:2327)
   by 0x49A9BF: InitOutput (xf86Init.c:365)
   by 0x425A7A: main (main.c:204)

Signed-off-by: Paulo Zanoni paulo.r.zan...@intel.com
---
 hw/xfree86/common/xf86Config.c |6 +-
 hw/xfree86/parser/scan.c   |   22 --
 hw/xfree86/parser/xf86Parser.h |8 
 3 files changed, 17 insertions(+), 19 deletions(-)

diff --git a/hw/xfree86/common/xf86Config.c b/hw/xfree86/common/xf86Config.c
index cb4be42..5ab3e67 100644
--- a/hw/xfree86/common/xf86Config.c
+++ b/hw/xfree86/common/xf86Config.c
@@ -2301,7 +2301,7 @@ checkInput(serverLayoutPtr layout, Bool implicit_layout) {
 ConfigStatus
 xf86HandleConfigFile(Bool autoconfig)
 {
-const char *filename, *dirname, *sysdirname;
+char *filename, *dirname, *sysdirname;
 char *filesearch, *dirsearch;
 MessageType filefrom = X_DEFAULT;
 MessageType dirfrom = X_DEFAULT;
@@ -2353,6 +2353,10 @@ xf86HandleConfigFile(Bool autoconfig)
return CONFIG_NOFILE;
 }
 
+free(filename);
+free(dirname);
+free(sysdirname);
+
 if ((xf86configptr = xf86readConfigFile ()) == NULL) {
xf86Msg(X_ERROR, Problem parsing the config file\n);
return CONFIG_PARSE_ERROR;
diff --git a/hw/xfree86/parser/scan.c b/hw/xfree86/parser/scan.c
index 99b3257..668237b 100644
--- a/hw/xfree86/parser/scan.c
+++ b/hw/xfree86/parser/scan.c
@@ -101,8 +101,6 @@ static int builtinIndex = 0;
 static int configPos = 0;  /* current readers position */
 static int configLineNo = 0;   /* linenumber */
 static char *configBuf, *configRBuf;   /* buffer for lines */
-static char *configPath;   /* path to config file */
-static char *configDirPath;/* path to config dir */
 static char *configSection = NULL; /* name of current section being parsed 
*/
 static int numFiles = 0;   /* number of config files */
 static int curFileIndex = 0;   /* index of current config file */
@@ -892,7 +890,8 @@ xf86initConfigFiles(void)
  * of the located files.
  *
  * The return value is a pointer to the actual name of the file that was
- * opened.  When no file is found, the return value is NULL.
+ * opened.  When no file is found, the return value is NULL. The caller should
+ * free() the returned value.
  *
  * The escape sequences allowed in the search path are defined above.
  *
@@ -914,7 +913,7 @@ xf86initConfigFiles(void)
%P/lib/X11/%X
 #endif
 
-const char *
+char *
 xf86openConfigFile(const char *path, const char *cmdline, const char *projroot)
 {
if (!path || !path[0])
@@ -923,8 +922,7 @@ xf86openConfigFile(const char *path, const char *cmdline, 
const char *projroot)
projroot = PROJECTROOT;
 
/* Search for a config file */
-   configPath = OpenConfigFile(path, cmdline, projroot, XCONFIGFILE);
-   return configPath;
+   return OpenConfigFile(path, cmdline, projroot, XCONFIGFILE);
 }
 
 /*
@@ -937,12 +935,13 @@ xf86openConfigFile(const char *path, const char *cmdline, 
const char *projroot)
  * fails if it is not found.
  *
  * The return value is a pointer to the actual name of the direcoty that was
- * opened.  When no directory is found, the return value is NULL.
+ * opened.  When no directory is found, the return value is NULL. The caller
+ * should free() the returned value.
  *
  * The escape sequences allowed in the search path are defined above.
  *
  */
-const char *
+char *
 xf86openConfigDirFiles(const char *path, const char *cmdline,
   const char *projroot)
 {
@@ -952,8 +951,7 @@ xf86openConfigDirFiles(const char *path, const char 
*cmdline,
projroot = PROJECTROOT;
 
/* Search for the multiconf directory */
-   configDirPath = OpenConfigDir(path, cmdline, projroot, XCONFIGDIR);
-   return configDirPath;
+   return OpenConfigDir(path, cmdline, projroot, XCONFIGDIR);
 }
 
 void
@@ -961,10 +959,6 @@ xf86closeConfigFile (void)
 {
int i;
 
-   free (configPath);
-   configPath = NULL;
-   free (configDirPath);
-   configDirPath = NULL;
free (configRBuf);
configRBuf = NULL;
free (configBuf);
diff --git a/hw/xfree86/parser/xf86Parser.h b/hw/xfree86/parser/xf86Parser.h
index a8785c5..c31fdc4 100644
--- 

[PATCH 3/5] parser: free scandir's list

2011-11-01 Thread przanoni
From: Paulo Zanoni paulo.r.zan...@intel.com

It seems appropriate to make the function that frees the list elements
also free the list.

80 bytes in 1 blocks are definitely lost in loss record 411 of 631
   at 0x4C2779D: malloc (vgpreload_memcheck-amd64-linux.so)
   by 0x4C27927: realloc (vgpreload_memcheck-amd64-linux.so)
   by 0x696A80D: scandir (scandir.c:108)
   by 0x4D8828: OpenConfigDir (scan.c:854)
   by 0x4D8A43: xf86openConfigDirFiles (scan.c:952)
   by 0x49031F: xf86HandleConfigFile (xf86Config.c:2327)
   by 0x49A9E3: InitOutput (xf86Init.c:365)
   by 0x425A7A: main (main.c:204)

Signed-off-by: Paulo Zanoni paulo.r.zan...@intel.com
---
 hw/xfree86/parser/scan.c |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/hw/xfree86/parser/scan.c b/hw/xfree86/parser/scan.c
index 668237b..96ea703 100644
--- a/hw/xfree86/parser/scan.c
+++ b/hw/xfree86/parser/scan.c
@@ -818,6 +818,7 @@ AddConfigDirFiles(const char *dirpath, struct dirent 
**list, int num)
numFiles++;
}
 
+   free(list);
return openedFile;
 }
 
@@ -856,7 +857,6 @@ OpenConfigDir(const char *path, const char *cmdline, const 
char *projroot,
if (!found) {
free(dirpath);
dirpath = NULL;
-   free(list);
}
}
 
-- 
1.7.7

___
xorg-devel@lists.x.org: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: http://lists.x.org/mailman/listinfo/xorg-devel


[PATCH 4/5] parser: free val.str after xf86getBoolValue

2011-11-01 Thread przanoni
From: Paulo Zanoni paulo.r.zan...@intel.com

After we convert the value to a boolean, we discard the string.

This is just one example:

3 bytes in 1 blocks are definitely lost in loss record 5 of 657
   at 0x4C2779D: malloc (vgpreload_memcheck-amd64-linux.so)
   by 0x4D744D: xf86getToken (scan.c:400)
   by 0x4D75F1: xf86getSubToken (scan.c:462)
   by 0x4DB3E0: xf86parseInputClassSection (InputClass.c:189)
   by 0x4D664C: xf86readConfigFile (read.c:184)
   by 0x490556: xf86HandleConfigFile (xf86Config.c:2360)
   by 0x49AA77: InitOutput (xf86Init.c:365)
   by 0x425A7A: main (main.c:204)

Signed-off-by: Paulo Zanoni paulo.r.zan...@intel.com
---
 hw/xfree86/parser/InputClass.c |6 ++
 1 files changed, 6 insertions(+), 0 deletions(-)

diff --git a/hw/xfree86/parser/InputClass.c b/hw/xfree86/parser/InputClass.c
index 3f80170..1128995 100644
--- a/hw/xfree86/parser/InputClass.c
+++ b/hw/xfree86/parser/InputClass.c
@@ -182,6 +182,7 @@ xf86parseInputClassSection(void)
 Error(QUOTE_MSG, MatchIsKeyboard);
 ptr-is_keyboard.set = xf86getBoolValue(ptr-is_keyboard.val,
 val.str);
+free(val.str);
 if (!ptr-is_keyboard.set)
 Error(BOOL_MSG, MatchIsKeyboard);
 break;
@@ -190,6 +191,7 @@ xf86parseInputClassSection(void)
 Error(QUOTE_MSG, MatchIsPointer);
 ptr-is_pointer.set = xf86getBoolValue(ptr-is_pointer.val,
val.str);
+free(val.str);
 if (!ptr-is_pointer.set)
 Error(BOOL_MSG, MatchIsPointer);
 break;
@@ -198,6 +200,7 @@ xf86parseInputClassSection(void)
 Error(QUOTE_MSG, MatchIsJoystick);
 ptr-is_joystick.set = xf86getBoolValue(ptr-is_joystick.val,
 val.str);
+free(val.str);
 if (!ptr-is_joystick.set)
 Error(BOOL_MSG, MatchIsJoystick);
 break;
@@ -206,6 +209,7 @@ xf86parseInputClassSection(void)
 Error(QUOTE_MSG, MatchIsTablet);
 ptr-is_tablet.set = xf86getBoolValue(ptr-is_tablet.val,
   val.str);
+free(val.str);
 if (!ptr-is_tablet.set)
 Error(BOOL_MSG, MatchIsTablet);
 break;
@@ -214,6 +218,7 @@ xf86parseInputClassSection(void)
 Error(QUOTE_MSG, MatchIsTouchpad);
 ptr-is_touchpad.set = xf86getBoolValue(ptr-is_touchpad.val,
 val.str);
+free(val.str);
 if (!ptr-is_touchpad.set)
 Error(BOOL_MSG, MatchIsTouchpad);
 break;
@@ -222,6 +227,7 @@ xf86parseInputClassSection(void)
 Error(QUOTE_MSG, MatchIsTouchscreen);
 ptr-is_touchscreen.set = 
xf86getBoolValue(ptr-is_touchscreen.val,
val.str);
+free(val.str);
 if (!ptr-is_touchscreen.set)
 Error(BOOL_MSG, MatchIsTouchscreen);
 break;
-- 
1.7.7

___
xorg-devel@lists.x.org: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: http://lists.x.org/mailman/listinfo/xorg-devel


[PATCH 5/5] parser: free val.str after xstrtokenize

2011-11-01 Thread przanoni
From: Paulo Zanoni paulo.r.zan...@intel.com

After we tokenize val.str, we discard it.

This is just one example:
6 bytes in 1 blocks are definitely lost in loss record 24 of 652
   at 0x4C2779D: malloc (in vgpreload_memcheck-amd64-linux.so)
   by 0x4D744D: xf86getToken (scan.c:400)
   by 0x4D75F1: xf86getSubToken (scan.c:462)
   by 0x4DB060: xf86parseInputClassSection (InputClass.c:145)
   by 0x4D664C: xf86readConfigFile (read.c:184)
   by 0x490556: xf86HandleConfigFile (xf86Config.c:2360)
   by 0x49AA77: InitOutput (xf86Init.c:365)
   by 0x425A7A: main (main.c:204)

Signed-off-by: Paulo Zanoni paulo.r.zan...@intel.com
---
 hw/xfree86/parser/InputClass.c |9 +
 1 files changed, 9 insertions(+), 0 deletions(-)

diff --git a/hw/xfree86/parser/InputClass.c b/hw/xfree86/parser/InputClass.c
index 1128995..2cdc912 100644
--- a/hw/xfree86/parser/InputClass.c
+++ b/hw/xfree86/parser/InputClass.c
@@ -128,54 +128,63 @@ xf86parseInputClassSection(void)
 Error(QUOTE_MSG, MatchProduct);
 add_group_entry(ptr-match_product,
 xstrtokenize(val.str, TOKEN_SEP));
+free(val.str);
 break;
 case MATCH_VENDOR:
 if (xf86getSubToken((ptr-comment)) != STRING)
 Error(QUOTE_MSG, MatchVendor);
 add_group_entry(ptr-match_vendor,
 xstrtokenize(val.str, TOKEN_SEP));
+free(val.str);
 break;
 case MATCH_DEVICE_PATH:
 if (xf86getSubToken((ptr-comment)) != STRING)
 Error(QUOTE_MSG, MatchDevicePath);
 add_group_entry(ptr-match_device,
 xstrtokenize(val.str, TOKEN_SEP));
+free(val.str);
 break;
 case MATCH_OS:
 if (xf86getSubToken((ptr-comment)) != STRING)
 Error(QUOTE_MSG, MatchOS);
 add_group_entry(ptr-match_os,
 xstrtokenize(val.str, TOKEN_SEP));
+free(val.str);
 break;
 case MATCH_PNPID:
 if (xf86getSubToken((ptr-comment)) != STRING)
 Error(QUOTE_MSG, MatchPnPID);
 add_group_entry(ptr-match_pnpid,
 xstrtokenize(val.str, TOKEN_SEP));
+free(val.str);
 break;
 case MATCH_USBID:
 if (xf86getSubToken((ptr-comment)) != STRING)
 Error(QUOTE_MSG, MatchUSBID);
 add_group_entry(ptr-match_usbid,
 xstrtokenize(val.str, TOKEN_SEP));
+free(val.str);
 break;
 case MATCH_DRIVER:
 if (xf86getSubToken((ptr-comment)) != STRING)
 Error(QUOTE_MSG, MatchDriver);
 add_group_entry(ptr-match_driver,
 xstrtokenize(val.str, TOKEN_SEP));
+free(val.str);
 break;
 case MATCH_TAG:
 if (xf86getSubToken((ptr-comment)) != STRING)
 Error(QUOTE_MSG, MatchTag);
 add_group_entry(ptr-match_tag,
 xstrtokenize(val.str, TOKEN_SEP));
+free(val.str);
 break;
 case MATCH_LAYOUT:
 if (xf86getSubToken((ptr-comment)) != STRING)
 Error(QUOTE_MSG, MatchLayout);
 add_group_entry(ptr-match_layout,
 xstrtokenize(val.str, TOKEN_SEP));
+free(val.str);
 break;
 case MATCH_IS_KEYBOARD:
 if (xf86getSubToken((ptr-comment)) != STRING)
-- 
1.7.7

___
xorg-devel@lists.x.org: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: http://lists.x.org/mailman/listinfo/xorg-devel


Re: [PATCH joystick v2 2/2] Deal with opaque input option types.

2011-11-01 Thread Chase Douglas
On 10/31/2011 06:41 PM, Peter Hutterer wrote:
 ABI 14 made the InputOption type opaque, move the existing code to ifdefs
 and use the new function calls otherwise.
 
 Signed-off-by: Peter Hutterer peter.hutte...@who-t.net

Reviewed-by: Chase Douglas chase.doug...@canonical.com
___
xorg-devel@lists.x.org: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: http://lists.x.org/mailman/listinfo/xorg-devel


Re: [PATCH 1/5] dix: don't InitXTestDevices if there's no XTest extension

2011-11-01 Thread Julien Cristau
On Tue, Nov  1, 2011 at 11:12:34 -0200, przan...@gmail.com wrote:

 From: Paulo Zanoni paulo.r.zan...@intel.com
 
 Signed-off-by: Paulo Zanoni paulo.r.zan...@intel.com
 ---
  dix/devices.c |5 -
  1 files changed, 4 insertions(+), 1 deletions(-)
 
 diff --git a/dix/devices.c b/dix/devices.c
 index 673a360..9d67c06 100644
 --- a/dix/devices.c
 +++ b/dix/devices.c
 @@ -681,7 +681,10 @@ InitCoreDevices(void)
  !EnableDevice(inputInfo.keyboard, TRUE))
  FatalError(Failed to enable core devices.);
  
 -InitXTestDevices();
 +#ifdef XTEST
 +if (!noTestExtensions)
 + InitXTestDevices();
 +#endif
  }
  
  /**

XTEST is always defined these days.  Also, IIRC there's a bunch of stuff
in XI that relies on the xtest devices.  Does that still work if you
don't init the devices?

Cheers,
Julien
___
xorg-devel@lists.x.org: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: http://lists.x.org/mailman/listinfo/xorg-devel


Re: [PATCH 1/5] dix: don't InitXTestDevices if there's no XTest extension

2011-11-01 Thread Paulo Zanoni
2011/11/1 Julien Cristau jcris...@debian.org:

 XTEST is always defined these days.  Also, IIRC there's a bunch of stuff
 in XI that relies on the xtest devices.  Does that still work if you
 don't init the devices?

It seems you're right. I didn't think on this scenario. Let's just
discard this patch then. Sorry :(

Thanks for the review.


 Cheers,
 Julien




-- 
Paulo Zanoni
___
xorg-devel@lists.x.org: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: http://lists.x.org/mailman/listinfo/xorg-devel


Re: [PATCH] Xext: XCopyArea does not work in Xinerama mode.#25113

2011-11-01 Thread Arvind Umrao

 Still waiting for review tag. At bugzilla, 2011BRB_Reviewed  by Jeremy

-Arvind

On 10/15/11 06:57, Arvind Umrao wrote:

Fixes: https://bugs.freedesktop.org/show_bug.cgi?id=25113

XCopyArea() does not work in Xinerama mode. XCopyArea does not copy areas of the 
screen across physical displays. XcopyArea works fine when source and destination 
image are in same screen, but Xcopy does not work, when we Xcopy image from one 
screen to the other in Xinerama mode. The solution is to use internal Xcopy  
instead of regular Xcopy. I mean use GetImage  PutImage Instead of regular 
Xcopy.

*1) Internal Xcopy*
In Internal Xcopy temporary buffer is allocated and Xineramadata is copied. 
GetImage reads the image(Xineramadata) from all intersection boxes and Putimage 
copies the image to the screen.

*2) Regular xcopy*
Regular xcopy calls the regular copyimage. Regular copyimage will be much 
faster when hardware acceleration is on.

Code changes are well commented. Code changes will execute only when xinerama 
is on and xcopy happens across screen. This bug was first reported for Xsun. 
Two years back, code changes was reviewed and intergrated to Oracle/Sun local 
Xserer repository.

*Testing*
a)I have tested it with Nvidia Quadro FX 1700 on x86 machine.You can find the 
test case in bugzilla. If you wish I can email some more test cases for stress 
testing.
b)I have tested my fixes using two XVR2500 frame buffer on SPARC Ultra 45 with 
Xinerama on. You can find the test case in bugzilla. If you wish I can email 
some more test cases, for stress testing.
c)Also I have tested my fixes on Sunray with Xinerama on

Signed-off-by: Arvind Umraoarvind.um...@oracle.com
---
  Xext/panoramiXprocs.c |  215 +
  1 files changed, 215 insertions(+), 0 deletions(-)

diff --git a/Xext/panoramiXprocs.c b/Xext/panoramiXprocs.c
index 9ea4611..1b6bd0a 100644
--- a/Xext/panoramiXprocs.c
+++ b/Xext/panoramiXprocs.c
@@ -1074,6 +1074,221 @@ int PanoramiXCopyArea(ClientPtr client)
}

free(data);
+} else if (src-type == XRT_WINDOW) {
+/*
+ * If destination image coordinate not lie in same screen of
+ * source image, then call Internal Copy instead of regular
+ * XCopy. I mean use GetImage  PutImage, instead of regular XCopy
+ */
+DrawablePtr pDst = NULL, pSrc = NULL;
+GCPtr pGC = NULL;
+RegionPtr pRgn[MAXSCREENS];
+int rc;
+DrawablePtr drawables[MAXSCREENS];
+char *data = NULL;
+size_t data_size;
+int pitch;
+int cross_screen = 0, rsrcFlag = 0;
+int rsrcx = 0, rsrcy = 0, rsrcx2 = stuff-width, rsrcy2 = 
stuff-height;
+
+bzero(pRgn, sizeof (RegionPtr) * MAXSCREENS);
+
+
+/*
+ * Execute only when Xinerama is on and having two or more screens.
+ * There are two cases when source  dest. image will not lie in same 
sceen.
+ * a) Right and bottom coordinates of destination image crosses the
+ * other screen.
+ * b) Top and left coordinates of destination image cross the other
+ * screen.
+ */
+if (PanoramiXNumScreens  1)
+FOR_NSCREENS_BACKWARD(j) {
+rc = dixLookupDrawable(drawables + j, src-info[j].id, client, 0,
+DixGetAttrAccess);
+if (rc != Success)
+return rc;
+if (!((drawables[j]-width + drawables[j]-x)  0 ||
+(drawables[j]-height + drawables[j]-y)  0 ||
+((stuff-srcX + drawables[j]-x + stuff-width)  0
+(stuff-dstX + drawables[j]-x + stuff-width)  0) ||
+((stuff-srcY + drawables[j]-y + stuff-height)  0
+(stuff-dstY + drawables[j]-y + stuff-height)  0) ||
+((drawables[j]-x + stuff-srcX)  
drawables[j]-pScreen-width
+(drawables[j]-x + stuff-dstX)  
drawables[j]-pScreen-width) ||
+((drawables[j]-y + stuff-srcY)  
drawables[j]-pScreen-height
+(drawables[j]-y + stuff-dstY)  
drawables[j]-pScreen-height))) {
+if (!(stuff-srcX == stuff-dstX  (stuff-srcY + drawables[j]-y)  
0
+(stuff-srcY + drawables[j]-y + stuff-height)  
drawables[j]-pScreen-height)
+!(stuff-srcY == stuff-dstY  (stuff-srcX + 
drawables[j]-x)  0
+(stuff-srcX + drawables[j]-x + stuff-width)  
drawables[j]-pScreen-width))
+cross_screen++;
+}
+}
+/*
+ * cross_screen  1, signifies that there are more than one screens and
+ * source and destination image are not in the same screen.
+ */
+
+RegionRec overlap, imageReg;
+BoxRec imageBox;
+
+FOR_NSCREENS_BACKWARD(j) {
+stuff-dstDrawable = dst-info[j].id;
+stuff-srcDrawable = src-info[j].id;
+stuff-gc = 

Re: [PATCH] xfree86: duplicate name and driver from pInfo for NewInputDeviceRequest

2011-11-01 Thread James Cloos
 PH == Peter Hutterer peter.hutte...@who-t.net writes:

PH xorg.conf devices had the name and driver set in the DDX's InputInfoPtr list
PH but not in the option list for those devices. That information was lost when
PH passing the options into NewInputDeviceRequest. NIDR then refused to start
PH the devices.

PH Introduced in xorg-server-1.11.0-250-ge4cd24e

PH Reported-by: James Cloos cl...@jhcloos.com
PH Signed-off-by: Peter Hutterer peter.hutte...@who-t.net
PH ---
PH  hw/xfree86/common/xf86Init.c |2 ++
PH  1 files changed, 2 insertions(+), 0 deletions(-)

Tested-by: James Cloos cl...@jhcloos.com

This, tested atop 8329afa59dd5ea3adf7adebdb2111a9bccbb126b, fixes the
regression.

-JimC
-- 
James Cloos cl...@jhcloos.com OpenPGP: 1024D/ED7DAEA6
___
xorg-devel@lists.x.org: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: http://lists.x.org/mailman/listinfo/xorg-devel


[PATCH util-macros 1/6] Fix the test for -Werror=attributes

2011-11-01 Thread Jeremy Huddleston
The current test was always failing to compile because 'return 0;' was
global rather than in the body of a function.

Signed-off-by: Jeremy Huddleston jerem...@apple.com
---
 xorg-macros.m4.in |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/xorg-macros.m4.in b/xorg-macros.m4.in
index 0527dfe..3b02190 100644
--- a/xorg-macros.m4.in
+++ b/xorg-macros.m4.in
@@ -1431,7 +1431,7 @@ if test x$GCC = xyes ; then
 AC_MSG_CHECKING([if $CC supports -Werror=attributes])
 save_CFLAGS=$CFLAGS
 CFLAGS=$CFLAGS $STRICT_CFLAGS -Werror=attributes
-AC_COMPILE_IFELSE([AC_LANG_SOURCE([return 0;])],
+AC_COMPILE_IFELSE([AC_LANG_SOURCE([], [return 0;])],
  [STRICT_CFLAGS=$STRICT_CFLAGS -Werror=attributes
   AC_MSG_RESULT([yes])],
  [AC_MSG_RESULT([no])])
-- 
1.7.7

___
xorg-devel@lists.x.org: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: http://lists.x.org/mailman/listinfo/xorg-devel


[PATCH util-macros 2/6] Add XORG_TESTSET_CFLAG which can be used to test what flags the compiler supports

2011-11-01 Thread Jeremy Huddleston
Signed-off-by: Jeremy Huddleston jerem...@apple.com
---
 xorg-macros.m4.in |   27 +++
 1 files changed, 27 insertions(+), 0 deletions(-)

diff --git a/xorg-macros.m4.in b/xorg-macros.m4.in
index 3b02190..c4a521f 100644
--- a/xorg-macros.m4.in
+++ b/xorg-macros.m4.in
@@ -1378,6 +1378,33 @@ AC_CHECK_DECL([__INTEL_COMPILER], [INTELCC=yes], 
[INTELCC=no])
 AC_CHECK_DECL([__SUNPRO_C], [SUNCC=yes], [SUNCC=no])
 ]) # XORG_COMPILER_BRAND
 
+# XORG_TESTSET_CFLAG(variable, flag, [alternative flag, ...])
+# ---
+# Minimum version: 1.16.0
+#
+# Append the given flag to the given variable if the compiler supports it.
+#
+AC_DEFUN([XORG_TESTSET_CFLAG], [
+# If the module's configure.ac calls AC_PROG_CC later on, CC gets set to C89
+AC_REQUIRE([AC_PROG_CC_C99])
+ifelse([$#], [0], [AC_MSG_ERROR(Incorrect arguments to XORG_TESTSET_CFLAG)],
+   [$#], [1], :,
+   [save_CFLAGS=$CFLAGS
+CFLAGS=$CFLAGS $2
+AC_MSG_CHECKING([if $CC supports $2])
+AC_COMPILE_IFELSE([AC_LANG_SOURCE([], [return 0;])],
+  supported=yes, supported=no)
+CFLAGS=$save_CFLAGS
+if test $supported = yes ; then
+AC_MSG_RESULT([yes])
+$1=$$1 $2
+else
+AC_MSG_RESULT([no])
+dnl XORG_TESTSET_CFLAG($1, shift(shift($@
+fi
+   ])
+]) # XORG_TESTSET_CFLAG
+
 # XORG_CWARNFLAGS
 # ---
 # Minimum version: 1.2.0
-- 
1.7.7

___
xorg-devel@lists.x.org: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: http://lists.x.org/mailman/listinfo/xorg-devel


[PATCH util-macros 3/6] Use XORG_TESTSET_CFLAG in XORG_STRICT_OPTION

2011-11-01 Thread Jeremy Huddleston
Signed-off-by: Jeremy Huddleston jerem...@apple.com
---
 xorg-macros.m4.in |   28 +---
 1 files changed, 9 insertions(+), 19 deletions(-)

diff --git a/xorg-macros.m4.in b/xorg-macros.m4.in
index c4a521f..456f78f 100644
--- a/xorg-macros.m4.in
+++ b/xorg-macros.m4.in
@@ -1443,31 +1443,21 @@ AC_SUBST(CWARNFLAGS)
 # Starting in 1.14.0 also exports $STRICT_CFLAGS for use in other tests or
 # when strict compilation is unconditionally desired.
 AC_DEFUN([XORG_STRICT_OPTION], [
-# If the module's configure.ac calls AC_PROG_CC later on, CC gets set to C89
-AC_REQUIRE([AC_PROG_CC_C99])
-AC_REQUIRE([XORG_COMPILER_BRAND])
 AC_REQUIRE([XORG_CWARNFLAGS])
 
 AC_ARG_ENABLE(strict-compilation,
  AS_HELP_STRING([--enable-strict-compilation],
  [Enable all warnings from compiler and make them 
errors (default: disabled)]),
  [STRICT_COMPILE=$enableval], [STRICT_COMPILE=no])
-if test x$GCC = xyes ; then
-STRICT_CFLAGS=-pedantic -Werror
-# Add -Werror=attributes if supported (gcc 4.2  later)
-AC_MSG_CHECKING([if $CC supports -Werror=attributes])
-save_CFLAGS=$CFLAGS
-CFLAGS=$CFLAGS $STRICT_CFLAGS -Werror=attributes
-AC_COMPILE_IFELSE([AC_LANG_SOURCE([], [return 0;])],
- [STRICT_CFLAGS=$STRICT_CFLAGS -Werror=attributes
-  AC_MSG_RESULT([yes])],
- [AC_MSG_RESULT([no])])
-CFLAGS=$save_CFLAGS
-elif test x$SUNCC = xyes; then
-STRICT_CFLAGS=-errwarn
-elif test x$INTELCC = xyes; then
-STRICT_CFLAGS=-Werror
-fi
+
+STRICT_CFLAGS=
+XORG_TESTSET_CFLAG(STRICT_CFLAGS, -pedantic)
+XORG_TESTSET_CFLAG(STRICT_CFLAGS, -Werror, -errwarn)
+
+# Earlier versions of gcc (eg: 4.2) supports -Werror=attributes, but does
+# not include activate it with -Werror, so we add it here explicitly.
+XORG_TESTSET_CFLAG(STRICT_CFLAGS, -Werror=attributes)
+
 if test x$STRICT_COMPILE = xyes; then
 CWARNFLAGS=$CWARNFLAGS $STRICT_CFLAGS
 fi
-- 
1.7.7

___
xorg-devel@lists.x.org: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: http://lists.x.org/mailman/listinfo/xorg-devel


[PATCH util-macros 4/6] Add XORG_COMPILER_FLAGS to replace XORG_CWARNFLAGS

2011-11-01 Thread Jeremy Huddleston
See: https://bugs.freedesktop.org/show_bug.cgi?id=31238

Signed-off-by: Jeremy Huddleston jerem...@apple.com
---
 xorg-macros.m4.in |   47 ++-
 1 files changed, 46 insertions(+), 1 deletions(-)

diff --git a/xorg-macros.m4.in b/xorg-macros.m4.in
index 456f78f..c362943 100644
--- a/xorg-macros.m4.in
+++ b/xorg-macros.m4.in
@@ -1405,12 +1405,54 @@ ifelse([$#], [0], [AC_MSG_ERROR(Incorrect arguments to 
XORG_TESTSET_CFLAG)],
])
 ]) # XORG_TESTSET_CFLAG
 
+# XORG_COMPILER_FLAGS
+# ---
+# Minimum version: 1.16.0
+#
+# Defines BASE_CFLAGS to contain a set of command line arguments supported
+# by the selected compiler which do NOT alter the generated code.  These
+# arguments will cause the compiler to print various warnings during
+# compilation AND turn a conservative set of warnings into errors.
+#
+# The set of flags supported by BASE_CFLAGS will grow in future
+# versions of util-macros as options are added to new compilers.
+#
+AC_DEFUN([XORG_COMPILER_FLAGS], [
+AC_REQUIRE([XORG_COMPILER_BRAND])
+
+dnl -v is too short to test reliably with XORG_TESTSET_CFLAG
+if test x$SUNCC = xyes; then
+BASE_CFLAGS=-v
+else
+BASE_CFLAGS=
+fi
+
+XORG_TESTSET_CFLAG(BASE_CFLAGS, -Wall)
+XORG_TESTSET_CFLAG(BASE_CFLAGS, -Wpointer-arith)
+XORG_TESTSET_CFLAG(BASE_CFLAGS, -Wstrict-prototypes)
+XORG_TESTSET_CFLAG(BASE_CFLAGS, -Wmissing-prototypes)
+XORG_TESTSET_CFLAG(BASE_CFLAGS, -Wmissing-declarations)
+XORG_TESTSET_CFLAG(BASE_CFLAGS, -Wnested-externs)
+XORG_TESTSET_CFLAG(BASE_CFLAGS, -Wbad-function-cast)
+XORG_TESTSET_CFLAG(BASE_CFLAGS, -Wformat=2, -Wformat)
+XORG_TESTSET_CFLAG(BASE_CFLAGS, -Wold-style-definition)
+XORG_TESTSET_CFLAG(BASE_CFLAGS, -Wdeclaration-after-statement)
+
+AC_SUBST(BASE_CFLAGS)
+]) # XORG_COMPILER_FLAGS
+
 # XORG_CWARNFLAGS
 # ---
 # Minimum version: 1.2.0
+# Deprecated since: 1.16.0 (Use XORG_COMPILER_FLAGS instead)
 #
 # Defines CWARNFLAGS to enable C compiler warnings.
 #
+# This function is deprecated because it defines -fno-strict-aliasing
+# which alters the code generated by the compiler.  If -fno-strict-aliasing
+# is needed, then it should be added explicitly in the module when
+# it is updated to use BASE_CFLAGS.
+#
 AC_DEFUN([XORG_CWARNFLAGS], [
 AC_REQUIRE([AC_PROG_CC_C99])
 AC_REQUIRE([XORG_COMPILER_BRAND])
@@ -1438,7 +1480,7 @@ AC_SUBST(CWARNFLAGS)
 # Add configure option to enable strict compilation flags, such as treating
 # warnings as fatal errors.
 # If --enable-strict-compilation is passed to configure, adds strict flags to
-# $CWARNFLAGS.
+# $BASE_CFLAGS and the deprecated $CWARNFLAGS.
 #
 # Starting in 1.14.0 also exports $STRICT_CFLAGS for use in other tests or
 # when strict compilation is unconditionally desired.
@@ -1459,9 +1501,11 @@ XORG_TESTSET_CFLAG(STRICT_CFLAGS, -Werror, -errwarn)
 XORG_TESTSET_CFLAG(STRICT_CFLAGS, -Werror=attributes)
 
 if test x$STRICT_COMPILE = xyes; then
+BASE_CFLAGS=$BASE_CFLAGS $STRICT_CFLAGS
 CWARNFLAGS=$CWARNFLAGS $STRICT_CFLAGS
 fi
 AC_SUBST([STRICT_CFLAGS])
+AC_SUBST([BASE_CFLAGS])
 AC_SUBST([CWARNFLAGS])
 ]) # XORG_STRICT_OPTION
 
@@ -1473,6 +1517,7 @@ AC_SUBST([CWARNFLAGS])
 #
 AC_DEFUN([XORG_DEFAULT_OPTIONS], [
 AC_REQUIRE([AC_PROG_INSTALL])
+XORG_COMPILER_FLAGS
 XORG_CWARNFLAGS
 XORG_STRICT_OPTION
 XORG_RELEASE_VERSION
-- 
1.7.7

___
xorg-devel@lists.x.org: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: http://lists.x.org/mailman/listinfo/xorg-devel


[PATCH util-macros 5/6] Update XORG_CWARNFLAGS to use XORG_COMPILER_FLAGS

2011-11-01 Thread Jeremy Huddleston
Signed-off-by: Jeremy Huddleston jerem...@apple.com
---
 xorg-macros.m4.in |   16 +++-
 1 files changed, 3 insertions(+), 13 deletions(-)

diff --git a/xorg-macros.m4.in b/xorg-macros.m4.in
index c362943..a2bf35c 100644
--- a/xorg-macros.m4.in
+++ b/xorg-macros.m4.in
@@ -1454,21 +1454,11 @@ AC_SUBST(BASE_CFLAGS)
 # it is updated to use BASE_CFLAGS.
 #
 AC_DEFUN([XORG_CWARNFLAGS], [
-AC_REQUIRE([AC_PROG_CC_C99])
+AC_REQUIRE([XORG_COMPILER_FLAGS])
 AC_REQUIRE([XORG_COMPILER_BRAND])
+CWARNFLAGS=$BASE_CFLAGS
 if  test x$GCC = xyes ; then
-CWARNFLAGS=-Wall -Wpointer-arith -Wstrict-prototypes -Wmissing-prototypes 
\
--Wmissing-declarations -Wnested-externs -fno-strict-aliasing \
--Wbad-function-cast -Wformat=2
-case `$CC -dumpversion` in
-3.4.* | 4.*)
-   CWARNFLAGS=$CWARNFLAGS -Wold-style-definition 
-Wdeclaration-after-statement
-   ;;
-esac
-else
-if test x$SUNCC = xyes; then
-   CWARNFLAGS=-v
-fi
+CWARNFLAGS=$CWARNFLAGS -fno-strict-aliasing
 fi
 AC_SUBST(CWARNFLAGS)
 ]) # XORG_CWARNFLAGS
-- 
1.7.7

___
xorg-devel@lists.x.org: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: http://lists.x.org/mailman/listinfo/xorg-devel


[PATCH util-macros 6/6] Add additional flags to XORG_COMPILER_FLAGS

2011-11-01 Thread Jeremy Huddleston
Signed-off-by: Jeremy Huddleston jerem...@apple.com
---
 xorg-macros.m4.in |   34 ++
 1 files changed, 34 insertions(+), 0 deletions(-)

diff --git a/xorg-macros.m4.in b/xorg-macros.m4.in
index a2bf35c..f9d633e 100644
--- a/xorg-macros.m4.in
+++ b/xorg-macros.m4.in
@@ -1427,6 +1427,7 @@ else
 BASE_CFLAGS=
 fi
 
+dnl This chunk of warnings were those that existed in the legacy CWARNFLAGS
 XORG_TESTSET_CFLAG(BASE_CFLAGS, -Wall)
 XORG_TESTSET_CFLAG(BASE_CFLAGS, -Wpointer-arith)
 XORG_TESTSET_CFLAG(BASE_CFLAGS, -Wstrict-prototypes)
@@ -1438,6 +1439,39 @@ XORG_TESTSET_CFLAG(BASE_CFLAGS, -Wformat=2, -Wformat)
 XORG_TESTSET_CFLAG(BASE_CFLAGS, -Wold-style-definition)
 XORG_TESTSET_CFLAG(BASE_CFLAGS, -Wdeclaration-after-statement)
 
+dnl This chunk adds additional warnings that could catch undesired effects.
+XORG_TESTSET_CFLAG(BASE_CFLAGS, -Wunused)
+XORG_TESTSET_CFLAG(BASE_CFLAGS, -Wuninitialized)
+XORG_TESTSET_CFLAG(BASE_CFLAGS, -Wshadow)
+XORG_TESTSET_CFLAG(BASE_CFLAGS, -Wcast-qual)
+XORG_TESTSET_CFLAG(BASE_CFLAGS, -Wmissing-noreturn)
+XORG_TESTSET_CFLAG(BASE_CFLAGS, -Wmissing-format-attribute)
+XORG_TESTSET_CFLAG(BASE_CFLAGS, -Wredundant-decls)
+XORG_TESTSET_CFLAG(BASE_CFLAGS, -Winline)
+
+dnl These are currently disabled because they are noisy.  They will be enabled
+dnl in the future once the codebase is sufficiently modernized to silence
+dnl them.  For now, I don't want them to drown out the other warnings.
+dnl XORG_TESTSET_CFLAG(BASE_CFLAGS, -Wlogical-op)
+dnl XORG_TESTSET_CFLAG(BASE_CFLAGS, -Wparentheses)
+dnl XORG_TESTSET_CFLAG(BASE_CFLAGS, -Wcast-align)
+
+dnl Turn some warnings into errors, so we don't accidently get successful 
builds
+dnl when there are problems that should be fixed.
+XORG_TESTSET_CFLAG(BASE_CFLAGS, -Werror=implicit)
+XORG_TESTSET_CFLAG(BASE_CFLAGS, -Werror=nonnull)
+XORG_TESTSET_CFLAG(BASE_CFLAGS, -Werror=init-self)
+XORG_TESTSET_CFLAG(BASE_CFLAGS, -Werror=main)
+XORG_TESTSET_CFLAG(BASE_CFLAGS, -Werror=missing-braces)
+XORG_TESTSET_CFLAG(BASE_CFLAGS, -Werror=sequence-point)
+XORG_TESTSET_CFLAG(BASE_CFLAGS, -Werror=return-type)
+XORG_TESTSET_CFLAG(BASE_CFLAGS, -Werror=trigraphs)
+XORG_TESTSET_CFLAG(BASE_CFLAGS, -Werror=array-bounds)
+XORG_TESTSET_CFLAG(BASE_CFLAGS, -Werror=write-strings)
+XORG_TESTSET_CFLAG(BASE_CFLAGS, -Werror=address)
+XORG_TESTSET_CFLAG(BASE_CFLAGS, -Werror=int-to-pointer-cast)
+XORG_TESTSET_CFLAG(BASE_CFLAGS, -Werror=pointer-to-int-cast)
+
 AC_SUBST(BASE_CFLAGS)
 ]) # XORG_COMPILER_FLAGS
 
-- 
1.7.7

___
xorg-devel@lists.x.org: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: http://lists.x.org/mailman/listinfo/xorg-devel


Re: [PATCH util-macros 2/6] Add XORG_TESTSET_CFLAG which can be used to test what flags the compiler supports

2011-11-01 Thread Jeremy Huddleston
This patch is currently incomplete.  I'm hoping an m4 guru (Gaetan, you're my 
hero) can help finish it.  The recursive part of XORG_TESTSET_CFLAG is 
currently commented out because it doesn't work.  From a high level, it looks 
like the logic is right (it should strip the second argument in the recursive 
call), but it's ending up recursing infinitely... which indicates to me that 
shift() isn't doing what I expect it to.

Aside from that error, this seems to do the right thing when I tested it with 
a module using the old CWARNFLAGS and the new BASE_CFLAGS (the only difference 
between the two is that CWARNFLAGS will include -fno-strict-aliasing).

--Jeremy

On Nov 1, 2011, at 1:16 PM, Jeremy Huddleston wrote:

 Signed-off-by: Jeremy Huddleston jerem...@apple.com
 ---
 xorg-macros.m4.in |   27 +++
 1 files changed, 27 insertions(+), 0 deletions(-)
 
 diff --git a/xorg-macros.m4.in b/xorg-macros.m4.in
 index 3b02190..c4a521f 100644
 --- a/xorg-macros.m4.in
 +++ b/xorg-macros.m4.in
 @@ -1378,6 +1378,33 @@ AC_CHECK_DECL([__INTEL_COMPILER], [INTELCC=yes], 
 [INTELCC=no])
 AC_CHECK_DECL([__SUNPRO_C], [SUNCC=yes], [SUNCC=no])
 ]) # XORG_COMPILER_BRAND
 
 +# XORG_TESTSET_CFLAG(variable, flag, [alternative flag, ...])
 +# ---
 +# Minimum version: 1.16.0
 +#
 +# Append the given flag to the given variable if the compiler supports it.
 +#
 +AC_DEFUN([XORG_TESTSET_CFLAG], [
 +# If the module's configure.ac calls AC_PROG_CC later on, CC gets set to C89
 +AC_REQUIRE([AC_PROG_CC_C99])
 +ifelse([$#], [0], [AC_MSG_ERROR(Incorrect arguments to 
 XORG_TESTSET_CFLAG)],
 +   [$#], [1], :,
 +   [save_CFLAGS=$CFLAGS
 +CFLAGS=$CFLAGS $2
 +AC_MSG_CHECKING([if $CC supports $2])
 +AC_COMPILE_IFELSE([AC_LANG_SOURCE([], [return 0;])],
 +  supported=yes, supported=no)
 +CFLAGS=$save_CFLAGS
 +if test $supported = yes ; then
 +AC_MSG_RESULT([yes])
 +$1=$$1 $2
 +else
 +AC_MSG_RESULT([no])
 +dnl XORG_TESTSET_CFLAG($1, shift(shift($@
 +fi
 +   ])
 +]) # XORG_TESTSET_CFLAG
 +
 # XORG_CWARNFLAGS
 # ---
 # Minimum version: 1.2.0
 -- 
 1.7.7
 

___
xorg-devel@lists.x.org: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: http://lists.x.org/mailman/listinfo/xorg-devel


Re: [PATCH util-macros 3/6] Use XORG_TESTSET_CFLAG in XORG_STRICT_OPTION

2011-11-01 Thread Jeremy Huddleston
Please ignore the bad grammar in the comment in this change.  I'll fix it ;)

On Nov 1, 2011, at 1:16 PM, Jeremy Huddleston wrote:

 Signed-off-by: Jeremy Huddleston jerem...@apple.com
 ---
 xorg-macros.m4.in |   28 +---
 1 files changed, 9 insertions(+), 19 deletions(-)
 
 diff --git a/xorg-macros.m4.in b/xorg-macros.m4.in
 index c4a521f..456f78f 100644
 --- a/xorg-macros.m4.in
 +++ b/xorg-macros.m4.in
 @@ -1443,31 +1443,21 @@ AC_SUBST(CWARNFLAGS)
 # Starting in 1.14.0 also exports $STRICT_CFLAGS for use in other tests or
 # when strict compilation is unconditionally desired.
 AC_DEFUN([XORG_STRICT_OPTION], [
 -# If the module's configure.ac calls AC_PROG_CC later on, CC gets set to C89
 -AC_REQUIRE([AC_PROG_CC_C99])
 -AC_REQUIRE([XORG_COMPILER_BRAND])
 AC_REQUIRE([XORG_CWARNFLAGS])
 
 AC_ARG_ENABLE(strict-compilation,
 AS_HELP_STRING([--enable-strict-compilation],
 [Enable all warnings from compiler and make them 
 errors (default: disabled)]),
 [STRICT_COMPILE=$enableval], [STRICT_COMPILE=no])
 -if test x$GCC = xyes ; then
 -STRICT_CFLAGS=-pedantic -Werror
 -# Add -Werror=attributes if supported (gcc 4.2  later)
 -AC_MSG_CHECKING([if $CC supports -Werror=attributes])
 -save_CFLAGS=$CFLAGS
 -CFLAGS=$CFLAGS $STRICT_CFLAGS -Werror=attributes
 -AC_COMPILE_IFELSE([AC_LANG_SOURCE([], [return 0;])],
 -   [STRICT_CFLAGS=$STRICT_CFLAGS -Werror=attributes
 -AC_MSG_RESULT([yes])],
 -   [AC_MSG_RESULT([no])])
 -CFLAGS=$save_CFLAGS
 -elif test x$SUNCC = xyes; then
 -STRICT_CFLAGS=-errwarn
 -elif test x$INTELCC = xyes; then
 -STRICT_CFLAGS=-Werror
 -fi
 +
 +STRICT_CFLAGS=
 +XORG_TESTSET_CFLAG(STRICT_CFLAGS, -pedantic)
 +XORG_TESTSET_CFLAG(STRICT_CFLAGS, -Werror, -errwarn)
 +
 +# Earlier versions of gcc (eg: 4.2) supports -Werror=attributes, but does
 +# not include activate it with -Werror, so we add it here explicitly.
 +XORG_TESTSET_CFLAG(STRICT_CFLAGS, -Werror=attributes)
 +
 if test x$STRICT_COMPILE = xyes; then
 CWARNFLAGS=$CWARNFLAGS $STRICT_CFLAGS
 fi
 -- 
 1.7.7
 

___
xorg-devel@lists.x.org: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: http://lists.x.org/mailman/listinfo/xorg-devel


Re: [PATCH util-macros 1/6] Fix the test for -Werror=attributes

2011-11-01 Thread Alan Coopersmith

I only see one argument to AC_LANG_SOURCE in
https://www.gnu.org/software/autoconf/manual/html_node/Generating-Sources.html

Did you mean to change the macro to AC_LANG_PROGRAM?

-alan-

On 11/01/11 13:16, Jeremy Huddleston wrote:

The current test was always failing to compile because 'return 0;' was
global rather than in the body of a function.

Signed-off-by: Jeremy Huddlestonjerem...@apple.com
---
  xorg-macros.m4.in |2 +-
  1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/xorg-macros.m4.in b/xorg-macros.m4.in
index 0527dfe..3b02190 100644
--- a/xorg-macros.m4.in
+++ b/xorg-macros.m4.in
@@ -1431,7 +1431,7 @@ if test x$GCC = xyes ; then
  AC_MSG_CHECKING([if $CC supports -Werror=attributes])
  save_CFLAGS=$CFLAGS
  CFLAGS=$CFLAGS $STRICT_CFLAGS -Werror=attributes
-AC_COMPILE_IFELSE([AC_LANG_SOURCE([return 0;])],
+AC_COMPILE_IFELSE([AC_LANG_SOURCE([], [return 0;])],
  [STRICT_CFLAGS=$STRICT_CFLAGS -Werror=attributes
   AC_MSG_RESULT([yes])],
  [AC_MSG_RESULT([no])])



--
-Alan Coopersmith-alan.coopersm...@oracle.com
 Oracle Solaris Platform Engineering: X Window System

___
xorg-devel@lists.x.org: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: http://lists.x.org/mailman/listinfo/xorg-devel


Re: [PATCH] Xext: XCopyArea does not work in Xinerama mode.#25113

2011-11-01 Thread Dave Airlie
On Sat, Oct 15, 2011 at 2:27 AM, Arvind Umrao arvind.um...@oracle.com wrote:
 Fixes: https://bugs.freedesktop.org/show_bug.cgi?id=25113

 XCopyArea() does not work in Xinerama mode. XCopyArea does not copy areas of 
 the screen across physical displays. XcopyArea works fine when source and 
 destination image are in same screen, but Xcopy does not work, when we Xcopy 
 image from one screen to the other in Xinerama mode. The solution is to use 
 internal Xcopy  instead of regular Xcopy. I mean use GetImage  PutImage 
 Instead of regular Xcopy.

 *1) Internal Xcopy*
 In Internal Xcopy temporary buffer is allocated and Xineramadata is copied. 
 GetImage reads the image(Xineramadata) from all intersection boxes and 
 Putimage copies the image to the screen.

 *2) Regular xcopy*
 Regular xcopy calls the regular copyimage. Regular copyimage will be much 
 faster when hardware acceleration is on.

 Code changes are well commented. Code changes will execute only when xinerama 
 is on and xcopy happens across screen. This bug was first reported for Xsun. 
 Two years back, code changes was reviewed and intergrated to Oracle/Sun local 
 Xserer repository.

 Signed-off-by: Arvind Umrao arvind.um...@oracle.com

Some slight review below: fix those and I think it can have my
Reviewed-by tag added.

        }

        free(data);
 +} else if (src-type == XRT_WINDOW) {
 +        /*
 +         * If destination image coordinate not lie in same screen of
 +         * source image, then call Internal Copy instead of regular
 +         * XCopy. I mean use GetImage  PutImage, instead of regular XCopy
 +         */
 +        DrawablePtr pDst = NULL, pSrc = NULL;
 +        GCPtr pGC = NULL;
 +        RegionPtr pRgn[MAXSCREENS];
 +        int rc;
 +        DrawablePtr drawables[MAXSCREENS];
 +        char *data = NULL;
 +        size_t data_size;
 +        int pitch;
 +        int cross_screen = 0, rsrcFlag = 0;
 +        int rsrcx = 0, rsrcy = 0, rsrcx2 = stuff-width, rsrcy2 = 
 stuff-height;
 +
 +        bzero(pRgn, sizeof (RegionPtr) * MAXSCREENS);

memset instead of bzero please.

 +
 +
 +        /*
 +         * Execute only when Xinerama is on and having two or more screens.
 +         * There are two cases when destination image will not lie in same 
 sceen.
 +         * a) Right and bottom coordinates of destination image crosses the
 +         * other screen.
 +         * b) Top and left coordinates of destination image cross the other
 +         * screen.
 +         */
 +        if (PanoramiXNumScreens  1)
 +            FOR_NSCREENS_BACKWARD(j) {
 +            rc = dixLookupDrawable(drawables + j, src-info[j].id, client, 0,
 +                    DixGetAttrAccess);
 +            if (rc != Success)
 +                return rc;
 +            if (!((drawables[j]-width + drawables[j]-x)  0 ||
 +                    (drawables[j]-height + drawables[j]-y)  0 ||
 +                    ((stuff-srcX + drawables[j]-x + stuff-width)  0 
 +                    (stuff-dstX + drawables[j]-x + stuff-width)  0) ||
 +                    ((stuff-srcY + drawables[j]-y + stuff-height)  0 
 +                    (stuff-dstY + drawables[j]-y + stuff-height)  0) ||
 +                    ((drawables[j]-x + stuff-srcX)  
 drawables[j]-pScreen-width 
 +                    (drawables[j]-x + stuff-dstX)  
 drawables[j]-pScreen-width) ||
 +                    ((drawables[j]-y + stuff-srcY)  
 drawables[j]-pScreen-height 
 +                    (drawables[j]-y + stuff-dstY)  
 drawables[j]-pScreen-height))) {
 +                if (!(stuff-srcX == stuff-dstX  (stuff-srcY + 
 drawables[j]-y)  0 
 +                        (stuff-srcY + drawables[j]-y + stuff-height)  
 drawables[j]-pScreen-height) 
 +                        !(stuff-srcY == stuff-dstY  (stuff-srcX + 
 drawables[j]-x)  0 
 +                        (stuff-srcX + drawables[j]-x + stuff-width)  
 drawables[j]-pScreen-width))
 +                    cross_screen++;
 +            }
 +        }
 +        /*
 +         * cross_screen  1, signifies that there are more than one screens 
 and
 +         * source and destination image are not in the same screen.
 +         */
 +
 +        RegionRec overlap, imageReg;
 +        BoxRec imageBox;
 +
 +        FOR_NSCREENS_BACKWARD(j) {
 +            stuff-dstDrawable = dst-info[j].id;
 +            stuff-srcDrawable = src-info[j].id;
 +            stuff-gc = gc-info[j].id;
 +            if (srcIsRoot) {
 +                stuff-srcX = srcx - screenInfo.screens[j]-x;
 +                stuff-srcY = srcy - screenInfo.screens[j]-y;
 +            }
 +            if (dstIsRoot) {
 +                stuff-dstX = dstx - screenInfo.screens[j]-x;
 +                stuff-dstY = dsty - screenInfo.screens[j]-y;
 +            }
 +
 +            VALIDATE_DRAWABLE_AND_GC(stuff-dstDrawable, pDst, 
 DixWriteAccess);
 +
 +            if (stuff-dstDrawable != stuff-srcDrawable) {
 +                rc = dixLookupDrawable(pSrc, stuff-srcDrawable, client, 0,
 +                        

Re: [PATCH util-macros 1/6] Fix the test for -Werror=attributes

2011-11-01 Thread Jeremy Huddleston
Thanks for the catch.

I've also added -errwarn=E_NO_IMPLICIT_DECL_ALLOWED

Do you want to add corresponding SunCC flags for the other -Werror=?

On Nov 1, 2011, at 1:37 PM, Alan Coopersmith wrote:

 I only see one argument to AC_LANG_SOURCE in
 https://www.gnu.org/software/autoconf/manual/html_node/Generating-Sources.html
 
 Did you mean to change the macro to AC_LANG_PROGRAM?
 
   -alan-
 
 On 11/01/11 13:16, Jeremy Huddleston wrote:
 The current test was always failing to compile because 'return 0;' was
 global rather than in the body of a function.
 
 Signed-off-by: Jeremy Huddlestonjerem...@apple.com
 ---
  xorg-macros.m4.in |2 +-
  1 files changed, 1 insertions(+), 1 deletions(-)
 
 diff --git a/xorg-macros.m4.in b/xorg-macros.m4.in
 index 0527dfe..3b02190 100644
 --- a/xorg-macros.m4.in
 +++ b/xorg-macros.m4.in
 @@ -1431,7 +1431,7 @@ if test x$GCC = xyes ; then
  AC_MSG_CHECKING([if $CC supports -Werror=attributes])
  save_CFLAGS=$CFLAGS
  CFLAGS=$CFLAGS $STRICT_CFLAGS -Werror=attributes
 -AC_COMPILE_IFELSE([AC_LANG_SOURCE([return 0;])],
 +AC_COMPILE_IFELSE([AC_LANG_SOURCE([], [return 0;])],
[STRICT_CFLAGS=$STRICT_CFLAGS -Werror=attributes
 AC_MSG_RESULT([yes])],
[AC_MSG_RESULT([no])])
 
 
 -- 
   -Alan Coopersmith-alan.coopersm...@oracle.com
Oracle Solaris Platform Engineering: X Window System
 

___
xorg-devel@lists.x.org: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: http://lists.x.org/mailman/listinfo/xorg-devel


[PATCH] randr: Make the RRConstrainCursorHarder logic the same as miPointerSetPosition

2011-11-01 Thread Rui Matos
The constraining logic in RRConstrainCursorHarder allows the cursor to reach
crtc positions of x = width and y = height while the constraining code in
miPointerSetPosition only allows it to reach x = width - 1 and y = height - 1
for the analogous screen case.

This patch makes the former's logic equivalent to the latter's which allows
applications to benefit from Fitts's law. E.g. a maximized application
adjacent to a crtc border wouldn't get pointer events if the user moved the
pointer all the way until it's contained.

Signed-off-by: Rui Matos tiagoma...@gmail.com
Reviewed-by: Daniel Stone dan...@fooishbar.org
---
21:07  daniels rtcm: just whack Reviewed-by: Daniel Stone 
dan...@fooishbar.org in there

This should also apply to the 1.11 branch.

 randr/rrcrtc.c |   29 ++---
 1 files changed, 10 insertions(+), 19 deletions(-)

diff --git a/randr/rrcrtc.c b/randr/rrcrtc.c
index 80f82f8..246f313 100644
--- a/randr/rrcrtc.c
+++ b/randr/rrcrtc.c
@@ -1457,7 +1457,7 @@ RRConstrainCursorHarder(DeviceIntPtr pDev, ScreenPtr 
pScreen, int mode, int *x,
 
crtc_bounds(crtc, left, right, top, bottom);
 
-   if ((*x = left)  (*x = right)  (*y = top)  (*y = bottom))
+   if ((*x = left)  (*x  right)  (*y = top)  (*y  bottom))
return;
 }
 
@@ -1473,24 +1473,15 @@ RRConstrainCursorHarder(DeviceIntPtr pDev, ScreenPtr 
pScreen, int mode, int *x,
crtc_bounds(crtc, left, right, top, bottom);
miPointerGetPosition(pDev, nx, ny);
 
-   if ((nx = left)  (nx = right)  (ny = top)  (ny = bottom)) {
-   if ((*x = left) || (*x = right)) {
-   int dx = *x - nx;
-
-   if (dx  0)
-   *x = right;
-   else if (dx  0)
-   *x = left;
-   }
-
-   if ((*y = top) || (*y = bottom)) {
-   int dy = *y - ny;
-
-   if (dy  0)
-   *y = bottom;
-   else if (dy  0)
-   *y = top;
-   }
+   if ((nx = left)  (nx  right)  (ny = top)  (ny  bottom)) {
+   if (*x  left)
+   *x = left;
+   if (*x = right)
+   *x = right - 1;
+   if (*y  top)
+   *y = top;
+   if (*y = bottom)
+   *y = bottom - 1;
 
return;
}
-- 
1.7.6.4

___
xorg-devel@lists.x.org: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: http://lists.x.org/mailman/listinfo/xorg-devel


Re: [PATCH util-macros 1/6] Fix the test for -Werror=attributes

2011-11-01 Thread Alan Coopersmith

On 11/01/11 13:56, Jeremy Huddleston wrote:

Thanks for the catch.

I've also added -errwarn=E_NO_IMPLICIT_DECL_ALLOWED

Do you want to add corresponding SunCC flags for the other -Werror=?


You mean the ones from patch 6 that you're suggesting to add to the
base flags, right?

Unfortunately, I don't know of any handy translation table for gcc -Werror=*
to Studio cc -errwarn=* flags, so I'm going to have to do some guessing here
based on the gcc docs I see at
   http://gcc.gnu.org/onlinedocs/gcc-4.5.3/gcc/Warning-Options.html

+XORG_TESTSET_CFLAG(BASE_CFLAGS, -Werror=implicit)

Which gcc expands to -Wimplicit-int and -Wimplicit-function-declaration

So the Studio versions would be:
 -errwarn=E_NO_EXPLICIT_TYPE_GIVEN -errwarn=E_NO_IMPLICIT_DECL_ALLOWED

+XORG_TESTSET_CFLAG(BASE_CFLAGS, -Werror=nonnull)

That requires support for gcc's attribute(nonnull), which Studio doesn't have.

+XORG_TESTSET_CFLAG(BASE_CFLAGS, -Werror=init-self)
+XORG_TESTSET_CFLAG(BASE_CFLAGS, -Werror=main)
+XORG_TESTSET_CFLAG(BASE_CFLAGS, -Werror=missing-braces)
+XORG_TESTSET_CFLAG(BASE_CFLAGS, -Werror=sequence-point)
+XORG_TESTSET_CFLAG(BASE_CFLAGS, -Werror=trigraphs)
+XORG_TESTSET_CFLAG(BASE_CFLAGS, -Werror=array-bounds)
+XORG_TESTSET_CFLAG(BASE_CFLAGS, -Werror=address)

I don't see any Studio equivalent to these.

+XORG_TESTSET_CFLAG(BASE_CFLAGS, -Werror=return-type)

The closest I see is -errwarn=E_OLD_STYLE_DECL_OR_BAD_TYPE
and -errwarn=E_FUNC_HAS_NO_RETURN_STMT

+XORG_TESTSET_CFLAG(BASE_CFLAGS, -Werror=write-strings)

I've fixed a lot of those, but there's a lot unfixed, so I don't
think we're ready for this to be a fatal error in the default set.

I also don't see a Studio equivalent.

+XORG_TESTSET_CFLAG(BASE_CFLAGS, -Werror=int-to-pointer-cast)
+XORG_TESTSET_CFLAG(BASE_CFLAGS, -Werror=pointer-to-int-cast)

Looks like -errwarn=E_BAD_PTR_INT_COMBINATION

--
-Alan Coopersmith-alan.coopersm...@oracle.com
 Oracle Solaris Platform Engineering: X Window System

___
xorg-devel@lists.x.org: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: http://lists.x.org/mailman/listinfo/xorg-devel


[PATCH] xfree86: Fix powerpc build with -Werror=int-to-pointer-cast -Werror=pointer-to-int-cast

2011-11-01 Thread Jeremy Huddleston
memType is a uint64_t on powerpc

Signed-off-by: Jeremy Huddleston jerem...@apple.com
---
 hw/xfree86/os-support/linux/lnx_video.c |6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/hw/xfree86/os-support/linux/lnx_video.c 
b/hw/xfree86/os-support/linux/lnx_video.c
index 3d45511..c12a654 100644
--- a/hw/xfree86/os-support/linux/lnx_video.c
+++ b/hw/xfree86/os-support/linux/lnx_video.c
@@ -469,11 +469,11 @@ mapVidMem(int ScreenNum, unsigned long Base, unsigned 
long Size, int flags)
 static void
 unmapVidMem(int ScreenNum, pointer Base, unsigned long Size)
 {
-memType alignOff = (memType)Base 
-   - ((memType)Base  ~(getpagesize() - 1));
+memType alignOff = (memType)(uintptr_t)Base 
+   - ((memType)(uintptr_t)Base  ~(getpagesize() - 1));
 
 DebugF(alignment offset: %lx\n,alignOff);
-munmap((caddr_t)((memType)Base - alignOff), (Size + alignOff));
+munmap((void *)(uintptr_t)((memType)(uintptr_t)Base - alignOff), (Size + 
alignOff));
 }
 
 
-- 
1.7.7

___
xorg-devel@lists.x.org: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: http://lists.x.org/mailman/listinfo/xorg-devel


Re: [PATCH] xfree86: Fix powerpc build with -Werror=int-to-pointer-cast -Werror=pointer-to-int-cast

2011-11-01 Thread Jeremy Huddleston
While this does fix the build failure, I'd much rather change memType to be a 
uintptr_t everywhere, but it was explicitly set to uint64_t for 32bit powerpc 
by Ian in the commit referenced below.  Ian, can you explain why you set 
memType to 64bits even though void * is only 32bits?  You referenced ppc32 code 
running on ppc64, but I don't see why that would be problematic.

commit e18d34f4238e13e226b0407fa2f5f77d2038de39
Author: Ian Romanick idr@umwelt.(none)
Date:   Fri Jul 21 16:47:45 2006 -0700

Make the various implementations of xf86ExtendedInitInt10 use the
libpciaccess interfaces.  This eliminates all calls to mapPciRom,
which in turn allows the elimination of hw/xfree86/int10/pci.c.


On Nov 1, 2011, at 3:01 PM, Jeremy Huddleston wrote:

 memType is a uint64_t on powerpc
 
 Signed-off-by: Jeremy Huddleston jerem...@apple.com
 ---
 hw/xfree86/os-support/linux/lnx_video.c |6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)
 
 diff --git a/hw/xfree86/os-support/linux/lnx_video.c 
 b/hw/xfree86/os-support/linux/lnx_video.c
 index 3d45511..c12a654 100644
 --- a/hw/xfree86/os-support/linux/lnx_video.c
 +++ b/hw/xfree86/os-support/linux/lnx_video.c
 @@ -469,11 +469,11 @@ mapVidMem(int ScreenNum, unsigned long Base, unsigned 
 long Size, int flags)
 static void
 unmapVidMem(int ScreenNum, pointer Base, unsigned long Size)
 {
 -memType alignOff = (memType)Base 
 - - ((memType)Base  ~(getpagesize() - 1));
 +memType alignOff = (memType)(uintptr_t)Base 
 + - ((memType)(uintptr_t)Base  ~(getpagesize() - 1));
 
 DebugF(alignment offset: %lx\n,alignOff);
 -munmap((caddr_t)((memType)Base - alignOff), (Size + alignOff));
 +munmap((void *)(uintptr_t)((memType)(uintptr_t)Base - alignOff), (Size + 
 alignOff));
 }
 
 
 -- 
 1.7.7

___
xorg-devel@lists.x.org: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: http://lists.x.org/mailman/listinfo/xorg-devel


[PATCH 2/7] AuthAudit: clean up string handling calls

2011-11-01 Thread Alan Coopersmith
The extra out pointer to redirect writes to the array isn't needed since
the removal of LBX (commit a9ed5a87902a), and eliminating it allows more
logical use of sizeof(addr) in length-checked strlcpy  snprintf calls to
write to it.

Signed-off-by: Alan Coopersmith alan.coopersm...@oracle.com
---
 os/connection.c |   11 +--
 1 files changed, 5 insertions(+), 6 deletions(-)

diff --git a/os/connection.c b/os/connection.c
index 4de6bbe..c5fc5a0 100644
--- a/os/connection.c
+++ b/os/connection.c
@@ -499,7 +499,6 @@ AuthAudit (ClientPtr client, Bool letin,
 unsigned int proto_n, char *auth_proto, int auth_id)
 {
 char addr[128];
-char *out = addr;
 char client_uid_string[64];
 LocalClientCredRec *lcc;
 #ifdef XSERVER_DTRACE
@@ -508,7 +507,7 @@ AuthAudit (ClientPtr client, Bool letin,
 #endif
 
 if (!len)
-strcpy(out, local host);
+strlcpy(addr, local host, sizeof(addr));
 else
switch (saddr-sa_family)
{
@@ -516,11 +515,11 @@ AuthAudit (ClientPtr client, Bool letin,
 #if defined(UNIXCONN) || defined(LOCALCONN)
case AF_UNIX:
 #endif
-   strcpy(out, local host);
+   strlcpy(addr, local host, sizeof(addr));
break;
 #if defined(TCPCONN) || defined(STREAMSCONN)
case AF_INET:
-   sprintf(out, IP %s,
+   snprintf(addr, sizeof(addr), IP %s,
inet_ntoa(((struct sockaddr_in *) saddr)-sin_addr));
break;
 #if defined(IPv6)  defined(AF_INET6)
@@ -528,13 +527,13 @@ AuthAudit (ClientPtr client, Bool letin,
char ipaddr[INET6_ADDRSTRLEN];
inet_ntop(AF_INET6, ((struct sockaddr_in6 *) saddr)-sin6_addr,
  ipaddr, sizeof(ipaddr));
-   sprintf(out, IP %s, ipaddr);
+   snprintf(addr, sizeof(addr), IP %s, ipaddr);
}
break;
 #endif
 #endif
default:
-   strcpy(out, unknown address);
+   strlcpy(addr, unknown address, sizeof(addr));
}
 
 if (GetLocalClientCreds(client, lcc) != -1) {
-- 
1.7.3.2

___
xorg-devel@lists.x.org: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: http://lists.x.org/mailman/listinfo/xorg-devel


[PATCH 3/7] LogVMessageVerb: Fix const mismatch warning

2011-11-01 Thread Alan Coopersmith
log.c, line 382: warning: assignment type mismatch:
pointer to char = pointer to const char

Signed-off-by: Alan Coopersmith alan.coopersm...@oracle.com
---
 os/log.c |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/os/log.c b/os/log.c
index 9ee32c9..671a01b 100644
--- a/os/log.c
+++ b/os/log.c
@@ -371,7 +371,7 @@ LogVMessageVerb(MessageType type, int verb, const char 
*format, va_list args)
 {
 const char *type_str;
 char tmpFormat[1024];
-char *new_format;
+const char *new_format;
 
 type_str = LogMessageTypeVerbString(type, verb);
 if (!type_str)
-- 
1.7.3.2

___
xorg-devel@lists.x.org: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: http://lists.x.org/mailman/listinfo/xorg-devel


[PATCH 4/7] Convert glx/single2.c:DoGetString() to use asprintf()

2011-11-01 Thread Alan Coopersmith
Signed-off-by: Alan Coopersmith alan.coopersm...@oracle.com
---
 glx/single2.c |4 +---
 1 files changed, 1 insertions(+), 3 deletions(-)

diff --git a/glx/single2.c b/glx/single2.c
index 9884f40..9f8254b 100644
--- a/glx/single2.c
+++ b/glx/single2.c
@@ -351,12 +351,10 @@ int DoGetString(__GLXclientState *cl, GLbyte *pc, 
GLboolean need_swap)
 }
 else if ( name == GL_VERSION ) {
if ( atof( string )  atof( GLServerVersion ) ) {
-   buf = malloc( strlen( string ) + strlen( GLServerVersion ) + 4 );
-   if ( buf == NULL ) {
+   if ( asprintf( buf, %s (%s), GLServerVersion, string ) == -1) {
string = GLServerVersion;
}
else {
-   sprintf( buf, %s (%s), GLServerVersion, string );
string = buf;
}
}
-- 
1.7.3.2

___
xorg-devel@lists.x.org: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: http://lists.x.org/mailman/listinfo/xorg-devel


[PATCH 5/7] xf86ShowOpts.c: Remove bad code from DoShowOptions

2011-11-01 Thread Alan Coopersmith
When we want to print a string, it's okay to just print it.
We don't need to first allocate a buffer 2 bytes bigger than the
string, copy the entire string unmodified to the buffer, print the
buffer, and then leak the buffer (though we AbortDDX 8 lines later,
and then just in case we survived that, call exit as well, so the
leak is short lived, just oh so pointless).

Oh, and for good measure, put the r in String, no matter how
much it stings.

Signed-off-by: Alan Coopersmith alan.coopersm...@oracle.com
---
 hw/xfree86/common/xf86ShowOpts.c |   14 +++---
 1 files changed, 3 insertions(+), 11 deletions(-)

diff --git a/hw/xfree86/common/xf86ShowOpts.c b/hw/xfree86/common/xf86ShowOpts.c
index a805916..3c3f615 100644
--- a/hw/xfree86/common/xf86ShowOpts.c
+++ b/hw/xfree86/common/xf86ShowOpts.c
@@ -53,7 +53,7 @@
 #include globals.h
 
 static const char* 
-optionTypeToSting(OptionValueType type)
+optionTypeToString(OptionValueType type)
 {
 switch (type) {
 case OPTV_NONE:
@@ -107,16 +107,8 @@ void DoShowOptions (void) {

i,xf86DriverList[i]-driverName,vers-vendor
);
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;  
-   }
-   sprintf(optname, %s, p-name);
-   ErrorF (\t%s:%s\n, optname,opttype);
+   ErrorF (\t%s:%s\n, p-name,
+   optionTypeToString(p-type));
}
ErrorF (}\n);
}
-- 
1.7.3.2

___
xorg-devel@lists.x.org: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: http://lists.x.org/mailman/listinfo/xorg-devel


[PATCH 7/7] Remove unnecessary variable rtrn in XkbKeysymText

2011-11-01 Thread Alan Coopersmith
Also removes even more unnecessary use of variable assignment inside
function arguments.

Signed-off-by: Alan Coopersmith alan.coopersm...@oracle.com
---
 xkb/xkbtext.c |8 
 1 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/xkb/xkbtext.c b/xkb/xkbtext.c
index 885beb7..cd19000 100644
--- a/xkb/xkbtext.c
+++ b/xkb/xkbtext.c
@@ -334,12 +334,12 @@ static char *buf;
 char *
 XkbKeysymText(KeySym sym,unsigned format)
 {
-static char buf[32],*rtrn;
+static char buf[32];
 
 if (sym==NoSymbol)
-strcpy(rtrn=buf,NoSymbol);
-else snprintf(rtrn=buf, sizeof(buf), 0x%lx, (long)sym);
-return rtrn;
+strcpy(buf,NoSymbol);
+else snprintf(buf, sizeof(buf), 0x%lx, (long)sym);
+return buf;
 }
 
 char *
-- 
1.7.3.2

___
xorg-devel@lists.x.org: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: http://lists.x.org/mailman/listinfo/xorg-devel


[PATCH 6/7] Remove xf86FormatPciBusNumber from API, inline the one place its used

2011-11-01 Thread Alan Coopersmith
Found no calls from current driver modules

Signed-off-by: Alan Coopersmith alan.coopersm...@oracle.com
---
 hw/xfree86/common/xf86.h   |1 -
 hw/xfree86/common/xf86pciBus.c |   17 ++---
 2 files changed, 6 insertions(+), 12 deletions(-)

diff --git a/hw/xfree86/common/xf86.h b/hw/xfree86/common/xf86.h
index 3185baf..f216d5e 100644
--- a/hw/xfree86/common/xf86.h
+++ b/hw/xfree86/common/xf86.h
@@ -104,7 +104,6 @@ extern _X_EXPORT Bool xf86ParsePciBusString(const char 
*busID, int *bus,
 int *device, int *func);
 extern _X_EXPORT Bool xf86ComparePciBusString(const char *busID, int bus,
   int device, int func);
-extern _X_EXPORT void xf86FormatPciBusNumber(int busnum, char *buffer);
 extern _X_EXPORT Bool xf86IsPrimaryPci(struct pci_device * pPci);
 extern _X_EXPORT Bool xf86CheckPciMemBase(struct pci_device * pPci,
   memType base);
diff --git a/hw/xfree86/common/xf86pciBus.c b/hw/xfree86/common/xf86pciBus.c
index fad0ae6..c009aba 100644
--- a/hw/xfree86/common/xf86pciBus.c
+++ b/hw/xfree86/common/xf86pciBus.c
@@ -81,16 +81,6 @@ static struct pci_slot_match xf86IsolateDevice = {
 PCI_MATCH_ANY, PCI_MATCH_ANY, PCI_MATCH_ANY, PCI_MATCH_ANY, 0
 };
 
-void
-xf86FormatPciBusNumber(int busnum, char *buffer)
-{
-/* 'buffer' should be at least 8 characters long */
-if (busnum  256)
-   sprintf(buffer, %d, busnum);
-else
-   sprintf(buffer, %d@%d, busnum  0x00ff, busnum  8);
-}
-
 /*
  * xf86Bus.c interface
  */
@@ -1345,7 +1335,12 @@ xf86PciConfigureNewDev(void *busData, struct pci_device 
*pVideo,
 
 pVideo = (struct pci_device *) busData;
 
-xf86FormatPciBusNumber(pVideo-bus, busnum);
+if (pVideo-bus  256)
+   snprintf(busnum, sizeof(busnum), %d, pVideo-bus);
+else
+   snprintf(busnum, sizeof(busnum), %d@%d,
+pVideo-bus  0x00ff, pVideo-bus  8);
+
 XNFasprintf(GDev-busID, PCI:%s:%d:%d,
busnum, pVideo-dev, pVideo-func);
 
-- 
1.7.3.2

___
xorg-devel@lists.x.org: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: http://lists.x.org/mailman/listinfo/xorg-devel


[PATCH 1/7] Convert a bunch of sprintf to snprintf calls

2011-11-01 Thread Alan Coopersmith
This batch is the straightforward set - others are more complex and
need more analysis to determine right size to pass.

Signed-off-by: Alan Coopersmith alan.coopersm...@oracle.com
---
 exa/exa_render.c   |6 +-
 hw/dmx/examples/ev.c   |4 +-
 hw/dmx/glxProxy/glxscreens.c   |5 +-
 hw/kdrive/ephyr/ephyrhostvideo.c   |9 +-
 hw/kdrive/linux/linux.c|2 +-
 hw/vfb/InitOutput.c|3 +-
 hw/xfree86/common/xf86Option.c |6 +-
 hw/xfree86/common/xf86sbusBus.c|2 +-
 hw/xfree86/fbdevhw/fbdevhw.c   |6 +-
 hw/xfree86/os-support/bsd/bsd_init.c   |   10 +-
 hw/xfree86/os-support/bus/Sbus.c   |   12 +-
 hw/xfree86/os-support/linux/lnx_init.c |2 +-
 hw/xfree86/x86emu/debug.c  |2 +-
 os/connection.c|4 +-
 os/osinit.c|2 +-
 os/rpcauth.c   |7 +-
 os/utils.c |4 +-
 os/xdmcp.c |4 +-
 randr/rrinfo.c |2 +-
 xkb/xkbtext.c  |  158 
 20 files changed, 127 insertions(+), 123 deletions(-)

diff --git a/exa/exa_render.c b/exa/exa_render.c
index 6f2af8a..3974afe 100644
--- a/exa/exa_render.c
+++ b/exa/exa_render.c
@@ -103,13 +103,13 @@ exaPrintCompositeFallback(CARD8 op,
 switch(op)
 {
 case PictOpSrc:
-   sprintf(sop, Src);
+   snprintf(sop, sizeof(sop), Src);
break;
 case PictOpOver:
-   sprintf(sop, Over);
+   snprintf(sop, sizeof(sop), Over);
break;
 default:
-   sprintf(sop, 0x%x, (int)op);
+   snprintf(sop, sizeof(sop), 0x%x, (int)op);
break;
 }
 
diff --git a/hw/dmx/examples/ev.c b/hw/dmx/examples/ev.c
index ba45c2b..ed23b8a 100644
--- a/hw/dmx/examples/ev.c
+++ b/hw/dmx/examples/ev.c
@@ -60,7 +60,7 @@ int main(int argc, char **argv)
 #define test_bit(bit) (mask[(bit)/8]  (1  ((bit)%8)))
 
 for (i = 0; i  32; i++) {
-sprintf(name, /dev/input/event%d, i);
+snprintf(name, sizeof(name), /dev/input/event%d, i);
 if ((fd = open(name, O_RDONLY, 0)) = 0) {
 ioctl(fd, EVIOCGVERSION, version);
 ioctl(fd, EVIOCGNAME(sizeof(buf)), buf);
@@ -92,7 +92,7 @@ int main(int argc, char **argv)
 }
 
 if (argc  1) {
-sprintf(name, /dev/input/event%d, atoi(argv[1]));
+snprintf(name, sizeof(name), /dev/input/event%d, atoi(argv[1]));
 if ((fd = open(name, O_RDWR, 0)) = 0) {
 printf(%s: open, fd = %d\n, name, fd);
 for (i = 0; i  LED_MAX; i++) {
diff --git a/hw/dmx/glxProxy/glxscreens.c b/hw/dmx/glxProxy/glxscreens.c
index 01e041c..baa4a65 100644
--- a/hw/dmx/glxProxy/glxscreens.c
+++ b/hw/dmx/glxProxy/glxscreens.c
@@ -120,8 +120,9 @@ static void CalcServerVersionAndExtensions( void )
   __glXVersionMinor = GLX_SERVER_MINOR_VERSION;
}
 
-   sprintf(GLXServerVersion, %d.%d DMX %d back-end server(s),
-  __glXVersionMajor, __glXVersionMinor, __glXNumActiveScreens );   
 
+   snprintf(GLXServerVersion, sizeof(GLXServerVersion),
+ %d.%d DMX %d back-end server(s),
+  __glXVersionMajor, __glXVersionMinor, __glXNumActiveScreens );
/*
 * set the ExtensionsString to the minimum extensions string
 */
diff --git a/hw/kdrive/ephyr/ephyrhostvideo.c b/hw/kdrive/ephyr/ephyrhostvideo.c
index 600b50f..69ad8a5 100644
--- a/hw/kdrive/ephyr/ephyrhostvideo.c
+++ b/hw/kdrive/ephyr/ephyrhostvideo.c
@@ -140,7 +140,7 @@ ephyrHostXVLogXErrorEvent (Display *a_display,
 mesg, BUFSIZ);
 (void) fprintf(a_fp, mesg, a_err_event-request_code);
 if (a_err_event-request_code  128) {
-sprintf(number, %d, a_err_event-request_code);
+snprintf(number, sizeof(number), %d, a_err_event-request_code);
 XGetErrorDatabaseText(dpy, XRequest, number, , buffer, BUFSIZ);
 } else {
 for (ext = dpy-ext_procs;
@@ -159,7 +159,8 @@ ephyrHostXVLogXErrorEvent (Display *a_display,
 fputs(  , a_fp);
 (void) fprintf(a_fp, mesg, a_err_event-minor_code);
 if (ext) {
-sprintf(mesg, %s.%d, ext-name, a_err_event-minor_code);
+snprintf(mesg, sizeof(mesg), %s.%d,
+ ext-name, a_err_event-minor_code);
 XGetErrorDatabaseText(dpy, XRequest, mesg, , buffer, BUFSIZ);
 (void) fprintf(a_fp,  (%s), buffer);
 }
@@ -182,8 +183,8 @@ ephyrHostXVLogXErrorEvent (Display *a_display,
 bext = ext;
 }
 if (bext)
-sprintf(buffer, %s.%d, bext-name,
-a_err_event-error_code - bext-codes.first_error);
+snprintf(buffer, sizeof(buffer), %s.%d, bext-name,
+ a_err_event-error_code - bext-codes.first_error);
 else
 strcpy(buffer, Value);
 

Re: [PATCH] Xi: allow passive keygrabs on the XIAll(Master)Devices fake devices

2011-11-01 Thread Peter Hutterer
ping?

this issue affects all XI2-capable servers.

On Thu, Oct 27, 2011 at 11:51:25AM +1000, Peter Hutterer wrote:
 They don't have a KeyClassRec, but we must still allow passive grabs on
 them.
 
 Signed-off-by: Peter Hutterer peter.hutte...@who-t.net
 ---
  Xi/exevents.c |2 +-
  1 files changed, 1 insertions(+), 1 deletions(-)
 
 diff --git a/Xi/exevents.c b/Xi/exevents.c
 index 053c76f..edf2c39 100644
 --- a/Xi/exevents.c
 +++ b/Xi/exevents.c
 @@ -1495,7 +1495,7 @@ GrabKey(ClientPtr client, DeviceIntPtr dev, 
 DeviceIntPtr modifier_device,
  rc = CheckGrabValues(client, param);
  if (rc != Success)
  return rc;
 -if (k == NULL)
 +if ((dev-id != XIAllDevices  dev-id != XIAllMasterDevices)  k == 
 NULL)
   return BadMatch;
  if (grabtype == GRABTYPE_XI)
  {
 -- 
 1.7.7

___
xorg-devel@lists.x.org: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: http://lists.x.org/mailman/listinfo/xorg-devel


[PATCH evdev] Don't crop long value from EvdevBitIsSet.

2011-11-01 Thread Peter Hutterer
Introduced in xf86-input-evdev-2.6.0-26-g4969389

Signed-off-by: Peter Hutterer peter.hutte...@who-t.net
---
Cutting long to int for the return value loses us some values, notably in
the ABS_MT ranges.

 src/evdev.c |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/src/evdev.c b/src/evdev.c
index f593df0..6ab1a18 100644
--- a/src/evdev.c
+++ b/src/evdev.c
@@ -190,7 +190,7 @@ static size_t EvdevCountBits(unsigned long *array, size_t 
nlongs)
 
 static inline int EvdevBitIsSet(const unsigned long *array, int bit)
 {
-return array[bit / LONG_BITS]  (1LL  (bit % LONG_BITS));
+return !!(array[bit / LONG_BITS]  (1LL  (bit % LONG_BITS)));
 }
 
 static inline void EvdevSetBit(unsigned long *array, int bit)
-- 
1.7.7
___
xorg-devel@lists.x.org: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: http://lists.x.org/mailman/listinfo/xorg-devel


Re: [PATCH] xfree86: Fix powerpc build with -Werror=int-to-pointer-cast -Werror=pointer-to-int-cast

2011-11-01 Thread Daniel Stone
Hi,

On 1 November 2011 22:05, Jeremy Huddleston jerem...@apple.com wrote:
 While this does fix the build failure, I'd much rather change memType to be a 
 uintptr_t everywhere, but it was explicitly set to uint64_t for 32bit powerpc 
 by Ian in the commit referenced below.  Ian, can you explain why you set 
 memType to 64bits even though void * is only 32bits?  You referenced ppc32 
 code running on ppc64, but I don't see why that would be problematic.

I'm pretty sure this was because 64-bit POWER machines were really
fond of mapping their PCI address space above the 32-bit range, so if
you truncated your addresses to 32-bit, you'd lose out.

Cheers,
Daniel
___
xorg-devel@lists.x.org: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: http://lists.x.org/mailman/listinfo/xorg-devel

Re: [PATCH 5/7] xf86ShowOpts.c: Remove bad code from DoShowOptions

2011-11-01 Thread Daniel Stone
Hi,

On 1 November 2011 22:42, Alan Coopersmith alan.coopersm...@oracle.com wrote:
 When we want to print a string, it's okay to just print it.
 We don't need to first allocate a buffer 2 bytes bigger than the
 string, copy the entire string unmodified to the buffer, print the
 buffer, and then leak the buffer (though we AbortDDX 8 lines later,
 and then just in case we survived that, call exit as well, so the
 leak is short lived, just oh so pointless).

 Oh, and for good measure, put the r in String, no matter how
 much it stings.

Bonus points if you felt like just removing optionTypeToSting, now
that it's unused.

 Signed-off-by: Alan Coopersmith alan.coopersm...@oracle.com

Reviewed-by: Daniel Stone dan...@fooishbar.org

Cheers,
Daniel
___
xorg-devel@lists.x.org: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: http://lists.x.org/mailman/listinfo/xorg-devel


Re: [PATCH 7/7] Remove unnecessary variable rtrn in XkbKeysymText

2011-11-01 Thread Daniel Stone
On 1 November 2011 22:42, Alan Coopersmith alan.coopersm...@oracle.com wrote:
 Also removes even more unnecessary use of variable assignment inside
 function arguments.

 Signed-off-by: Alan Coopersmith alan.coopersm...@oracle.com

Reviewed-by: Daniel Stone dan...@fooishbar.org
___
xorg-devel@lists.x.org: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: http://lists.x.org/mailman/listinfo/xorg-devel


Re: [PATCH 5/7] xf86ShowOpts.c: Remove bad code from DoShowOptions

2011-11-01 Thread Alan Coopersmith

On 11/01/11 17:50, Daniel Stone wrote:

Hi,

On 1 November 2011 22:42, Alan Coopersmithalan.coopersm...@oracle.com  wrote:

When we want to print a string, it's okay to just print it.
We don't need to first allocate a buffer 2 bytes bigger than the
string, copy the entire string unmodified to the buffer, print the
buffer, and then leak the buffer (though we AbortDDX 8 lines later,
and then just in case we survived that, call exit as well, so the
leak is short lived, just oh so pointless).

Oh, and for good measure, put the r in String, no matter how
much it stings.


Bonus points if you felt like just removing optionTypeToSting, now
that it's unused.


It's still used - I just put the call directly in the ErrorF
argument, instead of storing in a variable:

+   ErrorF (\t%s:%s\n, p-name,
+   optionTypeToString(p-type));


--
-Alan Coopersmith-alan.coopersm...@oracle.com
 Oracle Solaris Platform Engineering: X Window System

___
xorg-devel@lists.x.org: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: http://lists.x.org/mailman/listinfo/xorg-devel


Re: [PATCH] xfree86: Fix powerpc build with -Werror=int-to-pointer-cast -Werror=pointer-to-int-cast

2011-11-01 Thread Jeremy Huddleston

On Nov 1, 2011, at 5:48 PM, Daniel Stone wrote:

 Hi,
 
 On 1 November 2011 22:05, Jeremy Huddleston jerem...@apple.com wrote:
 While this does fix the build failure, I'd much rather change memType to be 
 a uintptr_t everywhere, but it was explicitly set to uint64_t for 32bit 
 powerpc by Ian in the commit referenced below.  Ian, can you explain why you 
 set memType to 64bits even though void * is only 32bits?  You referenced 
 ppc32 code running on ppc64, but I don't see why that would be problematic.
 
 I'm pretty sure this was because 64-bit POWER machines were really
 fond of mapping their PCI address space above the 32-bit range, so if
 you truncated your addresses to 32-bit, you'd lose out.

Really?  Did someone not get the memo that they wanted to continue to support 
32bit userland?

I guess we're stuck with that ugly casting patch then...


___
xorg-devel@lists.x.org: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: http://lists.x.org/mailman/listinfo/xorg-devel


Re: [PATCH 5/7] xf86ShowOpts.c: Remove bad code from DoShowOptions

2011-11-01 Thread Daniel Stone
Hi,

On 2 November 2011 01:14, Alan Coopersmith alan.coopersm...@oracle.com wrote:
 On 11/01/11 17:50, Daniel Stone wrote:
 On 1 November 2011 22:42, Alan Coopersmithalan.coopersm...@oracle.com
  wrote:
 When we want to print a string, it's okay to just print it.
 We don't need to first allocate a buffer 2 bytes bigger than the
 string, copy the entire string unmodified to the buffer, print the
 buffer, and then leak the buffer (though we AbortDDX 8 lines later,
 and then just in case we survived that, call exit as well, so the
 leak is short lived, just oh so pointless).

 Oh, and for good measure, put the r in String, no matter how
 much it stings.

 Bonus points if you felt like just removing optionTypeToSting, now
 that it's unused.

 It's still used - I just put the call directly in the ErrorF
 argument, instead of storing in a variable:

 +                                       ErrorF (\t%s:%s\n, p-name,
 +
 optionTypeToString(p-type));

Sure, that's optionTypeToSt_R_ing -- optionTypeToSting is now a sad
unwanted orphan.  (Yes, there were two functions named mostly the same
thing, doing mostly the same thing.)

Cheers,
Daniel
___
xorg-devel@lists.x.org: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: http://lists.x.org/mailman/listinfo/xorg-devel

Re: [PATCH 4/5] parser: free val.str after xf86getBoolValue

2011-11-01 Thread Peter Hutterer
On Tue, Nov 01, 2011 at 11:12:37AM -0200, przan...@gmail.com wrote:
 From: Paulo Zanoni paulo.r.zan...@intel.com
 
 After we convert the value to a boolean, we discard the string.
 
 This is just one example:
 
 3 bytes in 1 blocks are definitely lost in loss record 5 of 657
at 0x4C2779D: malloc (vgpreload_memcheck-amd64-linux.so)
by 0x4D744D: xf86getToken (scan.c:400)
by 0x4D75F1: xf86getSubToken (scan.c:462)
by 0x4DB3E0: xf86parseInputClassSection (InputClass.c:189)
by 0x4D664C: xf86readConfigFile (read.c:184)
by 0x490556: xf86HandleConfigFile (xf86Config.c:2360)
by 0x49AA77: InitOutput (xf86Init.c:365)
by 0x425A7A: main (main.c:204)
 
 Signed-off-by: Paulo Zanoni paulo.r.zan...@intel.com

Reviewed-by: Peter Hutterer peter.hutte...@who-t.net

 ---
  hw/xfree86/parser/InputClass.c |6 ++
  1 files changed, 6 insertions(+), 0 deletions(-)
 
 diff --git a/hw/xfree86/parser/InputClass.c b/hw/xfree86/parser/InputClass.c
 index 3f80170..1128995 100644
 --- a/hw/xfree86/parser/InputClass.c
 +++ b/hw/xfree86/parser/InputClass.c
 @@ -182,6 +182,7 @@ xf86parseInputClassSection(void)
  Error(QUOTE_MSG, MatchIsKeyboard);
  ptr-is_keyboard.set = xf86getBoolValue(ptr-is_keyboard.val,
  val.str);
 +free(val.str);
  if (!ptr-is_keyboard.set)
  Error(BOOL_MSG, MatchIsKeyboard);
  break;
 @@ -190,6 +191,7 @@ xf86parseInputClassSection(void)
  Error(QUOTE_MSG, MatchIsPointer);
  ptr-is_pointer.set = xf86getBoolValue(ptr-is_pointer.val,
 val.str);
 +free(val.str);
  if (!ptr-is_pointer.set)
  Error(BOOL_MSG, MatchIsPointer);
  break;
 @@ -198,6 +200,7 @@ xf86parseInputClassSection(void)
  Error(QUOTE_MSG, MatchIsJoystick);
  ptr-is_joystick.set = xf86getBoolValue(ptr-is_joystick.val,
  val.str);
 +free(val.str);
  if (!ptr-is_joystick.set)
  Error(BOOL_MSG, MatchIsJoystick);
  break;
 @@ -206,6 +209,7 @@ xf86parseInputClassSection(void)
  Error(QUOTE_MSG, MatchIsTablet);
  ptr-is_tablet.set = xf86getBoolValue(ptr-is_tablet.val,
val.str);
 +free(val.str);
  if (!ptr-is_tablet.set)
  Error(BOOL_MSG, MatchIsTablet);
  break;
 @@ -214,6 +218,7 @@ xf86parseInputClassSection(void)
  Error(QUOTE_MSG, MatchIsTouchpad);
  ptr-is_touchpad.set = xf86getBoolValue(ptr-is_touchpad.val,
  val.str);
 +free(val.str);
  if (!ptr-is_touchpad.set)
  Error(BOOL_MSG, MatchIsTouchpad);
  break;
 @@ -222,6 +227,7 @@ xf86parseInputClassSection(void)
  Error(QUOTE_MSG, MatchIsTouchscreen);
  ptr-is_touchscreen.set = 
 xf86getBoolValue(ptr-is_touchscreen.val,
 val.str);
 +free(val.str);
  if (!ptr-is_touchscreen.set)
  Error(BOOL_MSG, MatchIsTouchscreen);
  break;
 -- 
 1.7.7
 
___
xorg-devel@lists.x.org: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: http://lists.x.org/mailman/listinfo/xorg-devel


Re: [PATCH 5/5] parser: free val.str after xstrtokenize

2011-11-01 Thread Peter Hutterer
On Tue, Nov 01, 2011 at 11:12:38AM -0200, przan...@gmail.com wrote:
 From: Paulo Zanoni paulo.r.zan...@intel.com
 
 After we tokenize val.str, we discard it.
 
 This is just one example:
 6 bytes in 1 blocks are definitely lost in loss record 24 of 652
at 0x4C2779D: malloc (in vgpreload_memcheck-amd64-linux.so)
by 0x4D744D: xf86getToken (scan.c:400)
by 0x4D75F1: xf86getSubToken (scan.c:462)
by 0x4DB060: xf86parseInputClassSection (InputClass.c:145)
by 0x4D664C: xf86readConfigFile (read.c:184)
by 0x490556: xf86HandleConfigFile (xf86Config.c:2360)
by 0x49AA77: InitOutput (xf86Init.c:365)
by 0x425A7A: main (main.c:204)
 
 Signed-off-by: Paulo Zanoni paulo.r.zan...@intel.com

Reviewed-by: Peter Hutterer peter.hutte...@who-t.net

 ---
  hw/xfree86/parser/InputClass.c |9 +
  1 files changed, 9 insertions(+), 0 deletions(-)
 
 diff --git a/hw/xfree86/parser/InputClass.c b/hw/xfree86/parser/InputClass.c
 index 1128995..2cdc912 100644
 --- a/hw/xfree86/parser/InputClass.c
 +++ b/hw/xfree86/parser/InputClass.c
 @@ -128,54 +128,63 @@ xf86parseInputClassSection(void)
  Error(QUOTE_MSG, MatchProduct);
  add_group_entry(ptr-match_product,
  xstrtokenize(val.str, TOKEN_SEP));
 +free(val.str);
  break;
  case MATCH_VENDOR:
  if (xf86getSubToken((ptr-comment)) != STRING)
  Error(QUOTE_MSG, MatchVendor);
  add_group_entry(ptr-match_vendor,
  xstrtokenize(val.str, TOKEN_SEP));
 +free(val.str);
  break;
  case MATCH_DEVICE_PATH:
  if (xf86getSubToken((ptr-comment)) != STRING)
  Error(QUOTE_MSG, MatchDevicePath);
  add_group_entry(ptr-match_device,
  xstrtokenize(val.str, TOKEN_SEP));
 +free(val.str);
  break;
  case MATCH_OS:
  if (xf86getSubToken((ptr-comment)) != STRING)
  Error(QUOTE_MSG, MatchOS);
  add_group_entry(ptr-match_os,
  xstrtokenize(val.str, TOKEN_SEP));
 +free(val.str);
  break;
  case MATCH_PNPID:
  if (xf86getSubToken((ptr-comment)) != STRING)
  Error(QUOTE_MSG, MatchPnPID);
  add_group_entry(ptr-match_pnpid,
  xstrtokenize(val.str, TOKEN_SEP));
 +free(val.str);
  break;
  case MATCH_USBID:
  if (xf86getSubToken((ptr-comment)) != STRING)
  Error(QUOTE_MSG, MatchUSBID);
  add_group_entry(ptr-match_usbid,
  xstrtokenize(val.str, TOKEN_SEP));
 +free(val.str);
  break;
  case MATCH_DRIVER:
  if (xf86getSubToken((ptr-comment)) != STRING)
  Error(QUOTE_MSG, MatchDriver);
  add_group_entry(ptr-match_driver,
  xstrtokenize(val.str, TOKEN_SEP));
 +free(val.str);
  break;
  case MATCH_TAG:
  if (xf86getSubToken((ptr-comment)) != STRING)
  Error(QUOTE_MSG, MatchTag);
  add_group_entry(ptr-match_tag,
  xstrtokenize(val.str, TOKEN_SEP));
 +free(val.str);
  break;
  case MATCH_LAYOUT:
  if (xf86getSubToken((ptr-comment)) != STRING)
  Error(QUOTE_MSG, MatchLayout);
  add_group_entry(ptr-match_layout,
  xstrtokenize(val.str, TOKEN_SEP));
 +free(val.str);
  break;
  case MATCH_IS_KEYBOARD:
  if (xf86getSubToken((ptr-comment)) != STRING)
 -- 
 1.7.7
 
 ___
 xorg-devel@lists.x.org: X.Org development
 Archives: http://lists.x.org/archives/xorg-devel
 Info: http://lists.x.org/mailman/listinfo/xorg-devel
 
Cheers,
  Peter
___
xorg-devel@lists.x.org: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: http://lists.x.org/mailman/listinfo/xorg-devel