Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 23 May 2024 16:12:58 -0700
From:      Chris <bsd-lists@bsdforge.com>
To:        Cy Schubert <Cy.Schubert@cschubert.com>
Cc:        Brooks Davis <brooks@freebsd.org>, freebsd-hackers <freebsd-hackers@freebsd.org>
Subject:   Re: incompatible integer to pointer conversion
Message-ID:  <7780ce78a3bdef9d1a79f6f051e3373e@bsdforge.com>
In-Reply-To: <402e05f251baab2d4903201dcb207775@bsdforge.com>
References:  <2e83baa48d2686b8024021668a7d334c@bsdforge.com> <Zk-6Lo5_G6oz04QF@spindle.one-eyed-alien.net> <20240523220938.324A01BD@slippy.cwsent.com> <402e05f251baab2d4903201dcb207775@bsdforge.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On 2024-05-23 15:28, Chris wrote:
> On 2024-05-23 15:09, Cy Schubert wrote:
>> In message <Zk-6Lo5_G6oz04QF@spindle.one-eyed-alien.net>, Brooks Davis
>> writes:
>>> On Thu, May 23, 2024 at 02:40:59PM -0700, Chris wrote:
>>> > Sorry, this is really a basic "programming in C 101" question.
>>> > But for the life of me, I'm not getting it. The source in
>>> > question:
>>> >
>>> > LDAP *setup_ldap()
>>> > {
>>> > 	LDAP *ret;
>>> > 	int n;
>>> >
>>> > 	if (debug) fprintf(stderr, "radldap: Setting up LDAP for %s, port %d\n"
>>> ,
>>> > 			   host, port);
>>> > 	if (!(ret = ldap_init(host, port))) {
>>> > 		fprintf(stderr, "radldap: Could not initialize LDAP!\n");
>>> > 		_exit(2);
>>> > 	}
>>> >
>>> > Now *you* can probably already see the problem. But this is what's returned
>>> :
>>> >
>>> > radldap.c:302:12: error: incompatible integer to pointer conversion assigni
>>> ng
>>> > to 'LDAP *' (aka 'struct ldap *') from 'int' [-Wint-conversion]
>>> >   302 |         if (!(ret = ldap_init(host, port))) {
>>> >       |                   ^ ~~~~~~~~~~~~~~~~~~~~~
>>> >
>>> > Thanks in advance for any hints, or pointers.
>>> >
>>> 
>>> Have you included ldap.h?  Are there any warnings about implicit
>>> declarations?
>> 
>> ldap.h includes this as well:
>> 
>> #if LDAP_DEPRECATED
>> LDAP_F( LDAP * )
>> ldap_init LDAP_P(( /* deprecated, use ldap_create or ldap_initialize */
>>         LDAP_CONST char *host,
>>         int port ));
>> 
>> LDAP_F( LDAP * )
>> ldap_open LDAP_P((      /* deprecated, use ldap_create or ldap_initialize 
>> */
>>         LDAP_CONST char *host,
>>         int port ));
>> #endif
>> 
>> Apps such as dovecot and apr-1 have,
>> 
>> 	#define LDAP_DEPRECATED 1
> Heh. Based on the volumes of warns I'm seeing, I can understand why. My
Well FWIW. I used the define you pointed at, and all's well for my current
task. Case closed.

Thanks again, Cy && Brooks!

> 
> Thanks for the pointer, Cy. Greatly appreciated!
>> 
>>> 
>>> -- Brooks
>>> 
> --Chris
--Chris



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?7780ce78a3bdef9d1a79f6f051e3373e>