aboutsummaryrefslogtreecommitdiff
path: root/engines/cge/cfile.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'engines/cge/cfile.cpp')
-rw-r--r--engines/cge/cfile.cpp48
1 files changed, 24 insertions, 24 deletions
diff --git a/engines/cge/cfile.cpp b/engines/cge/cfile.cpp
index 7c4f689e30..4fb0988d38 100644
--- a/engines/cge/cfile.cpp
+++ b/engines/cge/cfile.cpp
@@ -55,9 +55,9 @@ IOBUF::IOBUF(const char *name, IOMODE mode, CRYPT *crpt)
}
IOBUF::~IOBUF(void) {
- if (Mode > REA)
+ if (Mode > REA)
WriteBuff();
- if (Buff)
+ if (Buff)
free(Buff);
}
@@ -81,18 +81,18 @@ void IOBUF::WriteBuff(void) {
uint16 IOBUF::Read(void *buf, uint16 len) {
uint16 total = 0;
while (len) {
- if (Ptr >= Lim)
+ if (Ptr >= Lim)
ReadBuff();
uint16 n = Lim - Ptr;
if (n) {
- if (len < n)
+ if (len < n)
n = len;
memcpy(buf, Buff + Ptr, n);
buf = (uint8 *)buf + n;
len -= n;
total += n;
Ptr += n;
- } else
+ } else
break;
}
return total;
@@ -103,40 +103,40 @@ uint16 IOBUF::Read(uint8 *buf) {
uint16 total = 0;
while (total < LINE_MAX - 2) {
- if (Ptr >= Lim)
+ if (Ptr >= Lim)
ReadBuff();
uint8 *p = Buff + Ptr;
uint16 n = Lim - Ptr;
if (n) {
- if (total + n >= LINE_MAX - 2)
+ if (total + n >= LINE_MAX - 2)
n = LINE_MAX - 2 - total;
uint8 *eol = (uint8 *) memchr(p, '\r', n);
- if (eol)
+ if (eol)
n = (uint16)(eol - p);
uint8 *eof = (uint8 *) memchr(p, '\32', n);
if (eof) { // end-of-file
n = (uint16)(eof - p);
Ptr = (uint16)(eof - Buff);
}
- if (n)
+ if (n)
memcpy(buf, p, n);
buf += n;
total += n;
- if (eof)
+ if (eof)
break;
Ptr += n;
if (eol) {
++ Ptr;
* (buf ++) = '\n';
++ total;
- if (Ptr >= Lim)
+ if (Ptr >= Lim)
ReadBuff();
- if (Ptr < Lim)
- if (Buff[Ptr] == '\n')
+ if (Ptr < Lim)
+ if (Buff[Ptr] == '\n')
++Ptr;
break;
}
- } else
+ } else
break;
}
*buf = '\0';
@@ -148,7 +148,7 @@ uint16 IOBUF::Write(void *buf, uint16 len) {
uint16 tot = 0;
while (len) {
uint16 n = IOBUF_SIZE - Lim;
- if (n > len)
+ if (n > len)
n = len;
if (n) {
memcpy(Buff + Lim, buf, n);
@@ -156,7 +156,7 @@ uint16 IOBUF::Write(void *buf, uint16 len) {
len -= n;
buf = (uint8 *)buf + n;
tot += n;
- } else
+ } else
WriteBuff();
}
return tot;
@@ -167,8 +167,8 @@ uint16 IOBUF::Write(uint8 *buf) {
uint16 len = 0;
if (buf) {
len = strlen((const char *) buf);
- if (len)
- if (buf[len - 1] == '\n')
+ if (len)
+ if (buf[len - 1] == '\n')
--len;
len = Write(buf, len);
if (len) {
@@ -184,7 +184,7 @@ uint16 IOBUF::Write(uint8 *buf) {
int IOBUF::Read(void) {
if (Ptr >= Lim) {
ReadBuff();
- if (Lim == 0)
+ if (Lim == 0)
return -1;
}
return Buff[Ptr ++];
@@ -211,9 +211,9 @@ CFILE::~CFILE(void) {
void CFILE::Flush(void) {
- if (Mode > REA)
+ if (Mode > REA)
WriteBuff();
- else
+ else
Lim = 0;
/*
@@ -250,11 +250,11 @@ void CFILE::Append(CFILE &f) {
Seek(Size());
if (f.Error == 0) {
while (true) {
- if ((Lim = f.IOHAND::Read(Buff, IOBUF_SIZE)) == IOBUF_SIZE)
+ if ((Lim = f.IOHAND::Read(Buff, IOBUF_SIZE)) == IOBUF_SIZE)
WriteBuff();
- else
+ else
break;
- if ((Error = f.Error) != 0)
+ if ((Error = f.Error) != 0)
break;
}
}