Permalink
Browse files

Fix downstream sprintf arguments through rb_raise

  • Loading branch information...
1 parent 08f27a6 commit 9473a1b181ed1997e3156d960b2bb2783f508191 @raggi raggi committed Jul 12, 2012
Showing with 13 additions and 13 deletions.
  1. +13 −13 ext/rubymain.cpp
View
@@ -233,7 +233,7 @@ static VALUE t_add_oneshot_timer (VALUE self, VALUE interval)
{
const unsigned long f = evma_install_oneshot_timer (FIX2INT (interval));
if (!f)
- rb_raise (rb_eRuntimeError, "ran out of timers; use #set_max_timers to increase limit");
+ rb_raise (rb_eRuntimeError, "%s", "ran out of timers; use #set_max_timers to increase limit");
return ULONG2NUM (f);
}
@@ -246,7 +246,7 @@ static VALUE t_start_server (VALUE self, VALUE server, VALUE port)
{
const unsigned long f = evma_create_tcp_server (StringValuePtr(server), FIX2INT(port));
if (!f)
- rb_raise (rb_eRuntimeError, "no acceptor (port is in use or requires root privileges)");
+ rb_raise (rb_eRuntimeError, "%s", "no acceptor (port is in use or requires root privileges)");
return ULONG2NUM (f);
}
@@ -269,7 +269,7 @@ static VALUE t_start_unix_server (VALUE self, VALUE filename)
{
const unsigned long f = evma_create_unix_domain_server (StringValuePtr(filename));
if (!f)
- rb_raise (rb_eRuntimeError, "no unix-domain acceptor");
+ rb_raise (rb_eRuntimeError, "%s", "no unix-domain acceptor");
return ULONG2NUM (f);
}
@@ -504,7 +504,7 @@ static VALUE t_connect_server (VALUE self, VALUE server, VALUE port)
try {
const unsigned long f = evma_connect_to_server (NULL, 0, StringValuePtr(server), NUM2INT(port));
if (!f)
- rb_raise (EM_eConnectionError, "no connection");
+ rb_raise (EM_eConnectionError, "%s", "no connection");
return ULONG2NUM (f);
} catch (std::runtime_error e) {
rb_raise (EM_eConnectionError, "%s", e.what());
@@ -525,7 +525,7 @@ static VALUE t_bind_connect_server (VALUE self, VALUE bind_addr, VALUE bind_port
try {
const unsigned long f = evma_connect_to_server (StringValuePtr(bind_addr), NUM2INT(bind_port), StringValuePtr(server), NUM2INT(port));
if (!f)
- rb_raise (EM_eConnectionError, "no connection");
+ rb_raise (EM_eConnectionError, "%s", "no connection");
return ULONG2NUM (f);
} catch (std::runtime_error e) {
rb_raise (EM_eConnectionError, "%s", e.what());
@@ -541,7 +541,7 @@ static VALUE t_connect_unix_server (VALUE self, VALUE serversocket)
{
const unsigned long f = evma_connect_to_unix_server (StringValuePtr(serversocket));
if (!f)
- rb_raise (rb_eRuntimeError, "no connection");
+ rb_raise (rb_eRuntimeError, "%s", "no connection");
return ULONG2NUM (f);
}
@@ -553,7 +553,7 @@ static VALUE t_attach_fd (VALUE self, VALUE file_descriptor, VALUE watch_mode)
{
const unsigned long f = evma_attach_fd (NUM2INT(file_descriptor), watch_mode == Qtrue);
if (!f)
- rb_raise (rb_eRuntimeError, "no connection");
+ rb_raise (rb_eRuntimeError, "%s", "no connection");
return ULONG2NUM (f);
}
@@ -703,7 +703,7 @@ static VALUE t_open_udp_socket (VALUE self, VALUE server, VALUE port)
{
const unsigned long f = evma_open_datagram_socket (StringValuePtr(server), FIX2INT(port));
if (!f)
- rb_raise (rb_eRuntimeError, "no datagram socket");
+ rb_raise (rb_eRuntimeError, "%s", "no datagram socket");
return ULONG2NUM (f);
}
@@ -805,7 +805,7 @@ static VALUE t_invoke_popen (VALUE self, VALUE cmd)
int len = RARRAY (cmd)->len;
#endif
if (len >= 2048)
- rb_raise (rb_eRuntimeError, "too many arguments to popen");
+ rb_raise (rb_eRuntimeError, "%s", "too many arguments to popen");
char *strings [2048];
for (int i=0; i < len; i++) {
VALUE ix = INT2FIX (i);
@@ -834,7 +834,7 @@ static VALUE t_read_keyboard (VALUE self)
{
const unsigned long f = evma_open_keyboard();
if (!f)
- rb_raise (rb_eRuntimeError, "no keyboard reader");
+ rb_raise (rb_eRuntimeError, "%s", "no keyboard reader");
return ULONG2NUM (f);
}
@@ -921,7 +921,7 @@ t__epoll_set
static VALUE t__epoll_set (VALUE self, VALUE val)
{
if (t__epoll_p(self) == Qfalse)
- rb_raise (EM_eUnsupported, "epoll is not supported on this platform");
+ rb_raise (EM_eUnsupported, "%s", "epoll is not supported on this platform");
evma_set_epoll (val == Qtrue ? 1 : 0);
return val;
@@ -958,7 +958,7 @@ t__kqueue_set
static VALUE t__kqueue_set (VALUE self, VALUE val)
{
if (t__kqueue_p(self) == Qfalse)
- rb_raise (EM_eUnsupported, "kqueue is not supported on this platform");
+ rb_raise (EM_eUnsupported, "%s", "kqueue is not supported on this platform");
evma_set_kqueue (val == Qtrue ? 1 : 0);
return val;
@@ -996,7 +996,7 @@ static VALUE t_send_file_data (VALUE self, VALUE signature, VALUE filename)
int b = evma_send_file_data_to_connection (NUM2ULONG (signature), StringValuePtr(filename));
if (b == -1)
- rb_raise(rb_eRuntimeError, "File too large. send_file_data() supports files under 32k.");
+ rb_raise(rb_eRuntimeError, "%s", "File too large. send_file_data() supports files under 32k.");
if (b > 0) {
char *err = strerror (b);
char buf[1024];

1 comment on commit 9473a1b

Contributor

ibc commented on 9473a1b Jul 13, 2012

This does not fix the compilation error. Please see #346 (comment)

Please sign in to comment.