diff options
author | lordjaxom <lordjaxom> | 2005-02-08 19:54:52 +0000 |
---|---|---|
committer | lordjaxom <lordjaxom> | 2005-02-08 19:54:52 +0000 |
commit | 78b9b7c6ba30158f97a9f6c34a16ac3047d5f4e3 (patch) | |
tree | 4b792b0fa20c5857431dc4139217f06c172fdf8a /tools/source.c | |
parent | b2b925d1a933c9129eb84699e9893d80e7e9534d (diff) | |
download | vdr-plugin-streamdev-78b9b7c6ba30158f97a9f6c34a16ac3047d5f4e3.tar.gz vdr-plugin-streamdev-78b9b7c6ba30158f97a9f6c34a16ac3047d5f4e3.tar.bz2 |
- transfer
Diffstat (limited to 'tools/source.c')
-rw-r--r-- | tools/source.c | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/tools/source.c b/tools/source.c index 3674eff..c832e2f 100644 --- a/tools/source.c +++ b/tools/source.c @@ -85,6 +85,29 @@ bool cTBSource::TimedWrite(const void *Buffer, size_t Length, uint TimeoutMs) { return true; } +bool cTBSource::SafeWrite(const void *Buffer, size_t Length) { + cTBSelect sel; + int offs; + + offs = 0; + while (Length > 0) { + int b; + + sel.Clear(); + sel.Add(m_Filed, true); + if (sel.Select() == -1) + return false; + + if (sel.CanWrite(m_Filed)) { + if ((b = Write((char*)Buffer + offs, Length)) == -1) + return false; + offs += b; + Length -= b; + } + } + return true; +} + ssize_t cTBSource::ReadUntil(void *Buffer, size_t Length, const char *Seq, uint TimeoutMs) { int seqlen, ms; |