if ( (size_t)file_offset >= sbuf.st_size )
return -1;
- /* if block_size == 0, we are parsnig HBIN records and need
+ /* if block_size == 0, we are parsing HBIN records and need
to read some of the header to get the block_size from there */
if ( block_size == 0 ) {
}
/*******************************************************************
- Input a randon offset and receive the correpsonding HBIN
+ Input a random offset and receive the corresponding HBIN
block for it
*******************************************************************/
}
/*******************************************************************
- Input a randon offset and receive the correpsonding HBIN
+ Input a random offset and receive the corresponding HBIN
block for it
*******************************************************************/
/* start with the open list */
for ( hbin=file->block_list; hbin; hbin=hbin->next ) {
- DEBUG(10,("lookup_hbin_block: address = 0x%x [0x%x]\n", hbin->file_off, (uint32)hbin ));
+ DEBUG(10,("lookup_hbin_block: address = 0x%x [0x%lx]\n", hbin->file_off, (unsigned long)hbin ));
if ( hbin_contains_offset( hbin, offset ) )
return hbin;
}
if ( curr_off == 0 )
prs_set_offset( ps, HBIN_HEADER_REC_SIZE );
- /* assume that the current offset is at the reacord header
+ /* assume that the current offset is at the record header
and we need to backup to read the record size */
curr_off -= sizeof(uint32);
static int hashrec_cmp( REGF_HASH_REC *h1, REGF_HASH_REC *h2 )
{
- return strcmp( h1->fullname, h2->fullname );
+ return StrCaseCmp( h1->fullname, h2->fullname );
}
/*******************************************************************
DLIST_ADD_END( file->sec_desc_list, nk->sec_desc, tmp );
- /* initialize offsets */
-
- nk->sec_desc->prev_sk_off = nk->sec_desc->sk_off;
- nk->sec_desc->next_sk_off = nk->sec_desc->sk_off;
-
- /* now update the offsets for us and the previous sd in the list */
+ /* update the offsets for us and the previous sd in the list.
+ if this is the first record, then just set the next and prev
+ offsets to ourself. */
if ( nk->sec_desc->prev ) {
REGF_SK_REC *prev = nk->sec_desc->prev;
nk->sec_desc->prev_sk_off = prev->hbin_off + prev->hbin->first_hbin_off - HBIN_HDR_SIZE;
- prev->next_sk_off = nk->sk_off;
+ prev->next_sk_off = nk->sec_desc->sk_off;
+
+ /* the end must loop around to the front */
+ nk->sec_desc->next_sk_off = file->sec_desc_list->sk_off;
+
+ /* and first must loop around to the tail */
+ file->sec_desc_list->prev_sk_off = nk->sec_desc->sk_off;
+ } else {
+ nk->sec_desc->prev_sk_off = nk->sec_desc->sk_off;
+ nk->sec_desc->next_sk_off = nk->sec_desc->sk_off;
}
}
- /* dump the reference count */
+ /* bump the reference count +1 */
nk->sk_off = nk->sec_desc->sk_off;
nk->sec_desc->ref_count++;