diff options
author | Dieter Hametner <dh (plus) vdr (at) gekrumbel (dot) de> | 2008-03-23 00:24:16 +0100 |
---|---|---|
committer | Dieter Hametner <dh (plus) vdr (at) gekrumbel (dot) de> | 2008-03-23 00:24:16 +0100 |
commit | 0f276e51c7dbf0e36baf35823f8b17163d094b39 (patch) | |
tree | 0d7343f5e75b9f7ced6e362121bd55cd77b47864 /tools.cpp | |
parent | 421c0f4b839309ef136aa22d912f58519e10e274 (diff) | |
parent | a69f5f5873c2843780b9779f5eccf6e2a692da80 (diff) | |
download | vdr-plugin-live-0f276e51c7dbf0e36baf35823f8b17163d094b39.tar.gz vdr-plugin-live-0f276e51c7dbf0e36baf35823f8b17163d094b39.tar.bz2 |
Merge branch 'master' into devel
Diffstat (limited to 'tools.cpp')
-rw-r--r-- | tools.cpp | 35 |
1 files changed, 29 insertions, 6 deletions
@@ -17,12 +17,35 @@ using namespace tnt; istream& operator>>( istream& is, tChannelID& ret ) { - if ( is.rdbuf()->in_avail() > 0 ) { - string line; - if ( !getline( is, line ) || ( !line.empty() && !( ret = tChannelID::FromString( line.c_str() ) ).Valid() ) ) - is.setstate( ios::badbit ); - } - return is; + /* alternativ implementation + string line; + if ( !getline( is, line ) ) { + if ( !is.eof() ) + is.setstate( ios::badbit ); + else + is.clear(); + 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 { |