pkgsrc/devel/ruby-ncurses/patches/patch-aa
marino 245a8fd209 devel/ruby-ncurses: fix _tracef build error on DragonFly
Original error:
ncurses_wrap.c: In function 'rbncurs_tracef':
ncurses_wrap.c:2398: error: lvalue required as unary '&' operand
2012-05-20 17:32:34 +00:00

251 lines
11 KiB
Text

$NetBSD: patch-aa,v 1.4 2012/05/20 17:32:34 marino Exp $
--- ncurses_wrap.c.orig 2009-07-31 10:52:36.000000000 +0000
+++ ncurses_wrap.c
@@ -475,7 +475,7 @@ static VALUE rbncurs_curses_version(){re
static VALUE rbncurs_define_key(VALUE dummy, VALUE definition, VALUE keycode)
{
return INT2NUM(define_key((definition != Qnil)
- ? STR2CSTR(definition)
+ ? StringValuePtr(definition)
: (char*)(NULL),
NUM2INT(keycode)));
}
@@ -580,10 +580,10 @@ static VALUE rbncurs_addchstr(VALUE dumm
return return_value;
}
static VALUE rbncurs_addnstr(VALUE dummy, VALUE arg1, VALUE arg2) {
- return INT2NUM(addnstr(STR2CSTR(arg1), NUM2INT(arg2)));
+ return INT2NUM(addnstr(StringValuePtr(arg1), NUM2INT(arg2)));
}
static VALUE rbncurs_addstr(VALUE dummy, VALUE arg1) {
- return INT2NUM(addstr(STR2CSTR(arg1)));
+ return INT2NUM(addstr(StringValuePtr(arg1)));
}
static VALUE rbncurs_attroff(VALUE dummy, VALUE arg1) {
return INT2NUM(attroff(NUM2ULONG(arg1)));
@@ -1011,10 +1011,10 @@ static VALUE rbncurs_insertln(VALUE dumm
return INT2NUM(insertln());
}
static VALUE rbncurs_insnstr(VALUE dummy, VALUE arg1, VALUE arg2) {
- return INT2NUM(insnstr(STR2CSTR(arg1), NUM2INT(arg2)));
+ return INT2NUM(insnstr(StringValuePtr(arg1), NUM2INT(arg2)));
}
static VALUE rbncurs_insstr(VALUE dummy, VALUE arg1) {
- return INT2NUM(insstr(STR2CSTR(arg1)));
+ return INT2NUM(insstr(StringValuePtr(arg1)));
}
#ifdef HAVE_INTRFLUSH
static VALUE rbncurs_intrflush(VALUE dummy, VALUE arg1, VALUE arg2) {
@@ -1070,10 +1070,10 @@ static VALUE rbncurs_mvaddchstr(VALUE du
return return_value;
}
static VALUE rbncurs_mvaddnstr(VALUE dummy, VALUE arg1, VALUE arg2, VALUE arg3, VALUE arg4) {
- return INT2NUM(mvaddnstr(NUM2INT(arg1), NUM2INT(arg2), STR2CSTR(arg3), NUM2INT(arg4)));
+ return INT2NUM(mvaddnstr(NUM2INT(arg1), NUM2INT(arg2), StringValuePtr(arg3), NUM2INT(arg4)));
}
static VALUE rbncurs_mvaddstr(VALUE dummy, VALUE arg1, VALUE arg2, VALUE arg3) {
- return INT2NUM(mvaddstr(NUM2INT(arg1), NUM2INT(arg2), STR2CSTR(arg3)));
+ return INT2NUM(mvaddstr(NUM2INT(arg1), NUM2INT(arg2), StringValuePtr(arg3)));
}
#ifdef HAVE_MVCHGAT
static VALUE rbncurs_mvchgat(VALUE dummy, VALUE arg1, VALUE arg2, VALUE arg3, VALUE arg4, VALUE arg5, VALUE arg6) {
@@ -1106,10 +1106,10 @@ static VALUE rbncurs_mvinsch(VALUE dummy
return INT2NUM(mvinsch(NUM2INT(arg1), NUM2INT(arg2), NUM2ULONG(arg3)));
}
static VALUE rbncurs_mvinsnstr(VALUE dummy, VALUE arg1, VALUE arg2, VALUE arg3, VALUE arg4) {
- return INT2NUM(mvinsnstr(NUM2INT(arg1), NUM2INT(arg2), STR2CSTR(arg3), NUM2INT(arg4)));
+ return INT2NUM(mvinsnstr(NUM2INT(arg1), NUM2INT(arg2), StringValuePtr(arg3), NUM2INT(arg4)));
}
static VALUE rbncurs_mvinsstr(VALUE dummy, VALUE arg1, VALUE arg2, VALUE arg3) {
- return INT2NUM(mvinsstr(NUM2INT(arg1), NUM2INT(arg2), STR2CSTR(arg3)));
+ return INT2NUM(mvinsstr(NUM2INT(arg1), NUM2INT(arg2), StringValuePtr(arg3)));
}
#ifdef HAVE_MVVLINE
static VALUE rbncurs_mvvline(VALUE dummy, VALUE arg1, VALUE arg2, VALUE arg3, VALUE arg4) {
@@ -1137,10 +1137,10 @@ static VALUE rbncurs_mvwaddchstr(VALUE d
return return_value;
}
static VALUE rbncurs_mvwaddnstr(VALUE dummy, VALUE arg1, VALUE arg2, VALUE arg3, VALUE arg4, VALUE arg5) {
- return INT2NUM(mvwaddnstr(get_window(arg1), NUM2INT(arg2), NUM2INT(arg3), STR2CSTR(arg4), NUM2INT(arg5)));
+ return INT2NUM(mvwaddnstr(get_window(arg1), NUM2INT(arg2), NUM2INT(arg3), StringValuePtr(arg4), NUM2INT(arg5)));
}
static VALUE rbncurs_mvwaddstr(VALUE dummy, VALUE arg1, VALUE arg2, VALUE arg3, VALUE arg4) {
- return INT2NUM(mvwaddstr(get_window(arg1), NUM2INT(arg2), NUM2INT(arg3), STR2CSTR(arg4)));
+ return INT2NUM(mvwaddstr(get_window(arg1), NUM2INT(arg2), NUM2INT(arg3), StringValuePtr(arg4)));
}
#ifdef HAVE_MVWCHGAT
static VALUE rbncurs_mvwchgat(VALUE dummy, VALUE arg1, VALUE arg2, VALUE arg3, VALUE arg4, VALUE arg5, VALUE arg6, VALUE arg7) {
@@ -1171,10 +1171,10 @@ static VALUE rbncurs_mvwinsch(VALUE dumm
return INT2NUM(mvwinsch(get_window(arg1), NUM2INT(arg2), NUM2INT(arg3), NUM2ULONG(arg4)));
}
static VALUE rbncurs_mvwinsnstr(VALUE dummy, VALUE arg1, VALUE arg2, VALUE arg3, VALUE arg4, VALUE arg5) {
- return INT2NUM(mvwinsnstr(get_window(arg1), NUM2INT(arg2), NUM2INT(arg3), STR2CSTR(arg4), NUM2INT(arg5)));
+ return INT2NUM(mvwinsnstr(get_window(arg1), NUM2INT(arg2), NUM2INT(arg3), StringValuePtr(arg4), NUM2INT(arg5)));
}
static VALUE rbncurs_mvwinsstr(VALUE dummy, VALUE arg1, VALUE arg2, VALUE arg3, VALUE arg4) {
- return INT2NUM(mvwinsstr(get_window(arg1), NUM2INT(arg2), NUM2INT(arg3), STR2CSTR(arg4)));
+ return INT2NUM(mvwinsstr(get_window(arg1), NUM2INT(arg2), NUM2INT(arg3), StringValuePtr(arg4)));
}
#ifdef HAVE_MVWVLINE
static VALUE rbncurs_mvwvline(VALUE dummy, VALUE arg1, VALUE arg2, VALUE arg3, VALUE arg4, VALUE arg5) {
@@ -1238,7 +1238,7 @@ static VALUE rbncurs_prefresh(VALUE dumm
}
#ifdef HAVE_PUTP
static VALUE rbncurs_putp(VALUE dummy, VALUE arg1) {
- return INT2NUM(putp(STR2CSTR(arg1)));
+ return INT2NUM(putp(StringValuePtr(arg1)));
}
#endif
#ifdef HAVE_QIFLUSH
@@ -1271,12 +1271,12 @@ static VALUE rbncurs_savetty(VALUE dummy
}
#ifdef HAVE_SCR_DUMP
static VALUE rbncurs_scr_dump(VALUE dummy, VALUE arg1) {
- return INT2NUM(scr_dump(STR2CSTR(arg1)));
+ return INT2NUM(scr_dump(StringValuePtr(arg1)));
}
#endif
#ifdef HAVE_SCR_INIT
static VALUE rbncurs_scr_init(VALUE dummy, VALUE arg1) {
- return INT2NUM(scr_init(STR2CSTR(arg1)));
+ return INT2NUM(scr_init(StringValuePtr(arg1)));
}
#endif
static VALUE rbncurs_scrl(VALUE dummy, VALUE arg1) {
@@ -1290,12 +1290,12 @@ static VALUE rbncurs_scrollok(VALUE dumm
}
#ifdef HAVE_SCR_RESTORE
static VALUE rbncurs_scr_restore(VALUE dummy, VALUE arg1) {
- return INT2NUM(scr_restore(STR2CSTR(arg1)));
+ return INT2NUM(scr_restore(StringValuePtr(arg1)));
}
#endif
#ifdef HAVE_SCR_SET
static VALUE rbncurs_scr_set(VALUE dummy, VALUE arg1) {
- return INT2NUM(scr_set(STR2CSTR(arg1)));
+ return INT2NUM(scr_set(StringValuePtr(arg1)));
}
#endif
static VALUE rbncurs_setscrreg(VALUE dummy, VALUE arg1, VALUE arg2) {
@@ -1352,7 +1352,7 @@ static VALUE rbncurs_slk_restore(VALUE d
return INT2NUM(slk_restore());
}
static VALUE rbncurs_slk_set(VALUE dummy, VALUE arg1, VALUE arg2, VALUE arg3) {
- return INT2NUM(slk_set(NUM2INT(arg1), STR2CSTR(arg2), NUM2INT(arg3)));
+ return INT2NUM(slk_set(NUM2INT(arg1), StringValuePtr(arg2), NUM2INT(arg3)));
}
static VALUE rbncurs_slk_touch(VALUE dummy) {
return INT2NUM(slk_touch());
@@ -1383,17 +1383,17 @@ static VALUE rbncurs_termname(VALUE dumm
}
#ifdef HAVE_TIGETFLAG
static VALUE rbncurs_tigetflag(VALUE dummy, VALUE arg1) {
- return INT2NUM(tigetflag(STR2CSTR(arg1)));
+ return INT2NUM(tigetflag(StringValuePtr(arg1)));
}
#endif
#ifdef HAVE_TIGETNUM
static VALUE rbncurs_tigetnum(VALUE dummy, VALUE arg1) {
- return INT2NUM(tigetnum(STR2CSTR(arg1)));
+ return INT2NUM(tigetnum(StringValuePtr(arg1)));
}
#endif
#ifdef HAVE_TIGETSTR
static VALUE rbncurs_tigetstr(VALUE dummy, VALUE arg1) {
- return rb_str_new2(tigetstr(STR2CSTR(arg1)));
+ return rb_str_new2(tigetstr(StringValuePtr(arg1)));
}
#endif
static VALUE rbncurs_timeout(VALUE dummy, VALUE arg1) {
@@ -1438,10 +1438,10 @@ static VALUE rbncurs_waddchstr(VALUE dum
return return_value;
}
static VALUE rbncurs_waddnstr(VALUE dummy, VALUE arg1, VALUE arg2, VALUE arg3) {
- return INT2NUM(waddnstr(get_window(arg1), STR2CSTR(arg2), NUM2INT(arg3)));
+ return INT2NUM(waddnstr(get_window(arg1), StringValuePtr(arg2), NUM2INT(arg3)));
}
static VALUE rbncurs_waddstr(VALUE dummy, VALUE arg1, VALUE arg2) {
- return INT2NUM(waddstr(get_window(arg1), STR2CSTR(arg2)));
+ return INT2NUM(waddstr(get_window(arg1), StringValuePtr(arg2)));
}
static VALUE rbncurs_wattron(VALUE dummy, VALUE arg1, VALUE arg2) {
return INT2NUM(wattron(get_window(arg1), NUM2INT(arg2)));
@@ -1514,10 +1514,10 @@ static VALUE rbncurs_winsertln(VALUE dum
return INT2NUM(winsertln(get_window(arg1)));
}
static VALUE rbncurs_winsnstr(VALUE dummy, VALUE arg1, VALUE arg2, VALUE arg3) {
- return INT2NUM(winsnstr(get_window(arg1), STR2CSTR(arg2), NUM2INT(arg3)));
+ return INT2NUM(winsnstr(get_window(arg1), StringValuePtr(arg2), NUM2INT(arg3)));
}
static VALUE rbncurs_winsstr(VALUE dummy, VALUE arg1, VALUE arg2) {
- return INT2NUM(winsstr(get_window(arg1), STR2CSTR(arg2)));
+ return INT2NUM(winsstr(get_window(arg1), StringValuePtr(arg2)));
}
static VALUE rbncurs_wmove(VALUE dummy, VALUE arg1, VALUE arg2, VALUE arg3) {
return INT2NUM(wmove(get_window(arg1), NUM2INT(arg2), NUM2INT(arg3)));
@@ -1619,7 +1619,7 @@ static VALUE rbncurs_unctrl(VALUE dummy,
{ return rb_str_new2(unctrl(NUM2ULONG(ch))); }
static VALUE rbncurs_newterm(VALUE dummy, VALUE rb_type, VALUE rb_outfd, VALUE rb_infd)
{
- char * type = (rb_type == Qnil) ? (char*)0 : STR2CSTR(rb_type);
+ char * type = (rb_type == Qnil) ? (char*)0 : StringValuePtr(rb_type);
int outfd = NUM2INT(rb_funcall(rb_outfd, rb_intern("to_i"), 0));
int infd = NUM2INT(rb_funcall(rb_infd, rb_intern("to_i"), 0));
VALUE rb_screen =
@@ -2277,7 +2277,7 @@ static VALUE rbncurs_wmouse_trafo(VALUE
#ifdef HAVE_MCPRINT
static VALUE rbncurs_mcprint(VALUE dummy, VALUE data, VALUE len)
{
- return INT2NUM(mcprint(STR2CSTR(data), NUM2INT(len)));
+ return INT2NUM(mcprint(StringValuePtr(data), NUM2INT(len)));
}
#endif
#ifdef HAVE_HAS_KEY
@@ -2373,14 +2373,15 @@ static VALUE rbncurs_setsyx(VALUE dummy,
static VALUE rbncurs_wprintw(int argc, VALUE * argv, VALUE dummy)
{
+ VALUE v;
+
if (argc < 2) {
rb_raise(rb_eArgError, "function needs at least 2 arguments: a WINDOW"
" and a String");
return Qnil;
}
- wprintw(get_window(argv[0]), "%s",
- STR2CSTR(rb_funcall3(rb_mKernel, rb_intern("sprintf"), argc-1,
- argv + 1)));
+ v = rb_funcall3(rb_mKernel, rb_intern("sprintf"), argc-1, argv + 1);
+ wprintw(get_window(argv[0]), "%s", StringValuePtr(v));
return Qnil;
}
@@ -2393,15 +2394,15 @@ static VALUE rbncurs_tracef(int argc, VA
rb_raise(rb_eArgError, "function needs at least 1 argument");
return Qnil;
}
- _tracef("%s",
- STR2CSTR(funcall3(rb_mKernel, rb_intern("sprintf"), argc, argv)));
+ VALUE tmp = funcall3(rb_mKernel, rb_intern("sprintf"), argc, argv);
+ _tracef("%s", StringValuePtr(tmp));
return Qnil;
}
#endif /* HAVE__TRACEF */
#ifdef HAVE__TRACEDUMP
static VALUE rbncurs_tracedump(VALUE dummy, VALUE rb_label, VALUE rb_win)
{
- _tracedump(STR2CSTR(rb_label), get_window(rb_win));
+ _tracedump(StringValuePtr(rb_label), get_window(rb_win));
}
#endif /* HAVE__TRACEDUMP */
#ifdef HAVE__TRACEATTR
@@ -2706,7 +2707,7 @@ void init_SCREEN_methods(void)
#ifdef HAVE_LOCALE_H
static VALUE rbncurs_setlocale(VALUE dummy, VALUE category, VALUE locale)
-{ return rb_str_new2(setlocale(NUM2INT(category), STR2CSTR(locale)));}
+{ return rb_str_new2(setlocale(NUM2INT(category), StringValuePtr(locale)));}
#endif
static void init_safe_functions(void)