kgio 1.3.0 → 1.3.0.1.gd225
Sign up to get free protection for your applications and to get access to all the features.
- data/ChangeLog +8 -0
- data/GIT-VERSION-FILE +1 -1
- data/ext/kgio/read_write.c +13 -7
- data/test/lib_read_write.rb +14 -0
- metadata +11 -7
data/ChangeLog
CHANGED
@@ -1,5 +1,13 @@
|
|
1
1
|
ChangeLog from git://git.bogomips.org/kgio.git ()
|
2
2
|
|
3
|
+
commit d225ede82d820d045bd7cfb826f444cf6601577c
|
4
|
+
Author: Eric Wong <normalperson@yhbt.net>
|
5
|
+
Date: Fri Oct 8 02:53:38 2010 -0700
|
6
|
+
|
7
|
+
return empty string on length=0
|
8
|
+
|
9
|
+
This matches behavior of all the core Ruby methods.
|
10
|
+
|
3
11
|
commit e4599227f0da0f652cbcb52838e631d7384dcd0d
|
4
12
|
Author: Eric Wong <e@yhbt.net>
|
5
13
|
Date: Thu Oct 7 20:02:40 2010 -0700
|
data/GIT-VERSION-FILE
CHANGED
@@ -1 +1 @@
|
|
1
|
-
GIT_VERSION = 1.3.0
|
1
|
+
GIT_VERSION = 1.3.0.1.gd225
|
data/ext/kgio/read_write.c
CHANGED
@@ -92,11 +92,14 @@ static VALUE my_read(int io_wait, int argc, VALUE *argv, VALUE io)
|
|
92
92
|
long n;
|
93
93
|
|
94
94
|
prepare_read(&a, argc, argv, io);
|
95
|
-
|
95
|
+
|
96
|
+
if (a.len > 0) {
|
97
|
+
set_nonblocking(a.fd);
|
96
98
|
retry:
|
97
|
-
|
98
|
-
|
99
|
-
|
99
|
+
n = (long)read(a.fd, a.ptr, a.len);
|
100
|
+
if (read_check(&a, n, "read", io_wait) != 0)
|
101
|
+
goto retry;
|
102
|
+
}
|
100
103
|
return a.buf;
|
101
104
|
}
|
102
105
|
|
@@ -159,10 +162,13 @@ static VALUE my_recv(int io_wait, int argc, VALUE *argv, VALUE io)
|
|
159
162
|
long n;
|
160
163
|
|
161
164
|
prepare_read(&a, argc, argv, io);
|
165
|
+
|
166
|
+
if (a.len > 0) {
|
162
167
|
retry:
|
163
|
-
|
164
|
-
|
165
|
-
|
168
|
+
n = (long)recv(a.fd, a.ptr, a.len, MSG_DONTWAIT);
|
169
|
+
if (read_check(&a, n, "recv", io_wait) != 0)
|
170
|
+
goto retry;
|
171
|
+
}
|
166
172
|
return a.buf;
|
167
173
|
}
|
168
174
|
|
data/test/lib_read_write.rb
CHANGED
@@ -18,6 +18,20 @@ module LibReadWriteTest
|
|
18
18
|
end
|
19
19
|
end
|
20
20
|
|
21
|
+
def test_read_zero
|
22
|
+
assert_equal "", @rd.kgio_read(0)
|
23
|
+
buf = "foo"
|
24
|
+
assert_equal buf.object_id, @rd.kgio_read(0, buf).object_id
|
25
|
+
assert_equal "", buf
|
26
|
+
end
|
27
|
+
|
28
|
+
def test_tryread_zero
|
29
|
+
assert_equal "", @rd.kgio_tryread(0)
|
30
|
+
buf = "foo"
|
31
|
+
assert_equal buf.object_id, @rd.kgio_tryread(0, buf).object_id
|
32
|
+
assert_equal "", buf
|
33
|
+
end
|
34
|
+
|
21
35
|
def test_read_eof
|
22
36
|
@wr.close
|
23
37
|
assert_nil @rd.kgio_read(5)
|
metadata
CHANGED
@@ -1,13 +1,15 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: kgio
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
5
|
-
prerelease:
|
4
|
+
hash: 375488223
|
5
|
+
prerelease: true
|
6
6
|
segments:
|
7
7
|
- 1
|
8
8
|
- 3
|
9
9
|
- 0
|
10
|
-
|
10
|
+
- 1
|
11
|
+
- gd225
|
12
|
+
version: 1.3.0.1.gd225
|
11
13
|
platform: ruby
|
12
14
|
authors:
|
13
15
|
- kgio hackers
|
@@ -112,12 +114,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
112
114
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
113
115
|
none: false
|
114
116
|
requirements:
|
115
|
-
- - "
|
117
|
+
- - ">"
|
116
118
|
- !ruby/object:Gem::Version
|
117
|
-
hash:
|
119
|
+
hash: 25
|
118
120
|
segments:
|
119
|
-
-
|
120
|
-
|
121
|
+
- 1
|
122
|
+
- 3
|
123
|
+
- 1
|
124
|
+
version: 1.3.1
|
121
125
|
requirements: []
|
122
126
|
|
123
127
|
rubyforge_project: rainbows
|