[Scummvm-cvs-logs] scummvm master -> 92aabb686889206060ecb67b8163c6817232f8f9

tsoliman tarek at bashasoliman.com
Wed Feb 22 14:48:45 CET 2012


This automated email contains information about 2 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
6b91c94a09 KEYMAPPER: Initialize Event::customType
92aabb6868 KEYMAPPER: Change HardwareKey id to Common::String


Commit: 6b91c94a096940285a2fe8909654fece0167900d
    https://github.com/scummvm/scummvm/commit/6b91c94a096940285a2fe8909654fece0167900d
Author: Tarek Soliman (tsoliman at scummvm.org)
Date: 2012-02-22T05:04:59-08:00

Commit Message:
KEYMAPPER: Initialize Event::customType

Changed paths:
    common/events.h



diff --git a/common/events.h b/common/events.h
index 69cca9b..5f6a779 100644
--- a/common/events.h
+++ b/common/events.h
@@ -118,7 +118,11 @@ struct Event {
 	CustomEventType customType;
 #endif
 
-	Event() : type(EVENT_INVALID), synthetic(false) {}
+	Event() : type(EVENT_INVALID), synthetic(false) {
+#ifdef ENABLE_KEYMAPPER
+		customType = 0;
+#endif
+	}
 };
 
 /**


Commit: 92aabb686889206060ecb67b8163c6817232f8f9
    https://github.com/scummvm/scummvm/commit/92aabb686889206060ecb67b8163c6817232f8f9
Author: Tarek Soliman (tsoliman at scummvm.org)
Date: 2012-02-22T05:44:59-08:00

Commit Message:
KEYMAPPER: Change HardwareKey id to Common::String

Changed paths:
    backends/keymapper/hardware-key.h
    backends/keymapper/keymap.cpp



diff --git a/backends/keymapper/hardware-key.h b/backends/keymapper/hardware-key.h
index 8c46ee6..9fd8d19 100644
--- a/backends/keymapper/hardware-key.h
+++ b/backends/keymapper/hardware-key.h
@@ -31,14 +31,12 @@
 
 namespace Common {
 
-#define HWKEY_ID_SIZE (30)
-
 /**
 * Describes an available hardware key
 */
 struct HardwareKey {
 	/** unique id used for saving/loading to config */
-	char hwKeyId[HWKEY_ID_SIZE];
+	String id;
 
 	/** Human readable description */
 	String description;
@@ -49,11 +47,8 @@ struct HardwareKey {
 	*/
 	KeyState key;
 
-	HardwareKey(const char *i, KeyState ky = KeyState(), String desc = "")
-		: key(ky), description(desc) {
-		assert(i);
-		Common::strlcpy(hwKeyId, i, HWKEY_ID_SIZE);
-	}
+	HardwareKey(String i, KeyState ky = KeyState(), String desc = "")
+		: id(i), key(ky), description(desc) { }
 };
 
 /**
@@ -108,11 +103,11 @@ public:
 		_keys.push_back(key);
 	}
 
-	const HardwareKey *findHardwareKey(const char *id) const {
+	const HardwareKey *findHardwareKey(String id) const {
 		List<const HardwareKey *>::const_iterator it;
 
 		for (it = _keys.begin(); it != _keys.end(); it++) {
-			if (strncmp((*it)->hwKeyId, id, HWKEY_ID_SIZE) == 0)
+			if ((*it)->id == id)
 				return (*it);
 		}
 		return 0;
@@ -175,8 +170,8 @@ private:
 		List<const HardwareKey *>::iterator it;
 
 		for (it = _keys.begin(); it != _keys.end(); it++) {
-			if (strncmp((*it)->hwKeyId, key->hwKeyId, HWKEY_ID_SIZE) == 0)
-				error("Error adding HardwareKey '%s' - id of %s already in use!", key->description.c_str(), key->hwKeyId);
+			if ((*it)->id == key->id)
+				error("Error adding HardwareKey '%s' - id of %s already in use!", key->description.c_str(), key->id.c_str());
 			else if ((*it)->key == key->key)
 				error("Error adding HardwareKey '%s' - key already in use!", key->description.c_str());
 		}
diff --git a/backends/keymapper/keymap.cpp b/backends/keymapper/keymap.cpp
index 5bee1a2..3913fd1 100644
--- a/backends/keymapper/keymap.cpp
+++ b/backends/keymapper/keymap.cpp
@@ -185,12 +185,10 @@ void Keymap::saveMappings() {
 		actIdLen = (actIdLen > ACTION_ID_SIZE) ? ACTION_ID_SIZE : actIdLen;
 
 		String actId((*it)->id, (*it)->id + actIdLen);
-		char hwId[HWKEY_ID_SIZE+1];
-
-		memset(hwId, 0, HWKEY_ID_SIZE+1);
+		String hwId = "";
 
 		if ((*it)->getMappedKey()) {
-			memcpy(hwId, (*it)->getMappedKey()->hwKeyId, HWKEY_ID_SIZE);
+			hwId = (*it)->getMappedKey()->id;
 		}
 		_configDomain->setVal(prefix + actId, hwId);
 	}






More information about the Scummvm-git-logs mailing list