Skip to content

Commit

Permalink
CRYOMNI3D: Silence more warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
lephilousophe committed Jul 4, 2019
1 parent 577a84a commit 8ed05ad
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 12 deletions.
6 changes: 3 additions & 3 deletions engines/cryomni3d/font_manager.cpp
Expand Up @@ -201,9 +201,9 @@ bool FontManager::displayBlockText(const Common::String &text,
_blockPos.x += _spaceWidth;
} else {
double sp = (word_i + 1) * spaceWidthPerWord - spaceConsumed;
_blockPos.x += sp;
spaceConsumed += sp;
remainingSpace -= sp;
_blockPos.x += int16(sp);
spaceConsumed += uint(sp);
remainingSpace -= uint(sp);
}
}
if (_blockPos.y + _lineHeight + getFontMaxHeight() >= _blockRect.bottom) {
Expand Down
2 changes: 1 addition & 1 deletion engines/cryomni3d/image/codecs/hlz.cpp
Expand Up @@ -76,7 +76,7 @@ void HLZDecoder::decodeFrameInPlace(Common::SeekableReadStream &stream, uint32 s
bool eof = false;
bool checkSize = (size != (uint32) - 1);
byte *orig = dst;
uint32 reg;
uint32 reg = 0;
int regBits = 0;
#define GETREG() getReg(stream, &size, &reg, &regBits)

Expand Down
4 changes: 2 additions & 2 deletions engines/cryomni3d/versailles/documentation.cpp
Expand Up @@ -1081,11 +1081,11 @@ Common::String Versailles_Documentation::docAreaHandleCastleMap() {
Common::Rect areaPos2;

Area(const Common::Rect &areaPos_, const char *record_, bool fillArea_ = true,
uint messageId_ = -1) :
uint messageId_ = uint(-1)) :
areaPos(areaPos_), record(record_), fillArea(fillArea_), messageId(messageId_) { }
Area(const Common::Rect &areaPos_, const Common::Rect &areaPos1_,
const Common::Rect &areaPos2_, const char *record_, bool fillArea_ = true,
uint messageId_ = -1) :
uint messageId_ = uint(-1)) :
areaPos(areaPos_), areaPos1(areaPos1_), areaPos2(areaPos2_),
record(record_), fillArea(fillArea_), messageId(messageId_) { }
} areas[] = {
Expand Down
8 changes: 4 additions & 4 deletions engines/cryomni3d/versailles/engine.cpp
Expand Up @@ -551,7 +551,7 @@ void CryOmni3DEngine_Versailles::syncOmni3DSettings() {
void CryOmni3DEngine_Versailles::syncSoundSettings() {
CryOmni3DEngine::syncSoundSettings();

int soundVolumeMusic = ConfMan.getInt("music_volume") / _musicVolumeFactor;
int soundVolumeMusic = int(ConfMan.getInt("music_volume") / _musicVolumeFactor);

bool mute = false;
if (ConfMan.hasKey("mute")) {
Expand Down Expand Up @@ -1359,13 +1359,13 @@ void CryOmni3DEngine_Versailles::animateWarpTransition(const Transition *transit
// We devide by 5 to slow down movement for modern CPUs
int deltaAlphaI;
if (deltaAlpha < M_PI) {
deltaAlphaI = -(deltaAlpha * 512. / 5.);
deltaAlphaI = int(-(deltaAlpha * 512. / 5.));
} else {
deltaAlphaI = (2.*M_PI - deltaAlpha) * 512. / 5.;
deltaAlphaI = int((2.*M_PI - deltaAlpha) * 512. / 5.);
}

double deltaBeta = -srcBeta - _omni3dMan.getBeta();
int deltaBetaI = -(deltaBeta * 512. / 5.);
int deltaBetaI = int(-(deltaBeta * 512. / 5.));

if (_omni3dSpeed > 0) {
deltaAlphaI <<= 2;
Expand Down
2 changes: 1 addition & 1 deletion engines/cryomni3d/versailles/logic.cpp
Expand Up @@ -2679,7 +2679,7 @@ IMG_CB(88003) {
// Dispatch to the correct state
if (_gameVariables[GameVariables::kBombState] >= 1 &&
_gameVariables[GameVariables::kBombState] <= 5) {
FixedImgCallback callback;
FixedImgCallback callback = nullptr;
switch (_gameVariables[GameVariables::kBombState]) {
case 1:
callback = &CryOmni3DEngine_Versailles::img_88003b;
Expand Down
3 changes: 2 additions & 1 deletion engines/cryomni3d/versailles/saveload.cpp
Expand Up @@ -134,7 +134,8 @@ void CryOmni3DEngine_Versailles::saveGame(bool visit, uint saveNum,
// Write save name
char saveNameC[kSaveDescriptionLen];
memset(saveNameC, 0, sizeof(saveNameC));
strncpy(saveNameC, saveName.c_str(), 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));

// dummy values
Expand Down

0 comments on commit 8ed05ad

Please sign in to comment.