iobuffer 1.1.0 → 1.1.1
Sign up to get free protection for your applications and to get access to all the features.
- data/ext/extconf.rb +1 -1
- data/ext/iobuffer.c +11 -11
- data/lib/iobuffer/version.rb +2 -2
- data/lib/iobuffer.rb +2 -0
- data/lib/iobuffer_ext.bundle +0 -0
- metadata +11 -8
data/ext/extconf.rb
CHANGED
data/ext/iobuffer.c
CHANGED
@@ -81,7 +81,7 @@ static int buffer_write_to(struct buffer * buf, int fd);
|
|
81
81
|
* Ruby IO objects.
|
82
82
|
*/
|
83
83
|
void
|
84
|
-
|
84
|
+
Init_iobuffer_ext()
|
85
85
|
{
|
86
86
|
cIO_Buffer = rb_define_class_under(rb_cIO, "Buffer", rb_cObject);
|
87
87
|
rb_define_alloc_func(cIO_Buffer, IO_Buffer_allocate);
|
@@ -287,6 +287,9 @@ IO_Buffer_prepend(VALUE self, VALUE data)
|
|
287
287
|
* Read the specified abount of data from the buffer. If no value
|
288
288
|
* is given the entire contents of the buffer are returned. Any data
|
289
289
|
* read from the buffer is cleared.
|
290
|
+
* The given length must be greater than 0 or an exception would raise.
|
291
|
+
* If the buffer size is zero then an empty string is returned (regardless
|
292
|
+
* the given length).
|
290
293
|
*/
|
291
294
|
static VALUE
|
292
295
|
IO_Buffer_read(int argc, VALUE * argv, VALUE self)
|
@@ -299,18 +302,15 @@ IO_Buffer_read(int argc, VALUE * argv, VALUE self)
|
|
299
302
|
|
300
303
|
if (rb_scan_args(argc, argv, "01", &length_obj) == 1) {
|
301
304
|
length = NUM2INT(length_obj);
|
302
|
-
|
303
|
-
|
304
|
-
|
305
|
-
|
306
|
-
|
307
|
-
}
|
308
|
-
|
309
|
-
if (length > buf->size)
|
305
|
+
if(length < 1)
|
306
|
+
rb_raise(rb_eArgError, "length must be greater than zero");
|
307
|
+
if(length > buf->size)
|
308
|
+
length = buf->size;
|
309
|
+
} else
|
310
310
|
length = buf->size;
|
311
311
|
|
312
|
-
if
|
313
|
-
|
312
|
+
if(buf->size == 0)
|
313
|
+
return rb_str_new2("");
|
314
314
|
|
315
315
|
str = rb_str_new(0, length);
|
316
316
|
buffer_read(buf, RSTRING_PTR(str), length);
|
data/lib/iobuffer/version.rb
CHANGED
data/lib/iobuffer.rb
ADDED
Binary file
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: iobuffer
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
4
|
+
version: 1.1.1
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -13,7 +13,7 @@ date: 2012-02-13 00:00:00.000000000 Z
|
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rake-compiler
|
16
|
-
requirement: &
|
16
|
+
requirement: &70314510650840 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
@@ -21,10 +21,10 @@ dependencies:
|
|
21
21
|
version: '0'
|
22
22
|
type: :development
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *70314510650840
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: rake
|
27
|
-
requirement: &
|
27
|
+
requirement: &70314510650200 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ! '>='
|
@@ -32,10 +32,10 @@ dependencies:
|
|
32
32
|
version: '0'
|
33
33
|
type: :development
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *70314510650200
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: rspec
|
38
|
-
requirement: &
|
38
|
+
requirement: &70314510649400 !ruby/object:Gem::Requirement
|
39
39
|
none: false
|
40
40
|
requirements:
|
41
41
|
- - ! '>='
|
@@ -43,16 +43,19 @@ dependencies:
|
|
43
43
|
version: '0'
|
44
44
|
type: :development
|
45
45
|
prerelease: false
|
46
|
-
version_requirements: *
|
46
|
+
version_requirements: *70314510649400
|
47
47
|
description: fast buffers for non-blocking IO
|
48
48
|
email:
|
49
49
|
- tony.arcieri@gmail.com
|
50
50
|
executables: []
|
51
|
-
extensions:
|
51
|
+
extensions:
|
52
|
+
- ext/extconf.rb
|
52
53
|
extra_rdoc_files: []
|
53
54
|
files:
|
54
55
|
- README.md
|
55
56
|
- lib/iobuffer/version.rb
|
57
|
+
- lib/iobuffer.rb
|
58
|
+
- lib/iobuffer_ext.bundle
|
56
59
|
- ext/iobuffer.c
|
57
60
|
- ext/extconf.rb
|
58
61
|
homepage: https://github.com/tarcieri/iobuffer
|