bencode_ext 0.2.1 → 0.2.2
Sign up to get free protection for your applications and to get access to all the features.
- data/Rakefile +7 -7
- data/VERSION +1 -1
- data/bencode_ext.gemspec +3 -3
- data/ext/bencode_ext/bencode.c +5 -5
- metadata +4 -4
data/Rakefile
CHANGED
@@ -4,16 +4,16 @@ require 'rake'
|
|
4
4
|
require 'jeweler'
|
5
5
|
Jeweler::Tasks.new do |gem|
|
6
6
|
# gem is a Gem::Specification... see http://docs.rubygems.org/read/chapter/20 for more options
|
7
|
-
gem.name =
|
8
|
-
gem.homepage =
|
9
|
-
gem.license =
|
7
|
+
gem.name = 'bencode_ext'
|
8
|
+
gem.homepage = 'http://github.com/naquad/bencode_ext'
|
9
|
+
gem.license = 'MIT'
|
10
10
|
gem.summary = %Q{BitTorrent encoding parser/writer}
|
11
11
|
gem.description = %Q{BEncodeExt is implementation of Bencode reader/writer (BitTorent encoding) in C.}
|
12
|
-
gem.email =
|
13
|
-
gem.authors = [
|
12
|
+
gem.email = 'naquad@gmail.com'
|
13
|
+
gem.authors = ['naquad']
|
14
14
|
gem.required_ruby_version = '~>1.9.2'
|
15
|
-
gem.
|
16
|
-
gem.add_development_dependency
|
15
|
+
gem.add_development_dependency 'rake-compiler', '~>0.7.5'
|
16
|
+
gem.add_development_dependency 'jeweler', '~> 1.5.2'
|
17
17
|
end
|
18
18
|
Jeweler::RubygemsDotOrgTasks.new
|
19
19
|
Jeweler::GemcutterTasks.new
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.2.
|
1
|
+
0.2.2
|
data/bencode_ext.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{bencode_ext}
|
8
|
-
s.version = "0.2.
|
8
|
+
s.version = "0.2.2"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["naquad"]
|
12
|
-
s.date = %q{2011-01-
|
12
|
+
s.date = %q{2011-01-15}
|
13
13
|
s.description = %q{BEncodeExt is implementation of Bencode reader/writer (BitTorent encoding) in C.}
|
14
14
|
s.email = %q{naquad@gmail.com}
|
15
15
|
s.extensions = ["ext/bencode_ext/extconf.rb"]
|
@@ -46,7 +46,7 @@ Gem::Specification.new do |s|
|
|
46
46
|
s.specification_version = 3
|
47
47
|
|
48
48
|
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
49
|
-
s.
|
49
|
+
s.add_development_dependency(%q<rake-compiler>, ["~> 0.7.5"])
|
50
50
|
s.add_development_dependency(%q<jeweler>, ["~> 1.5.2"])
|
51
51
|
else
|
52
52
|
s.add_dependency(%q<rake-compiler>, ["~> 0.7.5"])
|
data/ext/bencode_ext/bencode.c
CHANGED
@@ -108,7 +108,7 @@ static VALUE decode(VALUE self, VALUE encoded){
|
|
108
108
|
case '0'...'9':{
|
109
109
|
long slen = parse_num(&str, &len);
|
110
110
|
|
111
|
-
if(
|
111
|
+
if(len && *str != ':')
|
112
112
|
rb_raise(DecodeError, "Invalid string length specification at %d: %c", rlen - len, *str);
|
113
113
|
|
114
114
|
if(!len || len < slen + 1)
|
@@ -136,10 +136,10 @@ static VALUE decode(VALUE self, VALUE encoded){
|
|
136
136
|
ret = crt;
|
137
137
|
break;
|
138
138
|
}else{
|
139
|
-
if(
|
139
|
+
if(BUILTIN_TYPE(current_container) == T_ARRAY){
|
140
140
|
rb_ary_push(current_container, crt);
|
141
141
|
}else if(NIL_P(key)){
|
142
|
-
if(
|
142
|
+
if(BUILTIN_TYPE(crt) != T_STRING)
|
143
143
|
rb_raise(DecodeError, "Dictionary key must be a string (at %d)!", rlen - len);
|
144
144
|
key = crt;
|
145
145
|
}else{
|
@@ -149,7 +149,7 @@ static VALUE decode(VALUE self, VALUE encoded){
|
|
149
149
|
|
150
150
|
if(state == ELEMENT_STRUCT){
|
151
151
|
rb_ary_push(container_stack, current_container);
|
152
|
-
if(max_depth
|
152
|
+
if(max_depth != -1 && max_depth < RARRAY_LEN(container_stack) + 1)
|
153
153
|
rb_raise(DecodeError, "Structure is too deep!");
|
154
154
|
current_container = crt;
|
155
155
|
}
|
@@ -171,7 +171,7 @@ static VALUE _decode_file(VALUE fp){
|
|
171
171
|
* call-seq:
|
172
172
|
* BEncode.decode_file(file)
|
173
173
|
*
|
174
|
-
*
|
174
|
+
* Loads content of _file_ and decodes it.
|
175
175
|
* _file_ may be either IO instance or
|
176
176
|
* String path to file.
|
177
177
|
*
|
metadata
CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 0
|
7
7
|
- 2
|
8
|
-
-
|
9
|
-
version: 0.2.
|
8
|
+
- 2
|
9
|
+
version: 0.2.2
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- naquad
|
@@ -14,7 +14,7 @@ autorequire:
|
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
16
|
|
17
|
-
date: 2011-01-
|
17
|
+
date: 2011-01-15 00:00:00 +02:00
|
18
18
|
default_executable:
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|
@@ -30,7 +30,7 @@ dependencies:
|
|
30
30
|
- 7
|
31
31
|
- 5
|
32
32
|
version: 0.7.5
|
33
|
-
type: :
|
33
|
+
type: :development
|
34
34
|
version_requirements: *id001
|
35
35
|
- !ruby/object:Gem::Dependency
|
36
36
|
name: jeweler
|