Re: [SMAUG] signedness warnings
Re: [SMAUG] signedness warnings
- To: smaug@realms.game.org
- From: Mysid <mysidia@gmail.com>
- Date: Wed, 11 May 2005 03:02:03 +0000
- Content-disposition: inline
- Content-length: 1026
- Content-transfer-encoding: 8bit
- Content-type: text/plain; charset=ISO-8859-1
- Delivered-to: sml@shadow-lands.com
- Domainkey-signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:reply-to:to:subject:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=Lv3ZuKwpFzyNEyVzbBTmrd2bk/ey4PM3QLZo0nvtHUFXiOWLZ1zlTQhcvk15wotYbg54V89g0dqMlVB+/QjUBqpTNo3A1f8/Id2PBjFaM9G+lIRpOlGRBCTwh+egxz94KcTA8zOjWtObQIQzXHDKaZ5q5QC+cHg9OhnowZkKMs0=
- In-reply-to: <001501c555c7$ee014280$0201a8c0@kara>
- References: <001501c555c7$ee014280$0201a8c0@kara>
- Reply-to: Mysid <mysidia@gmail.com>
- Sender: owner-smaug@realms.game.org
On 5/11/05, PoE <averety@earthlink.net> wrote:
>
> Hello, I recently upgraded to GCC 4.0 and now I am getting these warnings.
>
> ident.c: In function 'set_auth':
> ident.c:288: warning: pointer targets in passing argument 3 of 'getsockname'
> differ in signedness
> ident.c:293: warning: pointer targets in passing argument 3 of 'getpeername'
> differ in signedness
It means probably that getsockname() expects a regular int
and you are passing it a pointer to an unsigned int.
getsockname() expects these arguments:
int getsockname(int s, struct sockaddr *name, socklen_t *namelen);
^^^^^^^^^^^^^^^^^^^^
the third argument is the pointer.
if you did
unsigned int x;
getsockname(fd, nameptr, &x);
you could expect to see this...
should instead use
socklen_t x;
(It should go without saying: If you use a pointer variable, make
sure the type of the thing it points to is the same as the pointer type)
--
-Mysid