easy-crc 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 3ac427e10260621e53de286d84c1f5546dcc6aaa
4
- data.tar.gz: 9dc192a043f58c65cad6d3805636e8ffa2fb6a98
3
+ metadata.gz: 61341df7aa15c4f90126147324c26c07eb0087b1
4
+ data.tar.gz: 5df125bb76c3527a960cf00be2530d1c9820a428
5
5
  SHA512:
6
- metadata.gz: afedc692533e8e6214a8485b77dce2d4ad22ea727311a981446f28eced2d8fd0ab59d0ca0791694d6db5beea11882b9ce50abca34372caf764bad50a2847b5d3
7
- data.tar.gz: 25c5bf169e03542e3be4f27f3b21a6668a83913a2bc6611c0c465f5da5770f514d4bb65a574e7ab75a5f74636941d72bee32daca743e328e2c9acdfcce23eb40
6
+ metadata.gz: 8fa30f7e49bee6b0adf7b1001a33cb00646edf49f480d89e4eebdfab7c26ef3b3d9b4e194d849e146cc8c926e769676c8d920f8921327c8403a076ee8557db24
7
+ data.tar.gz: 6fbb0361c38f241c29fd8dbb924845c3368248cf6ebdf57073d452b0b2fa29347757679cb8388f924657ce7de62f027838942c1424eddb17c121cfc9f6319872
@@ -145,17 +145,22 @@ easy_crc_crc32_cleanup(VALUE p)
145
145
  }
146
146
 
147
147
  static VALUE
148
- easy_crc_crc32(VALUE self, VALUE path)
148
+ easy_crc_crc32(VALUE self, VALUE path, VALUE seed)
149
149
  {
150
150
  easy_crc32_params params;
151
151
  VALUE vparams;
152
152
 
153
153
  if(TYPE(path) != T_STRING)
154
154
  rb_raise(rb_eTypeError, "invalid type for path name");
155
+ if(TYPE(seed) != T_FIXNUM)
156
+ rb_raise(rb_eTypeError, "invalid type for seed");
155
157
 
156
158
  params.path = StringValueCStr(path);
157
159
  params.fd = NULL;
158
- params.crc = 0;
160
+ if(seed == Qnil)
161
+ params.crc = 0;
162
+ else
163
+ params.crc = FIX2LONG(seed);
159
164
  params.error = 0;
160
165
  params.stop = false;
161
166
 
@@ -163,7 +168,7 @@ easy_crc_crc32(VALUE self, VALUE path)
163
168
 
164
169
  rb_ensure(easy_crc_crc32_start, vparams, easy_crc_crc32_cleanup, vparams);
165
170
 
166
- if(params.error == 1)
171
+ if(params.error == 1)
167
172
  rb_raise(rb_eIOError, "failed to open file");
168
173
 
169
174
  if(params.error == 2)
@@ -180,5 +185,5 @@ Init_easy_crc()
180
185
  {
181
186
  VALUE mEasyCrc;
182
187
  mEasyCrc = rb_define_module("EasyCRC");
183
- rb_define_module_function(mEasyCrc, "crc32", easy_crc_crc32, 1);
188
+ rb_define_module_function(mEasyCrc, "_crc32", easy_crc_crc32, 2);
184
189
  }
@@ -2,4 +2,7 @@ require 'easy_crc.so'
2
2
  require 'easy-crc/version'
3
3
 
4
4
  module EasyCRC
5
+ def self.crc32(path, seed = 0)
6
+ _crc32(path, seed)
7
+ end
5
8
  end
@@ -1,3 +1,3 @@
1
1
  module EasyCRC
2
- VERSION = '0.0.1'
2
+ VERSION = '0.0.2'
3
3
  end
metadata CHANGED
@@ -1,41 +1,41 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: easy-crc
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - FlavourSys Technology GmbH
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-01-21 00:00:00.000000000 Z
11
+ date: 2016-07-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake-compiler
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - '>='
17
+ - - ">="
18
18
  - !ruby/object:Gem::Version
19
19
  version: '0'
20
20
  type: :development
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - '>='
24
+ - - ">="
25
25
  - !ruby/object:Gem::Version
26
26
  version: '0'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: rspec
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - '>='
31
+ - - ">="
32
32
  - !ruby/object:Gem::Version
33
33
  version: '0'
34
34
  type: :development
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - '>='
38
+ - - ">="
39
39
  - !ruby/object:Gem::Version
40
40
  version: '0'
41
41
  description: EasyCRC let's you calculate CRC32 checksums of files without locking
@@ -46,10 +46,10 @@ extensions:
46
46
  - ext/easy_crc/extconf.rb
47
47
  extra_rdoc_files: []
48
48
  files:
49
+ - ext/easy_crc/easy_crc.c
50
+ - ext/easy_crc/extconf.rb
49
51
  - lib/easy-crc.rb
50
52
  - lib/easy-crc/version.rb
51
- - ext/easy_crc/extconf.rb
52
- - ext/easy_crc/easy_crc.c
53
53
  homepage: http://github.com/flavoursys/easy-crc
54
54
  licenses:
55
55
  - MIT
@@ -60,17 +60,17 @@ require_paths:
60
60
  - lib
61
61
  required_ruby_version: !ruby/object:Gem::Requirement
62
62
  requirements:
63
- - - '>='
63
+ - - ">="
64
64
  - !ruby/object:Gem::Version
65
65
  version: '0'
66
66
  required_rubygems_version: !ruby/object:Gem::Requirement
67
67
  requirements:
68
- - - '>='
68
+ - - ">="
69
69
  - !ruby/object:Gem::Version
70
70
  version: '0'
71
71
  requirements: []
72
72
  rubyforge_project:
73
- rubygems_version: 2.0.14
73
+ rubygems_version: 2.6.4
74
74
  signing_key:
75
75
  specification_version: 4
76
76
  summary: GIL-free CRC32 checksums of files