xsync: remove cast abuse.
This commit is contained in:
		
							parent
							
								
									119d9c46e8
								
							
						
					
					
						commit
						1208a1dbca
					
				
							
								
								
									
										81
									
								
								Xext/sync.c
								
								
								
								
							
							
						
						
									
										81
									
								
								Xext/sync.c
								
								
								
								
							|  | @ -353,7 +353,7 @@ SyncAddTriggerToCounter(pTrigger) | ||||||
| 	    return Success; | 	    return Success; | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     if (!(pCur = (SyncTriggerList *)xalloc(sizeof(SyncTriggerList)))) |     if (!(pCur = xalloc(sizeof(SyncTriggerList)))) | ||||||
| 	return BadAlloc; | 	return BadAlloc; | ||||||
| 
 | 
 | ||||||
|     pCur->pTrigger = pTrigger; |     pCur->pTrigger = pTrigger; | ||||||
|  | @ -600,8 +600,7 @@ SyncSendCounterNotifyEvents(client, ppAwait, num_events) | ||||||
| 
 | 
 | ||||||
|     if (client->clientGone) |     if (client->clientGone) | ||||||
| 	return; | 	return; | ||||||
|     pev = pEvents = (xSyncCounterNotifyEvent *) |     pev = pEvents = xalloc(num_events * sizeof(xSyncCounterNotifyEvent)); | ||||||
| 		 xalloc(num_events * sizeof(xSyncCounterNotifyEvent)); |  | ||||||
|     if (!pEvents)  |     if (!pEvents)  | ||||||
| 	return; | 	return; | ||||||
|     UpdateCurrentTime(); |     UpdateCurrentTime(); | ||||||
|  | @ -732,7 +731,7 @@ SyncAwaitTriggerFired(pTrigger) | ||||||
| 
 | 
 | ||||||
|     pAwaitUnion = (SyncAwaitUnion *)pAwait->pHeader; |     pAwaitUnion = (SyncAwaitUnion *)pAwait->pHeader; | ||||||
|     numwaits = pAwaitUnion->header.num_waitconditions; |     numwaits = pAwaitUnion->header.num_waitconditions; | ||||||
|     ppAwait = (SyncAwait **)xalloc(numwaits * sizeof(SyncAwait *)); |     ppAwait = xalloc(numwaits * sizeof(SyncAwait *)); | ||||||
|     if (!ppAwait) |     if (!ppAwait) | ||||||
| 	goto bail; | 	goto bail; | ||||||
| 
 | 
 | ||||||
|  | @ -887,7 +886,7 @@ SyncEventSelectForAlarm(pAlarm, client, wantevents) | ||||||
| 
 | 
 | ||||||
|     /* add new client to pAlarm->pEventClients */ |     /* add new client to pAlarm->pEventClients */ | ||||||
| 
 | 
 | ||||||
|     pClients = (SyncAlarmClientList *) xalloc(sizeof(SyncAlarmClientList)); |     pClients = xalloc(sizeof(SyncAlarmClientList)); | ||||||
|     if (!pClients) |     if (!pClients) | ||||||
| 	return BadAlloc; | 	return BadAlloc; | ||||||
| 
 | 
 | ||||||
