nitlanguage
/
nit.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
d55330d
)
lib/socket: fix enlarge buffer when size is at 0
author
Alexis Laferrière
<alexis.laf@xymus.net>
Fri, 29 May 2015 16:29:50 +0000
(12:29 -0400)
committer
Alexis Laferrière
<alexis.laf@xymus.net>
Fri, 29 May 2015 17:08:15 +0000
(13:08 -0400)
Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>
lib/socket/socket.nit
patch
|
blob
|
history
diff --git
a/lib/socket/socket.nit
b/lib/socket/socket.nit
index
a665b41
..
251c78a
100644
(file)
--- a/
lib/socket/socket.nit
+++ b/
lib/socket/socket.nit
@@
-182,7
+182,7
@@
class TCPStream
fun enlarge(len: Int) do
if _buffer_capacity >= len then return
- while _buffer_capacity < len do _buffer_capacity *= 2
+ while _buffer_capacity < len do _buffer_capacity = _buffer_capacity * 2 + 2
var ns = new NativeString(_buffer_capacity)
_buffer.copy_to(ns, _buffer_length - _buffer_pos, _buffer_pos, 0)
_buffer = ns