[Libreoffice-commits] core.git: odk/examples onlineupdate/source oox/qa opencl/opencltest opencl/source registry/test xmlhelp/source xmloff/qa

Julien Nabet (via logerrit) logerrit at kemper.freedesktop.org
Tue Oct 5 21:10:30 UTC 2021


 odk/examples/cpp/DocumentLoader/DocumentLoader.cxx                       |   13 ++--
 onlineupdate/source/update/updater/progressui-unused/progressui_gonk.cxx |    6 --
 oox/qa/token/tokenmap-test.cxx                                           |    1 
 opencl/opencltest/main.cxx                                               |   10 +--
 opencl/source/openclwrapper.cxx                                          |    2 
 registry/test/testmerge.cxx                                              |    9 +--
 registry/test/testregcpp.cxx                                             |    6 --
 xmlhelp/source/cxxhelp/provider/resultsetforquery.cxx                    |   29 ++++------
 xmloff/qa/unit/tokenmap-test.cxx                                         |    1 
 9 files changed, 31 insertions(+), 46 deletions(-)

New commits:
commit 10ad9560fba562f494fa44fc8a7bd2388d9e8c5c
Author:     Julien Nabet <serval2412 at yahoo.fr>
AuthorDate: Tue Oct 5 20:49:26 2021 +0200
Commit:     Julien Nabet <serval2412 at yahoo.fr>
CommitDate: Tue Oct 5 23:09:56 2021 +0200

    drop 'using namespace std' in o* r* x*
    
    Change-Id: I15d56d133cf464a3cb6483be785b1259c7f35b43
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/123120
    Tested-by: Jenkins
    Reviewed-by: Julien Nabet <serval2412 at yahoo.fr>

diff --git a/odk/examples/cpp/DocumentLoader/DocumentLoader.cxx b/odk/examples/cpp/DocumentLoader/DocumentLoader.cxx
index 057a9e8152b0..6925fef788b1 100644
--- a/odk/examples/cpp/DocumentLoader/DocumentLoader.cxx
+++ b/odk/examples/cpp/DocumentLoader/DocumentLoader.cxx
@@ -49,7 +49,6 @@
 #include <com/sun/star/lang/XMultiComponentFactory.hpp>
 #include <com/sun/star/registry/XSimpleRegistry.hpp>
 
-using namespace std;
 using namespace com::sun::star::uno;
 using namespace com::sun::star::lang;
 using namespace com::sun::star::beans;
@@ -67,14 +66,14 @@ SAL_IMPLEMENT_MAIN_WITH_ARGS(argc, argv)
 
     if (nCount < 1)
     {
-        cout << "using: DocumentLoader -env:URE_MORE_TYPES=<office_types_rdb_url> <file_url> "
+        std::cout << "using: DocumentLoader -env:URE_MORE_TYPES=<office_types_rdb_url> <file_url> "
                 "[<uno_connection_url>]"
-             << endl
-             << endl
+             << std::endl
+             << std::endl
              << "example: DocumentLoader -env:URE_MORE_TYPES=\"file:///.../program/offapi.rdb\" "
                 "\"file:///e:/temp/test.odt\" "
                 "\"uno:socket,host=localhost,port=2083;urp;StarOffice.ServiceManager\""
-             << endl;
+             << std::endl;
         exit(1);
     }
      if (nCount == 2)
@@ -109,8 +108,8 @@ SAL_IMPLEMENT_MAIN_WITH_ARGS(argc, argv)
     }
     catch ( Exception& e )
     {
-        cout << "Error: cannot establish a connection using "
-             << sConnectionString << endl << e.Message << endl;
+        std::cout << "Error: cannot establish a connection using "
+             << sConnectionString << std::endl << e.Message << std::endl;
         exit(1);
     }
 
diff --git a/onlineupdate/source/update/updater/progressui-unused/progressui_gonk.cxx b/onlineupdate/source/update/updater/progressui-unused/progressui_gonk.cxx
index c855e548efe0..2878aa2f0bb7 100644
--- a/onlineupdate/source/update/updater/progressui-unused/progressui_gonk.cxx
+++ b/onlineupdate/source/update/updater/progressui-unused/progressui_gonk.cxx
@@ -16,8 +16,6 @@
 
 #define LOG(args...)  __android_log_print(ANDROID_LOG_INFO, "GeckoUpdater" , ## args)
 
