aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexander Tkachev2016-06-15 13:40:15 +0600
committerAlexander Tkachev2016-08-24 16:07:55 +0600
commitf571f3dd28a4b82973d26ff724edec60ad6ea845 (patch)
treeb3b917616aa7d8e96612007cec5a07d7469e5f81
parenta83e91e1ca6666be620d1cd1b0a8e4f267d7eaf2 (diff)
downloadscummvm-rg350-f571f3dd28a4b82973d26ff724edec60ad6ea845.tar.gz
scummvm-rg350-f571f3dd28a4b82973d26ff724edec60ad6ea845.tar.bz2
scummvm-rg350-f571f3dd28a4b82973d26ff724edec60ad6ea845.zip
CLOUD: Add comments for StorageWizardDialog methods
-rw-r--r--gui/storagewizarddialog.cpp1
-rw-r--r--gui/storagewizarddialog.h20
2 files changed, 21 insertions, 0 deletions
diff --git a/gui/storagewizarddialog.cpp b/gui/storagewizarddialog.cpp
index b419d1127a..46be812f6d 100644
--- a/gui/storagewizarddialog.cpp
+++ b/gui/storagewizarddialog.cpp
@@ -141,6 +141,7 @@ int StorageWizardDialog::decodeHashchar(char c) {
}
bool StorageWizardDialog::correctChecksum(Common::String s) {
+ if (s.size() == 0) return false; //no last char
int providedChecksum = decodeHashchar(s.lastChar());
int calculatedChecksum = 0x2A;
for (uint32 i = 0; i < s.size()-1; ++i) {
diff --git a/gui/storagewizarddialog.h b/gui/storagewizarddialog.h
index b75b952222..93e368463c 100644
--- a/gui/storagewizarddialog.h
+++ b/gui/storagewizarddialog.h
@@ -40,8 +40,28 @@ class StorageWizardDialog : public Dialog {
StaticTextWidget *_messageWidget;
ButtonWidget *_connectWidget;
+ /**
+ * Return the value corresponding to the given character.
+ *
+ * There is a value corresponding to each of 64 selected
+ * printable characters (0-9, A-Z, a-z, ? and !).
+ *
+ * When given another character, -1 is returned.
+ */
int decodeHashchar(char c);
+
+ /**
+ * Return whether checksum is correct.
+ *
+ * The last character of the string is treated as
+ * the checksum of all the others (decoded with
+ * decodeHashchar()).
+ *
+ * Checksum = (c[0] ^ c[1] ^ ...) % 64
+ */
bool correctChecksum(Common::String s);
+
+ /** The "CRC16_CCITT_FALSE" CRC-16 algorithm. */
uint32 crc16(Common::String s);
public:
StorageWizardDialog(uint32 storageId);