base32 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
data/Rakefile CHANGED
@@ -26,22 +26,22 @@ require 'rubygems'
26
26
 
27
27
  task :default => ['test:all']
28
28
 
29
- CLEAN.include "ext/**/*.bundle", "ext/**/*.o"
30
- CLOBBER.include "ext/Makefile", "ext/base32", "pkg/**/*"
29
+ CLEAN.include "ext/**/*.{bundle,o,so}"
30
+ CLOBBER.include "ext/Makefile", "ext/mkmf.log", "pkg/**/*"
31
31
 
32
32
  gemspec = Gem::Specification.new do |s|
33
33
  s.author = "Samuel Tesla"
34
34
  s.email = "samuel@thoughtlocker.net"
35
35
  s.extensions = ["ext/extconf.rb"]
36
36
  s.extra_rdoc_files = ["README"]
37
- s.files = FileList["Rakefile", "{config,test}/**/*", "ext/*.{c,h,rb,bundle}"]
37
+ s.files = FileList["Rakefile", "{config,test}/**/*", "ext/*.{c,h,rb}"]
38
38
  s.has_rdoc = true
39
39
  s.homepage = "http://base32.rubyforge.org"
40
40
  s.name = 'base32'
41
41
  s.require_paths << 'ext'
42
42
  s.requirements << 'none'
43
43
  s.summary = "Ruby extension for base32 encoding and decoding"
44
- s.version = "0.1.0"
44
+ s.version = "0.1.1"
45
45
  end
46
46
 
47
47
  Rake::GemPackageTask.new(gemspec) do |pkg|
@@ -19,7 +19,7 @@
19
19
  * THE SOFTWARE.
20
20
  */
21
21
 
22
- #include "ruby.h"
22
+ #include "decoder.h"
23
23
 
24
24
  static inline uint8_t
25
25
  decode_bits (const uint8_t bits)
@@ -48,7 +48,8 @@ decode_bits (const uint8_t bits)
48
48
  return table[bits];
49
49
  }
50
50
 
51
- size_t base32_decode_buffer_size (const size_t encodedTextLength)
51
+ inline size_t
52
+ base32_decode_buffer_size (const size_t encodedTextLength)
52
53
  {
53
54
  if (encodedTextLength == 0 || encodedTextLength % 8 != 0)
54
55
  return 0;
@@ -23,6 +23,7 @@
23
23
  #define DECODER_H
24
24
 
25
25
  #include <stdlib.h>
26
+ #include <stdint.h>
26
27
 
27
28
  inline size_t base32_decoder_buffer_size (const size_t encodedTextLength);
28
29
 
@@ -21,20 +21,23 @@
21
21
 
22
22
  #include "encoder.h"
23
23
 
24
- inline size_t base32_encoder_last_quintent (const size_t bytes)
24
+ inline size_t
25
+ base32_encoder_last_quintent (const size_t bytes)
25
26
  {
26
27
  int quintets = bytes * 8 / 5;
27
28
  int remainder = bytes % 5;
28
29
  return remainder == 0 ? quintets : quintets + 1;
29
30
  }
30
31
 
31
- inline size_t base32_encoder_output_padding_size (const size_t bytes)
32
+ inline size_t
33
+ base32_encoder_output_padding_size (const size_t bytes)
32
34
  {
33
35
  unsigned remainder = bytes % 5;
34
36
  return remainder == 0 ? 0 : (5 - remainder) * 8 / 5;
35
37
  }
36
38
 
37
- inline size_t base32_encoder_buffer_size (const size_t bytes)
39
+ inline size_t
40
+ base32_encoder_buffer_size (const size_t bytes)
38
41
  {
39
42
  return base32_encoder_last_quintent (bytes) +
40
43
  base32_encoder_output_padding_size (bytes);
@@ -84,7 +87,7 @@ base32_encoder_encode_bits (int position, const uint8_t *buffer)
84
87
  }
85
88
  }
86
89
 
87
- static uint8_t
90
+ static inline uint8_t
88
91
  base32_encoder_encode_at_position (unsigned position, const uint8_t *buffer)
89
92
  {
90
93
  const char *table = "ABCDEFGHIJKLMNOPQRSTUVWXYZ234567";
@@ -23,8 +23,9 @@
23
23
  #define ENCODER_H
24
24
 
25
25
  #include <stdlib.h>
26
+ #include <stdint.h>
26
27
 
27
- size_t base32_encoder_buffer_size (const size_t bytes);
28
+ inline size_t base32_encoder_buffer_size (const size_t bytes);
28
29
 
29
30
  void base32_encode (uint8_t *output, const size_t outputLength,
30
31
  const uint8_t *input, const size_t inputLength);
data/ext/ext.c CHANGED
@@ -19,6 +19,7 @@
19
19
  * THE SOFTWARE.
20
20
  */
21
21
 
22
+ #include <stdlib.h>
22
23
  #include "ruby.h"
23
24
  #include "decoder.h"
24
25
  #include "encoder.h"
metadata CHANGED
@@ -3,8 +3,8 @@ rubygems_version: 0.9.4
3
3
  specification_version: 1
4
4
  name: base32
5
5
  version: !ruby/object:Gem::Version
6
- version: 0.1.0
7
- date: 2007-06-28 00:00:00 -05:00
6
+ version: 0.1.1
7
+ date: 2007-06-29 00:00:00 -05:00
8
8
  summary: Ruby extension for base32 encoding and decoding
9
9
  require_paths:
10
10
  - lib