#include "lber-int.h"
-static ber_tag_t ber_getnint LDAP_P((
+static ber_len_t ber_getnint LDAP_P((
BerElement *ber,
ber_int_t *num,
ber_len_t len ));
* Next, read the length. The first byte contains the length of
* the length. If bit 8 is set, the length is the long form,
* otherwise it's the short form. We don't allow a length that's
- * greater than what we can hold in an unsigned long.
+ * greater than what we can hold in a ber_len_t.
*/
*len = netlen = 0;
return( tag );
}
-static ber_tag_t
+static ber_len_t
ber_getnint(
BerElement *ber,
ber_int_t *num,
if ( (tag = ber_skip_tag( ber, &len )) == LBER_DEFAULT )
return( LBER_DEFAULT );
- if ( (unsigned long) ber_getnint( ber, num, len ) != len )
+ if ( ber_getnint( ber, num, len ) != len )
return( LBER_DEFAULT );
else
return( tag );
if ( datalen > (*len - 1) )
return( LBER_DEFAULT );
- if ( (unsigned long) ber_read( ber, buf, datalen ) != datalen )
+ if ( (ber_len_t) ber_read( ber, buf, datalen ) != datalen )
return( LBER_DEFAULT );
buf[datalen] = '\0';
if ( (*buf = (char *) LBER_MALLOC( datalen + 1 )) == NULL )
return( LBER_DEFAULT );
- if ( (unsigned long) ber_read( ber, *buf, datalen ) != datalen ) {
+ if ( (ber_len_t) ber_read( ber, *buf, datalen ) != datalen ) {
LBER_FREE( *buf );
*buf = NULL;
return( LBER_DEFAULT );
return( LBER_DEFAULT );
}
- if ( (unsigned long) ber_read( ber, *buf, datalen ) != datalen ) {
+ if ( (ber_len_t) ber_read( ber, *buf, datalen ) != datalen ) {
LBER_FREE( buf );
*buf = NULL;
return( LBER_DEFAULT );
char *s;
int rc;
- unsigned long tag, len;
+ ber_tag_t tag;
+ ber_len_t len;
BerElement *ber;
Sockbuf *sb;
}
printf("decode: message tag 0x%lx and length %ld\n",
- tag, len );
+ (unsigned long) tag, (long) len );
for( s = argv[1]; *s; s++ ) {
char buf[128];
*/
if ( len <= 127 ) {
- netlen = LBER_LEN_HTON( len );
- return( ber_write( ber, (char *) &netlen + sizeof(long) - 1,
- 1, nosos ) );
+ char length_byte = (char) len;
+ return( ber_write( ber, &length_byte, 1, nosos ) );
}
/*
#endif /* STR_TRANSLATION */
if ( (lenlen = ber_put_len( ber, len, 0 )) == -1 ||
- (unsigned long) ber_write( ber, str, len, 0 ) != len ) {
+ (ber_len_t) ber_write( ber, str, len, 0 ) != len ) {
rc = -1;
} else {
/* return length of tag + length + contents */
return( -1 );
/* the length itself */
- if ( ber_write( ber, (char *) &netlen + sizeof(long)
+ if ( ber_write( ber, (char *) (&netlen + 1)
- (FOUR_BYTE_LEN - 1), FOUR_BYTE_LEN - 1, 1 )
!= FOUR_BYTE_LEN - 1 )
return( -1 );