charlock_holmes 0.6.7 → 0.6.8

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.7)
4
+ charlock_holmes (0.6.8)
5
5
 
6
6
  GEM
7
7
  remote: http://rubygems.org/
@@ -23,7 +23,7 @@ static VALUE rb_converter_convert(VALUE self, VALUE rb_txt, VALUE rb_src_enc, VA
23
23
  // first determin the size of the output buffer
24
24
  out_len = ucnv_convert(dst_enc, src_enc, NULL, 0, src_txt, src_len, &status);
25
25
  if (status != U_BUFFER_OVERFLOW_ERROR) {
26
- rb_raise(rb_eArgError, u_errorName(status));
26
+ rb_raise(rb_eArgError, "%s", u_errorName(status));
27
27
  }
28
28
  out_buf = malloc(out_len);
29
29
 
@@ -32,11 +32,11 @@ static VALUE rb_converter_convert(VALUE self, VALUE rb_txt, VALUE rb_src_enc, VA
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
34
  free(out_buf);
35
- rb_raise(rb_eArgError, u_errorName(status));
35
+ rb_raise(rb_eArgError, "%s", u_errorName(status));
36
36
  }
37
37
 
38
38
  #ifdef HAVE_RUBY_ENCODING_H
39
- (rb_encoding *)rb_enc = rb_enc_find(dst_enc);
39
+ rb_enc = (void *)rb_enc_find(dst_enc);
40
40
  #endif
41
41
 
42
42
  rb_out = charlock_new_enc_str(out_buf, out_len, rb_enc);
@@ -50,4 +50,4 @@ void _init_charlock_converter() {
50
50
  rb_cConverter = rb_define_class_under(rb_mCharlockHolmes, "Converter", rb_cObject);
51
51
 
52
52
  rb_define_singleton_method(rb_cConverter, "convert", rb_converter_convert, 3);
53
- }
53
+ }
@@ -54,14 +54,10 @@ static int detect_binary_content(charlock_detector_t *detector, VALUE rb_str) {
54
54
  binary_result = magic_buffer(detector->magic, RSTRING_PTR(rb_str), RSTRING_LEN(rb_str));
55
55
 
56
56
  if (binary_result) {
57
- if (strstr(binary_result, "library") ||
58
- strstr(binary_result, "bundle") ||
59
- strstr(binary_result, "archive") ||
60
- (!strstr(binary_result, "text") && strstr(binary_result, "executable")) ||
61
- strstr(binary_result, "data"))
57
+ if (!strstr(binary_result, "text"))
62
58
  return 1;
63
59
  } else {
64
- rb_raise(rb_eStandardError, magic_error(detector->magic));
60
+ rb_raise(rb_eStandardError, "%s", magic_error(detector->magic));
65
61
  }
66
62
 
67
63
  return 0;
@@ -275,12 +271,12 @@ static VALUE rb_encdec__alloc(VALUE klass)
275
271
 
276
272
  detector->csd = ucsdet_open(&status);
277
273
  if (U_FAILURE(status)) {
278
- rb_raise(rb_eStandardError, u_errorName(status));
274
+ rb_raise(rb_eStandardError, "%s", u_errorName(status));
279
275
  }
280
276
 
281
277
  detector->magic = magic_open(0);
282
278
  if (detector->magic == NULL) {
283
- rb_raise(rb_eStandardError, magic_error(detector->magic));
279
+ rb_raise(rb_eStandardError, "%s", magic_error(detector->magic));
284
280
  }
285
281
 
286
282
  // load the libmagic database
@@ -58,8 +58,8 @@ Dir.chdir("#{CWD}/src") do
58
58
  sys("tar zxvf #{src}")
59
59
  Dir.chdir(dir) do
60
60
  sys("./configure --prefix=#{CWD}/dst/ --disable-shared --enable-static --with-pic")
61
- sys("make")
62
- sys("make install")
61
+ sys("make -C src install")
62
+ sys("make -C magic install")
63
63
  end
64
64
  end
65
65
 
@@ -1,3 +1,3 @@
1
1
  module CharlockHolmes
2
- VERSION = "0.6.7"
2
+ VERSION = "0.6.8"
3
3
  end
@@ -104,7 +104,7 @@ describe CharlockHolmes::EncodingDetector do
104
104
  MAPPING.each do |mapping|
105
105
  file, encoding, type = mapping
106
106
 
107
- test "#{file} should be detected as #{encoding}" do
107
+ test "#{file} should be detected as #{encoding || 'binary'}" do
108
108
  path = File.expand_path "../fixtures/#{file}", __FILE__
109
109
  content = File.read path
110
110
  guessed = @detector.detect content
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: 9
4
+ hash: 23
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 6
9
- - 7
10
- version: 0.6.7
9
+ - 8
10
+ version: 0.6.8
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-09-07 00:00:00 -07:00
19
+ date: 2011-09-08 00:00:00 -07:00
20
20
  default_executable:
21
21
  dependencies:
22
22
  - !ruby/object:Gem::Dependency