Proposed patches for bug 6963

Geoff Clare gwc at opengroup.org
Thu Jun 1 11:52:59 EEST 2006


The attached patches to address failures on PPC64 in Xlib14/vcnlist
and Xlib14/sicvals have been tested by the LSB folks who originally
reported the problem.
The LSB bug is http://bugs.linuxbase.org/show_bug.cgi?id=1365 .

I'll wait a few days for any feedback here before committing them
to CVS.

-- 
Geoff Clare <g.clare at opengroup.org>
The Open Group, Thames Tower, Station Road, Reading, RG1 1LX, England
-------------- next part --------------
--- vcnlist.m.orig	2005-11-03 08:56:20.000000000 +0000
+++ vcnlist.m.new	2006-05-19 09:16:19.000000000 +0100
@@ -109,6 +109,7 @@
 */
 >>EXTERN
 #include <locale.h>
+#include <string.h>
 #include <ximtest.h>
 
 /* Stuff from SetICValues */
@@ -162,7 +163,7 @@
 XVaNestedList
 
 int dummy;
-int endlist=0;
+char *endlist = NULL;
 >>SET startup localestartup
 >>SET cleanup localecleanup
 >>EXTERN
@@ -176,6 +177,7 @@
 	/* check the base_value returned in ic_base_val */
 	switch(type)
 	{
+#if 0 /* not used */
 		case ICV_WINDOW:
 			if(return_val->win != base_val->win)
 			{
@@ -185,6 +187,8 @@
 				return(False);
 			}
 			break;
+#endif
+#if 0 /* not used */
 		case ICV_STYLE:
 			if(return_val->style != base_val->style)
 			{
@@ -194,6 +198,7 @@
 				return(False);
 			}
 			break;
+#endif
 		case ICV_STR:
 			if(strcmp(return_val->str,base_val->str) != 0)
 			{
@@ -248,11 +253,12 @@
 			if(return_val->val_long != base_val->val_long)
 			{
 				report("Returned value does not match expected value for %s",name);
-				report("     returned %d",return_val->val_long);
-				report("     expected %d",base_val->val_long);
+				report("     returned %lu",return_val->val_long);
+				report("     expected %lu",base_val->val_long);
 				return(False);
 			}
 			break;
+#if 0 /* not used */
 		case ICV_ATOM:
 			if(return_val->atom != base_val->atom)
 			{
@@ -262,6 +268,7 @@
 				return(False);
 			}
 			break;
+#endif
 		case ICV_PMAP:
 			if(return_val->pmap != base_val->pmap)
 			{
@@ -271,6 +278,7 @@
 				return(False);
 			}
 			break;
+#if 0 /* not used */
 		case ICV_FS:
 			if(return_val->fs != base_val->fs)
 			{
@@ -280,6 +288,7 @@
 				return(False);
 			}
 			break;
+#endif
 		case ICV_INT:
 			if(return_val->val_int != base_val->val_int)
 			{
@@ -302,11 +311,11 @@
 			   (return_val->cb.client_data != base_val->cb.client_data))
 			{
 				report("Returned value does not match expected value for %s",name);
-				report("     returned (0x%x,%c)",
-					return_val->cb.callback,
+				report("     returned (%p,%p)",
+					(void *)return_val->cb.callback,
 					return_val->cb.client_data);
-				report("     expected (0x%x,%c)",
-					base_val->cb.callback,
+				report("     expected (%p,%p)",
+					(void *)base_val->cb.callback,
 					base_val->cb.client_data);
 				return(False);
 			}
@@ -455,7 +464,7 @@
 XIC ic;
 char *ic_name;
 ic_val_def *ic_val;
-int endlist = 0;
+char *endlist = NULL;
 Display *dpy;
 XIM im = NULL;
 XFontSet fs = NULL;
@@ -469,7 +478,6 @@
 att_def *att,ret_att;
 char name_sub[128];
 char name[128];
-int *val;
 #endif
 
 #if XT_X_RELEASE > 4
@@ -554,23 +562,32 @@
 					continue;
 					ncheck++;
 
-				if(ils->type == ICV_LONG	|| 
-				   ils->type == ICV_ATOM	||
-				   ils->type == ICV_WINDOW	||
-				   ils->type == ICV_INT)
-				{
-					val = (int*)ils->val;
-					att->va = 
-					  XVaCreateNestedList(dummy,ils->name,*val,NULL);
+				if(ils->type == ICV_LONG)
+				{
+					att->va = XVaCreateNestedList(dummy,
+						ils->name,
+						(XPointer)ils->val->val_long,
+						endlist);
+				}
+				else if(ils->type == ICV_INT)
+				{
+					att->va = XVaCreateNestedList(dummy,
+						ils->name,
+						(XPointer)ils->val->val_int,
+						endlist);
 				}
 				else
-					att->va = 
-					  XVaCreateNestedList(dummy,ils->name,ils->val,NULL);
+				{
+					att->va = XVaCreateNestedList(dummy,
+						ils->name,
+						(XPointer)ils->val,
+						endlist);
+				}
 				ic_name = name;
 				ic_val = (ic_val_def *)att->va;
 
 				pstr = XSetICValues(ic, ic_name, 
-						    ic_val, endlist);
+					(XPointer)ic_val, endlist);
 				if(pstr != NULL && *pstr != '\0')
 				{
 					report("%s() returns non-null result, %s",
@@ -581,8 +598,12 @@
 				{
 					/* fetch the values */
 					ret_icv = &icv;
-					ret_att.va = XVaCreateNestedList(dummy,ils->name,&ret_icv,NULL);
-					pstr = XGetICValues(ic,ic_name,ret_att.va,NULL);
+					ret_att.va = XVaCreateNestedList(dummy,
+						ils->name,
+						(XPointer)&ret_icv,
+						endlist);
+					pstr = XGetICValues(ic,ic_name,
+						(XPointer)ret_att.va,endlist);
 					if(pstr != NULL && *pstr != '\0')
 					{
 						report("XGetICValues returns non-null result, %s",
@@ -651,7 +672,7 @@
 ic_val_def 	*ic_val;
 char 		*ic_name1, *ic_name2;
 ic_val_def 	icv1, icv2, *picv, *ret_icv1, *ret_icv2;
-int endlist = 0;
+char *endlist = NULL;
 Display *dpy;
 XIM im = NULL;
 XFontSet fs = NULL;
@@ -665,7 +686,7 @@
 att_def *att, ret_att;
 char name_sub[128];
 char name[128];
-int 		*val, *val1, *val2;
+XPointer	val1, val2;
 int		index1, index2;
 ic_val_def 	ic_val1, ic_val2, ic_val3;
 #endif
@@ -754,31 +775,23 @@
 
 				if (ncheck == 1)
 				{
-					if(ils->type == ICV_LONG	|| 
-				   	ils->type == ICV_ATOM	||
-				   	ils->type == ICV_WINDOW	||
-				   	ils->type == ICV_INT)
-					{
-						val = (int*)ils->val;
-						val1 = (int *)*val;
-					}
+					if(ils->type == ICV_LONG)
+						val1 = (XPointer)ils->val->val_long;
+					else if(ils->type == ICV_INT)
+						val1 = (XPointer)ils->val->val_int;
 					else
-						val1 = (int*)ils->val;
+						val1 = (XPointer)ils->val;
 					ic_name1 = ils->name;
 					index1 = j;
 				}
 				else if (ncheck == 2)
 				{
-					if(ils->type == ICV_LONG	|| 
-				   	ils->type == ICV_ATOM	||
-				   	ils->type == ICV_WINDOW	||
-				   	ils->type == ICV_INT)
-					{
-						val = (int*)ils->val;
-						val2 = (int *)*val;
-					}
+					if(ils->type == ICV_LONG)
+						val2 = (XPointer)ils->val->val_long;
+					else if(ils->type == ICV_INT)
+						val2 = (XPointer)ils->val->val_int;
 					else
-						val2 = (int*)ils->val;
+						val2 = (XPointer)ils->val;
 					ic_name2 = ils->name;
 					index2 = j;
 				}
@@ -787,11 +800,14 @@
 			
 			if (ncheck >= 2)
 			{
-			 	att->va = XVaCreateNestedList(dummy, ic_name1, val1, ic_name2, val2, NULL);
+			 	att->va = XVaCreateNestedList(dummy,
+					ic_name1, val1, ic_name2, val2,
+					endlist);
 				ic_val = (ic_val_def *)att->va;
 				ic_name = name;
 
-				pstr = XSetICValues(ic, ic_name, ic_val, endlist);
+				pstr = XSetICValues(ic, ic_name,
+					(XPointer)ic_val, endlist);
 				if(pstr != NULL && *pstr != '\0')
 				{
 					report("%s() returns non-null result, %s",
@@ -816,8 +832,12 @@
 						}
 						/* fetch the values */
 						ret_icv = &icv;
-						ret_att.va = XVaCreateNestedList(dummy,ils->name,&ret_icv,NULL);
-						pstr = XGetICValues(ic,ic_name,ret_att.va,NULL);
+						ret_att.va = XVaCreateNestedList(dummy,
+							ils->name,
+							(XPointer)&ret_icv,
+							endlist);
+						pstr = XGetICValues(ic,ic_name,
+							(XPointer)ret_att.va,endlist);
 						if(pstr != NULL && *pstr != '\0')
 						{
 							report("XGetICValues returns non-null result, %s",
@@ -890,7 +910,7 @@
 ic_val_def 	*ic_val;
 char 		*ic_name1, *ic_name2;
 ic_val_def 	icv1, icv2, *picv, *ret_icv1, *ret_icv2;
-int endlist = 0;
+char *endlist = NULL;
 Display *dpy;
 XIM im = NULL;
 XFontSet fs = NULL;
@@ -904,7 +924,7 @@
 att_def 	*att, *att1, ret_att;
 char name_sub[128];
 char 	name[128];
-int 		*val, *val1, *val2;
+XPointer	val1, val2;
 int		index1, index2;
 ic_val_def 	ic_val1, ic_val2, ic_val3;
 XVaNestedList	va_temp;
@@ -994,31 +1014,23 @@
 
 				if (ncheck == 1)
 				{
-					if(ils->type == ICV_LONG	|| 
-				   	ils->type == ICV_ATOM	||
-				   	ils->type == ICV_WINDOW	||
-				   	ils->type == ICV_INT)
-					{
-						val = (int*)ils->val;
-						val1 = (int *)*val;
-					}
+					if(ils->type == ICV_LONG)
+						val1 = (XPointer)ils->val->val_long;
+					else if(ils->type == ICV_INT)
+						val1 = (XPointer)ils->val->val_int;
 					else
-						val1 = (int*)ils->val;
+						val1 = (XPointer)ils->val;
 					ic_name1 = ils->name;
 					index1 = j;
 				}
 				else if (ncheck == 2)
 				{
-					if(ils->type == ICV_LONG	|| 
-				   	ils->type == ICV_ATOM	||
-				   	ils->type == ICV_WINDOW	||
-				   	ils->type == ICV_INT)
-					{
-						val = (int*)ils->val;
-						val2 = (int *)*val;
-					}
+					if(ils->type == ICV_LONG)
+						val2 = (XPointer)ils->val->val_long;
+					else if(ils->type == ICV_INT)
+						val2 = (XPointer)ils->val->val_int;
 					else
-						val2 = (int*)ils->val;
+						val2 = (XPointer)ils->val;
 					ic_name2 = ils->name;
 					index2 = j;
 				}
@@ -1027,12 +1039,18 @@
 			
 			if (ncheck >= 2)
 			{
-			 	va_temp = XVaCreateNestedList(dummy, ic_name1, val1, NULL);
-			 	att->va = XVaCreateNestedList(dummy, XNVaNestedList, (char *)va_temp, ic_name2, val2, NULL);
+			 	va_temp = XVaCreateNestedList(dummy,
+					ic_name1, (XPointer)val1,
+					endlist);
+			 	att->va = XVaCreateNestedList(dummy,
+					XNVaNestedList, (XPointer)va_temp,
+					ic_name2, (XPointer)val2,
+					endlist);
 				ic_val = (ic_val_def *)att->va;
 				ic_name = name;
 
-				pstr = XSetICValues(ic, ic_name, ic_val, endlist);
+				pstr = XSetICValues(ic, ic_name,
+					(XPointer)ic_val, endlist);
 				if(pstr != NULL && *pstr != '\0')
 				{
 					report("%s() returns non-null result, %s",
@@ -1059,8 +1077,12 @@
 tet_infoline("5");
 						/* fetch the values */
 						ret_icv = &icv;
-						ret_att.va = XVaCreateNestedList(dummy,ils->name,&ret_icv,NULL);
-						pstr = XGetICValues(ic,ic_name,ret_att.va,NULL);
+						ret_att.va = XVaCreateNestedList(dummy,
+							ils->name,
+							(XPointer)&ret_icv,
+							endlist);
+						pstr = XGetICValues(ic,ic_name,
+							(XPointer)ret_att.va,endlist);
 						if(pstr != NULL && *pstr != '\0')
 						{
 							report("XGetICValues returns non-null result, %s",
-------------- next part --------------
--- sicvals.m.orig	2006-05-19 16:24:51.000000000 +0100
+++ sicvals.m.new	2006-05-19 16:24:56.000000000 +0100
@@ -113,6 +113,7 @@
 */
 >>EXTERN
 #include <locale.h>
+#include <string.h>
 #include <ximtest.h>
 
 typedef struct {
@@ -167,7 +168,7 @@
 XIC ic;
 char *ic_name;
 ic_val_def *ic_val;
-int endlist = 0;
+char *endlist = NULL;
 >>SET startup fontstartup
 >>SET cleanup fontcleanup
 >>EXTERN
@@ -186,8 +187,10 @@
 			if(return_val->win != base_val->win)
 			{
 				report("Returned value does not match expected value for %s",name);
-				report("     returned 0x%x",return_val->win);
-				report("     expected 0x%x",base_val->win);
+				report("     returned 0x%lx",
+					(unsigned long)return_val->win);
+				report("     expected 0x%lx",
+					(unsigned long)base_val->win);
 				return(False);
 			}
 			break;
@@ -195,8 +198,10 @@
 			if(return_val->style != base_val->style)
 			{
 				report("Returned value does not match expected value for %s",name);
-				report("     returned 0x%x",return_val->style);
-				report("     expected 0x%x",base_val->style);
+				report("     returned 0x%lx",
+					(unsigned long)return_val->style);
+				report("     expected 0x%lx",
+					(unsigned long)base_val->style);
 				return(False);
 			}
 			break;
@@ -245,8 +250,10 @@
 			if(return_val->cmap != base_val->cmap)
 			{
 				report("Returned value does not match expected value for %s",name);
-				report("     returned 0x%x",return_val->cmap);
-				report("     expected 0x%x",base_val->cmap);
+				report("     returned 0x%lx",
+					(unsigned long)return_val->cmap);
+				report("     expected 0x%lx",
+					(unsigned long)base_val->cmap);
 				return(False);
 			}
 			break;
@@ -254,11 +261,12 @@
 			if(return_val->val_long != base_val->val_long)
 			{
 				report("Returned value does not match expected value for %s",name);
-				report("     returned %d",return_val->val_long);
-				report("     expected %d",base_val->val_long);
+				report("     returned %lu",return_val->val_long);
+				report("     expected %lu",base_val->val_long);
 				return(False);
 			}
 			break;
+#if 0 /* not used */
 		case ICV_ATOM:
 			if(return_val->atom != base_val->atom)
 			{
@@ -268,15 +276,19 @@
 				return(False);
 			}
 			break;
+#endif
 		case ICV_PMAP:
 			if(return_val->pmap != base_val->pmap)
 			{
 				report("Returned value does not match expected value for %s",name);
-				report("     returned 0x%x",return_val->pmap);
-				report("     expected 0x%x",base_val->pmap);
+				report("     returned 0x%lx",
+					(unsigned long)return_val->pmap);
+				report("     expected 0x%lx",
+					(unsigned long)base_val->pmap);
 				return(False);
 			}
 			break;
+#if 0 /* not used */
 		case ICV_FS:
 			if(return_val->fs != base_val->fs)
 			{
@@ -286,6 +298,7 @@
 				return(False);
 			}
 			break;
+#endif
 		case ICV_INT:
 			if(return_val->val_int != base_val->val_int)
 			{
@@ -298,8 +311,9 @@
 		case ICV_CURSOR:
 			if(return_val->cur != base_val->cur)
 			{
-				report("Returned base_value for %s, 0x%x does not match expected base_value 0x%x",
-					name,return_val->cur,base_val->cur);
+				report("Returned base_value for %s, 0x%lx does not match expected base_value 0x%lx",
+					name,(unsigned long)return_val->cur,
+					(unsigned long)base_val->cur);
 				return(False);
 			}
 			break;
@@ -308,11 +322,11 @@
 			   (return_val->cb.client_data != base_val->cb.client_data))
 			{
 				report("Returned value does not match expected value for %s",name);
-				report("     returned (0x%x,%c)",
-					return_val->cb.callback,
+				report("     returned (%p,%p)",
+					(void *)return_val->cb.callback,
 					return_val->cb.client_data);
-				report("     expected (0x%x,%c)",
-					base_val->cb.callback,
+				report("     expected (%p,%p)",
+					(void *)base_val->cb.callback,
 					base_val->cb.client_data);
 				return(False);
 			}
@@ -416,7 +430,6 @@
 ic_val_def icv,*picv,*ret_icv;
 int num_ic;
 ic_list_def *il;
-int *val;
 #endif
 
 #if XT_X_RELEASE > 4
@@ -495,17 +508,14 @@
 				ncheck++;
 
 				ic_name = il->name;
-				if(il->type == ICV_LONG	||
-					il->type == ICV_ATOM	||
-				   il->type == ICV_WINDOW ||
-				   il->type == ICV_INT)
-				{
-					val = (int*)il->val;
-					val = (int*)*val;
-     				ic_val = (ic_val_def *)val; 
-				}
+				if(il->type == ICV_LONG)
+					ic_val = (ic_val_def *)il->val->val_long;
+				else if(il->type == ICV_WINDOW)
+					ic_val = (ic_val_def *)il->val->win;
+				else if(il->type == ICV_INT)
+					ic_val = (ic_val_def *)il->val->val_int;
 				else
-     				ic_val = il->val; 
+					ic_val = il->val; 
 
 				pstr = XCALL;
 				if(pstr != NULL && *pstr != '\0')
@@ -518,7 +528,8 @@
 				{
 					/* fetch the values */
 					ret_icv = &icv;
-					pstr = XGetICValues(ic,ic_name,&ret_icv,NULL);
+					pstr = XGetICValues(ic,ic_name,
+						(XPointer)&ret_icv,endlist);
 					if(pstr != NULL && *pstr != '\0')
 					{
 						report("XGetICValues returns non-null result, %s",
@@ -607,7 +618,6 @@
 att_def *att,ret_att;
 char name_sub[128];
 char name[128];
-int *val;
 #endif
 
 #if XT_X_RELEASE > 4
@@ -691,19 +701,37 @@
 	     			continue;
 				ncheck++;
  
-				if(ils->type == ICV_LONG	|| 
-				   ils->type == ICV_ATOM	||
-				   ils->type == ICV_WINDOW	||
-				   ils->type == ICV_INT)
+				if(ils->type == ICV_LONG)
+				{
+					att->va = XVaCreateNestedList(dummy,
+						ils->name,
+						(XPointer)ils->val->val_long,
+						endlist);
+				}
+				else if(ils->type == ICV_WINDOW)
+				{
+					att->va = XVaCreateNestedList(dummy,
+						ils->name,
+						(XPointer)ils->val->win,
+						endlist);
+				}
+				else if(ils->type == ICV_INT)
 				{
-					val = (int*)ils->val;
-     				att->va = XVaCreateNestedList(dummy,ils->name,*val,NULL);
+					att->va = XVaCreateNestedList(dummy,
+						ils->name,
+						(XPointer)ils->val->val_int,
+						endlist);
 				}
 				else
-     				att->va = XVaCreateNestedList(dummy,ils->name,ils->val,NULL);
+				{
+					att->va = XVaCreateNestedList(dummy,
+						ils->name,
+						(XPointer)ils->val,
+						endlist);
+				}
 
-        		ic_name = name;
-        		ic_val = (ic_val_def *)att->va;
+				ic_name = name;
+				ic_val = (ic_val_def *)att->va;
 
 				pstr = XCALL;
 				if(pstr != NULL && *pstr != '\0')
@@ -716,8 +744,12 @@
 				{
 					/* fetch the values */
 					ret_icv = &icv;
-        			ret_att.va = XVaCreateNestedList(dummy,ils->name,&ret_icv,NULL);
-					pstr = XGetICValues(ic,ic_name,ret_att.va,NULL);
+					ret_att.va = XVaCreateNestedList(dummy,
+						ils->name,
+						(XPointer)&ret_icv,
+						endlist);
+					pstr = XGetICValues(ic,ic_name,
+						(XPointer)ret_att.va,endlist);
 					if(pstr != NULL && *pstr != '\0')
 					{
 						report("XGetICValues returns non-null result, %s",
@@ -813,7 +845,6 @@
 att_def *att,ret_att;
 char name_sub[128];
 char name[128];
-int *val;
 #endif
 
 #if XT_X_RELEASE > 4
@@ -898,18 +929,36 @@
 	        		continue;
 				ncheck++;
  
-				if(ils->type == ICV_LONG	|| 
-				   ils->type == ICV_ATOM	||
-				   ils->type == ICV_WINDOW	||
-				   ils->type == ICV_INT)
+				if(ils->type == ICV_LONG)
+				{
+					att->va = XVaCreateNestedList(dummy,
+						ils->name,
+						(XPointer)ils->val->val_long,
+						endlist);
+				}
+				else if(ils->type == ICV_WINDOW)
 				{
-					val = (int*)ils->val;
-    				att->va = XVaCreateNestedList(dummy,ils->name,*val,NULL);
+					att->va = XVaCreateNestedList(dummy,
+						ils->name,
+						(XPointer)ils->val->win,
+						endlist);
+				}
+				else if(ils->type == ICV_INT)
+				{
+					att->va = XVaCreateNestedList(dummy,
+						ils->name,
+						(XPointer)ils->val->val_int,
+						endlist);
 				}
 				else
-     				att->va = XVaCreateNestedList(dummy,ils->name,ils->val,NULL);
-        		ic_name = name;
-        		ic_val = (ic_val_def *)att->va;
+				{
+					att->va = XVaCreateNestedList(dummy,
+						ils->name,
+						(XPointer)ils->val,
+						endlist);
+				}
+				ic_name = name;
+				ic_val = (ic_val_def *)att->va;
 
 				pstr = XCALL;
 				if(pstr != NULL && *pstr != '\0')
@@ -922,8 +971,12 @@
 				{
 					/* fetch the values */
 					ret_icv = &icv;
-       			ret_att.va = XVaCreateNestedList(dummy,ils->name,&ret_icv,NULL);
-					pstr = XGetICValues(ic,ic_name,ret_att.va,NULL);
+					ret_att.va = XVaCreateNestedList(dummy,
+						ils->name,
+						(XPointer)&ret_icv,
+						endlist);
+					pstr = XGetICValues(ic,ic_name,
+						(XPointer)ret_att.va,endlist);
 					if(pstr != NULL && *pstr != '\0')
 					{
 						report("XGetICValues returns non-null result, %s",
@@ -999,7 +1052,6 @@
 XrmDatabase db = NULL;
 int ncheck = 0;
 char *pstr;
-int *val;
 int cur_cnt;
 XEvent ev;
 #endif


More information about the xorg-test mailing list