Commit 13bd786a authored by Kurt Zeilenga's avatar Kurt Zeilenga
Browse files

VC++ Port: round 1

parent 047f7b08
......@@ -11,7 +11,6 @@
* is provided ``as is'' without express or implied warranty.
*/
#define DISABLE_BRIDGE
#include "portable.h"
#ifndef lint
......
# Microsoft Developer Studio Project File - Name="libavl" - Package Owner=<4>
# Microsoft Developer Studio Generated Build File, Format Version 5.00
# ** DO NOT EDIT **
# TARGTYPE "Win32 (x86) Static Library" 0x0104
CFG=libavl - Win32 Debug
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
!MESSAGE use the Export Makefile command and run
!MESSAGE
!MESSAGE NMAKE /f "libavl.mak".
!MESSAGE
!MESSAGE You can specify a configuration when running NMAKE
!MESSAGE by defining the macro CFG on the command line. For example:
!MESSAGE
!MESSAGE NMAKE /f "libavl.mak" CFG="libavl - Win32 Debug"
!MESSAGE
!MESSAGE Possible choices for configuration are:
!MESSAGE
!MESSAGE "libavl - Win32 Release" (based on "Win32 (x86) Static Library")
!MESSAGE "libavl - Win32 Debug" (based on "Win32 (x86) Static Library")
!MESSAGE
# Begin Project
# PROP Scc_ProjName ""
# PROP Scc_LocalPath ""
CPP=cl.exe
!IF "$(CFG)" == "libavl - Win32 Release"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 0
# PROP BASE Output_Dir "Release"
# PROP BASE Intermediate_Dir "Release"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 0
# PROP Output_Dir "Release"
# PROP Intermediate_Dir "Release"
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /FD /c
# ADD CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /FD /c
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LIB32=link.exe -lib
# ADD BASE LIB32 /nologo
# ADD LIB32 /nologo
!ELSEIF "$(CFG)" == "libavl - Win32 Debug"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 1
# PROP BASE Output_Dir "Debug"
# PROP BASE Intermediate_Dir "Debug"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 1
# PROP Output_Dir "Debug"
# PROP Intermediate_Dir "Debug"
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /GX /Z7 /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /FD /c
# ADD CPP /nologo /W3 /GX /Z7 /Od /I "..\..\include" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /FD /c
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LIB32=link.exe -lib
# ADD BASE LIB32 /nologo
# ADD LIB32 /nologo /out:"..\Debug\libavl.lib"
!ENDIF
# Begin Target
# Name "libavl - Win32 Release"
# Name "libavl - Win32 Debug"
# Begin Source File
SOURCE=.\avl.c
# End Source File
# Begin Source File
SOURCE=..\..\include\avl.h
# End Source File
# End Target
# End Project
Microsoft Developer Studio Workspace File, Format Version 5.00
# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
###############################################################################
Project: "libavl"=.\libavl.dsp - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
}}}
###############################################################################
Global:
Package=<5>
{{{
}}}
Package=<3>
{{{
}}}
###############################################################################
#define LDAP_BRIDGE /* disable LDAP_BRIDGE code */
#include "portable.h"
#if defined( LDAP_DEBUG ) && defined( LDAP_LIBUI )
#include <stdio.h>
#include <ac/string.h>
#include <ctype.h>
#include <ac/string.h>
#endif /* LDAP_DEBUG && LDAP_LIBUI */
#include "lber.h"
......
......@@ -11,7 +11,6 @@
* is provided ``as is'' without express or implied warranty.
*/
#define DISABLE_BRIDGE /* disable LDAP_BRIDGE code */
#include "portable.h"
#include <stdio.h>
......@@ -24,21 +23,8 @@
#endif
#include <ac/string.h>
#ifdef MACOS
#include "macos.h"
#endif /* MACOS */
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#ifdef PCNFS
#include <tklib.h>
#endif /* PCNFS */
#if defined( DOS ) || defined( _WIN32 )
#include "msdos.h"
#endif /* DOS */
#include <ac/socket.h>
#include "lber.h"
......@@ -126,7 +112,7 @@ ber_skip_tag( BerElement *ber, unsigned long *len )
if ( ber_read( ber, (char *) &netlen + diff, noctets )
!= noctets )
return( LBER_DEFAULT );
*len = LBER_NTOHL( netlen );
*len = NTOHL( netlen );
} else {
*len = lc;
}
......@@ -175,10 +161,10 @@ ber_getnint( BerElement *ber, long *num, int len )
sign = (0x80 & *(p+diff) );
if ( sign && len < sizeof(long) ) {
for ( i = 0; i < diff; i++ ) {
*(p+i) = 0xff;
*(p+i) = (char) 0xff;
}
}
*num = LBER_NTOHL( netnum );
*num = NTOHL( netnum );
return( len );
}
......@@ -191,7 +177,7 @@ ber_get_int( BerElement *ber, long *num )
if ( (tag = ber_skip_tag( ber, &len )) == LBER_DEFAULT )
return( LBER_DEFAULT );
if ( ber_getnint( ber, num, (int)len ) != len )
if ( (unsigned long) ber_getnint( ber, num, (int)len ) != len )
return( LBER_DEFAULT );
else
return( tag );
......@@ -210,7 +196,7 @@ ber_get_stringb( BerElement *ber, char *buf, unsigned long *len )
if ( datalen > (*len - 1) )
return( LBER_DEFAULT );
if ( ber_read( ber, buf, datalen ) != datalen )
if ( (unsigned long) ber_read( ber, buf, datalen ) != datalen )
return( LBER_DEFAULT );
buf[datalen] = '\0';
......@@ -249,7 +235,7 @@ ber_get_stringa( BerElement *ber, char **buf )
if ( (*buf = (char *) malloc( (size_t)datalen + 1 )) == NULL )
return( LBER_DEFAULT );
if ( ber_read( ber, *buf, datalen ) != datalen )
if ( (unsigned long) ber_read( ber, *buf, datalen ) != datalen )
return( LBER_DEFAULT );
(*buf)[datalen] = '\0';
......@@ -282,7 +268,7 @@ ber_get_stringal( BerElement *ber, struct berval **bv )
if ( ((*bv)->bv_val = (char *) malloc( (size_t)len + 1 )) == NULL )
return( LBER_DEFAULT );
if ( ber_read( ber, (*bv)->bv_val, len ) != len )
if ( (unsigned long) ber_read( ber, (*bv)->bv_val, len ) != len )
return( LBER_DEFAULT );
((*bv)->bv_val)[len] = '\0';
(*bv)->bv_len = len;
......@@ -319,7 +305,7 @@ ber_get_bitstringa( BerElement *ber, char **buf, unsigned long *blen )
if ( ber_read( ber, (char *)&unusedbits, 1 ) != 1 )
return( LBER_DEFAULT );
if ( ber_read( ber, *buf, datalen ) != datalen )
if ( (unsigned long) ber_read( ber, *buf, datalen ) != datalen )
return( LBER_DEFAULT );
*blen = datalen * 8 - unusedbits;
......
......@@ -11,7 +11,6 @@
* is provided ``as is'' without express or implied warranty.
*/
#define DISABLE_BRIDGE
#include "portable.h"
#include <stdio.h>
......@@ -24,21 +23,8 @@
#include <varargs.h>
#endif
#ifdef MACOS
#include "macos.h"
#endif /* MACOS */
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#ifdef PCNFS
#include <tklib.h>
#endif /* PCNFS */
#if defined( DOS ) || defined( _WIN32 )
#include "msdos.h"
#endif /* DOS */
#include <ac/socket.h>
#include "lber.h"
......@@ -79,7 +65,7 @@ ber_put_tag( BerElement *ber, unsigned long tag, int nosos )
taglen = ber_calc_taglen( tag );
ntag = LBER_HTONL( tag );
ntag = HTONL( tag );
return( ber_write( ber, ((char *) &ntag) + sizeof(long) - taglen,
taglen, nosos ) );
......@@ -125,7 +111,7 @@ ber_put_len( BerElement *ber, unsigned long len, int nosos )
*/
if ( len <= 127 ) {
netlen = LBER_HTONL( len );
netlen = HTONL( len );
return( ber_write( ber, (char *) &netlen + sizeof(long) - 1,
1, nosos ) );
}
......@@ -152,7 +138,7 @@ ber_put_len( BerElement *ber, unsigned long len, int nosos )
return( -1 );
/* write the length itself */
netlen = LBER_HTONL( len );
netlen = HTONL( len );
if ( ber_write( ber, (char *) &netlen + (sizeof(long) - i), i, nosos )
!= i )
return( -1 );
......@@ -203,7 +189,7 @@ ber_put_int_or_enum( BerElement *ber, long num, unsigned long tag )
if ( (lenlen = ber_put_len( ber, len, 0 )) == -1 )
return( -1 );
i++;
netnum = LBER_HTONL( num );
netnum = HTONL( num );
if ( ber_write( ber, (char *) &netnum + (sizeof(long) - i), i, 0 )
!= i )
return( -1 );
......@@ -259,7 +245,7 @@ ber_put_ostring( BerElement *ber, char *str, unsigned long len,
#endif /* STR_TRANSLATION */
if ( (lenlen = ber_put_len( ber, len, 0 )) == -1 ||
ber_write( ber, str, len, 0 ) != len ) {
(unsigned long) ber_write( ber, str, len, 0 ) != len ) {
rc = -1;
} else {
/* return length of tag + length + contents */
......@@ -295,7 +281,7 @@ ber_put_bitstring( BerElement *ber, char *str,
return( -1 );
len = ( blen + 7 ) / 8;
unusedbits = len * 8 - blen;
unusedbits = (unsigned char) ((len * 8) - blen);
if ( (lenlen = ber_put_len( ber, len + 1, 0 )) == -1 )
return( -1 );
......@@ -411,7 +397,7 @@ ber_put_seqorset( BerElement *ber )
*/
len = (*sos)->sos_clen;
netlen = LBER_HTONL( len );
netlen = HTONL( len );
if ( sizeof(long) > 4 && len > 0xFFFFFFFFL )
return( -1 );
......@@ -460,12 +446,14 @@ ber_put_seqorset( BerElement *ber )
/* the tag */
taglen = ber_calc_taglen( (*sos)->sos_tag );
ntag = LBER_HTONL( (*sos)->sos_tag );
ntag = HTONL( (*sos)->sos_tag );
SAFEMEMCPY( (*sos)->sos_first, (char *) &ntag +
sizeof(long) - taglen, taglen );
if ( ber->ber_options & LBER_USE_DER ) {
ltag = (lenlen == 1) ? len : 0x80 + (lenlen - 1);
ltag = (lenlen == 1)
? (unsigned char) len
: 0x80 + (lenlen - 1);
}
/* one byte of length length */
......
......@@ -11,7 +11,6 @@
* is provided ``as is'' without express or implied warranty.
*/
#define DISABLE_BRIDGE
#include "portable.h"
#include <stdio.h>
......@@ -21,26 +20,13 @@
#include <ctype.h>
#include <ac/unistd.h>
#if defined( DOS ) || defined( _WIN32 )
#include "msdos.h"
#endif /* DOS || _WIN32 */
#ifdef MACOS
#include "macos.h"
#else /* MACOS */
#include <errno.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#ifdef PCNFS
#include <tklib.h>
#endif /* PCNFS */
#endif /* MACOS */
#include <ac/socket.h>
#ifdef _WIN32
#include <winsock.h>
#ifdef HAVE_IO_H
#include <io.h>
#endif /* _WIN32 */
#endif
#include "lber.h"
......@@ -320,8 +306,8 @@ ber_flush( Sockbuf *sb, BerElement *ber, int freeit )
return( -1 );
/* fake error if write was not atomic */
if (rc < towrite) {
#if !defined( MACOS ) && !defined( DOS )
errno = EMSGSIZE;
#if defined( WSAEMSGSIZE )
errno = WSAEMSGSIZE;
#endif
return( -1 );
}
......@@ -538,7 +524,7 @@ ber_get_next( Sockbuf *sb, unsigned long *len, BerElement *ber )
noctets ) {
return( LBER_DEFAULT );
}
*len = LBER_NTOHL( netlen );
*len = NTOHL( netlen );
} else {
*len = lc;
}
......@@ -557,7 +543,7 @@ ber_get_next( Sockbuf *sb, unsigned long *len, BerElement *ber )
#endif /* DOS && !_WIN32 */
if ( ( sb->sb_options & LBER_MAX_INCOMING_SIZE ) &&
*len > sb->sb_max_incoming ) {
*len > (unsigned long) sb->sb_max_incoming ) {
return( LBER_DEFAULT );
}
......
# Microsoft Developer Studio Project File - Name="liblber" - Package Owner=<4>
# Microsoft Developer Studio Generated Build File, Format Version 5.00
# ** DO NOT EDIT **
# TARGTYPE "Win32 (x86) Static Library" 0x0104
CFG=liblber - Win32 Debug
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
!MESSAGE use the Export Makefile command and run
!MESSAGE
!MESSAGE NMAKE /f "liblber.mak".
!MESSAGE
!MESSAGE You can specify a configuration when running NMAKE
!MESSAGE by defining the macro CFG on the command line. For example:
!MESSAGE
!MESSAGE NMAKE /f "liblber.mak" CFG="liblber - Win32 Debug"
!MESSAGE
!MESSAGE Possible choices for configuration are:
!MESSAGE
!MESSAGE "liblber - Win32 Release" (based on "Win32 (x86) Static Library")
!MESSAGE "liblber - Win32 Debug" (based on "Win32 (x86) Static Library")
!MESSAGE
# Begin Project
# PROP Scc_ProjName ""
# PROP Scc_LocalPath ""
CPP=cl.exe
!IF "$(CFG)" == "liblber - Win32 Release"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 0
# PROP BASE Output_Dir "Release"
# PROP BASE Intermediate_Dir "Release"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 0
# PROP Output_Dir "Release"
# PROP Intermediate_Dir "Release"
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /FD /c
# ADD CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /FD /c
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LIB32=link.exe -lib
# ADD BASE LIB32 /nologo
# ADD LIB32 /nologo
!ELSEIF "$(CFG)" == "liblber - Win32 Debug"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 1
# PROP BASE Output_Dir "Debug"
# PROP BASE Intermediate_Dir "Debug"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 1
# PROP Output_Dir "Debug"
# PROP Intermediate_Dir "Debug"
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /GX /Z7 /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /FD /c
# ADD CPP /nologo /W3 /GX /Z7 /Od /I "..\..\include" /I "..\..\..\include" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /FD /c
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LIB32=link.exe -lib
# ADD BASE LIB32 /nologo
# ADD LIB32 /nologo /out:"..\Debug\liblber.lib"
!ENDIF
# Begin Target
# Name "liblber - Win32 Release"
# Name "liblber - Win32 Debug"
# Begin Source File
SOURCE=.\bprint.c
# End Source File
# Begin Source File
SOURCE=.\decode.c
# End Source File
# Begin Source File
SOURCE=.\encode.c
# End Source File
# Begin Source File
SOURCE=.\io.c
# End Source File
# Begin Source File
SOURCE=..\..\include\lber.h
# End Source File
# End Target
# End Project
Microsoft Developer Studio Workspace File, Format Version 5.00
# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
###############################################################################
Project: "liblber"=.\liblber.dsp - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
}}}
###############################################################################
Global:
Package=<5>
{{{
}}}
Package=<3>
{{{
}}}
###############################################################################
......@@ -5,37 +5,24 @@
* abandon.c
*/
#include "portable.h"
#ifndef lint
static char copyright[] = "@(#) Copyright (c) 1990 Regents of the University of Michigan.\nAll rights reserved.\n";
#endif
#include <stdio.h>
#include <string.h>
#if !defined( MACOS ) && !defined( DOS )
#include <sys/types.h>
#include <sys/socket.h>
#endif
#if defined( DOS ) || defined( _WIN32 )
#include <malloc.h>
#include "msdos.h"
#endif /* DOS */
#ifdef MACOS
#include <stdlib.h>
#include "macos.h"
#endif /* MACOS */
#include <ac/socket.h>
#include <ac/string.h>
#include "lber.h"
#include "ldap.h"
#include "ldap-int.h"
#ifdef NEEDPROTOS
static int do_abandon( LDAP *ld, int origid, int msgid );
#else /* NEEDPROTOS */
static int do_abandon();
#endif /* NEEDPROTOS */
static int do_abandon LDAP_P(( LDAP *ld, int origid, int msgid ));
/*
* ldap_abandon - perform an ldap (and X.500) abandon operation. Parameters:
*
......@@ -107,7 +94,7 @@ do_abandon( LDAP *ld, int origid, int msgid )
err = 0;
if ( sendabandon ) {
/* create a message to send */
if ( (ber = alloc_ber_with_options( ld )) == NULLBER ) {
if ( (ber = ldap_alloc_ber_with_options( ld )) == NULLBER ) {
err = -1;
ld->ld_errno = LDAP_NO_MEMORY;
} else {
......@@ -151,10 +138,10 @@ do_abandon( LDAP *ld, int origid, int msgid )
#ifdef LDAP_REFERRALS
if ( lr != NULL ) {
if ( sendabandon ) {
free_connection( ld, lr->lr_conn, 0, 1 );
ldap_free_connection( ld, lr->lr_conn, 0, 1 );
}
if ( origid == msgid ) {
free_request( ld, lr );
ldap_free_request( ld, lr );
}
}
#endif /* LDAP_REFERRALS */
......
......@@ -5,26 +5,16 @@
* add.c
*/
#ifndef lint
#include "portable.h"
#ifndef lint
static char copyright[] = "@(#) Copyright (c) 1990 Regents of the University of Michigan.\nAll rights reserved.\n";
#endif
#include <stdio.h>
#include <string.h>
#ifdef MACOS
#include "macos.h"
#endif /* MACOS */
#if defined( DOS ) || defined( _WIN32 )
#include <malloc.h>
#include "msdos.h"
#endif /* DOS */
#if !defined( MACOS ) && !defined( DOS )
#include <sys/types.h>
#include <sys/socket.h>
#endif /* !MACOS && !DOS */
#include <ac/socket.h>
#include <ac/string.h>
#include "lber.h"
#include "ldap.h"
......@@ -69,7 +59,7 @@ ldap_add( LDAP *ld, char *dn, LDAPMod **attrs )