php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #9360 Type of the parameter conflicts with previous declaration of function
Submitted: 2001-02-20 17:10 UTC Modified: 2001-02-24 16:24 UTC
From: amra at us dot ibm dot com Assigned:
Status: Closed Package: Compile Failure
PHP Version: 4.0.4pl1 OS: OS400
Private report: No CVE-ID: None
 [2001-02-20 17:10 UTC] amra at us dot ibm dot com
When compiling using a C compiler, it does not allow parameters that are defined as const to be passed to a function that does not have the const qualifier in the prototype.  Also, there are some parameter mismatches.  Details below.

---------- begin [main/network.c] ----------
ERROR :129   Type of the parameter  conflicts with previous declaration of function .
INFORMATIONAL :129   Prototype has type pointer to  unsigned character .
INFORMATIONAL :129   Argument has type pointer to   constant unsigned character .
---------- end   [network.qwobj] ----------

Line 129:

host_info = gethostbyname(host);

But host is const char *.  So I had to change line to as follows:
host_info = gethostbyname((char *)host);

---------- begin [fsock.qwobj] ----------
ERROR :110   Type of the parameter  conflicts with previous declaration of function .
INFORMATIONAL :110   Prototype has type pointer to  unsigned character .
INFORMATIONAL :110   Argument has type pointer to   constant unsigned character .
ERROR :183   Type of the parameter  conflicts with previous declaration of function .
INFORMATIONAL :183   Prototype has type pointer to  unsigned character .
INFORMATIONAL :183   Argument has type pointer to  signed integer .
ERROR :183   Type of the parameter  conflicts with previous declaration of function .
INFORMATIONAL :183   Prototype has type pointer to  signed integer .
INFORMATIONAL :183   Argument has type pointer to  unsigned integer .
---------- end   [fsock.qwobj] ----------

Line 110:

host_info = gethostbyname((char *)addr);
But addr is const char *.  So I had to change line to as follows:
host_info = gethostbyname((char *)addr);

Line 183:
Protoype for getsockopt is: getsockopt(int, int, int, char *, int *).

However, Line 183 contains:

if (getsockopt(sockfd, SOL_SOCKET, SO_ERROR, &error, &len) < 0) {

where error is int and len is socklen_t.  I had to change line to as follows:

if (getsockopt(sockfd, SOL_SOCKET, SO_ERROR, (char *)&error, (int *)&len) < 0) {


I hope that these types of changes are made, so as to compile easily on any platform. 

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2001-02-24 16:24 UTC] sas@php.net
All above warnings/errors are caused by apparently non-conforming system header files.

Details can be found in  Pine.LNX.4.31.0102210826100.2044-100000@rossini.schumann.cx
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Mar 28 22:01:26 2024 UTC