summaryrefslogtreecommitdiff
path: root/tools.cpp
diff options
context:
space:
mode:
authorDieter Hametner <dh (plus) vdr (at) gekrumbel (dot) de>2008-03-23 00:24:16 +0100
committerDieter Hametner <dh (plus) vdr (at) gekrumbel (dot) de>2008-03-23 00:24:16 +0100
commit0f276e51c7dbf0e36baf35823f8b17163d094b39 (patch)
tree0d7343f5e75b9f7ced6e362121bd55cd77b47864 /tools.cpp
parent421c0f4b839309ef136aa22d912f58519e10e274 (diff)
parenta69f5f5873c2843780b9779f5eccf6e2a692da80 (diff)
downloadvdr-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.cpp35
1 files changed, 29 insertions, 6 deletions
diff --git a/tools.cpp b/tools.cpp
index 41db7b9..5fee00b 100644
--- a/tools.cpp
+++ b/tools.cpp
@@ -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 {