summaryrefslogtreecommitdiff
path: root/devel/ruby-ncurses/patches/patch-ab
blob: 64094592a1ecc15be1be4d0951d36c9009797ee3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
$NetBSD: patch-ab,v 1.2 2013/12/12 22:54:36 jperkin Exp $

Disable TYPE_IPV4 on SunOS.

--- form_wrap.c.orig	2009-07-31 10:52:36.000000000 +0000
+++ form_wrap.c
@@ -618,12 +618,14 @@ static VALUE rbncurs_c_set_field_type(in
 		rb_raise(rb_eArgError, "TYPE_ENUM requires three additional arguments");
 	 }
     else {
+		VALUE v;
 		int n = rbncurs_array_length(arg3);
 		/*  Will ncurses free this array of strings in free_field()? */
 		char** list = ALLOC_N(char*, n+1);
 		int i;
 		for (i = 0; i < n; i++) {
-		  list[i] = STR2CSTR(rb_ary_entry(arg3, (long)i));
+		  v = rb_ary_entry(arg3, (long)i);
+		  list[i] = StringValuePtr(v);
 		}
 		list[n] = NULL;
 		return INT2NUM(set_field_type(field, ftype, 
@@ -652,13 +654,15 @@ static VALUE rbncurs_c_set_field_type(in
 	 if (argc != 2)
 		rb_raise(rb_eArgError, "TYPE_REGEXP requires one additional argument");
 	 return INT2NUM(set_field_type(field, ftype, 
-											 STR2CSTR(arg3)));
+											 StringValue(arg3)));
   }
+#ifndef __sun
   else if (ftype == TYPE_IPV4){	
 	 if (argc != 1)
 		rb_raise(rb_eArgError, "TYPE_IPV4 has no additional arguments");
 	 return INT2NUM(set_field_type(field, ftype));
   }
+#endif
   else {	
 	 /*  It is a user-defined field type. */
 	 /*  Will store the arguments associated with this field */
@@ -740,7 +744,7 @@ static VALUE rbncurs_m_field_pad(VALUE d
  */
 static VALUE rbncurs_c_set_field_buffer(VALUE rb_field, VALUE buf, VALUE value) {
   FIELD* field = get_field(rb_field);
-  return INT2NUM(set_field_buffer(field, NUM2INT(buf), STR2CSTR(value)));
+  return INT2NUM(set_field_buffer(field, NUM2INT(buf), StringValuePtr(value)));
 }
 static VALUE rbncurs_m_set_field_buffer(VALUE dummy, VALUE rb_field, VALUE buf, VALUE value)
 { return rbncurs_c_set_field_buffer(rb_field, buf, value); }
@@ -1044,13 +1048,15 @@ static VALUE rbncurs_m_form_opts(VALUE d
  * form_requestname
  */
 static VALUE rbncurs_c_form_request_name(VALUE request) {
-  return rb_str_new2(form_request_name(NUM2INT(request)));
+  const char *s;
+  s = form_request_name(NUM2INT(request));
+  return rb_str_new2(s);
 }
 static VALUE rbncurs_m_form_request_name(VALUE dummy, VALUE request)
 { return rbncurs_c_form_request_name(request); }
 
 static VALUE rbncurs_c_form_request_by_name(VALUE name) {
-  return INT2NUM(form_request_by_name(STR2CSTR(name)));
+  return INT2NUM(form_request_by_name(StringValuePtr(name)));
 }
 static VALUE rbncurs_m_form_request_by_name(VALUE dummy, VALUE name)
 { return rbncurs_c_form_request_by_name(name); }
@@ -1442,7 +1448,9 @@ void init_form(void)
   rb_define_const(mForm, "TYPE_INTEGER", wrap_fieldtype(TYPE_INTEGER));
   rb_define_const(mForm, "TYPE_NUMERIC", wrap_fieldtype(TYPE_NUMERIC));
   rb_define_const(mForm, "TYPE_REGEXP", wrap_fieldtype(TYPE_REGEXP));
+#ifndef __sun
   rb_define_const(mForm, "TYPE_IPV4", wrap_fieldtype(TYPE_IPV4));
+#endif
 
 }