From a6b01d2049a137932f303cdee554d8d2703d7af7 Mon Sep 17 00:00:00 2001 From: Guillaume Denneulin Date: Fri, 10 Jan 2014 14:58:42 +0100 Subject: Add integer conversion that can take care of sign extension BZ: 163707 When using signed integers of size 8 or 16, the bit of sign needs to be propagated if the API called by the plugin wait for "int" type Add the virtual toInteger function in CTypeElement for each parameter type to take care of conversion to "int". Specialize this function in the class CIntegerParameterType to take care of sign extension. Change-Id: I41183dccbcc21212299d1dde86b3ad4ba8432ce4 Signed-off-by: Guillaume Denneulin --- parameter/IntegerParameterType.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) mode change 100644 => 100755 parameter/IntegerParameterType.cpp (limited to 'parameter/IntegerParameterType.cpp') diff --git a/parameter/IntegerParameterType.cpp b/parameter/IntegerParameterType.cpp old mode 100644 new mode 100755 index 3c3a626..b07194b --- a/parameter/IntegerParameterType.cpp +++ b/parameter/IntegerParameterType.cpp @@ -343,6 +343,16 @@ uint32_t CIntegerParameterType::getDefaultValue() const return _uiMin; } +int CIntegerParameterType::toPlainInteger(int iSizeOptimizedData) const +{ + if (_bSigned) { + + signExtend(iSizeOptimizedData); + } + + return base::toPlainInteger(iSizeOptimizedData); +} + // Convert value provided by the user as a string into an int64 bool CIntegerParameterType::convertValueFromString(const string& strValue, int64_t& iData, CParameterAccessContext& parameterAccessContext) const { -- cgit v1.1