utf8_proc 0.2.2 → 0.2.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 6d9b7e197b0e827d0ce3df4f1859f1b9fc405d49
4
- data.tar.gz: 6ed9d4f8fcacef1623d6c526f7343b6c78e2037a
3
+ metadata.gz: 0f0100ceec29ddf6573a113e96b40afc739d7584
4
+ data.tar.gz: 8698ee90244f05aec2754f3aaf1701a7a13cd8cc
5
5
  SHA512:
6
- metadata.gz: 00a888e9d9866ded8d419037633962afa65f32a232985c454ed49f2cc30b2417eab4c240cbb57b413fe2338543501332edb1f52badb2e92e410360230a0a40cd
7
- data.tar.gz: b68cd49b1495c6a97160353341ebaf16ffba1db0d89a84f76f3af6b42a299b150697dbf4d4287182da7e35addab88436bab593abbe6fa8987d9ec26b8ec61c6f
6
+ metadata.gz: adae5ae7a317c87d0a75553161530152c26d2479c7b8849eeff5cf7109476ad0e9255e4e13bd039eea780173ea8bc1eb43beebbc2ef0658ca069b363d33eb0bc
7
+ data.tar.gz: 8429060afb0af89b5e2fb3ac2a5cc54220bf9ed5e164f611b871aaa1bb9399ef71f0a5511b6b14826d8260284d615ad6d41ab4c5761def775ba1cfcf0a2b0d2f
data/.travis.yml CHANGED
@@ -1,5 +1,15 @@
1
- sudo: false
1
+ dist: trusty
2
+ sudo: required
2
3
  language: ruby
3
4
  rvm:
4
5
  - 2.4.0
5
- before_install: gem install bundler -v 1.14.4
6
+ - 2.3.3
7
+ - 2.2.6
8
+ - 2.1.10
9
+ - 2.0.0
10
+ before_install:
11
+ - wget -O utf8proc.zip https://github.com/JuliaLang/utf8proc/archive/v2.1.0.zip
12
+ - unzip utf8proc.zip
13
+ - pushd utf8proc* && sudo make install prefix=/usr && popd
14
+ - gem install bundler -v 1.14.4
15
+ script: bundle exec rake
data/README.md CHANGED
@@ -1,5 +1,6 @@
1
1
  # UTF8Proc
2
2
 
