console 0.3 → 0.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (2) hide show
  1. data/ext/console/console.c +3 -4
  2. metadata +31 -40
@@ -17,8 +17,10 @@
17
17
  static inline int calc_width(char* string, long strlen, long byte_offset, size_t* num_bytes, size_t* num_cols) {
18
18
  wchar_t wc;
19
19
  size_t width = -1;
20
+ mbstate_t state;
20
21
 
21
- *num_bytes = mbrtowc(&wc, string + byte_offset, strlen - byte_offset, NULL);
22
+ memset(&state, 0, sizeof(state));
23
+ *num_bytes = mbrtowc(&wc, string + byte_offset, strlen - byte_offset, &state);
22
24
 
23
25
  if(*num_bytes == (size_t)-2) {
24
26
  rb_raise(rb_eArgError, "malformed string: incomplete multibyte character at position %ld", byte_offset);
@@ -34,9 +36,6 @@ static inline int calc_width(char* string, long strlen, long byte_offset, size_t
34
36
  }
35
37
 
36
38
  *num_cols = wcwidth(wc);
37
- /* sometimes this seems to happen! maybe it's not bad...
38
- if(width == 0) rb_raise(rb_eArgError, "bad string: non-printable character at position %ld", RSTRING_LEN(v_string) - remaining_bytes);
39
- */
40
39
 
41
40
  return 0;
42
41
  }
metadata CHANGED
@@ -1,33 +1,32 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: console
3
- version: !ruby/object:Gem::Version
4
- hash: 13
5
- prerelease: false
6
- segments:
7
- - 0
8
- - 3
9
- version: "0.3"
3
+ version: !ruby/object:Gem::Version
4
+ version: '0.4'
5
+ prerelease:
10
6
  platform: ruby
11
- authors:
7
+ authors:
12
8
  - William Morgan
13
9
  autorequire:
14
10
  bindir: bin
15
11
  cert_chain: []
16
-
17
- date: 2011-01-17 20:18:21 -08:00
12
+ date: 2011-04-30 14:51:22.000000000 -07:00
18
13
  default_executable:
19
14
  dependencies: []
20
-
21
- description: Console is a helper class for displaying super-ASCII strings on the console. Console is needed when you want to mix two-column (e.g. Chinese) and single-column (e.g. ASCII) characters and know how much horizontal realestate the result takes on the screen. This is generally necessary when you want to have internationalization support in a console-based program. Console currently provides utility methods for determining the display width of a string, and for taking a substring based on display position and display width.
15
+ description: Console is a helper class for displaying super-ASCII strings on the console.
16
+ Console is needed when you want to mix two-column (e.g. Chinese) and single-column
17
+ (e.g. ASCII) characters and know how much horizontal realestate the result takes
18
+ on the screen. This is generally necessary when you want to have internationalization
19
+ support in a console-based program. Console currently provides utility methods for
20
+ determining the display width of a string, and for taking a substring based on display
21
+ position and display width.
22
22
  email: wmorgan-console@masanjin.net
23
23
  executables: []
24
-
25
- extensions:
24
+ extensions:
26
25
  - ext/console/extconf.rb
27
- extra_rdoc_files:
26
+ extra_rdoc_files:
28
27
  - README
29
28
  - ext/console/console.c
30
- files:
29
+ files:
31
30
  - README
32
31
  - ext/console/extconf.rb
33
32
  - ext/console/console.c
@@ -36,36 +35,28 @@ files:
36
35
  has_rdoc: true
37
36
  homepage: http://masanjin.net/console
38
37
  licenses: []
39
-
40
38
  post_install_message:
41
- rdoc_options: []
42
-
43
- require_paths:
39
+ rdoc_options:
40
+ - -c
41
+ - utf8
42
+ require_paths:
44
43
  - lib
45
- required_ruby_version: !ruby/object:Gem::Requirement
44
+ required_ruby_version: !ruby/object:Gem::Requirement
46
45
  none: false
47
- requirements:
48
- - - ">="
49
- - !ruby/object:Gem::Version
50
- hash: 3
51
- segments:
52
- - 0
53
- version: "0"
54
- required_rubygems_version: !ruby/object:Gem::Requirement
46
+ requirements:
47
+ - - ! '>='
48
+ - !ruby/object:Gem::Version
49
+ version: '0'
50
+ required_rubygems_version: !ruby/object:Gem::Requirement
55
51
  none: false
56
- requirements:
57
- - - ">="
58
- - !ruby/object:Gem::Version
59
- hash: 3
60
- segments:
61
- - 0
62
- version: "0"
52
+ requirements:
53
+ - - ! '>='
54
+ - !ruby/object:Gem::Version
55
+ version: '0'
63
56
  requirements: []
64
-
65
57
  rubyforge_project:
66
- rubygems_version: 1.3.7
58
+ rubygems_version: 1.6.0
67
59
  signing_key:
68
60
  specification_version: 3
69
61
  summary: Console is a helper for properly handling super-ASCII strings on the console.
70
62
  test_files: []
71
-