Changeset 33 for trunk/lib


Ignore:
Timestamp:
07/17/05 15:03:02 (19 years ago)
Author:
tim
Message:

Fixed some bugs.

rewrote testing code to allow for a path filter expression.

Location:
trunk/lib
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/lib/regfio.c

    r32 r33  
    254254/*******************************************************************
    255255 *******************************************************************/
    256 static bool prs_nk_rec( const char *desc, prs_struct *ps, int depth, REGF_NK_REC *nk )
     256static bool prs_nk_rec( const char *desc, prs_struct *ps,
     257                        int depth, REGF_NK_REC *nk )
    257258{
    258259  uint16 class_length, name_length;
     
    266267  depth++;
    267268       
    268   /* back up and get the data_size */
    269        
     269  /* back up and get the data_size */   
    270270  if ( !prs_set_offset( ps, ps->data_offset-sizeof(uint32)) )
    271271    return false;
     
    274274    return false;
    275275       
    276   if ( !prs_uint8s( true, "header", ps, depth, nk->header, sizeof( nk->header )) )
     276  if (!prs_uint8s(true, "header", ps, depth, nk->header, sizeof(nk->header)))
    277277    return false;
    278278               
     
    307307    return false;
    308308
    309   if ( !prs_uint32( "max_bytes_subkeyname", ps, depth, &nk->max_bytes_subkeyname))
    310     return false;
    311   if ( !prs_uint32( "max_bytes_subkeyclassname", ps, depth, &nk->max_bytes_subkeyclassname))
    312     return false;
     309  if (!prs_uint32("max_bytes_subkeyname", ps, depth, &nk->max_bytes_subkeyname))
     310    return false;
     311  if ( !prs_uint32( "max_bytes_subkeyclassname", ps,
     312                    depth, &nk->max_bytes_subkeyclassname))
     313  { return false; }
    313314  if ( !prs_uint32( "max_bytes_valuename", ps, depth, &nk->max_bytes_valuename))
    314315    return false;
     
    325326    return false;       
    326327               
    327   if ( class_length ) {
     328  if ( class_length )
     329  {
    328330    ;;
    329331  }
    330332       
    331   if ( name_length ) {
    332     if ( ps->io ) {
    333       if ( !(nk->keyname = (char*)zcalloc(sizeof(char), name_length+1 )) )
     333  if ( name_length )
     334  {
     335    if(ps->io && !(nk->keyname = (char*)zcalloc(sizeof(char), name_length+1)))
    334336        return false;
    335     }
    336337
    337338    if ( !prs_uint8s( true, "name", ps, depth, nk->keyname, name_length) )
     
    344345  end_off = ps->data_offset;
    345346
    346   /* data_size must be divisible by 8 and large enough to hold the original record */
     347  /* data_size must be divisible by 8 and large enough to hold
     348     the original record */
    347349
    348350  data_size = ((start_off - end_off) & 0xfffffff8 );
    349   if ( data_size > nk->rec_size )
    350     /*DEBUG(10,("Encountered reused record (0x%x < 0x%x)\n", data_size, nk->rec_size));*/
    351 
    352     if ( !ps->io )
    353       nk->hbin->dirty = true;
    354 
     351  /*if ( data_size > nk->rec_size )
     352      DEBUG(10,("Encountered reused record (0x%x < 0x%x)\n", data_size, nk->rec_size));*/
     353
     354  if ( !ps->io )
     355    nk->hbin->dirty = true;
     356 
     357  nk->subkey_index = 0;
    355358  return true;
    356359}
     
    627630
    628631  data_size = ((start_off - end_off) & 0xfffffff8 );
    629   if ( data_size > lf->rec_size )
     632  /*  if ( data_size > lf->rec_size )*/
    630633    /*DEBUG(10,("Encountered reused record (0x%x < 0x%x)\n", data_size, lf->rec_size));*/
    631634
    632     if ( !hbin->ps.io )
    633       hbin->dirty = true;
     635  if ( !hbin->ps.io )
     636    hbin->dirty = true;
    634637
    635638  return true;
     
    681684
    682685  data_size = ((start_off - end_off) & 0xfffffff8 );
    683   if ( data_size > sk->rec_size )
     686  /*  if ( data_size > sk->rec_size )*/
    684687    /*DEBUG(10,("Encountered reused record (0x%x < 0x%x)\n", data_size, sk->rec_size));*/
    685688
    686     if ( !hbin->ps.io )
    687       hbin->dirty = true;
     689  if ( !hbin->ps.io )
     690    hbin->dirty = true;
    688691
    689692  return true;
     
    937940
    938941  /* get the initial nk record */
    939        
    940   if ( !prs_nk_rec( "nk_rec", &hbin->ps, depth, nk ))
     942  if (!prs_nk_rec("nk_rec", &hbin->ps, depth, nk))
    941943    return false;
    942944
    943945  /* fill in values */
    944        
    945946  if ( nk->num_values && (nk->values_off!=REGF_OFFSET_NONE) )
    946947  {
     
    12241225
    12251226
     1227/* XXX: An interator struct should be used instead, and this function
     1228 *   should operate on it, so the state of iteration isn't stored in the
     1229 * REGF_NK_REC struct itself.
     1230 */
    12261231/*******************************************************************
    12271232 This acts as an interator over the subkeys defined for a given
  • trunk/lib/void_stack.c

    r31 r33  
    5656    free(stack->elements[i]);
    5757  free(stack);
     58}
     59
     60
     61unsigned short void_stack_size(void_stack* stack)
     62{
     63  return stack->top;
    5864}
    5965
     
    121127
    122128
    123 void* void_stack_iterator_next(void_stack_iterator* iter)
     129const void* void_stack_iterator_next(void_stack_iterator* iter)
    124130{
    125131  if(iter->cur < iter->stack->top)
Note: See TracChangeset for help on using the changeset viewer.