[Scummvm-git-logs] scummvm master -> f04b3f6841be0e73f2374c287854baf71843beed
lephilousophe
noreply at scummvm.org
Sun Sep 18 11:21:43 UTC 2022
This automated email contains information about 2 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
d9456b459f CRYOMNI3D: Add members initializer
f04b3f6841 CRYOMNI3D: Use a null-terminated string
Commit: d9456b459f5b8ba69eda9af1b4041108f4d17bc6
https://github.com/scummvm/scummvm/commit/d9456b459f5b8ba69eda9af1b4041108f4d17bc6
Author: Le Philousophe (lephilousophe at users.noreply.github.com)
Date: 2022-09-18T13:19:59+02:00
Commit Message:
CRYOMNI3D: Add members initializer
This will fix static analyzer errors
Changed paths:
engines/cryomni3d/font_manager.cpp
engines/cryomni3d/fonts/cryoextfont.cpp
engines/cryomni3d/fonts/cryofont.cpp
engines/cryomni3d/versailles/documentation.cpp
engines/cryomni3d/versailles/documentation.h
engines/cryomni3d/versailles/engine.cpp
diff --git a/engines/cryomni3d/font_manager.cpp b/engines/cryomni3d/font_manager.cpp
index c7ce648faae..9a91b63d078 100644
--- a/engines/cryomni3d/font_manager.cpp
+++ b/engines/cryomni3d/font_manager.cpp
@@ -34,10 +34,11 @@
namespace CryOmni3D {
-FontManager::FontManager() : _currentFont(nullptr), _transparentBackground(false),
- _spaceWidth(0), _charSpacing(0), _lineHeight(30), _foreColor(0), _blockTextRemaining(nullptr),
- _useSpaceDelimiter(true), _keepASCIIjoined(true), _codepage(Common::kCodePageInvalid),
- _toUnicode(false) {
+FontManager::FontManager() : _codepage(Common::kCodePageInvalid), _toUnicode(false),
+ _currentFont(nullptr), _currentFontId(uint(-1)), _transparentBackground(false),
+ _spaceWidth(0), _charSpacing(0), _foreColor(0), _currentSurface(nullptr),
+ _lineHeight(30), _justifyText(false), _blockTextRemaining(nullptr),
+ _useSpaceDelimiter(true), _keepASCIIjoined(true) {
}
FontManager::~FontManager() {
diff --git a/engines/cryomni3d/fonts/cryoextfont.cpp b/engines/cryomni3d/fonts/cryoextfont.cpp
index 89d74a70c81..d6767a14006 100644
--- a/engines/cryomni3d/fonts/cryoextfont.cpp
+++ b/engines/cryomni3d/fonts/cryoextfont.cpp
@@ -250,7 +250,7 @@ uint32 CryoExtFont::mapGlyph(uint32 chr) const {
}
}
-CryoExtFont::Glyph::Glyph() : offX(0), offY(0), advance(0), bitmap(nullptr) {
+CryoExtFont::Glyph::Glyph() : h(0), w(0), offX(0), offY(0), advance(0), bitmap(nullptr) {
}
CryoExtFont::Glyph::~Glyph() {
diff --git a/engines/cryomni3d/fonts/cryofont.cpp b/engines/cryomni3d/fonts/cryofont.cpp
index b552b0e4604..06c2dc26924 100644
--- a/engines/cryomni3d/fonts/cryofont.cpp
+++ b/engines/cryomni3d/fonts/cryofont.cpp
@@ -167,7 +167,7 @@ uint32 CryoFont::mapGlyph(uint32 chr) const {
return chr;
}
-CryoFont::Glyph::Glyph() : offX(0), offY(0), advance(0), bitmap(nullptr) {
+CryoFont::Glyph::Glyph() : h(0), w(0), offX(0), offY(0), advance(0), bitmap(nullptr) {
}
CryoFont::Glyph::~Glyph() {
diff --git a/engines/cryomni3d/versailles/documentation.cpp b/engines/cryomni3d/versailles/documentation.cpp
index 6639d987985..cabfd323226 100644
--- a/engines/cryomni3d/versailles/documentation.cpp
+++ b/engines/cryomni3d/versailles/documentation.cpp
@@ -90,7 +90,7 @@ void Versailles_Documentation::init(const Sprites *sprites, FontManager *fontMan
_allDocsFileName = allDocsFileName;
_linksDocsFileName = linksDocsFileName;
- // Japanese version of Versailles handles records attributeswith multilines
+ // Japanese version of Versailles handles records attributes with multilines
_multilineAttributes = (_engine->getLanguage() == Common::JA_JPN);
// Build list of records
diff --git a/engines/cryomni3d/versailles/documentation.h b/engines/cryomni3d/versailles/documentation.h
index d5dbcfdeaf4..4e2993ae8e3 100644
--- a/engines/cryomni3d/versailles/documentation.h
+++ b/engines/cryomni3d/versailles/documentation.h
@@ -39,7 +39,7 @@ namespace Versailles {
class Versailles_Documentation {
public:
Versailles_Documentation() : _engine(nullptr), _fontManager(nullptr), _sprites(nullptr),
- _messages(nullptr), _linksData(nullptr), _linksSize(0),
+ _messages(nullptr), _multilineAttributes(false), _linksData(nullptr), _linksSize(0),
_currentInTimeline(false), _currentMapLayout(false), _currentHasMap(false) { }
~Versailles_Documentation() { delete [] _linksData; }
diff --git a/engines/cryomni3d/versailles/engine.cpp b/engines/cryomni3d/versailles/engine.cpp
index e7999c2b6d9..f79e2aa9c30 100644
--- a/engines/cryomni3d/versailles/engine.cpp
+++ b/engines/cryomni3d/versailles/engine.cpp
@@ -59,7 +59,8 @@ CryOmni3DEngine_Versailles::CryOmni3DEngine_Versailles(OSystem *syst,
_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) {
+ _countingDown(false), _countdownNextEvent(0),
+ _currentSubtitleSet(nullptr), _currentSubtitle(nullptr) {
}
CryOmni3DEngine_Versailles::~CryOmni3DEngine_Versailles() {
Commit: f04b3f6841be0e73f2374c287854baf71843beed
https://github.com/scummvm/scummvm/commit/f04b3f6841be0e73f2374c287854baf71843beed
Author: Le Philousophe (lephilousophe at users.noreply.github.com)
Date: 2022-09-18T13:19:59+02:00
Commit Message:
CRYOMNI3D: Use a null-terminated string
This is cleaner than just silencing the warning
Changed paths:
engines/cryomni3d/versailles/saveload.cpp
diff --git a/engines/cryomni3d/versailles/saveload.cpp b/engines/cryomni3d/versailles/saveload.cpp
index b6c6849ad9c..246ad69d1de 100644
--- a/engines/cryomni3d/versailles/saveload.cpp
+++ b/engines/cryomni3d/versailles/saveload.cpp
@@ -161,11 +161,13 @@ void CryOmni3DEngine_Versailles::saveGame(bool visit, uint saveNum,
syncCountdown();
// Write save name
- char saveNameC[kSaveDescriptionLen];
+
+ // Allocate one more byte to silence GCC warning
+ // The save name doesn't have to be null terminated in the save file
+ char saveNameC[kSaveDescriptionLen + 1];
memset(saveNameC, 0, sizeof(saveNameC));
- // Silence -Wstringop-truncation using parentheses, we don't have to have a null-terminated string here
- (strncpy(saveNameC, saveName.c_str(), sizeof(saveNameC)));
- out->write(saveNameC, sizeof(saveNameC));
+ strncpy(saveNameC, saveName.c_str(), kSaveDescriptionLen);
+ out->write(saveNameC, kSaveDescriptionLen);
// dummy values
out->writeUint32LE(0);
More information about the Scummvm-git-logs
mailing list