-using namespace std;
-
 int InitProgressUI(int *argc, char ***argv)
 {
     return 0;
@@ -48,7 +46,7 @@ void UpdateProgressUI(float progress)
     sLastNumBars = numBars;
 
     size_t numSpaces = kProgressBarLength - numBars;
-    string bars(numBars, '=');
-    string spaces(numSpaces, ' ');
+    std::string bars(numBars, '=');
+    std::string spaces(numSpaces, ' ');
     LOG("Progress [ %s%s ]\n", bars.c_str(), spaces.c_str());
 }
diff --git a/oox/qa/token/tokenmap-test.cxx b/oox/qa/token/tokenmap-test.cxx
index 4f617189bbf4..058f7c16ebbf 100644
--- a/oox/qa/token/tokenmap-test.cxx
+++ b/oox/qa/token/tokenmap-test.cxx
@@ -15,7 +15,6 @@
 #include <oox/token/tokenmap.hxx>
 #include <oox/token/tokens.hxx>
 
-using namespace std;
 using namespace com::sun::star::uno;
 
 namespace oox {
diff --git a/opencl/opencltest/main.cxx b/opencl/opencltest/main.cxx
index a499032f8c05..0db18b0042d1 100644
--- a/opencl/opencltest/main.cxx
+++ b/opencl/opencltest/main.cxx
@@ -18,8 +18,6 @@
 
 #include <clew_setup.hxx>
 
-using namespace std;
-
 // The purpose of this separate executable is to check whether OpenCL works
 // without crashing (asserting, etc.). Other checks can be done by LO core itself.
 
@@ -44,7 +42,7 @@ static void runTest(const char* deviceName, const char* devicePlatform)
     // Find the given OpenCL device (in order to use the same one as LO core).
     cl_uint numPlatforms;
     openclcheck(clGetPlatformIDs(0, nullptr, &numPlatforms));
-    vector<cl_platform_id> platforms(numPlatforms);
+    std::vector<cl_platform_id> platforms(numPlatforms);
     openclcheck(clGetPlatformIDs(numPlatforms, platforms.data(), nullptr));
     cl_platform_id platformId = nullptr;
     for (cl_uint i = 0; i < numPlatforms; ++i)
@@ -67,7 +65,7 @@ static void runTest(const char* deviceName, const char* devicePlatform)
 
     cl_uint numDevices;
     openclcheck(clGetDeviceIDs(platformId, CL_DEVICE_TYPE_ALL, 0, nullptr, &numDevices));
-    vector<cl_device_id> devices(numDevices);
+    std::vector<cl_device_id> devices(numDevices);
     openclcheck(
         clGetDeviceIDs(platformId, CL_DEVICE_TYPE_ALL, numDevices, devices.data(), nullptr));
     cl_device_id deviceId = nullptr;
@@ -116,11 +114,11 @@ static void runTest(const char* deviceName, const char* devicePlatform)
         size_t length;
         status
             = clGetProgramBuildInfo(program, deviceId, CL_PROGRAM_BUILD_LOG, 0, nullptr, &length);
-        vector<char> error(length + 1);
+        std::vector<char> error(length + 1);
         status = clGetProgramBuildInfo(program, deviceId, CL_PROGRAM_BUILD_LOG, length,
                                        error.data(), nullptr);
         error[length] = '\0';
-        cerr << "OpenCL driver check build error:" << error.data() << endl;
+        std::cerr << "OpenCL driver check build error:" << error.data() << std::endl;
         abort();
     }
 #endif
diff --git a/opencl/source/openclwrapper.cxx b/opencl/source/openclwrapper.cxx
index 6f4de39bfae7..f6d1242baa3d 100644
--- a/opencl/source/openclwrapper.cxx
+++ b/opencl/source/openclwrapper.cxx
@@ -56,8 +56,6 @@ if( status != CL_SUCCESS )  \
     return false; \
 }
 
-using namespace std;
-
 namespace {
 
 bool bIsInited = false;
diff --git a/registry/test/testmerge.cxx b/registry/test/testmerge.cxx
index 2e8cbbcc59cc..d16100c5c373 100644
--- a/registry/test/testmerge.cxx
+++ b/registry/test/testmerge.cxx
@@ -30,9 +30,6 @@
 #include <rtl/ustring.hxx>
 
 
-using namespace std;
-
-
 sal_Int32 lValue1   = 123456789;
 sal_Int32 lValue2   = 54321;
 sal_Int32 lValue3   = 111333111;
@@ -103,7 +100,7 @@ void test_generateMerge1()
 
     delete myRegistry;
 
-    cout << "test_generateMerge1() Ok!\n";
+    std::cout << "test_generateMerge1() Ok!\n";
     return;
 }
 
