summaryrefslogtreecommitdiff
path: root/tools.cpp
diff options
context:
space:
mode:
authorDieter Hametner <dh (plus) vdr (at) gekrumbel (dot) de>2008-03-22 00:46:17 +0100
committerDieter Hametner <dh (plus) vdr (at) gekrumbel (dot) de>2008-03-22 00:46:17 +0100
commitd00342a76f291e9a01548b90ebfe3334959ce7aa (patch)
tree01ba05139d764e7cb8fea5d221d38a5b6c638b08 /tools.cpp
parentd1114a3065afa5178b2911691aa2f9bbe1c2d62b (diff)
downloadvdr-plugin-live-d00342a76f291e9a01548b90ebfe3334959ce7aa.tar.gz
vdr-plugin-live-d00342a76f291e9a01548b90ebfe3334959ce7aa.tar.bz2
An other attempt to fix operator>> for tChannelID.
Diffstat (limited to 'tools.cpp')
-rw-r--r--tools.cpp25
1 files changed, 15 insertions, 10 deletions
diff --git a/tools.cpp b/tools.cpp
index 3a80ff7..b8c23ab 100644
--- a/tools.cpp
+++ b/tools.cpp
@@ -17,16 +17,21 @@ using namespace tnt;
istream& operator>>( istream& is, tChannelID& ret )
{
- string line;
- if ( !getline( is, line ) ) {
- if ( !is.eof() )
- is.setstate( ios::badbit );
- return is;
- }
-
- if ( !line.empty() && !( ret = tChannelID::FromString( line.c_str() ) ).Valid() )
- is.setstate( ios::badbit );
- return is;
+ string line;
+ if (!getline( is, line ) ) {
+ if (0 == is.gcount()) {
+ is.clear(is.rdstate() & ~ios::failbit);
+ return is;
+ }
+ if (!is.eof()) {
+ is.setstate( ios::badbit );
+ return is;
+ }
+ }
+
+ if ( !line.empty() && !( ret = tChannelID::FromString( line.c_str() ) ).Valid() )
+ is.setstate( ios::badbit );
+ return is;
}
namespace vdrlive {