aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFilippos Karapetis2010-08-21 13:03:35 +0000
committerFilippos Karapetis2010-08-21 13:03:35 +0000
commitd986a7883423ec6eb50021714e449421256a7ade (patch)
treee110cbe9c3e118653964ce64e13a1839204fbf20
parentf9d9fe8f1295f557fdf51f48b5e9f806c8190ca2 (diff)
downloadscummvm-rg350-d986a7883423ec6eb50021714e449421256a7ade.tar.gz
scummvm-rg350-d986a7883423ec6eb50021714e449421256a7ade.tar.bz2
scummvm-rg350-d986a7883423ec6eb50021714e449421256a7ade.zip
SCI: Fixed potentially undefined behavior
svn-id: r52256
-rw-r--r--engines/sci/engine/kfile.cpp7
1 files changed, 4 insertions, 3 deletions
diff --git a/engines/sci/engine/kfile.cpp b/engines/sci/engine/kfile.cpp
index e6036f3be5..ed1b74f6a9 100644
--- a/engines/sci/engine/kfile.cpp
+++ b/engines/sci/engine/kfile.cpp
@@ -954,14 +954,15 @@ reg_t kFileIOReadByte(EngineState *s, int argc, reg_t *argv) {
FileHandle *f = getFileFromHandle(s, argv[0].toUint16());
if (!f)
return NULL_REG;
- return make_reg(0, (s->r_acc.toUint16() & 0xff00) | f->_in->readByte());
+ byte b = f->_in->readByte();
+ return make_reg(0, (s->r_acc.toUint16() & 0xff00) | b);
}
reg_t kFileIOWriteByte(EngineState *s, int argc, reg_t *argv) {
FileHandle *f = getFileFromHandle(s, argv[0].toUint16());
if (f)
f->_out->writeByte(argv[1].toUint16() & 0xff);
- return s->r_acc; // FIXME: does this really doesn't return anything?
+ return s->r_acc; // FIXME: does this really not return anything?
}
reg_t kFileIOReadWord(EngineState *s, int argc, reg_t *argv) {
@@ -975,7 +976,7 @@ reg_t kFileIOWriteWord(EngineState *s, int argc, reg_t *argv) {
FileHandle *f = getFileFromHandle(s, argv[0].toUint16());
if (f)
f->_out->writeUint16LE(argv[1].toUint16());
- return s->r_acc; // FIXME: does this really doesn't return anything?
+ return s->r_acc; // FIXME: does this really not return anything?
}
reg_t kCD(EngineState *s, int argc, reg_t *argv) {