[prev in list] [next in list] [prev in thread] [next in thread] 

List:       linux-ha-dev
Subject:    RE: [Linux-ha-dev] A bunch of warnings on ia64
From:       "Zou, Yixiong" <yixiong.zou () intel ! com>
Date:       2004-01-28 17:14:52
Message-ID: 3C4C3612EC443546A33E57003DB4F0F9017F910C () orsmsx409 ! jf ! intel ! com
[Download RAW message or body]

The 'p' is re-declared to be a void *.  I think that is the type it
suppose to have since it just points to a buffer, not a char array. 

------------------------------------------------------------------------

Yixiong Zou (yixiong.zou@intel.com)

(626) 443-0100

All views expressed in this email are those of the individual sender. 



> -----Original Message-----
> From: linux-ha-dev-bounces@lists.linux-ha.org 
> [mailto:linux-ha-dev-bounces@lists.linux-ha.org] On Behalf Of Horms
> Sent: Wednesday, January 28, 2004 12:47 AM
> To: High-Availability Linux Development List
> Subject: Re: [Linux-ha-dev] A bunch of warnings on ia64
> 
> 
> On Tue, Jan 27, 2004 at 06:27:07PM -0800, Zou, Yixiong wrote:
> > Here's the patch that fixes all the warnings in checkpoint code.  
> > Lars, you want to verify if it works on your platform? 
> 
> Is the casting of p to (char *), which is its type anyway, really
> neccessary?
> 
> > Also, the RH7.2 on IA64 is quite broken on socket.h.  
> > 
> > Index: replica.c
> > ===================================================================
> > RCS file: 
> /home/cvs/linux-ha/linux-ha/telecom/checkpointd/replica.c,v
> > retrieving revision 1.5
> > diff -u -r1.5 replica.c
> > --- replica.c	21 Dec 2003 11:18:38 -0000	1.5
> > +++ replica.c	28 Jan 2004 02:17:40 -0000
> > @@ -362,7 +362,7 @@
> >  
> >  /* pack the replica so that it can be sent in a ckpt message */
> >  int 
> > -SaCkptReplicaPack(void** data, int* dataLength,
> > +SaCkptReplicaPack(void** data, size_t* dataLength,
> >  	SaCkptReplicaT* replica)
> >  {
> >  	SaCkptSectionT* sec = NULL;
> > @@ -507,7 +507,7 @@
> >  SaCkptReplicaT* 
> >  SaCkptReplicaUnpack(void* data, int dataLength)
> >  {
> > -	char* p = NULL;
> > +	void * p = NULL;
> >  	char* q = NULL;
> >  	int i = 0;
> >  	int n = 0;
> > @@ -524,71 +524,71 @@
> >  
> >  	p = data;
> >  
> > -	n = (int)*p;
> > -	p += sizeof(n);
> > +	n = *(int *)p;
> > +	p = (char *)p + sizeof(n);
> >  
> >  	memcpy(replica->checkpointName, p, n);
> > -	p += n;
> > +	p = (char *)p + n;
> >  
> >  	replica->checkpointName[n] = 0;
> >  
> >  	replica->maxSectionNumber = *(int*)p;
> > -	p += sizeof(replica->maxSectionNumber);
> > +	p = (char *)p + sizeof(replica->maxSectionNumber);
> >  
> >  	replica->maxSectionSize = *(int*)p;
> > -	p += sizeof(replica->maxSectionSize);
> > +	p = (char *)p +  sizeof(replica->maxSectionSize);
> >  
> >  	replica->maxSectionIDSize = *(int*)p;
> > -	p += sizeof(replica->maxSectionIDSize);
> > +	p = (char *)p + sizeof(replica->maxSectionIDSize);
> >  
> >  	replica->retentionDuration = *(int*)p;
> > -	p += sizeof(replica->retentionDuration);
> > +	p = (char *)p + sizeof(replica->retentionDuration);
> >  
> >  	replica->checkpointSize = *(int*)p;
> > -	p += sizeof(replica->checkpointSize);
> > +	p = (char *)p + sizeof(replica->checkpointSize);
> >  
> >  	replica->sectionNumber = *(int*)p;
> > -	p += sizeof(replica->sectionNumber);
> > +	p = (char *)p + sizeof(replica->sectionNumber);
> >  
> >  	replica->createFlag = *(int*)p;
> > -	p += sizeof(replica->createFlag);
> > +	p = (char *)p + sizeof(replica->createFlag);
> >  
> >  	replica->ownerPID = *(int*)p;
> > -	p += sizeof(replica->ownerPID);
> > +	p = (char *)p + sizeof(replica->ownerPID);
> >  
> >  	list = replica->nodeList = NULL;
> >  
> >  	n = *(int*)p;
> > -	p += sizeof(n);
> > +	p = (char *)p + sizeof(n);
> >  
> >  	for(i=0; i<n; i++) {
> >  		state = 
> (SaCkptStateT*)SaCkptMalloc(sizeof(SaCkptStateT));
> >  		SACKPTASSERT(state != NULL);
> >  		
> >  		m = *(int*)p;
> > -		p += sizeof(m);
> > +		p = (char *)p + sizeof(m);
> >  
> >  		memcpy(state->nodeName, p, m);
> > -		p += m;
> > +		p = (char *)p + m;
> >  
> >  		state->nodeName[m] = 0;
> >  
> >  		state->state = *(int*)p;
> > -		p += sizeof(state->state);
> > +		p = (char *)p + sizeof(state->state);
> >  
> >  		list = g_list_append(list, (gpointer)state);
> >  	}
> >  
> >  	n = *(int*)p;
> > -	p += sizeof(n);
> > +	p = (char *)p + sizeof(n);
> >  
> >  	memcpy(replica->activeNodeName, p, n);
> > -	p += n;
> > +	p = (char *)p + n;
> >  
> >  	replica->activeNodeName[n] = 0;
> >  
> >  	replica->nextOperationNumber = *(int*)p;
> > -	p += sizeof(replica->nextOperationNumber);
> > +	p = (char *)p + sizeof(replica->nextOperationNumber);
> >  
> >  	list = replica->sectionList;
> >  	for(i=0; i<replica->sectionNumber; i++) {
> > @@ -600,29 +600,29 @@
> >  			(gpointer)sec);
> >  
> >  		sec->sectionID.idLen = *(int*)p;
> > -		p += sizeof(sec->sectionID.idLen);
> > +		p = (char *)p + sizeof(sec->sectionID.idLen);
> >  
> >  		if (sec->sectionID.idLen > 0) {
> >  			memcpy(sec->sectionID.id, p, 
> sec->sectionID.idLen);
> > -			p += sec->sectionID.idLen;
> > +			p = (char *)p + sec->sectionID.idLen;
> >  		} 
> >  
> >  		sec->dataState = *(int*)p;
> > -		p += sizeof(sec->dataState);
> > +		p = (char *)p + sizeof(sec->dataState);
> >  
> >  		if (sec->dataState == SA_CKPT_SECTION_CORRUPTED) {
> >  			continue;
> >  		}
> >  
> >  		sec->expirationTime = *(int*)p;
> > -		p += sizeof(sec->expirationTime);
> > +		p = (char *)p + sizeof(sec->expirationTime);
> >  
> >  		sec->lastUpdateTime = *(int*)p;
> > -		p += sizeof(sec->lastUpdateTime);
> > +		p = (char *)p + sizeof(sec->lastUpdateTime);
> >  
> >  		/* by default , 0 will be the active copy */
> >  		sec->dataLength[0] = *(int*)p;
> > -		p += sizeof(sec->dataLength[0]);
> > +		p = (char *)p + sizeof(sec->dataLength[0]);
> >  
> >  		if (sec->dataLength[0] > 0) {
> >  			sec->data[0] = (void*)SaCkptMalloc( 
> > @@ -630,7 +630,7 @@
> >  			SACKPTASSERT(sec->data[0] != NULL);
> >  			
> >  			memcpy(sec->data[0], p, sec->dataLength[0]);
> > -			p += sec->dataLength[0];
> > +			p = (char *)p + sec->dataLength[0];
> >  		}
> >  
> >  		sec->dataIndex = 0;
> > @@ -675,7 +675,7 @@
> >  
> >  int 
> >  SaCkptReplicaRead(SaCkptReplicaT* replica, 
> > -	int* dataLength, void** data,
> > +	size_t* dataLength, void** data,
> >  	int paramLength, void* param)
> >  {
> >  	SaCkptSectionT* sec = NULL;
> > Index: replica.h
> > ===================================================================
> > RCS file: 
> /home/cvs/linux-ha/linux-ha/telecom/checkpointd/replica.h,v
> > retrieving revision 1.3
> > diff -u -r1.3 replica.h
> > --- replica.h	19 Dec 2003 15:55:37 -0000	1.3
> > +++ replica.h	28 Jan 2004 02:17:40 -0000
> > @@ -237,7 +237,7 @@
> >  int SaCkptReplicaRemove(SaCkptReplicaT**);
> >  int SaCkptReplicaFree(SaCkptReplicaT**);
> >  
> > -int SaCkptReplicaPack(void**, int*, SaCkptReplicaT*);
> > +int SaCkptReplicaPack(void**, size_t*, SaCkptReplicaT*);
> >  SaCkptReplicaT* SaCkptReplicaUnpack(void*, int);
> >  
> >  int SaCkptReplicaUpdate(SaCkptReplicaT*, SaCkptReqT, 
> > @@ -250,7 +250,7 @@
> >  	int, void*, int, void*);
> >  
> >  int SaCkptReplicaRead(SaCkptReplicaT*,  
> > -	int*, void**, int, void*);
> > +	size_t*, void**, int, void*);
> >  
> >  int SaCkptSectionRead(SaCkptReplicaT*,	SaCkptSectionT*,
> >  	size_t, size_t*, void**);
> > 
> > 
> --------------------------------------------------------------
> ----------
> > 
> > Yixiong Zou (yixiong.zou@intel.com)
> > 
> > (626) 443-0100
> > 
> > All views expressed in this email are those of the 
> individual sender. 
> > 
> > _______________________________________________________
> > Linux-HA-Dev: Linux-HA-Dev@lists.linux-ha.org
> > http://lists.linux-ha.org/mailman/listinfo/linux-ha-dev
> > Home Page: http://linux-ha.org/
> 
> -- 
> Horms
> _______________________________________________________
> Linux-HA-Dev: Linux-HA-Dev@lists.linux-ha.org
> http://lists.linux-ha.org/mailman/listinfo/linux-ha-dev
> Home Page: http://linux-ha.org/
> 
_______________________________________________________
Linux-HA-Dev: Linux-HA-Dev@lists.linux-ha.org
http://lists.linux-ha.org/mailman/listinfo/linux-ha-dev
Home Page: http://linux-ha.org/

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic