From e876d6629e8682f5d818141bc0710f6d82311373 Mon Sep 17 00:00:00 2001 From: Ryan Date: Sun, 28 Jun 2009 20:11:55 +0200 Subject: [PATCH] Fix unused variable warnings. --- src/net.cc | 12 +++++------- src/net.h | 2 -- src/node.cc | 11 ++++++++--- src/process.cc | 7 ++++--- src/timer.cc | 2 ++ test/mjsunit/test-http-cat.js | 2 +- test/mjsunit/test-node-cat.js | 2 +- 7 files changed, 21 insertions(+), 17 deletions(-) diff --git a/src/net.cc b/src/net.cc index 39a0dde..8b08752 100644 --- a/src/net.cc +++ b/src/net.cc @@ -75,13 +75,15 @@ Connection::Initialize (v8::Handle target) } Handle -Connection::ReadyStateGetter (Local _, const AccessorInfo& info) +Connection::ReadyStateGetter (Local property, const AccessorInfo& info) { Connection *connection = NODE_UNWRAP(Connection, info.This()); if (!connection) return Handle(); HandleScope scope; + assert(property == READY_STATE_SYMBOL); + switch(connection->ReadyState()) { case OPEN: return scope.Close(OPEN_SYMBOL); case OPENING: return scope.Close(OPENING_SYMBOL); @@ -131,12 +133,6 @@ Connection::~Connection () ForceClose(); } -void -Connection::SetServer (Handle server_handle) -{ - HandleScope scope; -} - Handle Connection::New (const Arguments& args) { @@ -557,6 +553,8 @@ Server::OnConnection (struct sockaddr *addr, socklen_t len) { HandleScope scope; + assert(len > 0); // just to get rid of the warning. + TryCatch try_catch; Local js_connection = diff --git a/src/net.h b/src/net.h index 3410410..e597ee9 100644 --- a/src/net.h +++ b/src/net.h @@ -42,8 +42,6 @@ protected: void FullClose (void) { oi_socket_full_close(&socket_); } void ForceClose (void) { oi_socket_force_close(&socket_); } - void SetServer (v8::Handle server_handle); - virtual void OnConnect (void); virtual void OnReceive (const void *buf, size_t len); virtual void OnDrain (void); diff --git a/src/node.cc b/src/node.cc index acfab87..988eb08 100644 --- a/src/node.cc +++ b/src/node.cc @@ -83,9 +83,12 @@ ObjectWrap::Unwrap (Handle handle) } void -ObjectWrap::MakeWeak (Persistent _, void *data) +ObjectWrap::MakeWeak (Persistent value, void *data) { ObjectWrap *obj = static_cast (data); + + assert(value == obj->handle_); + obj->weak_ = true; if (obj->attach_count_ == 0) delete obj; @@ -247,9 +250,11 @@ node::FatalException (TryCatch &try_catch) static ev_async eio_watcher; static void -node_eio_cb (EV_P_ ev_async *w, int revents) +node_eio_cb (EV_P_ ev_async *watcher, int revents) { - int r = eio_poll(); + assert(watcher == &eio_watcher); + assert(revents == EV_ASYNC); + eio_poll(); } static void diff --git a/src/process.cc b/src/process.cc index 5fe4810..ec63c93 100644 --- a/src/process.cc +++ b/src/process.cc @@ -65,12 +65,13 @@ Process::New (const Arguments& args) } Handle -Process::PIDGetter (Local _, const AccessorInfo& info) +Process::PIDGetter (Local property, const AccessorInfo& info) { + HandleScope scope; Process *process = NODE_UNWRAP(Process, info.This()); - assert(process); - HandleScope scope; + assert(process); + assert(property == PID_SYMBOL); if (process->pid_ == 0) return Null(); diff --git a/src/timer.cc b/src/timer.cc index 941decf..92e5420 100644 --- a/src/timer.cc +++ b/src/timer.cc @@ -59,6 +59,8 @@ Timer::OnTimeout (EV_P_ ev_timer *watcher, int revents) { Timer *timer = static_cast(watcher->data); + assert(revents == EV_TIMEOUT); + timer->Emit("Timeout", 0, NULL); /* XXX i'm a bit worried if this is the correct test? diff --git a/test/mjsunit/test-http-cat.js b/test/mjsunit/test-http-cat.js index 65dc836..8073f51 100644 --- a/test/mjsunit/test-http-cat.js +++ b/test/mjsunit/test-http-cat.js @@ -15,7 +15,7 @@ server.listen(PORT); var got_good_server_content = false; var bad_server_got_error = false; -function onLoad() { +function onLoad () { node.http.cat("http://localhost:"+PORT+"/", "utf8") .addCallback(function (content) { node.debug("got response"); diff --git a/test/mjsunit/test-node-cat.js b/test/mjsunit/test-node-cat.js index 67eccfb..9fce01f 100644 --- a/test/mjsunit/test-node-cat.js +++ b/test/mjsunit/test-node-cat.js @@ -15,7 +15,7 @@ server.listen(PORT); var errors = 0; var successes = 0; -function onLoad() { +function onLoad () { var promise = node.cat("http://localhost:"+PORT, "utf8"); promise.addCallback(function (content) { -- 2.7.4