#include <ac/string.h>
#include <ac/socket.h>
-#undef LDAP_F_PRE
-#define LDAP_F_PRE LDAP_F_EXPORT
-
#include "lber-int.h"
static ber_len_t ber_getnint LDAP_P((
{
unsigned char xbyte;
ber_tag_t tag;
- char *tagp;
unsigned int i;
assert( ber != NULL );
if ( ber_read( ber, (char *) &xbyte, 1 ) != 1 )
return( LBER_DEFAULT );
+ tag = xbyte;
+
if ( (xbyte & LBER_BIG_TAG_MASK) != LBER_BIG_TAG_MASK )
- return( (ber_tag_t) xbyte );
+ return tag;
- tagp = (char *) &tag;
- tagp[0] = xbyte;
for ( i = 1; i < sizeof(ber_tag_t); i++ ) {
if ( ber_read( ber, (char *) &xbyte, 1 ) != 1 )
return( LBER_DEFAULT );
- tagp[i] = xbyte;
+ tag << 8;
+ tag |= 0x00ffUL & (ber_tag_t) xbyte;
if ( ! (xbyte & LBER_MORE_TAG_MASK) )
break;
if ( i == sizeof(ber_tag_t) )
return( LBER_DEFAULT );
- /* want leading, not trailing 0's */
- return( tag >> (sizeof(ber_tag_t) - i - 1) );
+ return tag;
}
ber_tag_t