summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2022-02-07 12:17:03 +0000
committerCaolán McNamara <caolanm@redhat.com>2022-02-07 18:04:57 +0100
commit07950568c85ff209c34d2ce962f6950c8d27ca90 (patch)
treeb05efe02e4291ca498556a925af2c3a17d546198
parentc67abb385fbc1d601aee2fc693f440bbdfd26760 (diff)
fix big-endian hsql to firebird migrationco-22.05-branch-point
Change-Id: I047d2366ad80eca701924cb0f66b6b1bcfdcac5b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/129565 Reviewed-by: Michael Stahl <michael.stahl@allotropia.de> Tested-by: Jenkins
-rw-r--r--connectivity/source/drivers/firebird/PreparedStatement.cxx6
1 files changed, 4 insertions, 2 deletions
diff --git a/connectivity/source/drivers/firebird/PreparedStatement.cxx b/connectivity/source/drivers/firebird/PreparedStatement.cxx
index 04e65b9c5e95..a3abf2d68cc8 100644
--- a/connectivity/source/drivers/firebird/PreparedStatement.cxx
+++ b/connectivity/source/drivers/firebird/PreparedStatement.cxx
@@ -209,7 +209,8 @@ void SAL_CALL OPreparedStatement::setString(sal_Int32 nParameterIndex,
{
str = str.copy(0, max_varchar_len);
}
- const auto nLength = str.getLength();
+ const sal_uInt16 nLength = str.getLength();
+ static_assert(sizeof(nLength) == 2, "must match dest memcpy len");
memcpy(pVar->sqldata, &nLength, 2);
// Actual data
memcpy(pVar->sqldata + 2, str.getStr(), str.getLength());
@@ -910,7 +911,7 @@ void SAL_CALL OPreparedStatement::setBytes(sal_Int32 nParameterIndex,
{
xBytesCopy.realloc( nMaxSize );
}
- const auto nSize = xBytesCopy.getLength();
+ const sal_uInt16 nSize = xBytesCopy.getLength();
// 8000 corresponds to value from lcl_addDefaultParameters
// in dbaccess/source/filter/hsqldb/createparser.cxx
if (nSize > 8000)
@@ -918,6 +919,7 @@ void SAL_CALL OPreparedStatement::setBytes(sal_Int32 nParameterIndex,
free(pVar->sqldata);
pVar->sqldata = static_cast<char *>(malloc(sizeof(char) * nSize + 2));
}
+ static_assert(sizeof(nSize) == 2, "must match dest memcpy len");
// First 2 bytes indicate string size
memcpy(pVar->sqldata, &nSize, 2);
// Actual data