servlib/bundling/BPQBlock.cc
changeset 40 c592e9b12a86
parent 39 6c24826aaf8e
child 41 dff653fd2b4f
--- a/servlib/bundling/BPQBlock.cc	Mon Aug 15 14:54:38 2011 +0100
+++ b/servlib/bundling/BPQBlock.cc	Mon Aug 15 15:54:40 2011 +0100
@@ -183,10 +183,19 @@
         block = b;
     }
 
+    int decoding_len=0; 
+    u_int i=0, j=0, len=0, num_frags=0;
+    u_char* buf = 0;
+ 
 /////////////////////////////////////////////////////
     ASSERT ( block != NULL );
-    
+    ASSERT ( block->data() != NULL );
+    // BPQ Kind must be 0 or 1
+    ASSERT ( *(block->data()) == 0 ||
+             *(block->data()) == 1 ); 
+
     log_debug_p(LOG, "BPQBlock::initialise: block != NULL");
+    log_debug_p(LOG, "BPQBlock::initialise: block->data() != NULL"); 
 
     log_debug_p(LOG, "BPQBlock::initialise: data_length() = %d", block->data_length());
     log_debug_p(LOG, "BPQBlock::initialise: data_offset() = %d", block->data_offset());
@@ -196,29 +205,15 @@
     log_debug_p(LOG, "BPQBlock::initialise: reloaded() = %s", 
         (block->reloaded()) ? "true" : "false" );
 ////////////////////////////////////////////////////
-    if(block->data() == NULL) {
-        log_debug_p(LOG, "BPQBlock::initialise: block->data() == NULL"); 
 
-        kind_ = KIND_QUERY;
-        matching_rule_ = 1;
-        query_len_ = 0;
-        query_val_ = 0;
-        
-        return BP_FAIL;
-    }
-
-    int decoding_len=0; 
-    u_int i=0, j=0;
-    u_int len = block->data_length();
-    log_debug_p(LOG, "BPQBlock::initialise: len = %u", len);
-    u_int num_frags;
-    ASSERT ( block->data() != NULL );
-    u_char* buf = block->data();
-    //log_debug_p(LOG, "BPQBlock::initialise: buf = %s", buf);
+    log_debug_p(LOG, "BPQBlock::initialise: extracting len");
+    len = block->data_length();
+    log_debug_p(LOG, "BPQBlock::initialise: extracting buf");
+    buf = block->data();
 
     // BPQ-kind             1-byte
     if ( i < len ) {
-        ASSERT ( buf[i] == 0 || buf[i] == 1 );
+        log_debug_p(LOG, "BPQBlock::initialise: extracting kind");
         kind_ = (kind_t) buf[i++];
         log_debug_p(LOG, "BPQBlock::initialise: kind = %d", kind_);
     }