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 /include | |
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 'include')
-rw-r--r-- | include/connectivity/FValue.hxx | 15 |
1 files changed, 3 insertions, 12 deletions
diff --git a/include/connectivity/FValue.hxx b/include/connectivity/FValue.hxx index aeac0c105371..93b7ec28dd7c 100644 --- a/include/connectivity/FValue.hxx +++ b/include/connectivity/FValue.hxx @@ -153,16 +153,6 @@ namespace connectivity operator=(_rRH); } - ORowSetValue(sal_uInt8 _rRH) - :m_eTypeKind(css::sdbc::DataType::TINYINT) - ,m_bNull(true) - ,m_bBound(true) - ,m_bModified(false) - ,m_bSigned(false) - { - m_aValue.m_pString = nullptr; - operator=(_rRH); - } ORowSetValue(sal_Int16 _rRH) :m_eTypeKind(css::sdbc::DataType::SMALLINT) ,m_bNull(true) @@ -234,6 +224,7 @@ namespace connectivity m_aValue.m_pString = nullptr; operator=(_rRH); } + ORowSetValue(sal_Bool) = delete; // aka sal_uInt8 ORowSetValue(const css::util::Date& _rRH) :m_eTypeKind(css::sdbc::DataType::DATE) @@ -301,9 +292,9 @@ namespace connectivity // simple types ORowSetValue& operator=(bool _rRH); + void operator =(sal_Bool) = delete; // aka sal_uInt8 ORowSetValue& operator=(sal_Int8 _rRH); - ORowSetValue& operator=(sal_uInt8 _rRH); ORowSetValue& operator=(sal_Int16 _rRH); ORowSetValue& operator=(sal_uInt16 _rRH); @@ -329,8 +320,8 @@ namespace connectivity ORowSetValue& operator=(const css::uno::Any& _rAny); operator bool() const { return !isNull() && getBool(); } + operator sal_Bool() const = delete; // aka sal_uInt8 operator sal_Int8() const { return isNull() ? static_cast<sal_Int8>(0) : getInt8(); } - operator sal_uInt8() const { return isNull() ? static_cast<sal_uInt8>(0) : getUInt8(); } operator sal_Int16() const { return isNull() ? static_cast<sal_Int16>(0) : getInt16(); } operator sal_uInt16() const { return isNull() ? static_cast<sal_uInt16>(0) : getUInt16(); } |