Diff for /libraries/liblber/decode.c between versions 1.1.3.1 and 1.4

version 1.1.3.1, 1998/08/08 22:43:15 version 1.4, 1998/08/17 21:26:26
Line 17 Line 17
 #include <stdarg.h>  #include <stdarg.h>
 #include "macos.h"  #include "macos.h"
 #else /* MACOS */  #else /* MACOS */
 #if defined(NeXT) || defined(VMS)  
   #if defined(NeXT) || defined(VMS) || defined(__FreeBSD__)
 #include <stdlib.h>  #include <stdlib.h>
 #else /* next || vms */  #else /* next || vms || freebsd */
 #include <malloc.h>  #include <malloc.h>
 #endif /* next || vms */  #endif /* next || vms || freebsd */
 #if defined(BC31) || defined(_WIN32)  #if defined(BC31) || defined(_WIN32)
 #include <stdarg.h>  #include <stdarg.h>
 #else /* BC31 || _WIN32 */  #else /* BC31 || _WIN32 */
Line 155  ber_getnint( BerElement *ber, long *num, Line 156  ber_getnint( BerElement *ber, long *num,
 {  {
         int     diff, sign, i;          int     diff, sign, i;
         long    netnum;          long    netnum;
           char    *p;
   
         /*          /*
          * The tag and length have already been stripped off.  We should           * The tag and length have already been stripped off.  We should
Line 172  ber_getnint( BerElement *ber, long *num, Line 174  ber_getnint( BerElement *ber, long *num,
         if ( ber_read( ber, ((char *) &netnum) + diff, len ) != len )          if ( ber_read( ber, ((char *) &netnum) + diff, len ) != len )
                 return( -1 );                  return( -1 );
   
         /* sign extend if necessary */          /* sign extend if necessary */
         sign = ((0x80 << ((len - 1) * 8)) & netnum);          p = (char *) &netnum;
         if ( sign && len < sizeof(long) ) {          sign = (0x80 & *(p+diff) );
                 for ( i = sizeof(long) - 1; i > len - 1; i-- ) {          if ( sign && len < sizeof(long) ) {
                         netnum |= (0xffL << (i * 8));                  for ( i = 0; i < diff; i++ ) {
                           *(p+i) = 0xff;
                 }                  }
         }          }
         *num = LBER_NTOHL( netnum );          *num = LBER_NTOHL( netnum );

Removed from v.1.1.3.1  
changed lines
  Added in v.1.4


______________
© Copyright 1998-2020, OpenLDAP Foundation, info@OpenLDAP.org