[Libreoffice-commits] core.git: 3 commits - connectivity/source

Lionel Elie Mamane lionel at mamane.lu
Wed Jan 29 21:14:58 PST 2014


 connectivity/source/drivers/firebird/PreparedStatement.cxx |    6 ++++--
 connectivity/source/drivers/firebird/ResultSet.cxx         |    2 +-
 2 files changed, 5 insertions(+), 3 deletions(-)

New commits:
commit a904aa609dddb80a44cf34a5e4299efe0dc2c49f
Author: Lionel Elie Mamane <lionel at mamane.lu>
Date:   Thu Jan 30 06:10:33 2014 +0100

    firebird driver: do not assume sizeof(short) == 2
    
    Change-Id: I4b4e6caa34c23baa75a87cf1750dce3ca3ae8aed

diff --git a/connectivity/source/drivers/firebird/ResultSet.cxx b/connectivity/source/drivers/firebird/ResultSet.cxx
index fa148bb..a89e460 100644
--- a/connectivity/source/drivers/firebird/ResultSet.cxx
+++ b/connectivity/source/drivers/firebird/ResultSet.cxx
@@ -507,7 +507,7 @@ OUString OResultSet::retrieveValue(const sal_Int32 nColumnIndex, const ISC_SHORT
     {
         // First 2 bytes are a short containing the length of the string
         // No idea if sqllen is still valid here?
-        short aLength = *((short*) m_pSqlda->sqlvar[nColumnIndex-1].sqldata);
+        sal_uInt16 aLength = *((sal_uInt16*) m_pSqlda->sqlvar[nColumnIndex-1].sqldata);
         return OUString(m_pSqlda->sqlvar[nColumnIndex-1].sqldata + 2,
                         aLength,
                         RTL_TEXTENCODING_UTF8);
commit b065cddb0ab014611f9f7f48b26295cd1e3e1046
Author: Lionel Elie Mamane <lionel at mamane.lu>
Date:   Thu Jan 30 06:09:29 2014 +0100

    TODO comment
    
    Change-Id: I3df4810534d64bb7f546cc18124edb6ebf3a147d

diff --git a/connectivity/source/drivers/firebird/PreparedStatement.cxx b/connectivity/source/drivers/firebird/PreparedStatement.cxx
index 1be05f7..cd53fcb 100644
--- a/connectivity/source/drivers/firebird/PreparedStatement.cxx
+++ b/connectivity/source/drivers/firebird/PreparedStatement.cxx
@@ -492,6 +492,7 @@ void SAL_CALL OPreparedStatement::setBlob(sal_Int32 nParameterIndex,
     openBlobForWriting(aBlobHandle, aBlobId);
 
     // Max segment size is 2^16 == SAL_MAX_UINT16
+    // LEM TODO: SAL_MAX_UINT16 is 2^16-1; this mixup is probably innocuous; to be checked
     sal_uInt64 nDataWritten = 0;
     ISC_STATUS aErr = 0;
     while (xBlob->length() - nDataWritten > 0)
commit 5e951de92544bceb19e03244f4ffef19c62c4d90
Author: Lionel Elie Mamane <lionel at mamane.lu>
Date:   Thu Jan 30 06:07:56 2014 +0100

    fdo#74160 firebird XParameters::setString truncate to 65535 characters
    
    as opposed to 17 characters
    
    Change-Id: I65c82243946c22eee0f033977b1cd0c5a84d226b

diff --git a/connectivity/source/drivers/firebird/PreparedStatement.cxx b/connectivity/source/drivers/firebird/PreparedStatement.cxx
index 7c7b3d3..1be05f7 100644
--- a/connectivity/source/drivers/firebird/PreparedStatement.cxx
+++ b/connectivity/source/drivers/firebird/PreparedStatement.cxx
@@ -208,10 +208,11 @@ void SAL_CALL OPreparedStatement::setString(sal_Int32 nParameterIndex,
     switch (dtype) {
     case SQL_VARYING:
     {
+        const sal_Int32 max_varchar_len = 0xFFFF;
         // First 2 bytes indicate string size
-        if (str.getLength() > (2^16)-1)
+        if (str.getLength() > max_varchar_len)
         {
-            str = str.copy(0, (2^16)-1);
+            str = str.copy(0, max_varchar_len);
         }
         const short nLength = str.getLength();
         memcpy(pVar->sqldata, &nLength, 2);


More information about the Libreoffice-commits mailing list