[Scummvm-git-logs] scummvm master -> 7b77a8739096f73b91dbc7a78b2e43f5c728df60
rvanlaar
noreply at scummvm.org
Wed Sep 21 10:07:09 UTC 2022
This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
7b77a87390 DIRECTOR: LINGO: Create new datum on checks
Commit: 7b77a8739096f73b91dbc7a78b2e43f5c728df60
https://github.com/scummvm/scummvm/commit/7b77a8739096f73b91dbc7a78b2e43f5c728df60
Author: Roland van Laar (roland at rolandvanlaar.nl)
Date: 2022-09-21T12:06:30+02:00
Commit Message:
DIRECTOR: LINGO: Create new datum on checks
Various equality checks used the first datum to signal the value of the
check. Setting the Datums type to int in the process.
Datum's destructor only removes the item that corresponds with it's
current type.
For example, when comparing two strings, d1 and d2. D1's type would
be set to int indicating if there was a match. D1, now being an int,
would not remove the string on destruction. The result is a memory leak.
Changed paths:
engines/director/lingo/lingo-code.cpp
diff --git a/engines/director/lingo/lingo-code.cpp b/engines/director/lingo/lingo-code.cpp
index e6a6fc5738a..ecd73c71775 100644
--- a/engines/director/lingo/lingo-code.cpp
+++ b/engines/director/lingo/lingo-code.cpp
@@ -1329,9 +1329,9 @@ Datum LC::eqData(Datum d1, Datum d2) {
d1.type == PARRAY || d2.type == PARRAY) {
return LC::compareArrays(LC::eqData, d1, d2, false, true);
}
- d1.u.i = d1.equalTo(d2, true);
- d1.type = INT;
- return d1;
+ Datum check;
+ check = d1.equalTo(d2, true);
+ return check;
}
void LC::c_eq() {
@@ -1345,9 +1345,9 @@ Datum LC::neqData(Datum d1, Datum d2) {
d1.type == PARRAY || d2.type == PARRAY) {
return LC::compareArrays(LC::neqData, d1, d2, false, true);
}
- d1.u.i = !d1.equalTo(d2, true);
- d1.type = INT;
- return d1;
+ Datum check;
+ check = !d1.equalTo(d2, true);
+ return check;
}
void LC::c_neq() {
@@ -1361,9 +1361,9 @@ Datum LC::gtData(Datum d1, Datum d2) {
d1.type == PARRAY || d2.type == PARRAY) {
return LC::compareArrays(LC::gtData, d1, d2, false, true);
}
- d1.u.i = d1 > d2 ? 1 : 0;
- d1.type = INT;
- return d1;
+ Datum check;
+ check = (d1 > d2 ? 1 : 0);
+ return check;
}
void LC::c_gt() {
@@ -1377,9 +1377,9 @@ Datum LC::ltData(Datum d1, Datum d2) {
d1.type == PARRAY || d2.type == PARRAY) {
return LC::compareArrays(LC::ltData, d1, d2, false, true);
}
- d1.u.i = d1 < d2 ? 1 : 0;
- d1.type = INT;
- return d1;
+ Datum check;
+ check = d1 < d2 ? 1 : 0;
+ return check;
}
void LC::c_lt() {
@@ -1393,9 +1393,9 @@ Datum LC::geData(Datum d1, Datum d2) {
d1.type == PARRAY || d2.type == PARRAY) {
return LC::compareArrays(LC::geData, d1, d2, false, true);
}
- d1.u.i = d1 >= d2 ? 1 : 0;
- d1.type = INT;
- return d1;
+ Datum check;
+ check = d1 >= d2 ? 1 : 0;
+ return check;
}
void LC::c_ge() {
@@ -1409,9 +1409,9 @@ Datum LC::leData(Datum d1, Datum d2) {
d1.type == PARRAY || d2.type == PARRAY) {
return LC::compareArrays(LC::leData, d1, d2, false, true);
}
- d1.u.i = d1 <= d2 ? 1 : 0;
- d1.type = INT;
- return d1;
+ Datum check;
+ check = d1 <= d2 ? 1 : 0;
+ return check;
}
void LC::c_le() {
More information about the Scummvm-git-logs
mailing list