summaryrefslogtreecommitdiffstats
path: root/src/save/PCSave.cpp
diff options
context:
space:
mode:
authoreray orçunus <erayorcunus@gmail.com>2020-03-25 15:13:06 +0100
committereray orçunus <erayorcunus@gmail.com>2020-03-26 16:54:03 +0100
commit0fe55eb5432906016cc3526caf3f86d5bf85aff1 (patch)
tree0f4f6bfafc9e3138bf090efb16b18e6fa22c2eab /src/save/PCSave.cpp
parentMerge pull request #353 from Sergeanur/Debug (diff)
downloadre3-0fe55eb5432906016cc3526caf3f86d5bf85aff1.tar
re3-0fe55eb5432906016cc3526caf3f86d5bf85aff1.tar.gz
re3-0fe55eb5432906016cc3526caf3f86d5bf85aff1.tar.bz2
re3-0fe55eb5432906016cc3526caf3f86d5bf85aff1.tar.lz
re3-0fe55eb5432906016cc3526caf3f86d5bf85aff1.tar.xz
re3-0fe55eb5432906016cc3526caf3f86d5bf85aff1.tar.zst
re3-0fe55eb5432906016cc3526caf3f86d5bf85aff1.zip
Diffstat (limited to 'src/save/PCSave.cpp')
-rw-r--r--src/save/PCSave.cpp14
1 files changed, 7 insertions, 7 deletions
diff --git a/src/save/PCSave.cpp b/src/save/PCSave.cpp
index 2702bd6e..e94db6db 100644
--- a/src/save/PCSave.cpp
+++ b/src/save/PCSave.cpp
@@ -38,7 +38,7 @@ C_PcSave::SaveSlot(int32 slot)
if (file != 0) {
DoGameSpecificStuffBeforeSave();
if (GenericSave(file)) {
- if (CFileMgr::CloseFile(file) != 0)
+ if (!!CFileMgr::CloseFile(file))
nErrorCode = SAVESTATUS_ERR_SAVE_CLOSE;
return true;
}
@@ -55,21 +55,21 @@ C_PcSave::PcClassSaveRoutine(int32 file, uint8 *data, uint32 size)
CFileMgr::Write(file, (const char*)&size, sizeof(size));
if (CFileMgr::GetErrorReadWrite(file)) {
nErrorCode = SAVESTATUS_ERR_SAVE_WRITE;
- strncpy(SaveFileNameJustSaved, ValidSaveName, 259);
+ strncpy(SaveFileNameJustSaved, ValidSaveName, sizeof(ValidSaveName) - 1);
return false;
}
CFileMgr::Write(file, (const char*)data, align4bytes(size));
- CheckSum += ((uint8*)&size)[0];
- CheckSum += ((uint8*)&size)[1];
- CheckSum += ((uint8*)&size)[2];
- CheckSum += ((uint8*)&size)[3];
+ CheckSum += (uint8) size;
+ CheckSum += (uint8) (size >> 8);
+ CheckSum += (uint8) (size >> 16);
+ CheckSum += (uint8) (size >> 24);
for (int i = 0; i < align4bytes(size); i++) {
CheckSum += *data++;
}
if (CFileMgr::GetErrorReadWrite(file)) {
nErrorCode = SAVESTATUS_ERR_SAVE_WRITE;
- strncpy(SaveFileNameJustSaved, ValidSaveName, 259);
+ strncpy(SaveFileNameJustSaved, ValidSaveName, sizeof(ValidSaveName) - 1);
return false;
}