@@ -168,7 +165,7 @@ void test_generateMerge2()
 
     delete myRegistry;
 
-    cout << "test_generateMerge2() Ok!\n";
+    std::cout << "test_generateMerge2() Ok!\n";
     return;
 }
 
@@ -400,7 +397,7 @@ void test_merge()
 
     delete myRegistry;
 
-    cout << "test_merge() Ok!\n";
+    std::cout << "test_merge() Ok!\n";
     return;
 }
 
diff --git a/registry/test/testregcpp.cxx b/registry/test/testregcpp.cxx
index 8b9531194c9b..6d545359b65a 100644
--- a/registry/test/testregcpp.cxx
+++ b/registry/test/testregcpp.cxx
@@ -29,8 +29,6 @@
 #include <rtl/alloc.h>
 #include <rtl/ustring.hxx>
 
-using namespace std;
-
 
 void test_coreReflection()
 {
@@ -368,7 +366,7 @@ void test_coreReflection()
 //  REG_ENSURE(!myRegistry->destroy(NULL), "testCoreReflection error 10");
     delete myRegistry;
 
-    cout << "test_coreReflection() Ok!\n";
+    std::cout << "test_coreReflection() Ok!\n";
 }
 
 void test_registry_CppApi()
@@ -689,7 +687,7 @@ void test_registry_CppApi()
     REG_ENSURE(!myRegistry->destroy(OUString()), "test_registry_CppApi error 63");
     delete(myRegistry);
 
-    cout << "test_registry_CppApi() Ok!\n";
+    std::cout << "test_registry_CppApi() Ok!\n";
 
     return;
 }
diff --git a/xmlhelp/source/cxxhelp/provider/resultsetforquery.cxx b/xmlhelp/source/cxxhelp/provider/resultsetforquery.cxx
index 6fa762de325e..3806dd68bdd4 100644
--- a/xmlhelp/source/cxxhelp/provider/resultsetforquery.cxx
+++ b/xmlhelp/source/cxxhelp/provider/resultsetforquery.cxx
@@ -44,7 +44,6 @@
 #include "resultsetforquery.hxx"
 #include "databases.hxx"
 
-using namespace std;
 using namespace chelp;
 using namespace com::sun::star;
 using namespace com::sun::star::ucb;
