From efdecb54292ecfdeb798de21098e2098df8d003c Mon Sep 17 00:00:00 2001 From: Julien Nabet Date: Fri, 1 Apr 2022 19:40:21 +0200 Subject: tdf#148310: Firebird: copy complete rows, CLOB field, last character lost off by 1 pb. Indeed we got: 610 sal_Int64 nCharWritten = 1; // XClob is indexed from 1 offapi/com/sun/star/sdbc/XClob.idl indeed indicates: 114 The substring begins at position pos and has up 115 to 116 length 117 consecutive characters. 118

119 @param pos 120 the starting position, 1-based 121 @param length 122 the length of the substring 123 @returns 124 the substring 125 @throws SQLException 126 if a database access error occurs. 127 */ 128 string getSubString([in]hyper pos, [in]long length) raises (SQLException); but if the string to copy has length 1, we never enter: while ( nLen > nCharWritten ) => we must change this into: while ( nLen >= nCharWritten ) also number of remaining characters to take into account at each loop must be adapted too: sal_Int64 nCharRemain = nLen - nCharWritten; => would be 0 into: sal_Int64 nCharRemain = nLen - nCharWritten + 1; Change-Id: I7697c8312024818f73a19c39f694cf209f494d71 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132443 Tested-by: Jenkins Reviewed-by: Julien Nabet (cherry picked from commit da81a880df76bebb6d9fbc770c313381a3c33268) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132378 Reviewed-by: Adolfo Jayme Barrientos --- connectivity/source/drivers/firebird/PreparedStatement.cxx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'connectivity') diff --git a/connectivity/source/drivers/firebird/PreparedStatement.cxx b/connectivity/source/drivers/firebird/PreparedStatement.cxx index a3abf2d68cc8..392785b9c816 100644 --- a/connectivity/source/drivers/firebird/PreparedStatement.cxx +++ b/connectivity/source/drivers/firebird/PreparedStatement.cxx @@ -612,9 +612,9 @@ void SAL_CALL OPreparedStatement::setClob(sal_Int32 nParameterIndex, const Refer sal_Int64 nCharWritten = 1; // XClob is indexed from 1 ISC_STATUS aErr = 0; sal_Int64 nLen = xClob->length(); - while ( nLen > nCharWritten ) + while ( nLen >= nCharWritten ) { - sal_Int64 nCharRemain = nLen - nCharWritten; + sal_Int64 nCharRemain = nLen - nCharWritten + 1; constexpr sal_uInt16 MAX_SIZE = SAL_MAX_UINT16 / 4; sal_uInt16 nWriteSize = std::min(nCharRemain, MAX_SIZE); OString sData = OUStringToOString( -- cgit 4 LibreOffice 核心代码仓库文档基金会
summaryrefslogtreecommitdiff
path: root/libcdr
diff options
context:
space:
mode:
authorFridrich Štrba <fridrich.strba@bluewin.ch>2013-01-25 16:56:55 +0100
committerFridrich Štrba <fridrich.strba@bluewin.ch>2013-01-25 16:56:55 +0100
commit302eebf0c88251a1514840a01a73316d898a6709 (patch)
tree714f214d67cee174eabd905dad0ce8a463017211 /libcdr
parent7a50b16839f96a3afdb4be699b3c429c0510881a (diff)
CDR: Actually apply the patch