apps/dtnquery/dtnquery.c
changeset 9 b72ba16e5586
parent 8 ce3cb8a86959
child 12 7463e4bb80e4
equal deleted inserted replaced
8:ce3cb8a86959 9:b72ba16e5586
   688 
   688 
   689     // matching rule type   1-byte
   689     // matching rule type   1-byte
   690     if (i<buf_len) bpq->matching_rule = (u_int) buf[i++];
   690     if (i<buf_len) bpq->matching_rule = (u_int) buf[i++];
   691 
   691 
   692     // BPQ-value-length     SDNV
   692     // BPQ-value-length     SDNV
   693     if ( (q_decoding_len = sdnv_decode (buf[i], buf_len - i, &(bpq->query.query_len))) == -1 )
   693     if ( (q_decoding_len = sdnv_decode (&(buf[i]), buf_len - i, &(bpq->query.query_len))) == -1 )
   694         return -1;
   694         return -1;
   695     i += q_decoding_len;
   695     i += q_decoding_len;
   696 
   696 
   697     // BPQ-value            n-bytes
   697     // BPQ-value            n-bytes
   698     if (i<buf_len) bpq->query.query_val = &(buf[i]);
   698     if (i<buf_len) bpq->query.query_val = &(buf[i]);
   699     i += bpq->query.query_len;
   699     i += bpq->query.query_len;
   700 
   700 
   701     // number of fragments  SDNV
   701     // number of fragments  SDNV
   702     if ( (f_decoding_len = sdnv_decode (buf[i], buf_len - i, &(bpq->fragments.num_frag_returned))) == -1 )
   702     if ( (f_decoding_len = sdnv_decode (&(buf[i]), buf_len - i, &(bpq->fragments.num_frag_returned))) == -1 )
   703         return -1;
   703         return -1;
   704     i += f_decoding_len;
   704     i += f_decoding_len;
   705 
   705 
   706     for (j=0; i<buf_len && j<bpq->fragments.num_frag_returned; ++j) {
   706     for (j=0; i<buf_len && j<bpq->fragments.num_frag_returned; ++j) {
   707 
   707 
   708         // fragment offsets     SDNV
   708         // fragment offsets     SDNV
   709         if ( (decoding_len = sdnv_decode (buf[i], buf_len - i, &(bpq->fragments.frag_offsets[j]))) == -1 )
   709         if ( (decoding_len = sdnv_decode (&(buf[i]), buf_len - i, &(bpq->fragments.frag_offsets[j]))) == -1 )
   710             return -1;
   710             return -1;
   711         i += decoding_len;
   711         i += decoding_len;
   712 
   712 
   713         // fragment lengths     SDNV
   713         // fragment lengths     SDNV
   714         if ( (decoding_len = sdnv_decode (buf[i], buf_len - i, &(bpq->fragments.frag_lenghts[j]))) == -1 )
   714         if ( (decoding_len = sdnv_decode (&(buf[i]), buf_len - i, &(bpq->fragments.frag_lenghts[j]))) == -1 )
   715             return -1;
   715             return -1;
   716         i += decoding_len;
   716         i += decoding_len;
   717     }
   717     }
   718 
   718 
   719     if (i != buf_len)
   719     if (i != buf_len)