From 385f6240278b38643894158d2eb7001f25fc965b Mon Sep 17 00:00:00 2001 From: Stephan Bergmann Date: Mon, 12 Dec 2016 15:31:35 +0100 Subject: Prevent use of ORowSetValue with sal_Bool as TINYINT sal_Bool and sal_uInt8 are typedefs for the same underlying type, so any use of ORowSetValue with sal_Bool instead of bool, apparently intending to treat the value as a boolean, actually treated it as a TINYINT. (See e.g. recent 7b0c57b2faec875c790051d233d1e9abaed2a3bc "some compilers don't like implicit bool-to-ORowSetValue conversion".) Now that there's no way to create a sal_uInt8 ORowSetValue, getUInt8 and the m_uInt8 union member can probably go away, too. Change-Id: Ia27554f76e7e9edce6410284b578064573e54fd3 Reviewed-on: https://gerrit.libreoffice.org/31909 Tested-by: Jenkins Reviewed-by: Stephan Bergmann --- .../source/commontools/FDatabaseMetaDataResultSet.cxx | 2 +- connectivity/source/commontools/FValue.cxx | 14 -------------- 2 files changed, 1 insertion(+), 15 deletions(-) (limited to 'connectivity/source/commontools') diff --git a/connectivity/source/commontools/FDatabaseMetaDataResultSet.cxx b/connectivity/source/commontools/FDatabaseMetaDataResultSet.cxx index 3e68e4a1c8e8..3d89a552a2cc 100644 --- a/connectivity/source/commontools/FDatabaseMetaDataResultSet.cxx +++ b/connectivity/source/commontools/FDatabaseMetaDataResultSet.cxx @@ -206,7 +206,7 @@ Reference< css::io::XInputStream > SAL_CALL ODatabaseMetaDataResultSet::getChara sal_Bool SAL_CALL ODatabaseMetaDataResultSet::getBoolean( sal_Int32 columnIndex ) throw(SQLException, RuntimeException, std::exception) { - return getValue(columnIndex); + return bool(getValue(columnIndex)); } diff --git a/connectivity/source/commontools/FValue.cxx b/connectivity/source/commontools/FValue.cxx index 974363f8b916..71679b253827 100644 --- a/connectivity/source/commontools/FValue.cxx +++ b/connectivity/source/commontools/FValue.cxx @@ -586,20 +586,6 @@ ORowSetValue& ORowSetValue::operator=(sal_Int8 _rRH) return *this; } - -ORowSetValue& ORowSetValue::operator=(sal_uInt8 _rRH) -{ - if(m_eTypeKind != DataType::TINYINT ) - free(); - - m_aValue.m_uInt8 = _rRH; - m_eTypeKind = DataType::TINYINT; - m_bNull = false; - m_bSigned = false; - return *this; -} - - ORowSetValue& ORowSetValue::operator=(sal_Int16 _rRH) { if(m_eTypeKind != DataType::SMALLINT ) -- cgit