aboutsummaryrefslogtreecommitdiff
path: root/backends/saves/default
diff options
context:
space:
mode:
authorAlexander Tkachev2019-07-16 20:13:50 +0700
committerMatan Bareket2019-07-30 14:51:41 -0400
commit1e92e7b9f3bd7a2fb55d77a7e28934abf3d02f19 (patch)
tree48ca7a2469d075b222faefa222fb2f0d6d84b502 /backends/saves/default
parentc1124c9cdae37271413842bce79a992bf4238cf4 (diff)
downloadscummvm-rg350-1e92e7b9f3bd7a2fb55d77a7e28934abf3d02f19.tar.gz
scummvm-rg350-1e92e7b9f3bd7a2fb55d77a7e28934abf3d02f19.tar.bz2
scummvm-rg350-1e92e7b9f3bd7a2fb55d77a7e28934abf3d02f19.zip
CLOUD: Fix saves syncing
This mostly affects OneDrive saves syncing, because it is the only cloud provider to return 0 as timestamp of (non-)created file. 0 is treated as EOF in /saves/timestamps file, thus all timestamps after such 0 timestamps were ignored and files were reuploaded as being "new". This commit also adds more verbose debug information on SavesSyncRequest decisions making for easier debugging.
Diffstat (limited to 'backends/saves/default')
-rw-r--r--backends/saves/default/default-saves.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/backends/saves/default/default-saves.cpp b/backends/saves/default/default-saves.cpp
index 44fd48bb7e..e9a4165ddb 100644
--- a/backends/saves/default/default-saves.cpp
+++ b/backends/saves/default/default-saves.cpp
@@ -360,7 +360,10 @@ void DefaultSaveFileManager::saveTimestamps(Common::HashMap<Common::String, uint
}
for (Common::HashMap<Common::String, uint32>::iterator i = timestamps.begin(); i != timestamps.end(); ++i) {
- Common::String data = i->_key + Common::String::format(" %u\n", i->_value);
+ uint32 v = i->_value;
+ if (v < 1) v = 1; // 0 timestamp is treated as EOF up there, so we should never save zeros
+
+ Common::String data = i->_key + Common::String::format(" %u\n", v);
if (f.write(data.c_str(), data.size()) != data.size()) {
warning("DefaultSaveFileManager: failed to write timestamps data into '%s'", filename.c_str());
return;