wok-current view ruby-ncurses/stuff/STR2CSTR-deprecated.patch @ rev 23712

updated udftools (2.1 -> 2.2)
author Hans-G?nter Theisgen
date Tue Apr 28 17:35:06 2020 +0100 (2020-04-28)
parents
children
line source
1 diff -Naur ncurses-ruby-1.3.1/form_wrap.c ncurses-ruby-1.3.1.p/form_wrap.c
2 --- ncurses-ruby-1.3.1/form_wrap.c 2011-05-31 01:41:46.000000000 +0200
3 +++ ncurses-ruby-1.3.1.p/form_wrap.c 2013-03-14 14:38:21.097682379 +0100
4 @@ -625,7 +625,8 @@
5 char** list = ALLOC_N(char*, n+1);
6 int i;
7 for (i = 0; i < n; i++) {
8 - list[i] = STR2CSTR(rb_ary_entry(arg3, (long)i));
9 + VALUE tmp = rb_ary_entry(arg3, (long)i);
10 + list[i] = StringValuePtr(tmp);
11 }
12 list[n] = NULL;
13 return INT2NUM(set_field_type(field, ftype,
14 @@ -654,7 +655,7 @@
15 if (argc != 2)
16 rb_raise(rb_eArgError, "TYPE_REGEXP requires one additional argument");
17 return INT2NUM(set_field_type(field, ftype,
18 - STR2CSTR(arg3)));
19 + StringValuePtr(arg3)));
20 }
21 else if (ftype == TYPE_IPV4){
22 if (argc != 1)
23 @@ -742,7 +743,7 @@
24 */
25 static VALUE rbncurs_c_set_field_buffer(VALUE rb_field, VALUE buf, VALUE value) {
26 FIELD* field = get_field(rb_field);
27 - return INT2NUM(set_field_buffer(field, NUM2INT(buf), STR2CSTR(value)));
28 + return INT2NUM(set_field_buffer(field, NUM2INT(buf), StringValuePtr(value)));
29 }
30 static VALUE rbncurs_m_set_field_buffer(VALUE dummy, VALUE rb_field, VALUE buf, VALUE value)
31 { return rbncurs_c_set_field_buffer(rb_field, buf, value); }
32 @@ -1052,7 +1053,7 @@
33 { return rbncurs_c_form_request_name(request); }
35 static VALUE rbncurs_c_form_request_by_name(VALUE name) {
36 - return INT2NUM(form_request_by_name(STR2CSTR(name)));
37 + return INT2NUM(form_request_by_name(StringValuePtr(name)));
38 }
39 static VALUE rbncurs_m_form_request_by_name(VALUE dummy, VALUE name)
40 { return rbncurs_c_form_request_by_name(name); }
41 diff -Naur ncurses-ruby-1.3.1/menu_wrap.c ncurses-ruby-1.3.1.p/menu_wrap.c
42 --- ncurses-ruby-1.3.1/menu_wrap.c 2011-05-31 01:41:46.000000000 +0200
43 +++ ncurses-ruby-1.3.1.p/menu_wrap.c 2013-03-14 14:39:37.016571464 +0100
44 @@ -372,7 +372,7 @@
45 * Item creation/destruction functions - mitem_new(3X) man page
46 */
47 static VALUE rbncurs_m_new_item(VALUE dummy, VALUE name, VALUE description)
48 -{ return wrap_item(new_item(STR2CSTR(name), STR2CSTR(description))); }
49 +{ return wrap_item(new_item(StringValuePtr(name), StringValuePtr(description))); }
51 static VALUE rbncurs_c_free_item(VALUE rb_item)
52 {
53 @@ -670,7 +670,7 @@
55 static VALUE rbncurs_c_menu_request_by_name(VALUE name)
56 {
57 - return INT2NUM(menu_request_by_name(STR2CSTR(name)));
58 + return INT2NUM(menu_request_by_name(StringValuePtr(name)));
59 }
60 static VALUE rbncurs_m_menu_request_by_name(VALUE dummy, VALUE name)
61 { return rbncurs_c_menu_request_by_name(name); }
62 @@ -909,7 +909,7 @@
63 static VALUE rbncurs_c_set_menu_mark(VALUE rb_menu, VALUE value)
64 {
65 MENU *menu = get_menu(rb_menu);
66 - return INT2NUM(set_menu_mark(menu, STR2CSTR(value)));
67 + return INT2NUM(set_menu_mark(menu, StringValuePtr(value)));
68 }
69 static VALUE rbncurs_m_set_menu_mark(VALUE dummy, VALUE rb_field, VALUE value)
70 { return rbncurs_c_set_menu_mark(rb_field, value); }
71 @@ -929,7 +929,7 @@
72 static VALUE rbncurs_c_set_menu_pattern(VALUE rb_menu, VALUE pattern)
73 {
74 MENU *menu = get_menu(rb_menu);
75 - return INT2NUM(set_menu_pattern(menu, STR2CSTR(pattern)));
76 + return INT2NUM(set_menu_pattern(menu, StringValuePtr(pattern)));
77 }
78 static VALUE rbncurs_m_set_menu_pattern(VALUE dummy, VALUE rb_menu, VALUE pattern)
79 { return rbncurs_c_set_menu_pattern(rb_menu, pattern); }
80 diff -Naur ncurses-ruby-1.3.1/ncurses_wrap.c ncurses-ruby-1.3.1.p/ncurses_wrap.c
81 --- ncurses-ruby-1.3.1/ncurses_wrap.c 2011-05-31 01:41:46.000000000 +0200
82 +++ ncurses-ruby-1.3.1.p/ncurses_wrap.c 2013-03-14 15:09:59.535783327 +0100
83 @@ -475,7 +475,7 @@
84 static VALUE rbncurs_define_key(VALUE dummy, VALUE definition, VALUE keycode)
85 {
86 return INT2NUM(define_key((definition != Qnil)
87 - ? STR2CSTR(definition)
88 + ? StringValuePtr(definition)
89 : (char*)(NULL),
90 NUM2INT(keycode)));
91 }
92 @@ -580,10 +580,10 @@
93 return return_value;
94 }
95 static VALUE rbncurs_addnstr(VALUE dummy, VALUE arg1, VALUE arg2) {
96 - return INT2NUM(addnstr(STR2CSTR(arg1), NUM2INT(arg2)));
97 + return INT2NUM(addnstr(StringValuePtr(arg1), NUM2INT(arg2)));
98 }
99 static VALUE rbncurs_addstr(VALUE dummy, VALUE arg1) {
100 - return INT2NUM(addstr(STR2CSTR(arg1)));
101 + return INT2NUM(addstr(StringValuePtr(arg1)));
102 }
103 static VALUE rbncurs_attroff(VALUE dummy, VALUE arg1) {
104 return INT2NUM(attroff(NUM2ULONG(arg1)));
105 @@ -1011,10 +1011,10 @@
106 return INT2NUM(insertln());
107 }
108 static VALUE rbncurs_insnstr(VALUE dummy, VALUE arg1, VALUE arg2) {
109 - return INT2NUM(insnstr(STR2CSTR(arg1), NUM2INT(arg2)));
110 + return INT2NUM(insnstr(StringValuePtr(arg1), NUM2INT(arg2)));
111 }
112 static VALUE rbncurs_insstr(VALUE dummy, VALUE arg1) {
113 - return INT2NUM(insstr(STR2CSTR(arg1)));
114 + return INT2NUM(insstr(StringValuePtr(arg1)));
115 }
116 #ifdef HAVE_INTRFLUSH
117 static VALUE rbncurs_intrflush(VALUE dummy, VALUE arg1, VALUE arg2) {
118 @@ -1070,10 +1070,10 @@
119 return return_value;
120 }
121 static VALUE rbncurs_mvaddnstr(VALUE dummy, VALUE arg1, VALUE arg2, VALUE arg3, VALUE arg4) {
122 - return INT2NUM(mvaddnstr(NUM2INT(arg1), NUM2INT(arg2), STR2CSTR(arg3), NUM2INT(arg4)));
123 + return INT2NUM(mvaddnstr(NUM2INT(arg1), NUM2INT(arg2), StringValuePtr(arg3), NUM2INT(arg4)));
124 }
125 static VALUE rbncurs_mvaddstr(VALUE dummy, VALUE arg1, VALUE arg2, VALUE arg3) {
126 - return INT2NUM(mvaddstr(NUM2INT(arg1), NUM2INT(arg2), STR2CSTR(arg3)));
127 + return INT2NUM(mvaddstr(NUM2INT(arg1), NUM2INT(arg2), StringValuePtr(arg3)));
128 }
129 #ifdef HAVE_MVCHGAT
130 static VALUE rbncurs_mvchgat(VALUE dummy, VALUE arg1, VALUE arg2, VALUE arg3, VALUE arg4, VALUE arg5, VALUE arg6) {
131 @@ -1106,10 +1106,10 @@
132 return INT2NUM(mvinsch(NUM2INT(arg1), NUM2INT(arg2), NUM2ULONG(arg3)));
133 }
134 static VALUE rbncurs_mvinsnstr(VALUE dummy, VALUE arg1, VALUE arg2, VALUE arg3, VALUE arg4) {
135 - return INT2NUM(mvinsnstr(NUM2INT(arg1), NUM2INT(arg2), STR2CSTR(arg3), NUM2INT(arg4)));
136 + return INT2NUM(mvinsnstr(NUM2INT(arg1), NUM2INT(arg2), StringValuePtr(arg3), NUM2INT(arg4)));
137 }
138 static VALUE rbncurs_mvinsstr(VALUE dummy, VALUE arg1, VALUE arg2, VALUE arg3) {
139 - return INT2NUM(mvinsstr(NUM2INT(arg1), NUM2INT(arg2), STR2CSTR(arg3)));
140 + return INT2NUM(mvinsstr(NUM2INT(arg1), NUM2INT(arg2), StringValuePtr(arg3)));
141 }
142 #ifdef HAVE_MVVLINE
143 static VALUE rbncurs_mvvline(VALUE dummy, VALUE arg1, VALUE arg2, VALUE arg3, VALUE arg4) {
144 @@ -1137,10 +1137,10 @@
145 return return_value;
146 }
147 static VALUE rbncurs_mvwaddnstr(VALUE dummy, VALUE arg1, VALUE arg2, VALUE arg3, VALUE arg4, VALUE arg5) {
148 - return INT2NUM(mvwaddnstr(get_window(arg1), NUM2INT(arg2), NUM2INT(arg3), STR2CSTR(arg4), NUM2INT(arg5)));
149 + return INT2NUM(mvwaddnstr(get_window(arg1), NUM2INT(arg2), NUM2INT(arg3), StringValuePtr(arg4), NUM2INT(arg5)));
150 }
151 static VALUE rbncurs_mvwaddstr(VALUE dummy, VALUE arg1, VALUE arg2, VALUE arg3, VALUE arg4) {
152 - return INT2NUM(mvwaddstr(get_window(arg1), NUM2INT(arg2), NUM2INT(arg3), STR2CSTR(arg4)));
153 + return INT2NUM(mvwaddstr(get_window(arg1), NUM2INT(arg2), NUM2INT(arg3), StringValuePtr(arg4)));
154 }
155 #ifdef HAVE_MVWCHGAT
156 static VALUE rbncurs_mvwchgat(VALUE dummy, VALUE arg1, VALUE arg2, VALUE arg3, VALUE arg4, VALUE arg5, VALUE arg6, VALUE arg7) {
157 @@ -1171,10 +1171,10 @@
158 return INT2NUM(mvwinsch(get_window(arg1), NUM2INT(arg2), NUM2INT(arg3), NUM2ULONG(arg4)));
159 }
160 static VALUE rbncurs_mvwinsnstr(VALUE dummy, VALUE arg1, VALUE arg2, VALUE arg3, VALUE arg4, VALUE arg5) {
161 - return INT2NUM(mvwinsnstr(get_window(arg1), NUM2INT(arg2), NUM2INT(arg3), STR2CSTR(arg4), NUM2INT(arg5)));
162 + return INT2NUM(mvwinsnstr(get_window(arg1), NUM2INT(arg2), NUM2INT(arg3), StringValuePtr(arg4), NUM2INT(arg5)));
163 }
164 static VALUE rbncurs_mvwinsstr(VALUE dummy, VALUE arg1, VALUE arg2, VALUE arg3, VALUE arg4) {
165 - return INT2NUM(mvwinsstr(get_window(arg1), NUM2INT(arg2), NUM2INT(arg3), STR2CSTR(arg4)));
166 + return INT2NUM(mvwinsstr(get_window(arg1), NUM2INT(arg2), NUM2INT(arg3), StringValuePtr(arg4)));
167 }
168 #ifdef HAVE_MVWVLINE
169 static VALUE rbncurs_mvwvline(VALUE dummy, VALUE arg1, VALUE arg2, VALUE arg3, VALUE arg4, VALUE arg5) {
170 @@ -1238,7 +1238,7 @@
171 }
172 #ifdef HAVE_PUTP
173 static VALUE rbncurs_putp(VALUE dummy, VALUE arg1) {
174 - return INT2NUM(putp(STR2CSTR(arg1)));
175 + return INT2NUM(putp(StringValuePtr(arg1)));
176 }
177 #endif
178 #ifdef HAVE_QIFLUSH
179 @@ -1271,12 +1271,12 @@
180 }
181 #ifdef HAVE_SCR_DUMP
182 static VALUE rbncurs_scr_dump(VALUE dummy, VALUE arg1) {
183 - return INT2NUM(scr_dump(STR2CSTR(arg1)));
184 + return INT2NUM(scr_dump(StringValuePtr(arg1)));
185 }
186 #endif
187 #ifdef HAVE_SCR_INIT
188 static VALUE rbncurs_scr_init(VALUE dummy, VALUE arg1) {
189 - return INT2NUM(scr_init(STR2CSTR(arg1)));
190 + return INT2NUM(scr_init(StringValuePtr(arg1)));
191 }
192 #endif
193 static VALUE rbncurs_scrl(VALUE dummy, VALUE arg1) {
194 @@ -1290,12 +1290,12 @@
195 }
196 #ifdef HAVE_SCR_RESTORE
197 static VALUE rbncurs_scr_restore(VALUE dummy, VALUE arg1) {
198 - return INT2NUM(scr_restore(STR2CSTR(arg1)));
199 + return INT2NUM(scr_restore(StringValuePtr(arg1)));
200 }
201 #endif
202 #ifdef HAVE_SCR_SET
203 static VALUE rbncurs_scr_set(VALUE dummy, VALUE arg1) {
204 - return INT2NUM(scr_set(STR2CSTR(arg1)));
205 + return INT2NUM(scr_set(StringValuePtr(arg1)));
206 }
207 #endif
208 static VALUE rbncurs_setscrreg(VALUE dummy, VALUE arg1, VALUE arg2) {
209 @@ -1352,7 +1352,7 @@
210 return INT2NUM(slk_restore());
211 }
212 static VALUE rbncurs_slk_set(VALUE dummy, VALUE arg1, VALUE arg2, VALUE arg3) {
213 - return INT2NUM(slk_set(NUM2INT(arg1), STR2CSTR(arg2), NUM2INT(arg3)));
214 + return INT2NUM(slk_set(NUM2INT(arg1), StringValuePtr(arg2), NUM2INT(arg3)));
215 }
216 static VALUE rbncurs_slk_touch(VALUE dummy) {
217 return INT2NUM(slk_touch());
218 @@ -1383,17 +1383,17 @@
219 }
220 #ifdef HAVE_TIGETFLAG
221 static VALUE rbncurs_tigetflag(VALUE dummy, VALUE arg1) {
222 - return INT2NUM(tigetflag(STR2CSTR(arg1)));
223 + return INT2NUM(tigetflag(StringValuePtr(arg1)));
224 }
225 #endif
226 #ifdef HAVE_TIGETNUM
227 static VALUE rbncurs_tigetnum(VALUE dummy, VALUE arg1) {
228 - return INT2NUM(tigetnum(STR2CSTR(arg1)));
229 + return INT2NUM(tigetnum(StringValuePtr(arg1)));
230 }
231 #endif
232 #ifdef HAVE_TIGETSTR
233 static VALUE rbncurs_tigetstr(VALUE dummy, VALUE arg1) {
234 - return rb_str_new2(tigetstr(STR2CSTR(arg1)));
235 + return rb_str_new2(tigetstr(StringValuePtr(arg1)));
236 }
237 #endif
238 static VALUE rbncurs_timeout(VALUE dummy, VALUE arg1) {
239 @@ -1438,10 +1438,10 @@
240 return return_value;
241 }
242 static VALUE rbncurs_waddnstr(VALUE dummy, VALUE arg1, VALUE arg2, VALUE arg3) {
243 - return INT2NUM(waddnstr(get_window(arg1), STR2CSTR(arg2), NUM2INT(arg3)));
244 + return INT2NUM(waddnstr(get_window(arg1), StringValuePtr(arg2), NUM2INT(arg3)));
245 }
246 static VALUE rbncurs_waddstr(VALUE dummy, VALUE arg1, VALUE arg2) {
247 - return INT2NUM(waddstr(get_window(arg1), STR2CSTR(arg2)));
248 + return INT2NUM(waddstr(get_window(arg1), StringValuePtr(arg2)));
249 }
250 static VALUE rbncurs_wattron(VALUE dummy, VALUE arg1, VALUE arg2) {
251 return INT2NUM(wattron(get_window(arg1), NUM2INT(arg2)));
252 @@ -1514,10 +1514,10 @@
253 return INT2NUM(winsertln(get_window(arg1)));
254 }
255 static VALUE rbncurs_winsnstr(VALUE dummy, VALUE arg1, VALUE arg2, VALUE arg3) {
256 - return INT2NUM(winsnstr(get_window(arg1), STR2CSTR(arg2), NUM2INT(arg3)));
257 + return INT2NUM(winsnstr(get_window(arg1), StringValuePtr(arg2), NUM2INT(arg3)));
258 }
259 static VALUE rbncurs_winsstr(VALUE dummy, VALUE arg1, VALUE arg2) {
260 - return INT2NUM(winsstr(get_window(arg1), STR2CSTR(arg2)));
261 + return INT2NUM(winsstr(get_window(arg1), StringValuePtr(arg2)));
262 }
263 static VALUE rbncurs_wmove(VALUE dummy, VALUE arg1, VALUE arg2, VALUE arg3) {
264 return INT2NUM(wmove(get_window(arg1), NUM2INT(arg2), NUM2INT(arg3)));
265 @@ -1619,7 +1619,7 @@
266 { return rb_str_new2(unctrl(NUM2ULONG(ch))); }
267 static VALUE rbncurs_newterm(VALUE dummy, VALUE rb_type, VALUE rb_outfd, VALUE rb_infd)
268 {
269 - char * type = (rb_type == Qnil) ? (char*)0 : STR2CSTR(rb_type);
270 + char * type = (rb_type == Qnil) ? (char*)0 : StringValuePtr(rb_type);
271 int outfd = NUM2INT(rb_funcall(rb_outfd, rb_intern("to_i"), 0));
272 int infd = NUM2INT(rb_funcall(rb_infd, rb_intern("to_i"), 0));
273 VALUE rb_screen =
274 @@ -2277,7 +2277,7 @@
275 #ifdef HAVE_MCPRINT
276 static VALUE rbncurs_mcprint(VALUE dummy, VALUE data, VALUE len)
277 {
278 - return INT2NUM(mcprint(STR2CSTR(data), NUM2INT(len)));
279 + return INT2NUM(mcprint(StringValuePtr(data), NUM2INT(len)));
280 }
281 #endif
282 #ifdef HAVE_HAS_KEY
283 @@ -2378,9 +2378,9 @@
284 " and a String");
285 return Qnil;
286 }
287 + VALUE tmp = rb_funcall3(rb_mKernel, rb_intern("sprintf"), argc-1, argv + 1);
288 wprintw(get_window(argv[0]), "%s",
289 - STR2CSTR(rb_funcall3(rb_mKernel, rb_intern("sprintf"), argc-1,
290 - argv + 1)));
291 + StringValuePtr(tmp));
292 return Qnil;
293 }
295 @@ -2394,14 +2394,14 @@
296 return Qnil;
297 }
298 _tracef("%s",
299 - STR2CSTR(rb_funcall3(rb_mKernel, rb_intern("sprintf"), argc, argv)));
300 + StringValuePtr(funcall3(rb_mKernel, rb_intern("sprintf"), argc, argv)));
301 return Qnil;
302 }
303 #endif /* HAVE__TRACEF */
304 #ifdef HAVE__TRACEDUMP
305 static VALUE rbncurs_tracedump(VALUE dummy, VALUE rb_label, VALUE rb_win)
306 {
307 - _tracedump(STR2CSTR(rb_label), get_window(rb_win));
308 + _tracedump(StringValuePtr(rb_label), get_window(rb_win));
309 }
310 #endif /* HAVE__TRACEDUMP */
311 #ifdef HAVE__TRACEATTR
312 @@ -2706,7 +2706,7 @@
314 #ifdef HAVE_LOCALE_H
315 static VALUE rbncurs_setlocale(VALUE dummy, VALUE category, VALUE locale)
316 -{ return rb_str_new2(setlocale(NUM2INT(category), STR2CSTR(locale)));}
317 +{ return rb_str_new2(setlocale(NUM2INT(category), StringValuePtr(locale)));}
318 #endif
320 static void init_safe_functions(void)