Skip to content

Commit

Permalink
Fix a bunch of compiler warnings on snow leopard.
Browse files Browse the repository at this point in the history
  • Loading branch information
jakedouglas committed Sep 1, 2009
1 parent 9cdad25 commit e235e84
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 14 deletions.
6 changes: 3 additions & 3 deletions ext/cmain.cpp
Expand Up @@ -31,7 +31,7 @@ extern "C" void ensure_eventmachine (const char *caller = "unknown caller")
char err_string[err_size];
snprintf (err_string, err_size, "eventmachine not initialized: %s", caller);
#ifdef BUILD_FOR_RUBY
rb_raise(rb_eRuntimeError, err_string);
rb_raise(rb_eRuntimeError, "%s", err_string);
#else
throw std::runtime_error (err_string);
#endif
Expand Down Expand Up @@ -727,7 +727,7 @@ extern "C" int evma_send_file_data_to_connection (const unsigned long binding, c
* Modified 25Jul07. This now returns -1 on file-too-large; 0 for success, and a positive
* errno in case of other errors.
*
/* Contributed by Kirk Haines.
* Contributed by Kirk Haines.
*/

char data[32*1024];
Expand All @@ -753,7 +753,7 @@ extern "C" int evma_send_file_data_to_connection (const unsigned long binding, c
close (Fd);
return 0;
}
else if (filesize > sizeof(data)) {
else if (filesize > (int) sizeof(data)) {
close (Fd);
return -1;
}
Expand Down
4 changes: 2 additions & 2 deletions ext/ed.cpp
Expand Up @@ -933,7 +933,7 @@ void ConnectionDescriptor::_WriteOutboundData()

#ifdef HAVE_WRITEV
if (!err) {
int sent = bytes_written;
uint sent = bytes_written;
deque<OutboundPage>::iterator op = OutboundPages.begin();

for (int i = 0; i < iovcnt; i++) {
Expand Down Expand Up @@ -1405,7 +1405,7 @@ DatagramDescriptor::DatagramDescriptor (int sd, EventMachine_t *parent_em):
*/

int oval = 1;
int sob = setsockopt (GetSocket(), SOL_SOCKET, SO_BROADCAST, (char*)&oval, sizeof(oval));
setsockopt (GetSocket(), SOL_SOCKET, SO_BROADCAST, (char*)&oval, sizeof(oval));

#ifdef HAVE_EPOLL
EpollEvent.events = EPOLLIN;
Expand Down
2 changes: 1 addition & 1 deletion ext/ed.h
Expand Up @@ -93,7 +93,6 @@ class EventableDescriptor: public Bindable_t

protected:
int MySocket;
int PendingConnectTimeout;

void (*EventCallback)(const unsigned long, int, const char*, const unsigned long);
void _GenericInboundDispatch(const char*, int);
Expand All @@ -108,6 +107,7 @@ class EventableDescriptor: public Bindable_t
#endif

EventMachine_t *MyEventMachine;
int PendingConnectTimeout;
};


Expand Down
10 changes: 5 additions & 5 deletions ext/em.cpp
Expand Up @@ -37,7 +37,7 @@ unsigned gLastTickCount;
/* The numer of max outstanding timers was once a const enum defined in em.h.
* Now we define it here so that users can change its value if necessary.
*/
static int MaxOutstandingTimers = 10000;
static uint MaxOutstandingTimers = 10000;


/* Internal helper to convert strings to internet addresses. IPv6-aware.
Expand Down Expand Up @@ -80,6 +80,7 @@ EventMachine_t::EventMachine_t
******************************/

EventMachine_t::EventMachine_t (void (*event_callback)(const unsigned long, int, const char*, const unsigned long)):
HeartbeatInterval(2000000),
EventCallback (event_callback),
NextHeartbeatTime (0),
LoopBreakerReader (-1),
Expand All @@ -88,7 +89,6 @@ EventMachine_t::EventMachine_t (void (*event_callback)(const unsigned long, int,
epfd (-1),
bKqueue (false),
kqfd (-1),
HeartbeatInterval(2000000),
inotify (NULL)
{
// Default time-slice is just smaller than one hundred mills.
Expand Down Expand Up @@ -265,7 +265,7 @@ int EventMachine_t::SetRlimitNofile (int nofiles)
getrlimit (RLIMIT_NOFILE, &rlim);
if (nofiles >= 0) {
rlim.rlim_cur = nofiles;
if (nofiles > rlim.rlim_max)
if ((uint)nofiles > rlim.rlim_max)
rlim.rlim_max = nofiles;
setrlimit (RLIMIT_NOFILE, &rlim);
// ignore the error return, for now at least.
Expand Down Expand Up @@ -652,7 +652,7 @@ bool EventMachine_t::_RunKqueueOnce()
if (gCurrentLoopTime >= NextHeartbeatTime) {
NextHeartbeatTime = gCurrentLoopTime + HeartbeatInterval;

for (int i=0; i < Descriptors.size(); i++) {
for (uint i=0; i < Descriptors.size(); i++) {
EventableDescriptor *ed = Descriptors[i];
assert (ed);
ed->Heartbeat();
Expand Down Expand Up @@ -2033,7 +2033,7 @@ void EventMachine_t::UnwatchPid (int pid)
struct kevent k;

EV_SET(&k, pid, EVFILT_PROC, EV_DELETE, 0, 0, 0);
int t = kevent (kqfd, &k, 1, NULL, 0, NULL);
/*int t =*/ kevent (kqfd, &k, 1, NULL, 0, NULL);
// t==-1 if the process already exited; ignore this for now
#endif

Expand Down
6 changes: 3 additions & 3 deletions ext/rubymain.cpp
Expand Up @@ -75,7 +75,7 @@ static void event_callback (struct em_event* e)
VALUE t = rb_ivar_get (EmModule, Intern_at_conns);
VALUE q = rb_hash_aref (t, ULONG2NUM (a1));
if (q == Qnil)
rb_raise (EM_eConnectionNotBound, "received %d bytes of data for unknown signature: %lu", a4, a1);
rb_raise (EM_eConnectionNotBound, "received %lu bytes of data for unknown signature: %lu", a4, a1);
rb_funcall (q, Intern_receive_data, 1, rb_str_new (a3, a4));
}
else if (a2 == EM_CONNECTION_NOTIFY_READABLE) {
Expand Down Expand Up @@ -737,7 +737,7 @@ static VALUE t_invoke_popen (VALUE self, VALUE cmd)
char buf[100];
memset (buf, 0, sizeof(buf));
snprintf (buf, sizeof(buf)-1, "no popen: %s", (err?err:"???"));
rb_raise (rb_eRuntimeError, buf);
rb_raise (rb_eRuntimeError, "%s", buf);
}
return ULONG2NUM (f);
}
Expand Down Expand Up @@ -918,7 +918,7 @@ static VALUE t_send_file_data (VALUE self, VALUE signature, VALUE filename)
memset (buf, 0, sizeof(buf));
snprintf (buf, sizeof(buf)-1, ": %s %s", StringValuePtr(filename),(err?err:"???"));

rb_raise (rb_eIOError, buf);
rb_raise (rb_eIOError, "%s", buf);
}

return INT2NUM (0);
Expand Down

0 comments on commit e235e84

Please sign in to comment.