fix issue with the question to byte
This commit is contained in:
parent
b16cf6df7c
commit
1e1ee73fbc
2 changed files with 7 additions and 4 deletions
|
@ -3,7 +3,7 @@ open Utils
|
|||
|
||||
let header_to_bytes header =
|
||||
new_buffer
|
||||
header
|
||||
(2 * get_obj_size header)
|
||||
[ header.id
|
||||
; header.flags
|
||||
; header.num_questions
|
||||
|
@ -14,7 +14,9 @@ let header_to_bytes header =
|
|||
;;
|
||||
|
||||
let question_to_bytes question =
|
||||
let buffer = new_buffer question [ question.type_; question.class_ ] in
|
||||
let buffer =
|
||||
new_buffer (2 * (get_obj_size question - 1)) [ question.type_; question.class_ ]
|
||||
in
|
||||
Bytes.cat buffer question.name
|
||||
;;
|
||||
|
||||
|
|
|
@ -11,8 +11,9 @@ let get_bytecode data =
|
|||
String.concat "" result
|
||||
;;
|
||||
|
||||
let new_buffer obj list =
|
||||
let size = 2 * Obj.size (Obj.repr obj) in
|
||||
let get_obj_size obj = Obj.size (Obj.repr obj)
|
||||
|
||||
let new_buffer size list =
|
||||
let buffer = Bytes.create size in
|
||||
let verification =
|
||||
List.fold_left
|
||||
|
|
Reference in a new issue