Commit 5d579214 authored by Quanah Gibson-Mount's avatar Quanah Gibson-Mount
Browse files

Fix ordered indexing

parent 09c4191b
......@@ -638,9 +638,6 @@ scale( int new, lutil_int_decnum *prev, unsigned char *tmp )
part >>= 8;
}
}
j++;
prev->beg += j;
prev->len -= j;
}
out = tmp + prev->bufsiz - 1;
......@@ -651,11 +648,9 @@ scale( int new, lutil_int_decnum *prev, unsigned char *tmp )
if (!new )
break;
}
if ( !prev->len ) {
prev->beg += i;
prev->len = -i;
prev->len++;
}
i--;
prev->beg = prev->bufsiz + i;
prev->len = -i;
AC_MEMCPY( prev->buf+prev->beg, tmp+prev->beg, prev->len );
}
......
......@@ -2161,13 +2161,17 @@ integerIndexer(
rc = LDAP_INVALID_SYNTAX;
goto leave;
}
/* If too small, pad with zeros */
/* If too small, sign-extend */
if ( iv.bv_len < index_intlen ) {
int j, k;
int j, k, pad;
keys[i].bv_val[0] = index_intlen;
if (iv.bv_val[0] & 0x80)
pad = 0xff;
else
pad = 0;
k = index_intlen - iv.bv_len + 1;
for ( j=1; j<k; j++)
keys[i].bv_val[j] = 0;
keys[i].bv_val[j] = pad;
for ( j = 0; j<iv.bv_len; j++ )
keys[i].bv_val[j+k] = iv.bv_val[j];
} else {
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment