[Scummvm-git-logs] scummvm master -> 0386193d56774b6b7f5ed310df713cd3a7d0ceda
sluicebox
noreply at scummvm.org
Sun Oct 29 22:42:59 UTC 2023
This automated email contains information about 6 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
3afdb0ba9e SCI: Fix memory leaks on error. PVS-Studio V773
97528ed81f SCI: Fix SJIS error detection. PVS-Studio V547
2801803b5f SCI: Remove redundant checks. PVS-Studio V547, V560, V654
56c122e6dd SCI32: Simplify cursor skip-color code. PVS-Studio V730
b0e47dc7ee SCI: Initialize EventManager fields. PVS-Studio V730
0386193d56 SCI: Use valid enum value. PVS-Studio V1016
Commit: 3afdb0ba9ee62ebbb7a9247d99bcc40700ae8833
https://github.com/scummvm/scummvm/commit/3afdb0ba9ee62ebbb7a9247d99bcc40700ae8833
Author: sluicebox (22204938+sluicebox at users.noreply.github.com)
Date: 2023-10-29T15:42:11-07:00
Commit Message:
SCI: Fix memory leaks on error. PVS-Studio V773
Changed paths:
engines/sci/resource/resource.cpp
diff --git a/engines/sci/resource/resource.cpp b/engines/sci/resource/resource.cpp
index 60395124dfc..71f6719b575 100644
--- a/engines/sci/resource/resource.cpp
+++ b/engines/sci/resource/resource.cpp
@@ -1880,8 +1880,10 @@ int ResourceManager::readResourceMapSCI0(ResourceSource *map) {
return SCI_ERROR_RESMAP_NOT_FOUND;
} else {
Common::File *file = new Common::File();
- if (!file->open(map->getLocationName()))
+ if (!file->open(map->getLocationName())) {
+ delete file;
return SCI_ERROR_RESMAP_NOT_FOUND;
+ }
fileStream = file;
}
@@ -1956,8 +1958,10 @@ int ResourceManager::readResourceMapSCI1(ResourceSource *map) {
return SCI_ERROR_RESMAP_NOT_FOUND;
} else {
Common::File *file = new Common::File();
- if (!file->open(map->getLocationName()))
+ if (!file->open(map->getLocationName())) {
+ delete file;
return SCI_ERROR_RESMAP_NOT_FOUND;
+ }
fileStream = file;
}
Commit: 97528ed81f2c77ad777f4e5f5142c834433f7a64
https://github.com/scummvm/scummvm/commit/97528ed81f2c77ad777f4e5f5142c834433f7a64
Author: sluicebox (22204938+sluicebox at users.noreply.github.com)
Date: 2023-10-29T15:42:11-07:00
Commit Message:
SCI: Fix SJIS error detection. PVS-Studio V547
Changed paths:
engines/sci/engine/state.cpp
diff --git a/engines/sci/engine/state.cpp b/engines/sci/engine/state.cpp
index ea17be6b304..0ada203e894 100644
--- a/engines/sci/engine/state.cpp
+++ b/engines/sci/engine/state.cpp
@@ -273,7 +273,7 @@ Common::String SciEngine::getSciLanguageString(const Common::String &str, kLangu
} else {
// Copy double-byte character
curChar2 = *(textPtr++);
- if (!curChar) {
+ if (!curChar2) {
error("SJIS character %02X is missing second byte", curChar);
break;
}
Commit: 2801803b5fb2df1a53a141558f50e7c0ba85e8fd
https://github.com/scummvm/scummvm/commit/2801803b5fb2df1a53a141558f50e7c0ba85e8fd
Author: sluicebox (22204938+sluicebox at users.noreply.github.com)
Date: 2023-10-29T15:42:12-07:00
Commit Message:
SCI: Remove redundant checks. PVS-Studio V547, V560, V654
Changed paths:
engines/sci/engine/features.cpp
engines/sci/engine/kstring.cpp
engines/sci/engine/seg_manager.cpp
engines/sci/event.cpp
engines/sci/graphics/paint32.cpp
engines/sci/graphics/picture.cpp
engines/sci/graphics/ports.cpp
engines/sci/sound/midiparser_sci.cpp
diff --git a/engines/sci/engine/features.cpp b/engines/sci/engine/features.cpp
index 8c30a826f93..67080b1280a 100644
--- a/engines/sci/engine/features.cpp
+++ b/engines/sci/engine/features.cpp
@@ -126,9 +126,7 @@ bool GameFeatures::autoDetectSoundType() {
_doSoundType = foundTarget ? SCI_VERSION_1_LATE : SCI_VERSION_1_EARLY;
break;
}
-
- if (_doSoundType != SCI_VERSION_NONE)
- return true;
+ return true;
}
}
}
diff --git a/engines/sci/engine/kstring.cpp b/engines/sci/engine/kstring.cpp
index 802d4c40916..9171f226ad9 100644
--- a/engines/sci/engine/kstring.cpp
+++ b/engines/sci/engine/kstring.cpp
@@ -274,7 +274,7 @@ reg_t kFormat(EngineState *s, int argc, reg_t *argv) {
/* int writelength; -- unused atm */
- if (xfer && (Common::isDigit(xfer) || xfer == '-' || xfer == '=')) {
+ if (Common::isDigit(xfer) || xfer == '-' || xfer == '=') {
char *destp;
if (xfer == '0')
diff --git a/engines/sci/engine/seg_manager.cpp b/engines/sci/engine/seg_manager.cpp
index 2b55d5b0998..50f7d1bbc3e 100644
--- a/engines/sci/engine/seg_manager.cpp
+++ b/engines/sci/engine/seg_manager.cpp
@@ -185,7 +185,7 @@ void SegManager::deallocate(SegmentId seg) {
bool SegManager::isHeapObject(reg_t pos) const {
const Object *obj = getObject(pos);
- if (obj == nullptr || (obj && obj->isFreed()))
+ if (obj == nullptr || obj->isFreed())
return false;
Script *scr = getScriptIfLoaded(pos.getSegment());
return !(scr && scr->isMarkedAsDeleted());
@@ -1143,7 +1143,7 @@ void SegManager::uninstantiateScriptSci0(int script_nr) {
// Make a pass over the object in order to uninstantiate all superclasses
- do {
+ while (true) {
reg.incOffset(objLength); // Step over the last checked object
objType = READ_SCI11ENDIAN_UINT16(scr->getBuf(reg.getOffset()));
@@ -1173,8 +1173,7 @@ void SegManager::uninstantiateScriptSci0(int script_nr) {
} // if object or class
reg.incOffset(-4); // Step back on header
-
- } while (objType != 0);
+ }
}
} // End of namespace Sci
diff --git a/engines/sci/event.cpp b/engines/sci/event.cpp
index 456589dff10..403d28697a6 100644
--- a/engines/sci/event.cpp
+++ b/engines/sci/event.cpp
@@ -324,7 +324,7 @@ SciEvent EventManager::getScummVMEvent() {
if (input.character && input.character <= 0xFF) {
// Extended characters need to be converted to the old to DOS CP850/437
// character sets for multilingual games
- if (input.character >= 0x80 && input.character <= 0xFF) {
+ if (input.character >= 0x80) {
// SSCI accepted all input scan codes, regardless of locale, and
// just didn't display any characters that were missing from fonts
// used by text input controls. We intentionally filter them out
diff --git a/engines/sci/graphics/paint32.cpp b/engines/sci/graphics/paint32.cpp
index 13028034a74..79d9baed271 100644
--- a/engines/sci/graphics/paint32.cpp
+++ b/engines/sci/graphics/paint32.cpp
@@ -149,14 +149,13 @@ reg_t GfxPaint32::makeLineBitmap(const Common::Point &startPoint, const Common::
switch (style) {
case kLineStyleSolid:
pattern = 0xFFFF;
- properties.solid = true;
break;
case kLineStyleDashed:
pattern = 0xFF00;
properties.solid = false;
break;
case kLineStylePattern:
- properties.solid = pattern == 0xFFFF;
+ properties.solid = (pattern == 0xFFFF);
break;
default:
break;
diff --git a/engines/sci/graphics/picture.cpp b/engines/sci/graphics/picture.cpp
index e58bc317d13..56f999bdef1 100644
--- a/engines/sci/graphics/picture.cpp
+++ b/engines/sci/graphics/picture.cpp
@@ -425,7 +425,6 @@ void GfxPicture::drawVectorData(const SciSpan<const byte> &data) {
Palette palette;
int16 pattern_Code = 0, pattern_Texture = 0;
bool icemanDrawFix = false;
- bool ignoreBrokenPriority = false;
memset(&palette, 0, sizeof(palette));
@@ -476,8 +475,6 @@ void GfxPicture::drawVectorData(const SciSpan<const byte> &data) {
pic_priority = data[curPos++] & 0x0F;
if (isEGA)
pic_priority = EGApriority[pic_priority];
- if (ignoreBrokenPriority)
- pic_priority = 255;
break;
case PIC_OP_DISABLE_PRIORITY:
pic_priority = 255;
diff --git a/engines/sci/graphics/ports.cpp b/engines/sci/graphics/ports.cpp
index 1a502dcb743..bfcca45c058 100644
--- a/engines/sci/graphics/ports.cpp
+++ b/engines/sci/graphics/ports.cpp
@@ -80,7 +80,7 @@ void GfxPorts::init(bool usesOldGfxFunctions, GfxPaint16 *paint16, GfxText16 *te
// Jones, Slater, Hoyle 3&4 and Crazy Nicks Laura Bow/Kings Quest were
// called with parameter -Nw 0 0 200 320.
- // Mother Goose (SCI1) uses -Nw 0 0 159 262. The game will later use
+ // Mother Goose (SCI1, SCI11) uses -Nw 0 0 159 262. The game will later use
// SetPort so we don't need to set the other fields.
// This actually meant not skipping the first 10 pixellines in windowMgrPort
int16 offTop = 10;
@@ -92,10 +92,7 @@ void GfxPorts::init(bool usesOldGfxFunctions, GfxPaint16 *paint16, GfxText16 *te
case GID_HOYLE4:
case GID_CNICK_LAURABOW:
case GID_CNICK_KQ:
- offTop = 0;
- break;
case GID_MOTHERGOOSE256:
- // only the SCI1 and SCI1.1 (VGA) versions need this
offTop = 0;
break;
case GID_FAIRYTALES:
diff --git a/engines/sci/sound/midiparser_sci.cpp b/engines/sci/sound/midiparser_sci.cpp
index 6c3495b5a81..329d930bb1b 100644
--- a/engines/sci/sound/midiparser_sci.cpp
+++ b/engines/sci/sound/midiparser_sci.cpp
@@ -637,9 +637,6 @@ void MidiParser_SCI::parseNextEvent(EventInfo &info) {
_position._runningStatus = info.event;
switch (info.command()) {
case 0xC:
- info.basic.param1 = *(_position._playPos++);
- info.basic.param2 = 0;
- break;
case 0xD:
info.basic.param1 = *(_position._playPos++);
info.basic.param2 = 0;
Commit: 56c122e6ddd0665444cf3db5bc10cdf6e45c3c67
https://github.com/scummvm/scummvm/commit/56c122e6ddd0665444cf3db5bc10cdf6e45c3c67
Author: sluicebox (22204938+sluicebox at users.noreply.github.com)
Date: 2023-10-29T15:42:12-07:00
Commit Message:
SCI32: Simplify cursor skip-color code. PVS-Studio V730
Previous code was based on SSCI's structure, but also introduced
an uninitialized read. Now we just use the skip color without the
unnecessary state.
Changed paths:
engines/sci/graphics/cursor32.cpp
engines/sci/graphics/cursor32.h
diff --git a/engines/sci/graphics/cursor32.cpp b/engines/sci/graphics/cursor32.cpp
index 148bb23e93d..1fac1c81e07 100644
--- a/engines/sci/graphics/cursor32.cpp
+++ b/engines/sci/graphics/cursor32.cpp
@@ -30,6 +30,10 @@
namespace Sci {
+enum {
+ kGfxCursor32SkipColor = 255
+};
+
GfxCursor32::GfxCursor32() :
_hideCount(0),
_position(0, 0),
@@ -95,7 +99,6 @@ void GfxCursor32::copy(DrawRegion &target, const DrawRegion &source) {
byte *targetPixel = target.data + ((drawRect.top - target.rect.top) * target.rect.width()) + (drawRect.left - target.rect.left);
const byte *sourcePixel = source.data + (sourceYOffset * source.rect.width()) + sourceXOffset;
- const uint8 skipColor = source.skipColor;
int16 sourceStride = source.rect.width();
int16 targetStride = target.rect.width();
@@ -107,7 +110,7 @@ void GfxCursor32::copy(DrawRegion &target, const DrawRegion &source) {
for (int16 y = 0; y < drawRectHeight; ++y) {
if (SKIP) {
for (int16 x = 0; x < drawRectWidth; ++x) {
- if (*sourcePixel != skipColor) {
+ if (*sourcePixel != kGfxCursor32SkipColor) {
*targetPixel = *sourcePixel;
}
++targetPixel;
@@ -227,8 +230,7 @@ void GfxCursor32::setView(const GuiResourceId viewId, const int16 loopNo, const
_cursor.data = (byte *)realloc(_cursor.data, _width * _height);
_cursor.rect = Common::Rect(_width, _height);
- memset(_cursor.data, 255, _width * _height);
- _cursor.skipColor = 255;
+ memset(_cursor.data, kGfxCursor32SkipColor, _width * _height);
Buffer target;
target.init(_width, _height, _width, _cursor.data, Graphics::PixelFormat::createFormatCLUT8());
@@ -242,7 +244,7 @@ void GfxCursor32::setView(const GuiResourceId viewId, const int16 loopNo, const
_width = _height = 1;
_cursor.data = (byte *)realloc(_cursor.data, _width * _height);
_cursor.rect = Common::Rect(_width, _height);
- *_cursor.data = _cursor.skipColor;
+ *_cursor.data = kGfxCursor32SkipColor;
_cursorBack.rect = _cursor.rect;
_cursorBack.rect.clip(_screenRegion.rect);
if (!_cursorBack.rect.isEmpty()) {
diff --git a/engines/sci/graphics/cursor32.h b/engines/sci/graphics/cursor32.h
index d3369365e8e..98d65d177d1 100644
--- a/engines/sci/graphics/cursor32.h
+++ b/engines/sci/graphics/cursor32.h
@@ -118,7 +118,6 @@ private:
struct DrawRegion {
Common::Rect rect;
byte *data;
- uint8 skipColor;
DrawRegion() : data(nullptr) {}
};
Commit: b0e47dc7ee88f6394175d7955788d2152af179f0
https://github.com/scummvm/scummvm/commit/b0e47dc7ee88f6394175d7955788d2152af179f0
Author: sluicebox (22204938+sluicebox at users.noreply.github.com)
Date: 2023-10-29T15:42:12-07:00
Commit Message:
SCI: Initialize EventManager fields. PVS-Studio V730
Changed paths:
engines/sci/event.cpp
diff --git a/engines/sci/event.cpp b/engines/sci/event.cpp
index 403d28697a6..a5c0ae0c980 100644
--- a/engines/sci/event.cpp
+++ b/engines/sci/event.cpp
@@ -145,6 +145,7 @@ EventManager::EventManager(bool fontIsExtended) :
_fontIsExtended(fontIsExtended)
#ifdef ENABLE_SCI32
, _hotRectanglesActive(false)
+ , _activeRectIndex(-1)
#endif
{}
Commit: 0386193d56774b6b7f5ed310df713cd3a7d0ceda
https://github.com/scummvm/scummvm/commit/0386193d56774b6b7f5ed310df713cd3a7d0ceda
Author: sluicebox (22204938+sluicebox at users.noreply.github.com)
Date: 2023-10-29T15:42:12-07:00
Commit Message:
SCI: Use valid enum value. PVS-Studio V1016
Changed paths:
engines/sci/metaengine.cpp
diff --git a/engines/sci/metaengine.cpp b/engines/sci/metaengine.cpp
index 84b8b541670..c3fc3bdaddf 100644
--- a/engines/sci/metaengine.cpp
+++ b/engines/sci/metaengine.cpp
@@ -130,7 +130,7 @@ static const GameIdStrToEnum s_gameIdStrToEnum[] = {
{ "sq5", "sq5", GID_SQ5, false, SCI_VERSION_NONE },
{ "sq6", "sq6", GID_SQ6, true, SCI_VERSION_NONE },
{ "torin", "torin", GID_TORIN, true, SCI_VERSION_NONE },
- { nullptr, nullptr, (SciGameId)-1, false, SCI_VERSION_NONE }
+ { nullptr, nullptr, GID_ALL, false, SCI_VERSION_NONE }
};
struct DemoIdEntry {
More information about the Scummvm-git-logs
mailing list