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

Norbert Thiebaud nthiebaud at gmail.com
Sat Jun 28 08:22:57 PDT 2014


 connectivity/source/drivers/odbc/OPreparedStatement.cxx |   11 +++++------
 1 file changed, 5 insertions(+), 6 deletions(-)

New commits:
commit d97990327361fa5ab1fce4726a2c7a4d3b4a7813
Author: Norbert Thiebaud <nthiebaud at gmail.com>
Date:   Sat Jun 28 17:22:11 2014 +0200

    odbc driver: let's not allocate the buffer twice for nothing
    
    Change-Id: If5db845c856a9fb3adf8c4fcb883607e1cb9446e

diff --git a/connectivity/source/drivers/odbc/OPreparedStatement.cxx b/connectivity/source/drivers/odbc/OPreparedStatement.cxx
index c40c665..ec2c172 100644
--- a/connectivity/source/drivers/odbc/OPreparedStatement.cxx
+++ b/connectivity/source/drivers/odbc/OPreparedStatement.cxx
@@ -346,16 +346,15 @@ void OPreparedStatement::setParameter(const sal_Int32 parameterIndex, const sal_
         }
         else
         {
-            std::vector<sal_uInt32> u;
+            pData = allocBindBuf(parameterIndex, _sData.getLength() * 4);
+            sal_uInt32* pCursor = (sal_uInt32*)pData;
+            nCharLen = 0;
             for (sal_Int32 i = 0; i != _sData.getLength();)
             {
-                u.push_back(_sData.iterateCodePoints(&i));
+                *pCursor++ = _sData.iterateCodePoints(&i);
+                nCharLen += 1;
             }
-            nCharLen = u.size();
             nByteLen = 4 * nCharLen;
-            pData = allocBindBuf(parameterIndex, nByteLen);
-            if (!u.empty())
-                memcpy(pData, &u[0], nByteLen);
         }
     }
     else


More information about the Libreoffice-commits mailing list