servlib/bundling/BPQBlock.cc
changeset 42 6e7559bfcb52
parent 41 dff653fd2b4f
child 43 721d4a13bd0b
--- a/servlib/bundling/BPQBlock.cc	Mon Aug 15 16:08:43 2011 +0100
+++ b/servlib/bundling/BPQBlock.cc	Mon Aug 15 17:48:10 2011 +0100
@@ -184,12 +184,12 @@
     }
 
     int decoding_len=0; 
-    u_int i=0, j=0, len=0, num_frags=0;
+    u_int i=0, j=0, offset=0, len=0, flen=0, num_frags=0;
     u_char* buf = 0;
  
 /////////////////////////////////////////////////////
     ASSERT ( block != NULL );
-    ASSERT ( block->data() != NULL );
+//    ASSERT ( block->data() != NULL );
     // BPQ Kind must be 0 or 1
     if ( *(block->data()) != 0 &&
          *(block->data()) != 1 ) {
@@ -209,8 +209,22 @@
         (block->reloaded()) ? "true" : "false" );
 ////////////////////////////////////////////////////
 
+    log_debug_p(LOG, "BPQBlock::initialise: extracting offset");
+    offset = block->data_offset();
+    log_debug_p(LOG, "BPQBlock::initialise: extracting full len");
+    flen = block->full_length();
     log_debug_p(LOG, "BPQBlock::initialise: extracting len");
     len = block->data_length();
+
+    if ( flen != offset + len ) {
+        log_err_p(LOG, "BPQBlock::initialise: flen != offset + len");
+    }
+    if ( block->writable_contents()->buf_len() < flen ){
+        log_err_p(LOG, "BPQBlock::initialise:  buf_len() < flen");
+        log_err_p(LOG, "BPQBlock::initialise:  buf_len() = %lu", 
+            block->writable_contents()->buf_len());
+    }
+
     log_debug_p(LOG, "BPQBlock::initialise: extracting buf");
     buf = block->data();