charlock_holmes 0.6.0 → 0.6.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- charlock_holmes (0.6.0)
4
+ charlock_holmes (0.6.2)
5
5
 
6
6
  GEM
7
7
  remote: http://rubygems.org/
data/README.md CHANGED
@@ -81,7 +81,7 @@ If the traditional `gem install charlock_holmes` doesn't work, you may need to s
81
81
 
82
82
  At the time of writing, Homebrew for OSX installs ICU (icu4c is the package name) and libmagic as keg-only installs so you'll have to specify the location during the gem install:
83
83
 
84
- `gem install charlock_holmes --with-icu-dir=/usr/local/Cellar/icu4c/4.4.1 --with-magic-dir=/usr/local/Cellar/libmagic/5.04`
84
+ `gem install charlock_holmes -- --with-icu-dir=/usr/local/Cellar/icu4c/4.4.1 --with-magic-dir=/usr/local/Cellar/libmagic/5.04`
85
85
 
86
86
  If you're using Bundler and need to specify a custom path(s), you can do so with the `bundle config` command:
87
87
 
@@ -25,24 +25,24 @@ static VALUE rb_converter_convert(VALUE self, VALUE rb_txt, VALUE rb_src_enc, VA
25
25
  if (status != U_BUFFER_OVERFLOW_ERROR) {
26
26
  rb_raise(rb_eArgError, u_errorName(status));
27
27
  }
28
- out_buf = xmalloc(out_len);
28
+ out_buf = malloc(out_len);
29
29
 
30
30
  // now do the actual conversion
31
31
  status = U_ZERO_ERROR;
32
32
  out_len = ucnv_convert(dst_enc, src_enc, out_buf, out_len, src_txt, src_len, &status);
33
33
  if (U_FAILURE(status)) {
34
- xfree(out_buf);
34
+ free(out_buf);
35
35
  rb_raise(rb_eArgError, u_errorName(status));
36
36
  }
37
37
 
38
- xfree(out_buf);
39
-
40
38
  #ifdef HAVE_RUBY_ENCODING_H
41
39
  (rb_encoding *)rb_enc = rb_enc_find(dst_enc);
42
40
  #endif
43
41
 
44
42
  rb_out = charlock_new_enc_str(out_buf, out_len, rb_enc);
45
43
 
44
+ free(out_buf);
45
+
46
46
  return rb_out;
47
47
  }
48
48
 
@@ -260,6 +260,8 @@ static void rb_encdec__free(void *obj)
260
260
 
261
261
  if (detector->magic)
262
262
  magic_close(detector->magic);
263
+
264
+ free(detector);
263
265
  }
264
266
 
265
267
  static VALUE rb_encdec__alloc(VALUE klass)
@@ -268,7 +270,8 @@ static VALUE rb_encdec__alloc(VALUE klass)
268
270
  UErrorCode status = U_ZERO_ERROR;
269
271
  VALUE obj;
270
272
 
271
- obj = Data_Make_Struct(klass, charlock_detector_t, NULL, rb_encdec__free, (void *)detector);
273
+ detector = malloc(sizeof(charlock_detector_t*));
274
+ obj = Data_Wrap_Struct(klass, NULL, rb_encdec__free, (void *)detector);
272
275
 
273
276
  detector->csd = ucsdet_open(&status);
274
277
  if (U_FAILURE(status)) {
@@ -1,7 +1,7 @@
1
1
  require 'mkmf'
2
2
 
3
3
  $CFLAGS << ' -Wall -funroll-loops'
4
- $CFLAGS << ' -Wextra -O0 -ggdb3' if ENV['DEBUG']
4
+ $CFLAGS << ' -Wextra -O0 -ggdb3' #if ENV['DEBUG']
5
5
 
6
6
  dir_config 'icu'
7
7
  $CFLAGS << ' -I/usr/local/Cellar/icu4c/4.4.1/include'
@@ -1,3 +1,3 @@
1
1
  module CharlockHolmes
2
- VERSION = "0.6.0"
2
+ VERSION = "0.6.2"
3
3
  end
@@ -112,7 +112,7 @@ describe CharlockHolmes::EncodingDetector do
112
112
  assert_equal encoding, guessed[:encoding]
113
113
  assert_equal type, guessed[:type]
114
114
 
115
- if content.respond_to? :force_encoding
115
+ if content.respond_to?(:force_encoding) && guessed[:type] == :text
116
116
  content.force_encoding guessed[:encoding]
117
117
  assert content.valid_encoding?
118
118
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: charlock_holmes
3
3
  version: !ruby/object:Gem::Version
4
- hash: 7
4
+ hash: 3
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 6
9
- - 0
10
- version: 0.6.0
9
+ - 2
10
+ version: 0.6.2
11
11
  platform: ruby
12
12
  authors:
13
13
  - Brian Lopez
@@ -16,7 +16,7 @@ autorequire:
16
16
  bindir: bin
17
17
  cert_chain: []
18
18
 
19
- date: 2011-08-27 00:00:00 -07:00
19
+ date: 2011-08-30 00:00:00 -07:00
20
20
  default_executable:
21
21
  dependencies:
22
22
  - !ruby/object:Gem::Dependency