Remove unneeded includes, prefer cstring over string.h

This commit is contained in:
King_DuckZ 2020-03-21 17:55:09 +01:00
parent 360c72eaf0
commit 91524c7f46

View File

@ -18,15 +18,13 @@
#include <windows.h> #include <windows.h>
#include "../detail/mswin/platform_spec.hpp" #include "../detail/mswin/platform_spec.hpp"
#elif defined(NANA_POSIX) #elif defined(NANA_POSIX)
#include <time.h>
#include <errno.h>
#include <unistd.h> #include <unistd.h>
#include <sys/time.h> #include <sys/time.h>
#include <sys/syscall.h> #include <sys/syscall.h>
#include <pthread.h> #include <pthread.h>
#include <sys/stat.h> #include <sys/stat.h>
#include <spawn.h> #include <spawn.h>
#include <string.h> #include <cstring>
static void posix_open_url(const char *url_utf8) static void posix_open_url(const char *url_utf8)
{ {
@ -55,7 +53,7 @@ static void posix_open_url(const char *url_utf8)
static const char firefox[] = "firefox"; static const char firefox[] = "firefox";
char name[sizeof firefox]{}; char name[sizeof firefox]{};
// argv does not like const-literals so make a copy. // argv does not like const-literals so make a copy.
strcpy(name, firefox); std::strcpy(name, firefox);
char *argv[3] = {name, const_cast<char *>(url_utf8), nullptr}; char *argv[3] = {name, const_cast<char *>(url_utf8), nullptr};
posix_spawn(&pid, path, NULL, NULL, argv, environ); posix_spawn(&pid, path, NULL, NULL, argv, environ);
} }