]> git.tdb.fi Git - libs/core.git/commitdiff
Use the new utilities to format some strings
authorMikko Rasa <tdb@tdb.fi>
Thu, 4 Mar 2021 10:29:09 +0000 (12:29 +0200)
committerMikko Rasa <tdb@tdb.fi>
Thu, 4 Mar 2021 10:34:13 +0000 (12:34 +0200)
source/core/windows/process.cpp
source/stringcodec/except.cpp

index 7b1efd693aff45fce41594914b4d16dc2264de70..d6d1484f7d3ec05079310d2412df2f2c37c7ac0c 100644 (file)
@@ -1,6 +1,7 @@
 #include <windows.h>
 #include <msp/core/systemerror.h>
 #include <msp/io/handle_private.h>
 #include <windows.h>
 #include <msp/core/systemerror.h>
 #include <msp/io/handle_private.h>
+#include <msp/strings/utils.h>
 #include "process.h"
 #include "process_private.h"
 
 #include "process.h"
 #include "process_private.h"
 
@@ -56,10 +57,7 @@ void Process::execute(const string &command, bool path_search, const Arguments &
 {
        string cmdline = quote_argument(command);
        for(Arguments::const_iterator i=args.begin(); i!=args.end(); ++i)
 {
        string cmdline = quote_argument(command);
        for(Arguments::const_iterator i=args.begin(); i!=args.end(); ++i)
-       {
-               cmdline += ' ';
-               cmdline += quote_argument(*i);
-       }
+               append(cmdline, " ", quote_argument(*i));
 
        STARTUPINFO startup;
        startup.cb = sizeof(STARTUPINFO);
 
        STARTUPINFO startup;
        startup.cb = sizeof(STARTUPINFO);
index b4d07ece559706025677393ea019a9cce39799c0..23ac3cd64f8f48c6992600c6641b887924f27a73 100644 (file)
@@ -1,4 +1,5 @@
 #include <msp/strings/format.h>
 #include <msp/strings/format.h>
+#include <msp/strings/utils.h>
 #include "except.h"
 
 using namespace std;
 #include "except.h"
 
 using namespace std;
@@ -19,11 +20,7 @@ string invalid_sequence::format_sequence(const string::const_iterator &begin, co
 {
        string result;
        for(string::const_iterator i=begin; i!=end; ++i)
 {
        string result;
        for(string::const_iterator i=begin; i!=end; ++i)
-       {
-               if(!result.empty())
-                       result += ' ';
-               result += lexical_cast<string>(static_cast<unsigned char>(*i), Fmt().fill('0').width(2).hex().uppercase());
-       }
+               append(result, " ", lexical_cast<string>(static_cast<unsigned char>(*i), Fmt().fill('0').width(2).hex().uppercase()));
        return result;
 }
 
        return result;
 }