[Libreoffice-commits] .: l10ntools/source

David Tardon dtardon at kemper.freedesktop.org
Mon Oct 11 03:28:16 PDT 2010


 l10ntools/source/help/HelpLinker.cxx |   21 +++++----------------
 1 file changed, 5 insertions(+), 16 deletions(-)

New commits:
commit c2e86c5eb908477cbbc3cbfb13619fa55f6fa845
Author: David Tardon <dtardon at redhat.com>
Date:   Mon Oct 11 12:27:45 2010 +0200

    #i111756# copy arguments directly to vector

diff --git a/l10ntools/source/help/HelpLinker.cxx b/l10ntools/source/help/HelpLinker.cxx
index 66c794c..80f7b84 100644
--- a/l10ntools/source/help/HelpLinker.cxx
+++ b/l10ntools/source/help/HelpLinker.cxx
@@ -1155,31 +1155,20 @@ HELPLINKER_DLLPUBLIC bool compileExtensionHelp
 {
     bool bSuccess = true;
 
-    sal_Int32 argc = nXhpFileCount + 3;
-    const char** argv = new const char*[argc];
-    argv[0] = "";
-    argv[1] = "-mod";
+    std::vector<std::string> args;
+    args.reserve(nXhpFileCount + 2);
+    args.push_back(std::string("-mod"));
     rtl::OString aOExtensionName = rtl::OUStringToOString( aExtensionName, fs::getThreadTextEncoding() );
-    argv[2] = aOExtensionName.getStr();
+    args.push_back(std::string(aOExtensionName.getStr()));
 
     for( sal_Int32 iXhp = 0 ; iXhp < nXhpFileCount ; ++iXhp )
     {
         rtl::OUString aXhpFile = pXhpFiles[iXhp];
 
         rtl::OString aOXhpFile = rtl::OUStringToOString( aXhpFile, fs::getThreadTextEncoding() );
-        char* pArgStr = new char[aOXhpFile.getLength() + 1];
-        strcpy( pArgStr, aOXhpFile.getStr() );
-        argv[iXhp + 3] = pArgStr;
+        args.push_back(std::string(aOXhpFile.getStr()));
     }
 
-    std::vector<std::string> args;
-    for( sal_Int32 i = 1; i < argc; ++i )
-        args.push_back(std::string( argv[i]) );
-
-    for( sal_Int32 iXhp = 0 ; iXhp < nXhpFileCount ; ++iXhp )
-        delete[] argv[iXhp + 3];
-    delete[] argv;
-
     rtl::OString aOExtensionLanguageRoot = rtl::OUStringToOString( aExtensionLanguageRoot, fs::getThreadTextEncoding() );
     const char* pExtensionPath = aOExtensionLanguageRoot.getStr();
     std::string aStdStrExtensionPath = pExtensionPath;


More information about the Libreoffice-commits mailing list