summaryrefslogtreecommitdiff
path: root/comm
diff options
context:
space:
mode:
authorchatty1995-02-08 14:44:24 +0000
committerchatty1995-02-08 14:44:24 +0000
commitc0cb7354d1dee328a45fcf838b2a4d9d1367b0f8 (patch)
tree882c9bb1dc5d94e190504c9782775e4df02305a3 /comm
parentb896b2810287f6e0f7c09c837930e2da823e47aa (diff)
downloadivy-league-c0cb7354d1dee328a45fcf838b2a4d9d1367b0f8.zip
ivy-league-c0cb7354d1dee328a45fcf838b2a4d9d1367b0f8.tar.gz
ivy-league-c0cb7354d1dee328a45fcf838b2a4d9d1367b0f8.tar.bz2
ivy-league-c0cb7354d1dee328a45fcf838b2a4d9d1367b0f8.tar.xz
new return types for Read*
Diffstat (limited to 'comm')
-rw-r--r--comm/Channel.cc36
-rw-r--r--comm/Channel.h16
2 files changed, 28 insertions, 24 deletions
diff --git a/comm/Channel.cc b/comm/Channel.cc
index 4515b95..9b559fc 100644
--- a/comm/Channel.cc
+++ b/comm/Channel.cc
@@ -3,7 +3,7 @@
*
* by Michel Beaudouin-Lafon
*
- * Copyright 1990-1993
+ * Copyright 1990-1995
* Laboratoire de Recherche en Informatique (LRI)
*
* File descriptors, channels
@@ -423,50 +423,54 @@ UchChannel :: WriteBuf (const byte* b, int n)
-void
+bool
UchChannel :: ReadLong (lword& l)
{
- Read ((byte*)&l, lwsize);
+ return bool (Read ((byte*)&l, lwsize) == lwsize);
}
-void
+bool
UchChannel :: ReadShort (sword& s)
{
- Read ((byte*)&s, swsize);
+ return bool (Read ((byte*)&s, swsize) == swsize);
}
-void
+bool
UchChannel :: ReadByte (byte& b)
{
- Read (&b, 1);
+ return bool (Read (&b, 1) == 1);
}
-void
+bool
UchChannel :: ReadChar (char& c)
{
- Read ((byte*)&c, 1);
+ return bool (Read ((byte*)&c, 1) == 1);
}
-void
-UchChannel :: ReadString (char* s)
+int
+UchChannel :: ReadString (char* s, int n)
{
+ int i = 0;
// this is extremely non optimal
do {
Read ((byte*)s, 1);
- } while (*s++);
+ i++;
+ } while (*s++ && n--);
+ return i;
}
-void
+int
UchChannel :: ReadString (CcuString& s)
{
// this enforces an undue limitation
char c [1024];
- ReadString (c);
+ int i = ReadString (c, -1);
s = c;
+ return i;
}
-void
+bool
UchChannel :: ReadBuf (byte* b, int n)
{
- Read (b, n);
+ return bool (Read (b, n) == n);
}
diff --git a/comm/Channel.h b/comm/Channel.h
index 9d30321..4a6d5f9 100644
--- a/comm/Channel.h
+++ b/comm/Channel.h
@@ -3,7 +3,7 @@
*
* by Michel Beaudouin-Lafon
*
- * Copyright 1990-1993
+ * Copyright 1990-1995
* Laboratoire de Recherche en Informatique (LRI)
*
* File descriptors, channels
@@ -117,13 +117,13 @@ virtual void WriteChar (char);
virtual void WriteString (const char*);
virtual void WriteBuf (const byte*, int);
-virtual void ReadLong (lword&);
-virtual void ReadShort (sword&);
-virtual void ReadByte (byte&);
-virtual void ReadChar (char&);
-virtual void ReadString (char*);
-virtual void ReadString (CcuString&);
-virtual void ReadBuf (byte*, int);
+virtual bool ReadLong (lword&);
+virtual bool ReadShort (sword&);
+virtual bool ReadByte (byte&);
+virtual bool ReadChar (char&);
+virtual int ReadString (char*, int);
+virtual int ReadString (CcuString&);
+virtual bool ReadBuf (byte*, int);
static CH_HANDLER ReadHandler;
static CH_HANDLER WriteHandler;