@@ -85,7 +84,7 @@ ResultSetForQuery::ResultSetForQuery( const uno::Reference< uno::XComponentConte
     xTrans->loadModule(TransliterationModules_UPPERCASE_LOWERCASE,
                        aLocale );
 
-    vector< vector< OUString > > queryList;
+    std::vector< std::vector< OUString > > queryList;
     {
         sal_Int32 idx;
         OUString query = aURLParameter.get_query();
@@ -95,7 +94,7 @@ ResultSetForQuery::ResultSetForQuery( const uno::Reference< uno::XComponentConte
             if( idx == -1 )
                 idx = query.getLength();
 
-            vector< OUString > currentQuery;
+            std::vector< OUString > currentQuery;
             OUString tmp(query.copy( 0,idx ));
             Sequence<sal_Int32> aSeq;
             OUString toliterate = xTrans->transliterate(
@@ -112,7 +111,7 @@ ResultSetForQuery::ResultSetForQuery( const uno::Reference< uno::XComponentConte
         }
     }
 
-    vector< OUString > aCompleteResultVector;
+    std::vector< OUString > aCompleteResultVector;
     OUString scope = aURLParameter.get_scope();
     bool bCaptionsOnly = scope == "Heading";
     sal_Int32 hitCount = aURLParameter.get_hitCount();
@@ -120,7 +119,7 @@ ResultSetForQuery::ResultSetForQuery( const uno::Reference< uno::XComponentConte
     IndexFolderIterator aIndexFolderIt( *pDatabases, aURLParameter.get_module(), aURLParameter.get_language() );
     OUString idxDir;
     bool bExtension = false;
-    vector< vector<HitItem> > aIndexFolderResultVectorVector;
+    std::vector< std::vector<HitItem> > aIndexFolderResultVectorVector;
 
     bool bTemporary;
     for (;;)
@@ -128,12 +127,12 @@ ResultSetForQuery::ResultSetForQuery( const uno::Reference< uno::XComponentConte
         idxDir = aIndexFolderIt.nextIndexFolder( bExtension, bTemporary );
         if( idxDir.isEmpty() )
             break;
-        vector<HitItem> aIndexFolderResultVector;
+        std::vector<HitItem> aIndexFolderResultVector;
 
         try
         {
-            vector< vector<HitItem> > aQueryListResultVectorVector;
-            set< OUString > aSet,aCurrent,aResultSet;
+            std::vector< std::vector<HitItem> > aQueryListResultVectorVector;
+            std::set< OUString > aSet,aCurrent,aResultSet;
 
             int nQueryListSize = queryList.size();
             if( nQueryListSize > 1 )
@@ -141,7 +140,7 @@ ResultSetForQuery::ResultSetForQuery( const uno::Reference< uno::XComponentConte
 
             for( int i = 0; i < nQueryListSize; ++i )
             {
-                vector<HitItem>* pQueryResultVector;
+                std::vector<HitItem>* pQueryResultVector;
                 if( nQueryListSize > 1 )
                 {
                     aQueryListResultVectorVector.emplace_back();
@@ -156,8 +155,8 @@ ResultSetForQuery::ResultSetForQuery( const uno::Reference< uno::XComponentConte
                 const std::vector< OUString >& aListItem = queryList[i];
                 OUString aNewQueryStr = aListItem[0];
 
-                vector<float> aScoreVector;
-                vector<OUString> aPathVector;
+                std::vector<float> aScoreVector;
+                std::vector<OUString> aPathVector;
 
                 try
                 {
@@ -201,7 +200,7 @@ ResultSetForQuery::ResultSetForQuery( const uno::Reference< uno::XComponentConte
             {
                 for( int n = 0 ; n < nQueryListSize ; ++n )
                 {
-                    vector<HitItem>& rQueryResultVector = aQueryListResultVectorVector[n];
+                    std::vector<HitItem>& rQueryResultVector = aQueryListResultVectorVector[n];
 
                     int nItemCount = rQueryResultVector.size();
                     for( int i = 0 ; i < nItemCount ; ++i )
@@ -251,7 +250,7 @@ ResultSetForQuery::ResultSetForQuery( const uno::Reference< uno::XComponentConte
 
 
     int nVectorCount = aIndexFolderResultVectorVector.size();
-    std::unique_ptr<std::vector<HitItem>::size_type[]> pCurrentVectorIndex(new vector<HitItem>::size_type[nVectorCount]);
+    std::unique_ptr<std::vector<HitItem>::size_type[]> pCurrentVectorIndex(new std::vector<HitItem>::size_type[nVectorCount]);
     for( int j = 0 ; j < nVectorCount ; ++j )
         pCurrentVectorIndex[j] = 0;
 
@@ -263,7 +262,7 @@ ResultSetForQuery::ResultSetForQuery( const uno::Reference< uno::XComponentConte
         float fBestScore = 0.0;
         for( int k = 0 ; k < nVectorCount ; ++k )
         {
-            vector<HitItem>& rIndexFolderVector = aIndexFolderResultVectorVector[k];
+            std::vector<HitItem>& rIndexFolderVector = aIndexFolderResultVectorVector[k];
             if( pCurrentVectorIndex[k] < rIndexFolderVector.size() )
             {
                 const HitItem& rItem = rIndexFolderVector[ pCurrentVectorIndex[k] ];
@@ -279,7 +278,7 @@ ResultSetForQuery::ResultSetForQuery( const uno::Reference< uno::XComponentConte
         if( iVectorWithBestScore == -1 )    // No item left at all
             break;
 
-        vector<HitItem>& rIndexFolderVector = aIndexFolderResultVectorVector[iVectorWithBestScore];
+        std::vector<HitItem>& rIndexFolderVector = aIndexFolderResultVectorVector[iVectorWithBestScore];
         const HitItem& rItem = rIndexFolderVector[ pCurrentVectorIndex[iVectorWithBestScore] ];
 
         pCurrentVectorIndex[iVectorWithBestScore]++;
diff --git a/xmloff/qa/unit/tokenmap-test.cxx b/xmloff/qa/unit/tokenmap-test.cxx
index 476416fc3933..395237b8adb1 100644
--- a/xmloff/qa/unit/tokenmap-test.cxx
+++ b/xmloff/qa/unit/tokenmap-test.cxx
@@ -16,7 +16,6 @@
 #include <xmloff/token/tokens.hxx>
 #include <xmloff/xmltoken.hxx>
 
-using namespace std;
 using namespace com::sun::star::uno;
 
 namespace xmloff {


More information about the Libreoffice-commits mailing list