We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 2fd7de8 commit fab9351Copy full SHA for fab9351
src/core/in_buf.ml
@@ -16,15 +16,17 @@ class virtual t_from_refill ?(bytes = Bytes.create _default_buf_size) () =
16
(** Consume [n] bytes from the inner buffer. *)
17
18
method input b i len : int =
19
- let buf = self#fill_buf () in
20
-
21
- if buf.len > 0 then (
22
- let n = min len buf.len in
23
- Bytes.blit buf.bytes buf.off b i n;
24
- Slice.consume buf n;
25
- n
26
- ) else
27
- 0
+ if len = 0 then 0
+ else (
+ let slice = self#fill_buf () in
+ if slice.len > 0 then (
+ let n = min len slice.len in
+ Bytes.blit slice.bytes slice.off b i n;
+ Slice.consume slice n;
+ n
+ ) else
28
+ 0
29
+ )
30
(** Default implementation of [input] using [fill_buf] *)
31
end
32
0 commit comments