3
+ [![Build Status](https://travis-ci.org/nomoon/utf8_proc.svg?branch=master)](https://travis-ci.org/nomoon/utf8_proc)
3
4
  [![Dependency Status](https://gemnasium.com/badges/github.com/nomoon/utf8_proc.svg)](https://gemnasium.com/github.com/nomoon/utf8_proc)
4
5
  [![Gem Version](https://badge.fury.io/rb/utf8_proc.svg)](https://badge.fury.io/rb/utf8_proc)
5
6
 
@@ -49,6 +50,9 @@ UTF8Proc.NFKC_CF(utf8_string)
49
50
 
50
51
  # Second argument may be any of: [:nfc (default), :nfd, :nfkc, :nfkd, :nfkc_cf]
51
52
  UTF8Proc.normalize(utf8_string, form = :nfc)
53
+
54
+ # Version string of loaded libutf8proc
55
+ UTF8Proc::LIBRARY_VERSION
52
56
  ```
53
57
 
54
58
  ## Contributing
@@ -1,6 +1,9 @@
1
1
  # frozen_string_literal: true
2
+ # rubocop:disable GlobalVars
2
3
  require "mkmf"
3
4
 
5
+ $CFLAGS << " -std=c99 -Wno-declaration-after-statement"
6
+
4
7
  pkg_config("utf8proc")
5
8
 
6
9
  have_library("utf8proc") || abort("This extension requires the utf8proc library.")
@@ -1,16 +1,17 @@
1
1
 
2
2
  #include "utf8_proc.h"
3
3
 
4
- const rb_encoding *enc_utf8;
5
- const rb_encoding *enc_usascii;
6
- ID NFC;
7
- ID NFD;
8
- ID NFKC;
9
- ID NFKD;
10
- ID NFKC_CF;
4
+ static rb_encoding *enc_utf8;
5
+ static rb_encoding *enc_usascii;
6
+ static ID NFC;
7
+ static ID NFD;
8
+ static ID NFKC;
9
+ static ID NFKD;
10
+ static ID NFKC_CF;
11
11
 
12
12
  static inline void checkStrEncoding(VALUE *string) {
13
- rb_encoding *enc = rb_enc_get(*string);
13
+ rb_encoding *enc;
14
+ enc = rb_enc_get(*string);
14
15
  if (enc != enc_utf8 && enc != enc_usascii) {
15
16
  rb_raise(rb_eEncodingError, "%s", "String must be in UTF-8 or US-ASCII encoding.");
16
17
  }
@@ -19,10 +20,13 @@ static inline void checkStrEncoding(VALUE *string) {
19
20
  static inline VALUE normInternal(VALUE string, utf8proc_option_t options) {
20
21
  checkStrEncoding(&string);
21
22
  utf8proc_uint8_t *retval;
22
- utf8proc_ssize_t retlen = utf8proc_map(
23
- (unsigned char *) StringValuePtr(string), RSTRING_LEN(string), &retval, options);
23
+ utf8proc_ssize_t retlen;
24
+ retlen = utf8proc_map(
25
+ (unsigned char *) StringValuePtr(string), RSTRING_LEN(string), &retval, options
26
+ );
24
27
 
25
- VALUE new_str = rb_enc_str_new((char *) retval, retlen, rb_utf8_encoding());
28
+ VALUE new_str;
29
+ new_str = rb_enc_str_new((char *) retval, retlen, rb_utf8_encoding());
26
30
  free(retval);
27
31
 
28
32
  return new_str;
@@ -59,7 +63,8 @@ VALUE norm(int argc, VALUE* argv, VALUE self){
59
63
  return toNFC(self, string);
60
64
  }
61
65
 
62
- ID s_form = SYM2ID(form);
66
+ ID s_form;
67
+ s_form = SYM2ID(form);
63
68
  if (s_form == NFC) {
64
69
  return toNFC(self, string);
65
70
  }else if(s_form == NFD) {
@@ -78,7 +83,8 @@ VALUE norm(int argc, VALUE* argv, VALUE self){
78
83
  }
79
84
 
80
85
  void Init_utf8_proc(void) {
81
- VALUE rb_mBase = rb_define_module("UTF8Proc");
86
+ VALUE rb_mBase;
87
+ rb_mBase = rb_define_module("UTF8Proc");
82
88
 
83
89
  enc_utf8 = rb_utf8_encoding();
84
90
  enc_usascii = rb_usascii_encoding();
@@ -88,6 +94,12 @@ void Init_utf8_proc(void) {
88
94
  NFKD = rb_intern("nfkd");
89
95
  NFKC_CF = rb_intern("nfkc_cf");
90
96
 
97
+ const char *libVersion;
98
+ libVersion = utf8proc_version();
99
+ rb_define_const(rb_mBase, "LIBRARY_VERSION", rb_str_freeze(
100
+ rb_enc_str_new(libVersion, strlen(libVersion), enc_utf8)
101
+ ));
102
+
91
103
  rb_define_singleton_method(rb_mBase, "NFC", toNFC, 1);
92
104
  rb_define_singleton_method(rb_mBase, "NFD", toNFD, 1);
93
105
  rb_define_singleton_method(rb_mBase, "NFKC", toNFKC, 1);
@@ -1,4 +1,4 @@
1
1
  # frozen_string_literal: true
2
2
  module UTF8Proc
3
- VERSION = "0.2.2"
3
+ VERSION = "0.2.3"
4
4
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: utf8_proc
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.2
4
+ version: 0.2.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tim Bellefleur