From cf6c9b65c6072f84ce3662a70e300cf2d64277ec Mon Sep 17 00:00:00 2001 From: Gav Wood Date: Wed, 4 Feb 2015 14:43:56 -0800 Subject: [PATCH] Potential Windows fix. --- libethereum/Client.cpp | 7 +++++-- libethereum/LogFilter.cpp | 7 +++++++ libethereum/LogFilter.h | 16 ++++++++++++++-- libserpent/util.cpp | 4 ++-- 4 files changed, 28 insertions(+), 6 deletions(-) diff --git a/libethereum/Client.cpp b/libethereum/Client.cpp index 9cfd18b2d..c5b6241d9 100644 --- a/libethereum/Client.cpp +++ b/libethereum/Client.cpp @@ -182,7 +182,7 @@ unsigned Client::installWatch(h256 _h) Guard l(m_filterLock); ret = m_watches.size() ? m_watches.rbegin()->first + 1 : 0; m_watches[ret] = ClientWatch(_h); - cwatch << "+++" << ret << _h; + cwatch << "+++" << ret << _h.abridged(); } auto ch = logs(ret); if (ch.empty()) @@ -200,7 +200,10 @@ unsigned Client::installWatch(LogFilter const& _f) { Guard l(m_filterLock); if (!m_filters.count(h)) + { + cwatch << "FFF" << _f << h.abridged(); m_filters.insert(make_pair(h, _f)); + } } return installWatch(h); } @@ -226,7 +229,7 @@ void Client::uninstallWatch(unsigned _i) void Client::noteChanged(h256Set const& _filters) { Guard l(m_filterLock); -// cnote << "noteChanged(" << _filters << ")"; + cnote << "noteChanged(" << _filters << ")"; // accrue all changes left in each filter into the watches. for (auto& i: m_watches) if (_filters.count(i.second.id)) diff --git a/libethereum/LogFilter.cpp b/libethereum/LogFilter.cpp index 79f43f2c6..fa8fbc333 100644 --- a/libethereum/LogFilter.cpp +++ b/libethereum/LogFilter.cpp @@ -27,6 +27,13 @@ using namespace std; using namespace dev; using namespace dev::eth; +std::ostream& dev::operator<<(std::ostream& _out, LogFilter const& _s) +{ + // TODO + _out << "(@" << _s.m_addresses << "#" << _s.m_topics << ">" << _s.m_earliest << "-" << _s.m_latest << "< +" << _s.m_skip << "^" << _s.m_max << ")"; + return _out; +} + void LogFilter::streamRLP(RLPStream& _s) const { _s.appendList(6) << m_addresses << m_topics << m_earliest << m_latest << m_max << m_skip; diff --git a/libethereum/LogFilter.h b/libethereum/LogFilter.h index b99ba8ee0..39e4ac7ee 100644 --- a/libethereum/LogFilter.h +++ b/libethereum/LogFilter.h @@ -28,6 +28,15 @@ namespace dev { + +namespace eth +{ +class LogFilter; +} + +/// Simple stream output for the StateDiff. +std::ostream& operator<<(std::ostream& _out, dev::eth::LogFilter const& _s); + namespace eth { @@ -56,14 +65,17 @@ public: LogFilter withEarliest(int _e) { m_earliest = _e; return *this; } LogFilter withLatest(int _e) { m_latest = _e; return *this; } + friend std::ostream& dev::operator<<(std::ostream& _out, dev::eth::LogFilter const& _s); + private: AddressSet m_addresses; std::array m_topics; int m_earliest = 0; int m_latest = -1; - unsigned m_max; - unsigned m_skip; + unsigned m_max = 10; + unsigned m_skip = 0; }; } + } diff --git a/libserpent/util.cpp b/libserpent/util.cpp index 5e83c0e41..1e3187ebc 100755 --- a/libserpent/util.cpp +++ b/libserpent/util.cpp @@ -273,7 +273,7 @@ void err(std::string errtext, Metadata met) { std::string err = "Error (file \"" + met.file + "\", line " + unsignedToDecimal(met.ln + 1) + ", char " + unsignedToDecimal(met.ch) + "): " + errtext; - std::cerr << err << "\n"; + std::cerr << err << std::endl; throw(err); } @@ -282,7 +282,7 @@ void warn(std::string errtext, Metadata met) { std::string err = "Warning (file \"" + met.file + "\", line " + unsignedToDecimal(met.ln + 1) + ", char " + unsignedToDecimal(met.ch) + "): " + errtext; - std::cerr << err << "\n"; + std::cerr << err << std::endl; } //Bin to hex