From 60875adfc5fd4eeab44511d606cef99ecdcff918 Mon Sep 17 00:00:00 2001 From: Jon Siwek Date: Thu, 31 May 2012 11:31:01 -0500 Subject: [PATCH 1/2] Fix format specifier on RemoteSerializer::Connect. This caused 32-bit systems to show a warning at compile-time, and fail when connecting to peers. --- src/RemoteSerializer.cc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/RemoteSerializer.cc b/src/RemoteSerializer.cc index cc5e8c5ff9..838bafb0d6 100644 --- a/src/RemoteSerializer.cc +++ b/src/RemoteSerializer.cc @@ -700,7 +700,8 @@ RemoteSerializer::PeerID RemoteSerializer::Connect(const IPAddr& ip, const size_t BUFSIZE = 1024; char* data = new char[BUFSIZE]; - snprintf(data, BUFSIZE, "%"PRIu64",%s,%s,%"PRIu16",%"PRIu32",%d", p->id, + snprintf(data, BUFSIZE, + "%"PRI_PTR_COMPAT_UINT",%s,%s,%"PRIu16",%"PRIu32",%d", p->id, ip.AsString().c_str(), zone_id.c_str(), port, uint32(retry), use_ssl); From eeb1609768063478f85064c9be55b1f46ede7bf7 Mon Sep 17 00:00:00 2001 From: Jon Siwek Date: Thu, 31 May 2012 15:32:28 -0500 Subject: [PATCH 2/2] Change Input::update_finished lookup to happen at init time. Also going through the internal_handler() function will set the event as "used" (i.e. it's marked as being raised somewhere) and fixes the core.check-unused-event-handlers test failure (addresses #823). --- src/input/Manager.cc | 7 ++----- src/input/Manager.h | 2 ++ 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/src/input/Manager.cc b/src/input/Manager.cc index bc79a2390b..f35071081b 100644 --- a/src/input/Manager.cc +++ b/src/input/Manager.cc @@ -194,6 +194,7 @@ Manager::TableStream::~TableStream() Manager::Manager() { + update_finished = internal_handler("Input::update_finished"); } Manager::~Manager() @@ -1199,11 +1200,7 @@ void Manager::EndCurrentSend(ReaderFrontend* reader) #endif // Send event that the current update is indeed finished. - EventHandler* handler = event_registry->Lookup("Input::update_finished"); - if ( handler == 0 ) - reporter->InternalError("Input::update_finished not found!"); - - SendEvent(handler, 2, new StringVal(i->name.c_str()), new StringVal(i->source.c_str())); + SendEvent(update_finished, 2, new StringVal(i->name.c_str()), new StringVal(i->source.c_str())); } void Manager::Put(ReaderFrontend* reader, Value* *vals) diff --git a/src/input/Manager.h b/src/input/Manager.h index 269e562e23..400918366e 100644 --- a/src/input/Manager.h +++ b/src/input/Manager.h @@ -184,6 +184,8 @@ private: enum StreamType { TABLE_STREAM, EVENT_STREAM }; map readers; + + EventHandlerPtr update_finished; };