ITS#9925 Fix some ancient #ifdef checks

Use #elif defined(...) for HAVE_WINSOCK and MACOS. All other instances
of these macros use #ifdef or similar. A compiler may warn about them
not being defined.

In libraries/liblber/sockbuf.c, (DOS && PCNFS) and (DOS && NCSA) were
replaced with HAVE_PCNFS and HAVE_NCSA, respectively. It seems logical
to do the same at the only remaining occurrence of DOS, PCNFS, and NCSA.

Use #if HARDCODE_DATA consistently, replacing two instances of #ifdef.
HARDCODE_DATA is always defined, and this way you can set HARDCODE_DATA
to 0 and have it work, rather than it going down the wrong branch and
failing in these two cases.
This commit is contained in:
Connor Smith 2022-10-03 11:11:10 +01:00 committed by Quanah Gibson-Mount
parent 13d9c925dd
commit 6489b6a857
2 changed files with 13 additions and 15 deletions

View File

@ -63,7 +63,7 @@
#ifdef HAVE_WINSOCK2
#include <winsock2.h>
#include <ws2tcpip.h>
#elif HAVE_WINSOCK
#elif defined(HAVE_WINSOCK)
#include <winsock.h>
#endif
@ -111,22 +111,20 @@
LBER_F( char * ) ber_pvt_wsa_err2string LDAP_P((int));
#elif MACOS
#elif defined(MACOS)
# define tcp_close( s ) tcpclose( s )
# define tcp_read( s, buf, len ) tcpread( s, buf, len )
# define tcp_write( s, buf, len ) tcpwrite( s, buf, len )
#elif DOS
# ifdef PCNFS
# define tcp_close( s ) close( s )
# define tcp_read( s, buf, len ) recv( s, buf, len, 0 )
# define tcp_write( s, buf, len ) send( s, buf, len, 0 )
# endif /* PCNFS */
# ifdef NCSA
# define tcp_close( s ) do { netclose( s ); netshut() } while(0)
# define tcp_read( s, buf, len ) nread( s, buf, len )
# define tcp_write( s, buf, len ) netwrite( s, buf, len )
# endif /* NCSA */
#elif defined(HAVE_PCNFS)
# define tcp_close( s ) close( s )
# define tcp_read( s, buf, len ) recv( s, buf, len, 0 )
# define tcp_write( s, buf, len ) send( s, buf, len, 0 )
#elif defined(HAVE_NCSA)
# define tcp_close( s ) do { netclose( s ); netshut() } while(0)
# define tcp_read( s, buf, len ) nread( s, buf, len )
# define tcp_write( s, buf, len ) netwrite( s, buf, len )
#elif defined(HAVE_CLOSESOCKET)
# define tcp_close( s ) closesocket( s )

View File

@ -1655,7 +1655,7 @@ write_cdata(char *opath)
}
#endif
#ifdef HARDCODE_DATA
#if HARDCODE_DATA
fprintf(out, PREF "ac_uint4 _uckdcmp_size = %ld;\n\n",
kdecomps_used * 2L);
@ -1753,7 +1753,7 @@ write_cdata(char *opath)
* Generate the combining class data.
*
*****************************************************************/
#ifdef HARDCODE_DATA
#if HARDCODE_DATA
fprintf(out, PREF "ac_uint4 _uccmcl_size = %ld;\n\n", (long) ccl_used);
fprintf(out, PREF "ac_uint4 _uccmcl_nodes[] = {");