From 466b162996697850872832f98e2ffbb0a3e826e9 Mon Sep 17 00:00:00 2001 From: D G Turner Date: Sat, 3 Aug 2019 14:52:57 +0100 Subject: CLOUD: Fix GCC Compilation Warning in Debug Code. The warning emitted here was due to debug() call with an empty format string, so this could have been fixed by replacing this with "%s", "". However, this change should be better since it avoids the duplication of the number of file check over several lines and reduces the string duplication i.e. DRY improvements. --- backends/cloud/savessyncrequest.cpp | 24 +++++++++++++++++------- 1 file changed, 17 insertions(+), 7 deletions(-) (limited to 'backends') diff --git a/backends/cloud/savessyncrequest.cpp b/backends/cloud/savessyncrequest.cpp index 3a581005c6..b906e5b5d6 100644 --- a/backends/cloud/savessyncrequest.cpp +++ b/backends/cloud/savessyncrequest.cpp @@ -137,14 +137,24 @@ void SavesSyncRequest::directoryListedCallback(Storage::ListDirectoryResponse re } } - debug(9, (_filesToDownload.size() > 0 ? "\nSavesSyncRequest: download files:" : "\nSavesSyncRequest: nothing to download")); - for (uint32 i = 0; i < _filesToDownload.size(); ++i) { - debug(9, " %s", _filesToDownload[i].name().c_str()); + debug(9, "\nSavesSyncRequest: "); + if (_filesToDownload.size() > 0) { + debug(9, "nothing to download"); + } else { + debug(9, "download files:"); + for (uint32 i = 0; i < _filesToDownload.size(); ++i) { + debug(9, " %s", _filesToDownload[i].name().c_str()); + } + debug(9, "%s", ""); } - if (_filesToDownload.size() > 0) debug(9, ""); - debug(9, (_filesToUpload.size() > 0 ? "SavesSyncRequest: upload files:" : "SavesSyncRequest: nothing to upload")); - for (uint32 i = 0; i < _filesToUpload.size(); ++i) { - debug(9, " %s", _filesToUpload[i].c_str()); + debug(9, "SavesSyncRequest: "); + if (_filesToUpload.size() > 0) { + debug(9, "nothing to upload"); + } else { + debug(9, "upload files:"); + for (uint32 i = 0; i < _filesToUpload.size(); ++i) { + debug(9, " %s", _filesToUpload[i].c_str()); + } } _totalFilesToHandle = _filesToDownload.size() + _filesToUpload.size(); -- cgit v1.2.3