[Scummvm-git-logs] scummvm master -> 1bc068decddc53960ad3307d0406d3948aaafefd
lephilousophe
lephilousophe at users.noreply.github.com
Sun Feb 16 19:23:48 UTC 2020
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:
1bc068decd CRYOMNI3D: Fix Coverity warnings
Commit: 1bc068decddc53960ad3307d0406d3948aaafefd
https://github.com/scummvm/scummvm/commit/1bc068decddc53960ad3307d0406d3948aaafefd
Author: Le Philousophe (lephilousophe at users.noreply.github.com)
Date: 2020-02-16T20:20:46+01:00
Commit Message:
CRYOMNI3D: Fix Coverity warnings
- Add initializations to constructors
- Use correct variable
- Fix unintended sign extension because of int promotion
- Use camelCase for variable names
Changed paths:
engines/cryomni3d/cryomni3d.cpp
engines/cryomni3d/fixed_image.cpp
engines/cryomni3d/omni3d.h
engines/cryomni3d/sprites.cpp
engines/cryomni3d/versailles/documentation.cpp
engines/cryomni3d/versailles/documentation.h
engines/cryomni3d/versailles/engine.cpp
engines/cryomni3d/versailles/toolbar.cpp
engines/cryomni3d/versailles/toolbar.h
engines/cryomni3d/video/hnm_decoder.cpp
diff --git a/engines/cryomni3d/cryomni3d.cpp b/engines/cryomni3d/cryomni3d.cpp
index a9f102d..952e69a 100644
--- a/engines/cryomni3d/cryomni3d.cpp
+++ b/engines/cryomni3d/cryomni3d.cpp
@@ -43,7 +43,7 @@ namespace CryOmni3D {
CryOmni3DEngine::CryOmni3DEngine(OSystem *syst,
const CryOmni3DGameDescription *gamedesc) : Engine(syst), _gameDescription(gamedesc),
- _canLoadSave(false), _fontManager(), _sprites(), _dragStatus(kDragStatus_NoDrag),
+ _canLoadSave(false), _fontManager(), _sprites(), _dragStatus(kDragStatus_NoDrag), _lastMouseButton(0),
_autoRepeatNextEvent(uint(-1)) {
if (!_mixer->isReady()) {
error("Sound initialization failed");
diff --git a/engines/cryomni3d/fixed_image.cpp b/engines/cryomni3d/fixed_image.cpp
index de685fe..cdae1a7 100644
--- a/engines/cryomni3d/fixed_image.cpp
+++ b/engines/cryomni3d/fixed_image.cpp
@@ -35,7 +35,11 @@ ZonFixedImage::ZonFixedImage(CryOmni3DEngine &engine,
const FixedImageConfiguration *configuration) :
_engine(engine), _inventory(inventory), _sprites(sprites),
_configuration(configuration),
- _callback(nullptr), _imageDecoder(nullptr), _imageSurface(nullptr) {
+ _callback(nullptr), _imageDecoder(nullptr), _imageSurface(nullptr),
+ _zonesMode(kZonesMode_None), _currentZone(uint(-1)), _exit(false), _zoneLow(false),
+ _zoneHigh(false), _zoneHighLeft(false), _zoneHighRight(false), _zoneLeft(false), _zoneRight(false),
+ _zoneQuestion(false), _zoneListen(false), _zoneSee(false), _zoneUse(false), _zoneSpeak(false),
+ _usedObject(nullptr), _highLeftId(0), _highRightId(0), _refreshCursor(false) {
}
ZonFixedImage::~ZonFixedImage() {
diff --git a/engines/cryomni3d/omni3d.h b/engines/cryomni3d/omni3d.h
index e7d9e08..7633a66 100644
--- a/engines/cryomni3d/omni3d.h
+++ b/engines/cryomni3d/omni3d.h
@@ -29,7 +29,9 @@ namespace CryOmni3D {
class Omni3DManager {
public:
- Omni3DManager() {}
+ Omni3DManager() : _vfov(0), _alpha(0), _beta(0), _xSpeed(0), _ySpeed(0), _alphaMin(0), _alphaMax(0),
+ _betaMin(0), _betaMax(0), _helperValue(0), _dirty(true), _dirtyCoords(true),
+ _sourceSurface(nullptr) {}
virtual ~Omni3DManager();
void init(double hfov);
diff --git a/engines/cryomni3d/sprites.cpp b/engines/cryomni3d/sprites.cpp
index 81844e7..c6ee772 100644
--- a/engines/cryomni3d/sprites.cpp
+++ b/engines/cryomni3d/sprites.cpp
@@ -211,7 +211,7 @@ const Graphics::Cursor &Sprites::getCursor(uint spriteId) const {
}
Sprites::CryoCursor::CryoCursor() : _width(0), _height(0), _offX(0), _offY(0), _data(nullptr),
- refCnt(1) {
+ refCnt(1), _constantId(uint(-1)) {
}
Sprites::CryoCursor::~CryoCursor() {
diff --git a/engines/cryomni3d/versailles/documentation.cpp b/engines/cryomni3d/versailles/documentation.cpp
index c207d9d..d52e67c 100644
--- a/engines/cryomni3d/versailles/documentation.cpp
+++ b/engines/cryomni3d/versailles/documentation.cpp
@@ -1400,7 +1400,6 @@ uint Versailles_Documentation::inGameHandleRecord(Graphics::ManagedSurface &surf
void Versailles_Documentation::drawRecordData(Graphics::ManagedSurface &surface,
const Common::String &text, const Common::String &title,
const Common::String &subtitle, const Common::String &caption) {
- bool displayMap = false;
unsigned char foreColor = 247;
Common::String background;
Common::Rect blockTitle;
@@ -1458,7 +1457,7 @@ void Versailles_Documentation::drawRecordData(Graphics::ManagedSurface &surface,
background = _engine->prepareFileName(background, "hlz");
Common::File backgroundFl;
if (!backgroundFl.open(background)) {
- background = displayMap ? "pas_fonP.hlz" : "pas_fond.hlz";
+ background = _currentMapLayout ? "pas_fonP.hlz" : "pas_fond.hlz";
} else {
backgroundFl.close();
}
diff --git a/engines/cryomni3d/versailles/documentation.h b/engines/cryomni3d/versailles/documentation.h
index dd889e1..7dea214 100644
--- a/engines/cryomni3d/versailles/documentation.h
+++ b/engines/cryomni3d/versailles/documentation.h
@@ -39,8 +39,9 @@ class CryOmni3DEngine;
namespace Versailles {
class Versailles_Documentation {
public:
- Versailles_Documentation() : _engine(nullptr), _fontManager(nullptr), _messages(nullptr),
- _linksData(nullptr), _linksSize(0) { }
+ Versailles_Documentation() : _engine(nullptr), _fontManager(nullptr), _sprites(nullptr),
+ _messages(nullptr), _linksData(nullptr), _linksSize(0),
+ _currentInTimeline(false), _currentMapLayout(false), _currentHasMap(false) { }
~Versailles_Documentation() { delete [] _linksData; }
void init(const Sprites *sprites, FontManager *fontManager, const Common::StringArray *messages,
diff --git a/engines/cryomni3d/versailles/engine.cpp b/engines/cryomni3d/versailles/engine.cpp
index 1137b81..9807df1 100644
--- a/engines/cryomni3d/versailles/engine.cpp
+++ b/engines/cryomni3d/versailles/engine.cpp
@@ -51,11 +51,15 @@ const FixedImageConfiguration CryOmni3DEngine_Versailles::kFixedImageConfigurati
CryOmni3DEngine_Versailles::CryOmni3DEngine_Versailles(OSystem *syst,
const CryOmni3DGameDescription *gamedesc) : CryOmni3DEngine(syst, gamedesc),
_mainPalette(nullptr), _cursorPalette(nullptr), _transparentPaletteMap(nullptr),
+ _transparentSrcStart(uint(-1)), _transparentSrcStop(uint(-1)), _transparentDstStart(uint(-1)),
+ _transparentDstStop(uint(-1)), _transparentNewStart(uint(-1)), _transparentNewStop(uint(-1)),
_currentPlace(nullptr), _currentWarpImage(nullptr), _fixedImage(nullptr),
_transitionAnimateWarp(true), _forceRedrawWarp(false), _forcePaletteUpdate(false),
_fadedPalette(false), _loadedSave(uint(-1)), _dialogsMan(this,
getFeatures() & GF_VERSAILLES_AUDIOPADDING_YES),
- _musicVolumeFactor(1.), _musicCurrentFile(nullptr),
+ _musicVolumeFactor(1.), _musicCurrentFile(nullptr), _omni3dSpeed(0),
+ _isPlaying(false), _isVisiting(false), _abortCommand(kAbortQuit),
+ _currentPlaceId(uint(-1)), _nextPlaceId(uint(-1)), _currentLevel(uint(-1)),
_countingDown(false), _countdownNextEvent(0) {
}
diff --git a/engines/cryomni3d/versailles/toolbar.cpp b/engines/cryomni3d/versailles/toolbar.cpp
index 6f08bb5..e4b1ce9 100644
--- a/engines/cryomni3d/versailles/toolbar.cpp
+++ b/engines/cryomni3d/versailles/toolbar.cpp
@@ -187,7 +187,7 @@ uint Toolbar::callbackInventory(uint invId, uint dragStatus) {
_inventorySelected = invId;
_engine->setCursor(181);
_zones[12].secondary = (obj->viewCallback() == nullptr);
- _inventory_button_dragging = true;
+ _inventoryButtonDragging = true;
return 1;
case kDragStatus_Dragging:
if (_inventorySelected == invId) {
@@ -195,7 +195,7 @@ uint Toolbar::callbackInventory(uint invId, uint dragStatus) {
}
_inventorySelected = invId;
_zones[12].secondary = (obj->viewCallback() == nullptr);
- _inventory_button_dragging = true;
+ _inventoryButtonDragging = true;
return 1;
case kDragStatus_Finished:
_engine->setCursor(obj->idSl());
@@ -242,7 +242,7 @@ uint Toolbar::callbackViewObject(uint dragStatus) {
return 0;
}
- _mouse_in_view_object = true;
+ _mouseInViewObject = true;
if (_inventorySelected == uint(-1)) {
// Nothing selected in toolbar
@@ -257,7 +257,7 @@ uint Toolbar::callbackViewObject(uint dragStatus) {
switch (dragStatus) {
case kDragStatus_NoDrag:
- _backup_selected_object = selectedObject;
+ _backupSelectedObject = selectedObject;
_engine->setCursor(181);
return 0;
case kDragStatus_Pressed:
@@ -277,11 +277,11 @@ uint Toolbar::callbackViewObject(uint dragStatus) {
}
uint Toolbar::callbackOptions(uint dragStatus) {
- _mouse_in_options = true;
+ _mouseInOptions = true;
switch (dragStatus) {
case kDragStatus_NoDrag:
- _backup_selected_object = _inventory->selectedObject();
+ _backupSelectedObject = _inventory->selectedObject();
_engine->setCursor(181);
return 0;
case kDragStatus_Pressed:
@@ -303,7 +303,7 @@ uint Toolbar::callbackOptions(uint dragStatus) {
}
uint Toolbar::callbackDocumentation(uint dragStatus) {
- _mouse_in_options = true;
+ _mouseInOptions = true;
switch (dragStatus) {
case kDragStatus_NoDrag:
@@ -476,7 +476,7 @@ void Toolbar::handleToolbarEvents(const Graphics::Surface *original) {
_inventoryHovered = uint(-1);
_inventorySelected = uint(-1);
_inventory->setSelectedObject(nullptr);
- _backup_selected_object = nullptr;
+ _backupSelectedObject = nullptr;
// Refresh zones because we erased selected object
updateZones();
@@ -493,8 +493,8 @@ void Toolbar::handleToolbarEvents(const Graphics::Surface *original) {
mouseInsideToolbar = (_engine->getMousePos().y > 388);
while (!exitToolbar) {
- _mouse_in_options = false;
- _mouse_in_view_object = false;
+ _mouseInOptions = false;
+ _mouseInViewObject = false;
_engine->pollEvents();
if (_engine->shouldAbort()) {
@@ -542,15 +542,15 @@ void Toolbar::handleToolbarEvents(const Graphics::Surface *original) {
_inventory->setSelectedObject(nullptr);
}
- if (_backup_selected_object != nullptr && !(_mouse_in_options || _mouse_in_view_object) &&
+ if (_backupSelectedObject != nullptr && !(_mouseInOptions || _mouseInViewObject) &&
!_engine->getCurrentMouseButton()) {
- _inventory->setSelectedObject(_backup_selected_object);
- _engine->setCursor(_backup_selected_object->idSl());
- _backup_selected_object = nullptr;
+ _inventory->setSelectedObject(_backupSelectedObject);
+ _engine->setCursor(_backupSelectedObject->idSl());
+ _backupSelectedObject = nullptr;
}
// Hover the inventory objects
- if (_inventory->selectedObject() == nullptr /* || _inventory_button_dragging */) {
+ if (_inventory->selectedObject() == nullptr /* || _inventoryButtonDragging */) {
// The 2nd above condition is maybe useless because when the mouse button is down the selected object is always null
bool shouldHover = false;
Common::Array<Zone>::const_iterator zoneIt = hitTestZones(mousePosInToolbar);
@@ -565,7 +565,7 @@ void Toolbar::handleToolbarEvents(const Graphics::Surface *original) {
redrawToolbar = true;
}
}
- if (!shouldHover && _inventoryHovered != uint(-1) && !_mouse_in_view_object) {
+ if (!shouldHover && _inventoryHovered != uint(-1) && !_mouseInViewObject) {
// Remove hovering
_inventoryHovered = uint(-1);
_inventorySelected = uint(-1);
@@ -578,7 +578,7 @@ void Toolbar::handleToolbarEvents(const Graphics::Surface *original) {
_zones[12].secondary = true;
redrawToolbar = true;
}
- _inventory_button_dragging = false;
+ _inventoryButtonDragging = false;
}
if (_parentMustRedraw) {
diff --git a/engines/cryomni3d/versailles/toolbar.h b/engines/cryomni3d/versailles/toolbar.h
index cb1eeb4..50f52a4 100644
--- a/engines/cryomni3d/versailles/toolbar.h
+++ b/engines/cryomni3d/versailles/toolbar.h
@@ -41,9 +41,10 @@ namespace Versailles {
class Toolbar {
public:
Toolbar() : _sprites(nullptr), _fontManager(nullptr), _inventory(nullptr),
- _messages(nullptr), _inventoryOffset(0), _engine(nullptr),
- _inventoryHovered(uint(-1)), _inventorySelected(uint(-1)), _inventoryEnabled(true),
- _position(60) { }
+ _messages(nullptr), _engine(nullptr), _inventoryEnabled(true), _inventoryMaxOffset(0),
+ _inventoryOffset(0), _inventoryHovered(uint(-1)), _inventorySelected(uint(-1)), _backupSelectedObject(nullptr),
+ _mouseInOptions(false), _mouseInViewObject(false), _inventoryButtonDragging(false), _parentMustRedraw(false),
+ _shortExit(false), _position(60) { }
~Toolbar();
void init(const Sprites *sprites, FontManager *fontManager,
@@ -89,10 +90,10 @@ private:
uint _inventoryHovered;
uint _inventorySelected;
- Object *_backup_selected_object;
- bool _mouse_in_options;
- bool _mouse_in_view_object;
- bool _inventory_button_dragging;
+ Object *_backupSelectedObject;
+ bool _mouseInOptions;
+ bool _mouseInViewObject;
+ bool _inventoryButtonDragging;
bool _parentMustRedraw;
bool _shortExit;
diff --git a/engines/cryomni3d/video/hnm_decoder.cpp b/engines/cryomni3d/video/hnm_decoder.cpp
index e139f99..43a75f9 100644
--- a/engines/cryomni3d/video/hnm_decoder.cpp
+++ b/engines/cryomni3d/video/hnm_decoder.cpp
@@ -165,6 +165,7 @@ HNMDecoder::HNM4VideoTrack::HNM4VideoTrack(uint32 width, uint32 height, uint32 f
} else {
memset(_palette, 0, 256 * 3);
}
+ _dirtyPalette = true;
if (width * height != frameSize) {
error("Invalid frameSize");
@@ -339,7 +340,7 @@ void HNMDecoder::HNM4VideoTrack::decodeInterframe(Common::SeekableReadStream *st
void HNMDecoder::HNM4VideoTrack::decodeIntraframe(Common::SeekableReadStream *stream, uint32 size) {
Image::HLZDecoder::decodeFrameInPlace(*stream, size, _frameBufferC);
- memcpy(_frameBufferP, _frameBufferC, _surface.w * _surface.h);
+ memcpy(_frameBufferP, _frameBufferC, (uint)_surface.w * (uint)_surface.h);
_surface.setPixels(_frameBufferC);
_curFrame++;
More information about the Scummvm-git-logs
mailing list