diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2015-11-10 10:12:07 +0100 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2015-11-10 10:31:20 +0100 |
commit | c0bd59c15b4a6e8523693c8a354456b9fadb8832 (patch) | |
tree | 67a35c16019355b6eac3faff74ce63d44eddfa96 /connectivity/source/drivers/postgresql | |
parent | 047239d5ca229bb8ad85a2d9fcd2ae7b6f35b976 (diff) |
loplugin:nullptr (automatic rewrite)
Change-Id: Iefeeb51c2b101c097a8d77a4625f84baf1f2da44
Diffstat (limited to 'connectivity/source/drivers/postgresql')
15 files changed, 52 insertions, 52 deletions
diff --git a/connectivity/source/drivers/postgresql/pq_baseresultset.cxx b/connectivity/source/drivers/postgresql/pq_baseresultset.cxx index db11fc9d7126..dc4e13371dff 100644 --- a/connectivity/source/drivers/postgresql/pq_baseresultset.cxx +++ b/connectivity/source/drivers/postgresql/pq_baseresultset.cxx @@ -554,13 +554,13 @@ Sequence< sal_Int8 > BaseResultSet::getBytes( sal_Int32 columnIndex ) Reference< ::com::sun::star::io::XInputStream > BaseResultSet::getBinaryStream( sal_Int32 /* columnIndex */ ) throw (SQLException, RuntimeException, std::exception) { - return 0; + return nullptr; } Reference< ::com::sun::star::io::XInputStream > BaseResultSet::getCharacterStream( sal_Int32 /* columnIndex */ ) throw (SQLException, RuntimeException, std::exception) { - return 0; + return nullptr; } Any BaseResultSet::getObject( diff --git a/connectivity/source/drivers/postgresql/pq_connection.cxx b/connectivity/source/drivers/postgresql/pq_connection.cxx index 9df93ea8c05f..8f59ea8a32fe 100644 --- a/connectivity/source/drivers/postgresql/pq_connection.cxx +++ b/connectivity/source/drivers/postgresql/pq_connection.cxx @@ -126,7 +126,7 @@ public: { m_conn->removeFromWeakMap(m_id); m_conn->release(); - m_conn = 0; + m_conn = nullptr; } } }; @@ -187,7 +187,7 @@ Connection::Connection( m_settings.logFile = fopen( "sdbc-pqsql.log", "a" ); if( m_settings.logFile ) { - setvbuf( m_settings.logFile, 0, _IONBF, 0 ); + setvbuf( m_settings.logFile, nullptr, _IONBF, 0 ); log( &m_settings, m_settings.loglevel , "set this loglevel" ); } else @@ -203,12 +203,12 @@ Connection::~Connection() if( m_settings.pConnection ) { PQfinish( m_settings.pConnection ); - m_settings.pConnection = 0; + m_settings.pConnection = nullptr; } if( m_settings.logFile ) { fclose( m_settings.logFile ); - m_settings.logFile = 0; + m_settings.logFile = nullptr; } } typedef ::std::list< ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XCloseable > > CloseableList; @@ -226,7 +226,7 @@ void Connection::close() throw ( SQLException, RuntimeException, std::exception { log( &m_settings, LogLevel::INFO, "closing connection" ); PQfinish( m_settings.pConnection ); - m_settings.pConnection = 0; + m_settings.pConnection = nullptr; } lstDispose.push_back( Reference< XComponent > ( m_settings.users, UNO_QUERY ) ); @@ -277,7 +277,7 @@ Reference< XStatement > Connection::createStatement() throw (SQLException, Runti Statement *stmt = new Statement( m_refMutex, this , &m_settings ); Reference< XStatement > ret( stmt ); ::rtl::ByteSequence id( 16 ); - rtl_createUuid( reinterpret_cast<sal_uInt8*>(id.getArray()), 0, sal_False ); + rtl_createUuid( reinterpret_cast<sal_uInt8*>(id.getArray()), nullptr, sal_False ); m_myStatements[ id ] = Reference< XCloseable > ( stmt ); stmt->queryAdapter()->addReference( new ClosableReference( id, this ) ); return ret; @@ -294,7 +294,7 @@ Reference< XPreparedStatement > Connection::prepareStatement( const OUString& sq Reference< XPreparedStatement > ret = stmt; ::rtl::ByteSequence id( 16 ); - rtl_createUuid( reinterpret_cast<sal_uInt8*>(id.getArray()), 0, sal_False ); + rtl_createUuid( reinterpret_cast<sal_uInt8*>(id.getArray()), nullptr, sal_False ); m_myStatements[ id ] = Reference< XCloseable > ( stmt ); stmt->queryAdapter()->addReference( new ClosableReference( id, this ) ); return ret; @@ -338,7 +338,7 @@ void Connection::rollback() throw (SQLException, RuntimeException, std::exceptio sal_Bool Connection::isClosed() throw (SQLException, RuntimeException, std::exception) { - return m_settings.pConnection == 0; + return m_settings.pConnection == nullptr; } Reference< XDatabaseMetaData > Connection::getMetaData() @@ -372,7 +372,7 @@ void Connection::setCatalog( const OUString& ) OUString Connection::getCatalog() throw (SQLException, RuntimeException, std::exception) { MutexGuard guard( m_refMutex->mutex ); - if( m_settings.pConnection == 0 ) + if( m_settings.pConnection == nullptr ) { throw SQLException( "pq_connection: connection is closed", *this, OUString(), 1, Any() ); @@ -547,10 +547,10 @@ void Connection::initialize( const Sequence< Any >& aArguments ) { char *err; std::shared_ptr<PQconninfoOption> oOpts(PQconninfoParse(o.getStr(), &err), PQconninfoFree); - if ( oOpts.get() == NULL ) + if ( oOpts.get() == nullptr ) { OUString errorMessage; - if ( err != NULL) + if ( err != nullptr) { errorMessage = OUString( err, strlen(err), m_settings.encoding ); free(err); @@ -567,9 +567,9 @@ void Connection::initialize( const Sequence< Any >& aArguments ) throw SQLException( buf.makeStringAndClear(), *this, OUString("HY092"), 5, Any() ); } - for ( PQconninfoOption * opt = oOpts.get(); opt->keyword != NULL; ++opt) + for ( PQconninfoOption * opt = oOpts.get(); opt->keyword != nullptr; ++opt) { - if ( opt->val != NULL ) + if ( opt->val != nullptr ) { keywords.push_back(strdup(opt->keyword)); values.push_back(strdup(opt->val)); @@ -577,8 +577,8 @@ void Connection::initialize( const Sequence< Any >& aArguments ) } } properties2arrays( args , tc, m_settings.encoding, keywords, values ); - keywords.push_back(NULL, SAL_NO_ACQUIRE); - values.push_back(NULL, SAL_NO_ACQUIRE); + keywords.push_back(nullptr, SAL_NO_ACQUIRE); + values.push_back(nullptr, SAL_NO_ACQUIRE); m_settings.pConnection = PQconnectdbParams( keywords.c_array(), values.c_array(), 0 ); } @@ -595,7 +595,7 @@ void Connection::initialize( const Sequence< Any >& aArguments ) buf.append( "'\n" ); buf.append( errorMessage ); PQfinish( m_settings.pConnection ); - m_settings.pConnection = 0; + m_settings.pConnection = nullptr; throw SQLException( buf.makeStringAndClear(), *this, errorMessage, CONNECTION_BAD, Any() ); } PQsetClientEncoding( m_settings.pConnection, "UNICODE" ); @@ -700,7 +700,7 @@ void log( ConnectionSettings *settings, sal_Int32 level, const char *str ) { static const char *strLevel[] = { "NONE", "ERROR", "SQL", "INFO", "DATA" }; - time_t t = ::time( 0 ); + time_t t = ::time( nullptr ); char *pString; #ifdef SAL_W32 pString = asctime( localtime( &t ) ); @@ -734,9 +734,9 @@ static const struct cppu::ImplementationEntry g_entries[] = { pq_sdbc_driver::ConnectionCreateInstance, pq_sdbc_driver::ConnectionGetImplementationName, pq_sdbc_driver::ConnectionGetSupportedServiceNames, cppu::createSingleComponentFactory, - 0 , 0 + nullptr , 0 }, - { 0, 0, 0, 0, 0, 0 } + { nullptr, nullptr, nullptr, nullptr, nullptr, 0 } }; diff --git a/connectivity/source/drivers/postgresql/pq_connection.hxx b/connectivity/source/drivers/postgresql/pq_connection.hxx index e4d7d2c0c294..ef1c7e24966f 100644 --- a/connectivity/source/drivers/postgresql/pq_connection.hxx +++ b/connectivity/source/drivers/postgresql/pq_connection.hxx @@ -102,13 +102,13 @@ struct ConnectionSettings { ConnectionSettings() : encoding( RTL_TEXTENCODING_UTF8), - pConnection(0), + pConnection(nullptr), maxNameLen(0), maxIndexKeys(0), - pTablesImpl(0), - pViewsImpl(0), + pTablesImpl(nullptr), + pViewsImpl(nullptr), showSystemColumns( false ), - logFile( 0 ), + logFile( nullptr ), loglevel( LogLevel::INFO ) {} rtl_TextEncoding encoding; diff --git a/connectivity/source/drivers/postgresql/pq_driver.cxx b/connectivity/source/drivers/postgresql/pq_driver.cxx index d67d14a1777b..801c2f132e0c 100644 --- a/connectivity/source/drivers/postgresql/pq_driver.cxx +++ b/connectivity/source/drivers/postgresql/pq_driver.cxx @@ -285,10 +285,10 @@ static const struct cppu::ImplementationEntry g_entries[] = { { pq_sdbc_driver::DriverCreateInstance, pq_sdbc_driver::DriverGetImplementationName, - pq_sdbc_driver::DriverGetSupportedServiceNames, 0, - 0 , 0 + pq_sdbc_driver::DriverGetSupportedServiceNames, nullptr, + nullptr , 0 }, - { 0, 0, 0, 0, 0, 0 } + { nullptr, nullptr, nullptr, nullptr, nullptr, 0 } }; extern "C" @@ -300,7 +300,7 @@ SAL_DLLPUBLIC_EXPORT void * SAL_CALL postgresql_sdbc_component_getFactory( // need to extract the defaultcontext, because the way, sdbc // bypasses the servicemanager, does not allow to use the // XSingleComponentFactory interface ... - void * pRet = 0; + void * pRet = nullptr; Reference< XSingleComponentFactory > xFactory; Reference< com::sun::star::lang::XMultiServiceFactory > xSmgr( static_cast< XInterface * >(pServiceManager), diff --git a/connectivity/source/drivers/postgresql/pq_preparedstatement.cxx b/connectivity/source/drivers/postgresql/pq_preparedstatement.cxx index 6e624ac1316f..27fe0bd1a392 100644 --- a/connectivity/source/drivers/postgresql/pq_preparedstatement.cxx +++ b/connectivity/source/drivers/postgresql/pq_preparedstatement.cxx @@ -297,7 +297,7 @@ void PreparedStatement::close( ) throw (SQLException, RuntimeException, std::ex Reference< XCloseable > resultSet; { MutexGuard guard( m_refMutex->mutex ); - m_pSettings = 0; + m_pSettings = nullptr; r = m_connection; m_connection.clear(); @@ -725,7 +725,7 @@ void PreparedStatement::setArray( const Reference< XArray >& x ) throw (SQLException, RuntimeException, std::exception) { - setString( parameterIndex, array2String( x->getArray( 0 ) ) ); + setString( parameterIndex, array2String( x->getArray( nullptr ) ) ); } void PreparedStatement::clearParameters( ) diff --git a/connectivity/source/drivers/postgresql/pq_preparedstatement.hxx b/connectivity/source/drivers/postgresql/pq_preparedstatement.hxx index 769215fa4e33..749e63591e5c 100644 --- a/connectivity/source/drivers/postgresql/pq_preparedstatement.hxx +++ b/connectivity/source/drivers/postgresql/pq_preparedstatement.hxx @@ -250,7 +250,7 @@ public: // OComponentHelper private: void checkColumnIndex( sal_Int32 parameterIndex ); void checkClosed() throw (com::sun::star::sdbc::SQLException, com::sun::star::uno::RuntimeException); - void raiseSQLException( const char * errorMsg, const char *errorType = 0 ) + void raiseSQLException( const char * errorMsg, const char *errorType = nullptr ) throw ( com::sun::star::sdbc::SQLException ); // PGresult *pgExecute( OString *pQuery ); }; diff --git a/connectivity/source/drivers/postgresql/pq_resultset.cxx b/connectivity/source/drivers/postgresql/pq_resultset.cxx index f17cef835516..d282cb44fab3 100644 --- a/connectivity/source/drivers/postgresql/pq_resultset.cxx +++ b/connectivity/source/drivers/postgresql/pq_resultset.cxx @@ -139,7 +139,7 @@ void ResultSet::close( ) throw (SQLException, RuntimeException, std::exception) if( m_result ) { PQclear(m_result ); - m_result = 0; + m_result = nullptr; m_row = -1; } owner = m_owner; diff --git a/connectivity/source/drivers/postgresql/pq_sequenceresultset.hxx b/connectivity/source/drivers/postgresql/pq_sequenceresultset.hxx index d15680063cc8..564471baf78b 100644 --- a/connectivity/source/drivers/postgresql/pq_sequenceresultset.hxx +++ b/connectivity/source/drivers/postgresql/pq_sequenceresultset.hxx @@ -76,7 +76,7 @@ public: const com::sun::star::uno::Sequence< OUString > &colNames, const com::sun::star::uno::Sequence< com::sun::star::uno::Sequence< com::sun::star::uno::Any > > &data, const com::sun::star::uno::Reference< com::sun::star::script::XTypeConverter > &tc, - const ColumnMetaDataVector *pVec = 0); + const ColumnMetaDataVector *pVec = nullptr); virtual ~SequenceResultSet(); public: // XCloseable diff --git a/connectivity/source/drivers/postgresql/pq_statement.cxx b/connectivity/source/drivers/postgresql/pq_statement.cxx index 1347e2a3761b..57d26df07f97 100644 --- a/connectivity/source/drivers/postgresql/pq_statement.cxx +++ b/connectivity/source/drivers/postgresql/pq_statement.cxx @@ -226,7 +226,7 @@ void Statement::close( ) throw (SQLException, RuntimeException, std::exception) Reference< XCloseable > resultSet; { MutexGuard guard( m_refMutex->mutex ); - m_pSettings = 0; + m_pSettings = nullptr; r = m_connection; m_connection.clear(); @@ -293,7 +293,7 @@ static void raiseSQLException( const Reference< XInterface> & owner, const OString & sql, const char * errorMsg, - const char *errorType = 0 ) + const char *errorType = nullptr ) throw( SQLException ) { OUStringBuffer buf(128); diff --git a/connectivity/source/drivers/postgresql/pq_statement.hxx b/connectivity/source/drivers/postgresql/pq_statement.hxx index 9453caf16ca6..0ab2e4b5a843 100644 --- a/connectivity/source/drivers/postgresql/pq_statement.hxx +++ b/connectivity/source/drivers/postgresql/pq_statement.hxx @@ -176,7 +176,7 @@ public: // XResultSetMetaDataSupplier (is required by framework (see private: void checkClosed() throw (com::sun::star::sdbc::SQLException, com::sun::star::uno::RuntimeException); - void raiseSQLException( const OUString & sql, const char * errorMsg, const char *errorType = 0 ) + void raiseSQLException( const OUString & sql, const char * errorMsg, const char *errorType = nullptr ) throw ( com::sun::star::sdbc::SQLException ); }; diff --git a/connectivity/source/drivers/postgresql/pq_statics.cxx b/connectivity/source/drivers/postgresql/pq_statics.cxx index 2d5b9de064c2..98bf332c5997 100644 --- a/connectivity/source/drivers/postgresql/pq_statics.cxx +++ b/connectivity/source/drivers/postgresql/pq_statics.cxx @@ -541,7 +541,7 @@ Statics & getStatics() static const char *tablePrivilegesNames[] = { "TABLE_CAT", "TABLE_SCHEM", "TABLE_NAME", "GRANTOR", "GRANTEE", "PRIVILEGE", - "IS_GRANTABLE" , 0 + "IS_GRANTABLE" , nullptr }; statics.tablePrivilegesNames = createStringSequence( tablePrivilegesNames ); @@ -552,7 +552,7 @@ Statics & getStatics() "DATA_TYPE", "TYPE_NAME", "COLUMN_SIZE", "BUFFER_LENGTH", "DECIMAL_DIGITS", "NUM_PREC_RADIX", "NULLABLE", "REMARKS", "COLUMN_DEF", "SQL_DATA_TYPE", "SQL_DATETIME_SUB", "CHAR_OCTET_LENGTH", - "ORDINAL_POSITION", "IS_NULLABLE", 0 + "ORDINAL_POSITION", "IS_NULLABLE", nullptr }; statics.columnRowNames = createStringSequence( columnNames ); @@ -564,7 +564,7 @@ Statics & getStatics() "SEARCHABLE", "UNSIGNED_ATTRIBUTE", "FIXED_PREC_SCALE", "AUTO_INCREMENT", "LOCAL_TYPE_NAME", "MINIMUM_SCALE", "MAXIMUM_SCALE", "SQL_DATA_TYPE", "SQL_DATETIME_SUB", - "NUM_PREC_RADIX", 0 + "NUM_PREC_RADIX", nullptr }; statics.typeinfoColumnNames = createStringSequence( typeinfoColumnNames ); @@ -573,7 +573,7 @@ Statics & getStatics() "TABLE_CAT", "TABLE_SCHEM", "TABLE_NAME", "NON_UNIQUE", "INDEX_QUALIFIER", "INDEX_NAME", "TYPE", "ORDINAL_POSITION", "COLUMN_NAME", - "ASC_OR_DESC", "CARDINALITY", "PAGES", "FILTER_CONDITION",0 + "ASC_OR_DESC", "CARDINALITY", "PAGES", "FILTER_CONDITION",nullptr }; statics.indexinfoColumnNames = createStringSequence( indexinfoColumnNames ); @@ -593,12 +593,12 @@ Statics & getStatics() "FK_NAME" , "PK_NAME" , "DEFERRABILITY" , - 0 + nullptr }; statics.importedKeysColumnNames = createStringSequence( importedKeysColumnNames ); - static const char * resultSetArrayColumnNames[] = { "INDEX" , "VALUE", 0 }; + static const char * resultSetArrayColumnNames[] = { "INDEX" , "VALUE", nullptr }; statics.resultSetArrayColumnNames = createStringSequence( resultSetArrayColumnNames ); @@ -666,7 +666,7 @@ Statics & getStatics() // { "_date", com::sun::star::sdbc::DataType::ARRAY }, // switch to date later // { "_time", com::sun::star::sdbc::DataType::ARRAY }, // switch to time later - { 0, 0 } + { nullptr, 0 } }; int i; for( i = 0 ; baseTypeDefs[i].typeName ; i ++ ) @@ -699,7 +699,7 @@ Statics & getStatics() { "SQL_DATA_TYPE", "TYPEINFO", "pg_catalog", "", com::sun::star::sdbc::DataType::INTEGER, 0,50,false,false,false,false, true }, // 15 { "SQL_DATETIME_SUB", "TYPEINFO", "pg_catalog", "", com::sun::star::sdbc::DataType::INTEGER, 0,50,false,false,false,false , true}, // 16 { "NUM_PREC_RADIX", "TYPEINFO", "pg_catalog", "", com::sun::star::sdbc::DataType::INTEGER, 0,50,false,false,false,false, true }, // 17 - {0,0,0,0,0,0,0,false,false,false,false, false} + {nullptr,nullptr,nullptr,nullptr,0,0,0,false,false,false,false, false} }; for( i = 0 ; defTypeInfoMetaData[i].columnName ; i++ ) diff --git a/connectivity/source/drivers/postgresql/pq_statics.hxx b/connectivity/source/drivers/postgresql/pq_statics.hxx index 300f3574dff3..505eceafd8f2 100644 --- a/connectivity/source/drivers/postgresql/pq_statics.hxx +++ b/connectivity/source/drivers/postgresql/pq_statics.hxx @@ -114,7 +114,7 @@ typedef std::unordered_map struct ImplementationStatics { ImplementationStatics() : - pProps(0) + pProps(nullptr) {} OUString implName; diff --git a/connectivity/source/drivers/postgresql/pq_tools.cxx b/connectivity/source/drivers/postgresql/pq_tools.cxx index 450a9be6bb5b..071fbd7b84fc 100644 --- a/connectivity/source/drivers/postgresql/pq_tools.cxx +++ b/connectivity/source/drivers/postgresql/pq_tools.cxx @@ -117,7 +117,7 @@ void bufferEscapeConstant( OUStringBuffer & buf, const OUString & value, Connect // 22018 is for "Invalid character value" and seems to be the best match. // We have no good XInterface Reference to pass here, so just give NULL throw SQLException(OUString(errstr, strlen(errstr), settings->encoding), - NULL, + nullptr, OUString("22018"), -1, Any()); @@ -158,12 +158,12 @@ static inline void ibufferQuoteIdentifier( OUStringBuffer & buf, const OUString OString y = iOUStringToOString( toQuote, settings ); char *cstr = PQescapeIdentifier(settings->pConnection, y.getStr(), y.getLength()); - if ( cstr == NULL ) + if ( cstr == nullptr ) { char *errstr = PQerrorMessage(settings->pConnection); // Implementation-defined SQLACCESS error throw SQLException(OUString(errstr, strlen(errstr), settings->encoding), - NULL, + nullptr, OUString("22018"), -1, Any()); @@ -825,7 +825,7 @@ OString extractSingleTableFromSelect( const OStringVector &vec ) else { static const char * forbiddenKeywords[] = - { "join", "natural", "outer", "inner", "left", "right", "full" , 0 }; + { "join", "natural", "outer", "inner", "left", "right", "full" , nullptr }; for( int i = 0 ; forbiddenKeywords[i] ; i ++ ) { size_t nKeywordLen = strlen(forbiddenKeywords[i]); diff --git a/connectivity/source/drivers/postgresql/pq_updateableresultset.cxx b/connectivity/source/drivers/postgresql/pq_updateableresultset.cxx index 0c8721cd4f8f..33a192469bae 100644 --- a/connectivity/source/drivers/postgresql/pq_updateableresultset.cxx +++ b/connectivity/source/drivers/postgresql/pq_updateableresultset.cxx @@ -126,7 +126,7 @@ com::sun::star::uno::Reference< com::sun::star::sdbc::XCloseable > UpdateableRes Reference <XCloseable > ret = pRS; // give it an refcount - pRS->m_meta = new ResultSetMetaData( mutex, pRS,0, ppSettings, result, schema, table ); + pRS->m_meta = new ResultSetMetaData( mutex, pRS,nullptr, ppSettings, result, schema, table ); PQclear( result ); // we don't need it anymore diff --git a/connectivity/source/drivers/postgresql/pq_xtable.cxx b/connectivity/source/drivers/postgresql/pq_xtable.cxx index f907597c12c4..39165fec26df 100644 --- a/connectivity/source/drivers/postgresql/pq_xtable.cxx +++ b/connectivity/source/drivers/postgresql/pq_xtable.cxx @@ -99,7 +99,7 @@ Table::Table( const ::rtl::Reference< RefCountedMutex > & refMutex, connection, pSettings, * getStatics().refl.table.pProps ), - m_pColumns( 0 ) + m_pColumns( nullptr ) {} Reference< XPropertySet > Table::createDataDescriptor( ) throw (RuntimeException, std::exception) |