|  | @ -1022,13 +1021,13 @@ SyncCreateCounter(client, id, initialvalue) | ||||||
| { | { | ||||||
|     SyncCounter *pCounter; |     SyncCounter *pCounter; | ||||||
| 
 | 
 | ||||||
|     if (!(pCounter = (SyncCounter *) xalloc(sizeof(SyncCounter)))) |     if (!(pCounter = xalloc(sizeof(SyncCounter)))) | ||||||
| 	return (SyncCounter *)NULL; | 	return NULL; | ||||||
| 
 | 
 | ||||||
|     if (!AddResource(id, RTCounter, (pointer) pCounter)) |     if (!AddResource(id, RTCounter, (pointer) pCounter)) | ||||||
|     { |     { | ||||||
| 	xfree((pointer) pCounter); | 	xfree(pCounter); | ||||||
| 	return (SyncCounter *)NULL; | 	return NULL; | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     pCounter->client = client; |     pCounter->client = client; | ||||||
|  | @ -1066,10 +1065,10 @@ SyncCreateSystemCounter(name, initial, resolution, counterType, | ||||||
| { | { | ||||||
|     SyncCounter    *pCounter; |     SyncCounter    *pCounter; | ||||||
| 
 | 
 | ||||||
|     SysCounterList = (SyncCounter **)xrealloc(SysCounterList, |     SysCounterList = xrealloc(SysCounterList, | ||||||
| 			    (SyncNumSystemCounters+1)*sizeof(SyncCounter *)); | 			    (SyncNumSystemCounters+1)*sizeof(SyncCounter *)); | ||||||
|     if (!SysCounterList) |     if (!SysCounterList) | ||||||
| 	return (pointer)NULL; | 	return NULL; | ||||||
| 
 | 
 | ||||||
|     /* this function may be called before SYNC has been initialized, so we
 |     /* this function may be called before SYNC has been initialized, so we
 | ||||||
|      * have to make sure RTCounter is created. |      * have to make sure RTCounter is created. | ||||||
|  | @ -1079,7 +1078,7 @@ SyncCreateSystemCounter(name, initial, resolution, counterType, | ||||||
| 	RTCounter = CreateNewResourceType(FreeCounter); | 	RTCounter = CreateNewResourceType(FreeCounter); | ||||||
| 	if (RTCounter == 0) | 	if (RTCounter == 0) | ||||||
| 	{ | 	{ | ||||||
| 	    return (pointer)NULL; | 	    return NULL; | ||||||
| 	} | 	} | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|  | @ -1089,11 +1088,11 @@ SyncCreateSystemCounter(name, initial, resolution, counterType, | ||||||
|     { |     { | ||||||
| 	SysCounterInfo *psci; | 	SysCounterInfo *psci; | ||||||
| 
 | 
 | ||||||
| 	psci = (SysCounterInfo *)xalloc(sizeof(SysCounterInfo)); | 	psci = xalloc(sizeof(SysCounterInfo)); | ||||||
| 	if (!psci) | 	if (!psci) | ||||||
| 	{ | 	{ | ||||||
| 	    FreeResource(pCounter->id, RT_NONE); | 	    FreeResource(pCounter->id, RT_NONE); | ||||||
| 	    return (pointer) pCounter; | 	    return pCounter; | ||||||
| 	} | 	} | ||||||
| 	pCounter->pSysCounterInfo = psci; | 	pCounter->pSysCounterInfo = psci; | ||||||
| 	psci->name = name; | 	psci->name = name; | ||||||
|  | @ -1105,7 +1104,7 @@ SyncCreateSystemCounter(name, initial, resolution, counterType, | ||||||
| 	XSyncMinValue(&psci->bracket_less); | 	XSyncMinValue(&psci->bracket_less); | ||||||
| 	SysCounterList[SyncNumSystemCounters++] = pCounter; | 	SysCounterList[SyncNumSystemCounters++] = pCounter; | ||||||
|     } |     } | ||||||
|     return (pointer) pCounter; |     return pCounter; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| void | void | ||||||
|  | @ -1331,7 +1330,7 @@ FreeAlarmClient(value, id) | ||||||
| 	    else | 	    else | ||||||
| 		pAlarm->pEventClients = pCur->next; | 		pAlarm->pEventClients = pCur->next; | ||||||
| 	    xfree(pCur); | 	    xfree(pCur); | ||||||
| 	    return(Success); | 	    return Success; | ||||||
| 	} | 	} | ||||||
|     } |     } | ||||||
|     FatalError("alarm client not on event list"); |     FatalError("alarm client not on event list"); | ||||||
|  | @ -1367,7 +1366,7 @@ ProcSyncInitialize(client) | ||||||
| 	swaps(&rep.sequenceNumber, n); | 	swaps(&rep.sequenceNumber, n); | ||||||
|     } |     } | ||||||
|     WriteToClient(client, sizeof(rep), (char *) &rep); |     WriteToClient(client, sizeof(rep), (char *) &rep); | ||||||
|     return (client->noClientException); |     return client->noClientException; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| /*
 | /*
 | ||||||
|  | @ -1396,7 +1395,7 @@ ProcSyncListSystemCounters(client) | ||||||
| 
 | 
 | ||||||
|     if (len) |     if (len) | ||||||
|     { |     { | ||||||
| 	walklist = list = (xSyncSystemCounter *) xalloc(len); | 	walklist = list = xalloc(len); | ||||||
| 	if (!list) | 	if (!list) | ||||||
| 	    return BadAlloc; | 	    return BadAlloc; | ||||||
|     } |     } | ||||||
|  | @ -1445,7 +1444,7 @@ ProcSyncListSystemCounters(client) | ||||||
| 	xfree(list); | 	xfree(list); | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     return (client->noClientException); |     return client->noClientException; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| /*
 | /*
 | ||||||
|  | @ -1521,7 +1520,7 @@ ProcSyncGetPriority(client) | ||||||
| 
 | 
 | ||||||
|     WriteToClient(client, sizeof(xSyncGetPriorityReply), (char *) &rep); |     WriteToClient(client, sizeof(xSyncGetPriorityReply), (char *) &rep); | ||||||
| 
 | 
 | ||||||
|     return (client->noClientException); |     return client->noClientException; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| /*
 | /*
 | ||||||
|  | @ -1542,7 +1541,7 @@ ProcSyncCreateCounter(client) | ||||||
|     if (!SyncCreateCounter(client, stuff->cid, initial)) |     if (!SyncCreateCounter(client, stuff->cid, initial)) | ||||||
| 	return BadAlloc; | 	return BadAlloc; | ||||||
| 
 | 
 | ||||||
|     return (client->noClientException); |     return client->noClientException; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| /*
 | /*
 | ||||||
|  | @ -1558,8 +1557,8 @@ ProcSyncSetCounter(client) | ||||||
| 
 | 
 | ||||||
|     REQUEST_SIZE_MATCH(xSyncSetCounterReq); |     REQUEST_SIZE_MATCH(xSyncSetCounterReq); | ||||||
| 
 | 
 | ||||||
|     pCounter = (SyncCounter *)SecurityLookupIDByType(client, stuff->cid, |     pCounter = SecurityLookupIDByType(client, stuff->cid, RTCounter, | ||||||
| 					   RTCounter, DixWriteAccess); | 				      DixWriteAccess); | ||||||
|     if (pCounter == NULL) |     if (pCounter == NULL) | ||||||
|     { |     { | ||||||
| 	client->errorValue = stuff->cid; | 	client->errorValue = stuff->cid; | ||||||
|  | @ -1591,8 +1590,8 @@ ProcSyncChangeCounter(client) | ||||||
| 
 | 
 | ||||||
|     REQUEST_SIZE_MATCH(xSyncChangeCounterReq); |     REQUEST_SIZE_MATCH(xSyncChangeCounterReq); | ||||||
| 
 | 
 | ||||||
|     pCounter = (SyncCounter *) SecurityLookupIDByType(client, stuff->cid, |     pCounter = SecurityLookupIDByType(client, stuff->cid, RTCounter, | ||||||
| 					    RTCounter, DixWriteAccess); | 				      DixWriteAccess); | ||||||
|     if (pCounter == NULL) |     if (pCounter == NULL) | ||||||
|     { |     { | ||||||
| 	client->errorValue = stuff->cid; | 	client->errorValue = stuff->cid; | ||||||
|  | @ -1629,8 +1628,8 @@ ProcSyncDestroyCounter(client) | ||||||
| 
 | 
 | ||||||
|     REQUEST_SIZE_MATCH(xSyncDestroyCounterReq); |     REQUEST_SIZE_MATCH(xSyncDestroyCounterReq); | ||||||
| 
 | 
 | ||||||
|     pCounter = (SyncCounter *)SecurityLookupIDByType(client, stuff->counter, |     pCounter = SecurityLookupIDByType(client, stuff->counter, RTCounter, | ||||||
| 					   RTCounter, DixDestroyAccess); | 				      DixDestroyAccess); | ||||||
|     if (pCounter == NULL) |     if (pCounter == NULL) | ||||||
|     { |     { | ||||||
| 	client->errorValue = stuff->counter; | 	client->errorValue = stuff->counter; | ||||||
|  | @ -1682,7 +1681,7 @@ ProcSyncAwait(client) | ||||||
|     /*  all the memory for the entire await list is allocated 
 |     /*  all the memory for the entire await list is allocated 
 | ||||||
|      *  here in one chunk |      *  here in one chunk | ||||||
|      */ |      */ | ||||||
|     pAwaitUnion = (SyncAwaitUnion *)xalloc((items+1) * sizeof(SyncAwaitUnion)); |     pAwaitUnion = xalloc((items+1) * sizeof(SyncAwaitUnion)); | ||||||
|     if (!pAwaitUnion) |     if (!pAwaitUnion) | ||||||
| 	return BadAlloc; | 	return BadAlloc; | ||||||
| 
 | 
 | ||||||
|  | @ -1775,8 +1774,8 @@ ProcSyncQueryCounter(client) | ||||||
| 
 | 
 | ||||||
|     REQUEST_SIZE_MATCH(xSyncQueryCounterReq); |     REQUEST_SIZE_MATCH(xSyncQueryCounterReq); | ||||||
| 
 | 
 | ||||||
|     pCounter = (SyncCounter *)SecurityLookupIDByType(client, stuff->counter, |     pCounter = SecurityLookupIDByType(client, stuff->counter, RTCounter, | ||||||
| 					    RTCounter, DixReadAccess); | 				      DixReadAccess); | ||||||
|     if (pCounter == NULL) |     if (pCounter == NULL) | ||||||
|     { |     { | ||||||
| 	client->errorValue = stuff->counter; | 	client->errorValue = stuff->counter; | ||||||
|  | @ -1806,7 +1805,7 @@ ProcSyncQueryCounter(client) | ||||||
| 	swapl(&rep.value_lo, n); | 	swapl(&rep.value_lo, n); | ||||||
|     } |     } | ||||||
|     WriteToClient(client, sizeof(xSyncQueryCounterReply), (char *) &rep); |     WriteToClient(client, sizeof(xSyncQueryCounterReply), (char *) &rep); | ||||||
|     return (client->noClientException); |     return client->noClientException; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
|  | @ -1833,7 +1832,7 @@ ProcSyncCreateAlarm(client) | ||||||
|     if (len != (Ones(vmask) + Ones(vmask & (XSyncCAValue|XSyncCADelta)))) |     if (len != (Ones(vmask) + Ones(vmask & (XSyncCAValue|XSyncCADelta)))) | ||||||
| 	return BadLength; | 	return BadLength; | ||||||
| 
 | 
 | ||||||
|     if (!(pAlarm = (SyncAlarm *) xalloc(sizeof(SyncAlarm)))) |     if (!(pAlarm = xalloc(sizeof(SyncAlarm)))) | ||||||
|     { |     { | ||||||
| 	return BadAlloc; | 	return BadAlloc; | ||||||
|     } |     } | ||||||
|  | @ -1904,8 +1903,8 @@ ProcSyncChangeAlarm(client) | ||||||
| 
 | 
 | ||||||
|     REQUEST_AT_LEAST_SIZE(xSyncChangeAlarmReq); |     REQUEST_AT_LEAST_SIZE(xSyncChangeAlarmReq); | ||||||
| 
 | 
 | ||||||
|     if (!(pAlarm = (SyncAlarm *)SecurityLookupIDByType(client, stuff->alarm, |     if (!(pAlarm = SecurityLookupIDByType(client, stuff->alarm, RTAlarm, | ||||||
| 					      RTAlarm, DixWriteAccess))) | 					  DixWriteAccess))) | ||||||
|     { |     { | ||||||
| 	client->errorValue = stuff->alarm; | 	client->errorValue = stuff->alarm; | ||||||
| 	return SyncErrorBase + XSyncBadAlarm; | 	return SyncErrorBase + XSyncBadAlarm; | ||||||
|  | @ -1945,12 +1944,12 @@ ProcSyncQueryAlarm(client) | ||||||
| 
 | 
 | ||||||
|     REQUEST_SIZE_MATCH(xSyncQueryAlarmReq); |     REQUEST_SIZE_MATCH(xSyncQueryAlarmReq); | ||||||
| 
 | 
 | ||||||
|     pAlarm = (SyncAlarm *)SecurityLookupIDByType(client, stuff->alarm, |     pAlarm = SecurityLookupIDByType(client, stuff->alarm, RTAlarm, | ||||||
| 						RTAlarm, DixReadAccess); | 				    DixReadAccess); | ||||||
|     if (!pAlarm) |     if (!pAlarm) | ||||||
|     { |     { | ||||||
| 	client->errorValue = stuff->alarm; | 	client->errorValue = stuff->alarm; | ||||||
| 	return (SyncErrorBase + XSyncBadAlarm); | 	return SyncErrorBase + XSyncBadAlarm; | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     rep.type = X_Reply; |     rep.type = X_Reply; | ||||||
|  | @ -1993,7 +1992,7 @@ ProcSyncQueryAlarm(client) | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     WriteToClient(client, sizeof(xSyncQueryAlarmReply), (char *) &rep); |     WriteToClient(client, sizeof(xSyncQueryAlarmReply), (char *) &rep); | ||||||
|     return (client->noClientException); |     return client->noClientException; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
|  | @ -2005,15 +2004,15 @@ ProcSyncDestroyAlarm(client) | ||||||
| 
 | 
 | ||||||
|     REQUEST_SIZE_MATCH(xSyncDestroyAlarmReq); |     REQUEST_SIZE_MATCH(xSyncDestroyAlarmReq); | ||||||
| 
 | 
 | ||||||
|     if (!((SyncAlarm *)SecurityLookupIDByType(client, stuff->alarm, |     if (!(SecurityLookupIDByType(client, stuff->alarm, RTAlarm, | ||||||
| 					      RTAlarm, DixDestroyAccess))) | 				 DixDestroyAccess))) | ||||||
|     { |     { | ||||||
| 	client->errorValue = stuff->alarm; | 	client->errorValue = stuff->alarm; | ||||||
| 	return SyncErrorBase + XSyncBadAlarm; | 	return SyncErrorBase + XSyncBadAlarm; | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     FreeResource(stuff->alarm, RT_NONE); |     FreeResource(stuff->alarm, RT_NONE); | ||||||
|     return (client->noClientException); |     return client->noClientException; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| /*
 | /*
 | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue