diff options
author | Guillaume Denneulin <guillaumex.denneulin@intel.com> | 2011-12-21 15:02:18 +0100 |
---|---|---|
committer | David Wagner <david.wagner@intel.com> | 2014-02-10 17:14:58 +0100 |
commit | 5901c1d3f448af5d0506d889b0543d9e0de0c2ce (patch) | |
tree | 1a69d72b8d920cb9604cdd8ed585cfe0cbd450ec /parameter | |
parent | ec0f84e3f601ac4ffb029b903c06007956c4b02a (diff) | |
download | external_parameter-framework-5901c1d3f448af5d0506d889b0543d9e0de0c2ce.zip external_parameter-framework-5901c1d3f448af5d0506d889b0543d9e0de0c2ce.tar.gz external_parameter-framework-5901c1d3f448af5d0506d889b0543d9e0de0c2ce.tar.bz2 |
PFW: Wrong file export in hexadecimal format
BZ: 18097
For fixed point parameters, if the output raw format is hexadecimal,
the settings were exported on 32 bits instead of their actual size
(8, 16 bits...).
Aligns also the way to deal with format on integer type
Change-Id: Ifb25f4d6769bcc7c55de5654443a4862ef5a9e0f
OLD-Change-Id: I5a9d695de98a7828af185b19e9943d4abf8bb805
Signed-off-by: Guillaume Denneulin <guillaumex.denneulin@intel.com>
Reviewed-on: http://android.intel.com:8080/29818
Reviewed-by: Barthes, FabienX <fabienx.barthes@intel.com>
Tested-by: Barthes, FabienX <fabienx.barthes@intel.com>
Reviewed-by: buildbot <buildbot@intel.com>
Tested-by: buildbot <buildbot@intel.com>
Diffstat (limited to 'parameter')
-rw-r--r-- | parameter/FixedPointParameterType.cpp | 9 | ||||
-rw-r--r-- | parameter/IntegerParameterType.cpp | 6 |
2 files changed, 11 insertions, 4 deletions
diff --git a/parameter/FixedPointParameterType.cpp b/parameter/FixedPointParameterType.cpp index 0c1cc07..a12004d 100644 --- a/parameter/FixedPointParameterType.cpp +++ b/parameter/FixedPointParameterType.cpp @@ -164,9 +164,6 @@ void CFixedPointParameterType::asString(const uint32_t& uiValue, string& strValu // Check consistency assert(isEncodable(iData)); - // Sign extend - signExtend(iData); - // Format ostringstream strStream; @@ -179,10 +176,16 @@ void CFixedPointParameterType::asString(const uint32_t& uiValue, string& strValu strStream << "0x" << hex << uppercase << setw(getSize()*2) << setfill('0') << (uint32_t)iData; } else { + // Sign extend + signExtend(iData); + strStream << iData; } } else { + // Sign extend + signExtend(iData); + // Unjustify iData >>= getSize() * 8 - getUtilSizeInBits(); diff --git a/parameter/IntegerParameterType.cpp b/parameter/IntegerParameterType.cpp index 3455fd5..cdbb7a5 100644 --- a/parameter/IntegerParameterType.cpp +++ b/parameter/IntegerParameterType.cpp @@ -33,6 +33,7 @@ #include <sstream> #include <iomanip> #include "ParameterAccessContext.h" +#include <assert.h> #define base CParameterType @@ -163,6 +164,9 @@ bool CIntegerParameterType::asInteger(const string& strValue, uint32_t& uiValue, void CIntegerParameterType::asString(const uint32_t& uiValue, string& strValue, CParameterAccessContext& parameterAccessContext) const { + // Check consistency + assert(isEncodable(uiValue)); + // Format ostringstream strStream; @@ -170,7 +174,7 @@ void CIntegerParameterType::asString(const uint32_t& uiValue, string& strValue, if (parameterAccessContext.valueSpaceIsRaw() && parameterAccessContext.outputRawFormatIsHex()) { // Hexa display with unecessary bits cleared out - strStream << "0x" << hex << uppercase << setw(getSize()*2) << setfill('0') << makeEncodable(uiValue); + strStream << "0x" << hex << uppercase << setw(getSize()*2) << setfill('0') << uiValue; } else { if (_bSigned) { |