mirror of
https://projects.vdr-developer.org/git/vdr-plugin-streamdev.git
synced 2023-10-10 17:16:51 +00:00
- transfer
This commit is contained in:
@@ -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;
|
||||
|
@@ -78,6 +78,8 @@ public:
|
||||
and errno is set appropriately. TimedRead only works on UNIX file
|
||||
descriptor sources. */
|
||||
bool TimedWrite(const void *Buffer, size_t Length, uint TimeoutMs);
|
||||
|
||||
bool SafeWrite(const void *Buffer, size_t Length);
|
||||
|
||||
/* ReadUntil() tries to read at most Length bytes into the storage pointed
|
||||
to by Buffer, which must be at least Length bytes in size, within the
|
||||
|
Reference in New Issue
Block a user