diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2016-12-12 15:31:35 +0100 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2016-12-12 18:02:57 +0000 |
commit | 385f6240278b38643894158d2eb7001f25fc965b (patch) | |
tree | f971df1481b714bd2f95c06bef997cf49e02243d /dbaccess | |
parent | 8845ccc1d46fe09eae7b37367a6fbc774fd0b7a4 (diff) |
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 <ci@libreoffice.org>
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
Diffstat (limited to 'dbaccess')
-rw-r--r-- | dbaccess/source/core/api/BookmarkSet.cxx | 2 | ||||
-rw-r--r-- | dbaccess/source/core/api/PrivateRow.cxx | 2 | ||||
-rw-r--r-- | dbaccess/source/core/api/RowSetBase.cxx | 2 |
3 files changed, 3 insertions, 3 deletions
diff --git a/dbaccess/source/core/api/BookmarkSet.cxx b/dbaccess/source/core/api/BookmarkSet.cxx index 57e685b5519e..d37b285d6fe3 100644 --- a/dbaccess/source/core/api/BookmarkSet.cxx +++ b/dbaccess/source/core/api/BookmarkSet.cxx @@ -153,7 +153,7 @@ void OBookmarkSet::updateColumn(sal_Int32 nPos, const Reference< XRowUpdate >& _ break; case DataType::BIT: case DataType::BOOLEAN: - _xParameter->updateBoolean(nPos,_rValue); + _xParameter->updateBoolean(nPos,bool(_rValue)); break; case DataType::TINYINT: if ( _rValue.isSigned() ) diff --git a/dbaccess/source/core/api/PrivateRow.cxx b/dbaccess/source/core/api/PrivateRow.cxx index cf44a2a3d153..c1b69fb4ffdf 100644 --- a/dbaccess/source/core/api/PrivateRow.cxx +++ b/dbaccess/source/core/api/PrivateRow.cxx @@ -42,7 +42,7 @@ sal_Bool SAL_CALL OPrivateRow::wasNull( ) throw (SQLException, RuntimeException sal_Bool SAL_CALL OPrivateRow::getBoolean( ::sal_Int32 columnIndex ) throw (SQLException, RuntimeException, std::exception) { m_nPos = columnIndex; - return m_aRow[m_nPos]; + return bool(m_aRow[m_nPos]); } ::sal_Int8 SAL_CALL OPrivateRow::getByte( ::sal_Int32 columnIndex ) throw (SQLException, RuntimeException, std::exception) { diff --git a/dbaccess/source/core/api/RowSetBase.cxx b/dbaccess/source/core/api/RowSetBase.cxx index 74a984ac2756..539557243bb0 100644 --- a/dbaccess/source/core/api/RowSetBase.cxx +++ b/dbaccess/source/core/api/RowSetBase.cxx @@ -256,7 +256,7 @@ OUString SAL_CALL ORowSetBase::getString( sal_Int32 columnIndex ) throw(SQLExcep sal_Bool SAL_CALL ORowSetBase::getBoolean( sal_Int32 columnIndex ) throw(SQLException, RuntimeException, std::exception) { ::osl::MutexGuard aGuard( *m_pMutex ); - return getValue(columnIndex); + return bool(getValue(columnIndex)); } sal_Int8 SAL_CALL ORowSetBase::getByte( sal_Int32 columnIndex ) throw(SQLException, RuntimeException, std::exception) |