cmultibyte 0.0.6 → 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
data/ext/Makefile CHANGED
@@ -53,7 +53,7 @@ vendorarchdir = $(vendorlibdir)/$(sitearch)
53
53
 
54
54
  NULLCMD = :
55
55
 
56
- CC = /usr/bin/cc
56
+ CC = /usr/bin/gcc -Wall
57
57
  CXX = g++
58
58
  LIBRUBY = $(LIBRUBY_A)
59
59
  LIBRUBY_A = lib$(RUBY_SO_NAME)-static.a
data/ext/cmultibyte.c CHANGED
@@ -17,7 +17,7 @@ static int inline is_unused(uint8_t byte) { return (byte > 240); }
17
17
  static int inline is_restricted(uint8_t byte) { return (byte > 244); }
18
18
 
19
19
  static uint8_t *tidy_byte2(uint8_t byte, uint8_t *dst) {
20
- int map;
20
+ int map, i;
21
21
  VALUE ary;
22
22
 
23
23
  if (byte < 160) {
@@ -29,7 +29,7 @@ static uint8_t *tidy_byte2(uint8_t byte, uint8_t *dst) {
29
29
  rb_ary_store(ary, 0, INT2FIX(map));
30
30
  ary = rb_funcall(ary, idPack, 1, rb_str_new2("U"));
31
31
  ary = rb_funcall(ary, idUnpack, 1, rb_str_new2("C*"));
32
- for (int i = 0; i < RARRAY_LEN(ary) ; i++) {
32
+ for (i = 0; i < RARRAY_LEN(ary) ; i++) {
33
33
  dst[i] = FIX2INT(RARRAY_PTR(ary)[i]);
34
34
  }
35
35
  return dst + RARRAY_LEN(ary);
@@ -76,9 +76,10 @@ VALUE rb_tidy_byte(VALUE self, VALUE byte) {
76
76
  }
77
77
 
78
78
  static void cp1252_hash_to_array(VALUE cp1252_hash) {
79
+ int i;
79
80
  cp1252 = ALLOC_N(int, 256);
80
81
  VALUE val;
81
- for (int i = 0; i < 256; i++) {
82
+ for (i = 0; i < 256; i++) {
82
83
  val = rb_hash_aref(cp1252_hash, INT2FIX(i));
83
84
  if (val == Qnil) {
84
85
  cp1252[i] = -1;
@@ -103,7 +104,6 @@ static VALUE protected_tidy_bytes(VALUE arg) {
103
104
  uint8_t byte;
104
105
 
105
106
  uint8_t *curr = arr;
106
- uint8_t *prev = curr;
107
107
  uint8_t *last_lead = curr;
108
108
 
109
109
  int did_write = 0;
@@ -128,7 +128,6 @@ static VALUE protected_tidy_bytes(VALUE arg) {
128
128
  int start_index = last_lead-arr;
129
129
  int end_index = curr-arr;
130
130
  int len = end_index - start_index;
131
- uint8_t *prev = curr;
132
131
 
133
132
  uint8_t temp[len];
134
133
  for (j = 0; j < len; j++) {
@@ -188,7 +187,8 @@ static VALUE tidy_bytes(VALUE string) {
188
187
  static VALUE force_tidy_bytes(VALUE string) {
189
188
  uint8_t *arr = malloc(4 * sizeof(uint8_t) * RSTRING_LEN(string));
190
189
  uint8_t *curr = arr;
191
- for (int i = 0 ; i < RSTRING_LEN(string) ; i++) {
190
+ int i;
191
+ for (i = 0 ; i < RSTRING_LEN(string) ; i++) {
192
192
  curr = tidy_byte2(RSTRING_PTR(string)[i], curr);
193
193
  }
194
194
  VALUE str = rb_str_new((const char *)arr, curr - arr);
@@ -1,3 +1,3 @@
1
1
  module Cmultibyte
2
- VERSION = "0.0.6"
2
+ VERSION = "0.1.0"
3
3
  end
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: cmultibyte
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 0.0.6
5
+ version: 0.1.0
6
6
  platform: ruby
7
7
  authors:
8
8
  - Burke Libbey