aboutsummaryrefslogtreecommitdiffstats
path: root/parameter
diff options
context:
space:
mode:
authorKevin Rocard <kevinx.rocard@intel.com>2012-07-30 15:46:09 +0200
committerDavid Wagner <david.wagner@intel.com>2014-02-12 17:03:11 +0100
commit7c7dc292ff39feb9ce0b9beda782f02e0f868d14 (patch)
tree45eebc9345794adef247a1be377a773425fda5eb /parameter
parent4ebc0984c7afe9a6f0168169d5141421b4adcc67 (diff)
downloadexternal_parameter-framework-7c7dc292ff39feb9ce0b9beda782f02e0f868d14.zip
external_parameter-framework-7c7dc292ff39feb9ce0b9beda782f02e0f868d14.tar.gz
external_parameter-framework-7c7dc292ff39feb9ce0b9beda782f02e0f868d14.tar.bz2
PFW: Mapping values are not truncated after ':'
BZ: 49228 When an mapping value contains a ':', anything after is no longer ignored. Example : <Component Name="STATE" Type="SYSFS_FILE" Mapping="Directory:/sys/bus/pci/devices/00 00:00:06.6/"/> the PFW used to consider the mapping field as: "Directory:/sys/bus/pci/devices/0000" but now it is consided entirely: "Directory:/sys/bus/pci/devices/00 00:00:06.6/" Change-Id: I95711fb4e4ee7d10739e6393717a08627192bb00 Signed-off-by: Kevin Rocard <kevinx.rocard@intel.com> Reviewed-on: http://android.intel.com:8080/59569 Reviewed-by: Becker, VincentX <vincentx.becker@intel.com> Reviewed-by: Mendi, EduardoX <eduardox.mendi@intel.com> Tested-by: Mendi, EduardoX <eduardox.mendi@intel.com> Reviewed-by: buildbot <buildbot@intel.com> Tested-by: buildbot <buildbot@intel.com>
Diffstat (limited to 'parameter')
-rw-r--r--parameter/MappingData.cpp22
1 files changed, 19 insertions, 3 deletions
diff --git a/parameter/MappingData.cpp b/parameter/MappingData.cpp
index a577439..4ec58e3 100644
--- a/parameter/MappingData.cpp
+++ b/parameter/MappingData.cpp
@@ -42,10 +42,26 @@ bool CMappingData::fromXml(const CXmlElement& xmlElement, CXmlSerializingContext
while (!(strMappingElement = mappingTok.next()).empty()) {
- Tokenizer keyValueTok(strMappingElement, ":");
+ string::size_type iFistDelimiterOccurrence = strMappingElement.find_first_of(':');
- string strKey = keyValueTok.next();
- string strValue = keyValueTok.next();
+ string strKey, strValue;
+
+ if (iFistDelimiterOccurrence == string::npos) {
+
+ // There is no delimiter in the mapping field,
+ // it means that no value has been provided
+ strKey = strMappingElement;
+ strValue = "";
+
+ } else {
+
+ // Get mapping key
+ strKey = strMappingElement.substr(0, iFistDelimiterOccurrence);
+
+ // Get mapping value
+ strValue = strMappingElement.substr(iFistDelimiterOccurrence + 1);
+
+ }
if (!addValue(strKey, strValue)) {