summaryrefslogtreecommitdiff
path: root/connectivity
diff options
context:
space:
mode:
Diffstat (limited to 'connectivity')
-rw-r--r--connectivity/source/drivers/postgresql/pq_baseresultset.cxx2
-rw-r--r--connectivity/source/drivers/postgresql/pq_connection.cxx9
-rw-r--r--connectivity/source/drivers/postgresql/pq_preparedstatement.cxx3
-rw-r--r--connectivity/source/drivers/postgresql/pq_tools.hxx8
-rw-r--r--connectivity/source/drivers/postgresql/pq_updateableresultset.cxx2
5 files changed, 16 insertions, 8 deletions
diff --git a/connectivity/source/drivers/postgresql/pq_baseresultset.cxx b/connectivity/source/drivers/postgresql/pq_baseresultset.cxx
index 8fc7140e4817..9ff5e01e098a 100644
--- a/connectivity/source/drivers/postgresql/pq_baseresultset.cxx
+++ b/connectivity/source/drivers/postgresql/pq_baseresultset.cxx
@@ -456,7 +456,7 @@ Sequence< sal_Int8 > BaseResultSet::getBytes( sal_Int32 columnIndex )
char * res = reinterpret_cast<char*>(PQunescapeBytea( reinterpret_cast<unsigned char const *>(val.getStr()), &length));
ret = Sequence< sal_Int8 > ( reinterpret_cast<sal_Int8*>(res), length );
if( res )
- free( res );
+ PQfreemem( res );
}
return ret;
}
diff --git a/connectivity/source/drivers/postgresql/pq_connection.cxx b/connectivity/source/drivers/postgresql/pq_connection.cxx
index 66c30c893aed..9a51f0cd2833 100644
--- a/connectivity/source/drivers/postgresql/pq_connection.cxx
+++ b/connectivity/source/drivers/postgresql/pq_connection.cxx
@@ -42,6 +42,7 @@
#include "pq_connection.hxx"
#include "pq_statement.hxx"
+#include "pq_tools.hxx"
#include "pq_preparedstatement.hxx"
#include "pq_databasemetadata.hxx"
#include "pq_xtables.hxx"
@@ -216,7 +217,7 @@ Reference< XPreparedStatement > Connection::prepareStatement( const OUString& sq
MutexGuard guard( m_xMutex->GetMutex() );
checkClosed();
- OString byteSql = OUStringToOString( sql, ConnectionSettings::encoding );
+ OString byteSql = rtl::OUStringToOString( sql, ConnectionSettings::encoding );
PreparedStatement *stmt = new PreparedStatement( m_xMutex, this, &m_settings, byteSql );
Reference< XPreparedStatement > ret = stmt;
@@ -414,7 +415,7 @@ static void properties2arrays( const Sequence< PropertyValue > & args,
{
OUString value;
tc->convertTo( prop.Value, cppu::UnoType<decltype(value)>::get() ) >>= value;
- char *v = strdup(OUStringToOString(value, enc).getStr());
+ char *v = strdup(rtl::OUStringToOString(value, enc).getStr());
values.push_back ( v );
}
else
@@ -460,7 +461,7 @@ void Connection::initialize( const Sequence< Any >& aArguments )
nColon = url.indexOf( ':' , 1+ nColon );
if( nColon != -1 )
{
- o = OUStringToOString( url.getStr()+nColon+1, ConnectionSettings::encoding );
+ o = rtl::OUStringToOString( url.getStr()+nColon+1, ConnectionSettings::encoding );
}
}
{
@@ -477,7 +478,7 @@ void Connection::initialize( const Sequence< Any >& aArguments )
if ( err != nullptr)
{
errorMessage = OUString( err, strlen(err), ConnectionSettings::encoding );
- free(err);
+ PQfreemem(err);
}
else
errorMessage = "#no error message#";
diff --git a/connectivity/source/drivers/postgresql/pq_preparedstatement.cxx b/connectivity/source/drivers/postgresql/pq_preparedstatement.cxx
index 2e352320353f..069cdfa13e35 100644
--- a/connectivity/source/drivers/postgresql/pq_preparedstatement.cxx
+++ b/connectivity/source/drivers/postgresql/pq_preparedstatement.cxx
@@ -479,8 +479,7 @@ void PreparedStatement::setBytes(
checkClosed();
checkColumnIndex( parameterIndex );
size_t len;
- struct Free { void operator ()(void * p) const { free(p); } };
- std::unique_ptr<unsigned char, Free> escapedString(
+ const std::unique_ptr<unsigned char, deleter_from_fn<PQfreemem>> escapedString(
PQescapeBytea( reinterpret_cast<unsigned char const *>(x.getConstArray()), x.getLength(), &len));
if( ! escapedString )
{
diff --git a/connectivity/source/drivers/postgresql/pq_tools.hxx b/connectivity/source/drivers/postgresql/pq_tools.hxx
index af751f8e633b..7fbdb260d30b 100644
--- a/connectivity/source/drivers/postgresql/pq_tools.hxx
+++ b/connectivity/source/drivers/postgresql/pq_tools.hxx
@@ -49,6 +49,14 @@
#include "pq_connection.hxx"
#include <vector>
+namespace
+{
+// helper to create one-time deleters
+template <auto fn>
+using deleter_from_fn = std::integral_constant<decltype(fn), fn>;
+
+}
+
namespace pq_sdbc_driver
{
bool isWhitespace( sal_Unicode c );
diff --git a/connectivity/source/drivers/postgresql/pq_updateableresultset.cxx b/connectivity/source/drivers/postgresql/pq_updateableresultset.cxx
index 880adc647c7e..d8780e76c563 100644
--- a/connectivity/source/drivers/postgresql/pq_updateableresultset.cxx
+++ b/connectivity/source/drivers/postgresql/pq_updateableresultset.cxx
@@ -481,7 +481,7 @@ void UpdateableResultSet::updateBytes( sal_Int32 columnIndex, const css::uno::Se
m_updateableField[columnIndex-1].value <<=
OUString( reinterpret_cast<char*>(escapedString), len, RTL_TEXTENCODING_ASCII_US );
- free( escapedString );
+ PQfreemem( escapedString );
}
void UpdateableResultSet::updateDate( sal_Int32 columnIndex, const css::util::Date& x )