From eb0b56b19017ab5c16c745e6da39c53126924ed6 Mon Sep 17 00:00:00 2001 From: Pieter Wuille Date: Fri, 1 Aug 2014 22:57:55 +0200 Subject: Simplify serialize.h's exception handling Remove the 'state' and 'exceptmask' from serialize.h's stream implementations, as well as related methods. As exceptmask always included 'failbit', and setstate was always called with bits = failbit, all it did was immediately raise an exception. Get rid of those variables, and replace the setstate with direct exception throwing (which also removes some dead code). As a result, good() is never reached after a failure (there are only 2 calls, one of which is in tests), and can just be replaced by !eof(). fail(), clear(n) and exceptions() are just never called. Delete them. --- src/test/alert_tests.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/test/alert_tests.cpp') diff --git a/src/test/alert_tests.cpp b/src/test/alert_tests.cpp index b16f3f7f57..e3066a51ab 100644 --- a/src/test/alert_tests.cpp +++ b/src/test/alert_tests.cpp @@ -83,7 +83,7 @@ struct ReadAlerts std::vector vch(alert_tests::alertTests, alert_tests::alertTests + sizeof(alert_tests::alertTests)); CDataStream stream(vch, SER_DISK, CLIENT_VERSION); try { - while (stream.good()) + while (!stream.eof()) { CAlert alert; stream >> alert; -- cgit v1.2.3