servlib/bundling/BPQBlock.cc
changeset 42 6e7559bfcb52
parent 41 dff653fd2b4f
child 43 721d4a13bd0b
equal deleted inserted replaced
41:dff653fd2b4f 42:6e7559bfcb52
   182         log_debug_p(LOG, "BPQBlock::initialise: b->source() == NULL");
   182         log_debug_p(LOG, "BPQBlock::initialise: b->source() == NULL");
   183         block = b;
   183         block = b;
   184     }
   184     }
   185 
   185 
   186     int decoding_len=0; 
   186     int decoding_len=0; 
   187     u_int i=0, j=0, len=0, num_frags=0;
   187     u_int i=0, j=0, offset=0, len=0, flen=0, num_frags=0;
   188     u_char* buf = 0;
   188     u_char* buf = 0;
   189  
   189  
   190 /////////////////////////////////////////////////////
   190 /////////////////////////////////////////////////////
   191     ASSERT ( block != NULL );
   191     ASSERT ( block != NULL );
   192     ASSERT ( block->data() != NULL );
   192 //    ASSERT ( block->data() != NULL );
   193     // BPQ Kind must be 0 or 1
   193     // BPQ Kind must be 0 or 1
   194     if ( *(block->data()) != 0 &&
   194     if ( *(block->data()) != 0 &&
   195          *(block->data()) != 1 ) {
   195          *(block->data()) != 1 ) {
   196         log_err_p(LOG, "BPQBlock::initialise: block->data() = %c(should be 0|1)",
   196         log_err_p(LOG, "BPQBlock::initialise: block->data() = %c(should be 0|1)",
   197             *(block->data()));
   197             *(block->data()));
   207         (block->complete()) ? "true" : "false" );
   207         (block->complete()) ? "true" : "false" );
   208     log_debug_p(LOG, "BPQBlock::initialise: reloaded() = %s", 
   208     log_debug_p(LOG, "BPQBlock::initialise: reloaded() = %s", 
   209         (block->reloaded()) ? "true" : "false" );
   209         (block->reloaded()) ? "true" : "false" );
   210 ////////////////////////////////////////////////////
   210 ////////////////////////////////////////////////////
   211 
   211 
       
   212     log_debug_p(LOG, "BPQBlock::initialise: extracting offset");
       
   213     offset = block->data_offset();
       
   214     log_debug_p(LOG, "BPQBlock::initialise: extracting full len");
       
   215     flen = block->full_length();
   212     log_debug_p(LOG, "BPQBlock::initialise: extracting len");
   216     log_debug_p(LOG, "BPQBlock::initialise: extracting len");
   213     len = block->data_length();
   217     len = block->data_length();
       
   218 
       
   219     if ( flen != offset + len ) {
       
   220         log_err_p(LOG, "BPQBlock::initialise: flen != offset + len");
       
   221     }
       
   222     if ( block->writable_contents()->buf_len() < flen ){
       
   223         log_err_p(LOG, "BPQBlock::initialise:  buf_len() < flen");
       
   224         log_err_p(LOG, "BPQBlock::initialise:  buf_len() = %lu", 
       
   225             block->writable_contents()->buf_len());
       
   226     }
       
   227 
   214     log_debug_p(LOG, "BPQBlock::initialise: extracting buf");
   228     log_debug_p(LOG, "BPQBlock::initialise: extracting buf");
   215     buf = block->data();
   229     buf = block->data();
   216 
   230 
   217     // BPQ-kind             1-byte
   231     // BPQ-kind             1-byte
   218     if ( i < len ) {
   232     if ( i < len ) {