diff --git a/common/arg.cpp b/common/arg.cpp index e6d6450f4..7accabaf7 100644 --- a/common/arg.cpp +++ b/common/arg.cpp @@ -12,16 +12,6 @@ #include "speculative.h" #include "preset.h" -// fix problem with std::min and std::max -#if defined(_WIN32) -#define WIN32_LEAN_AND_MEAN -#ifndef NOMINMAX -# define NOMINMAX -#endif -#include -#include -#endif - #include #include #include @@ -38,20 +28,6 @@ #include // for hardware_concurrency #include -#ifndef __EMSCRIPTEN__ -#ifdef __linux__ -#include -#elif defined(_WIN32) -# if !defined(PATH_MAX) -# define PATH_MAX MAX_PATH -# endif -#elif defined(_AIX) -#include -#else -#include -#endif -#endif - #define LLAMA_MAX_URL_LENGTH 2084 // Maximum URL Length in Chrome: 2083 using json = common_json; @@ -1259,44 +1235,7 @@ bool common_params_to_map(int argc, char ** argv, llama_example ex, std::map buf; - std::vector ptrs; -}; - -static utf8_argv make_utf8_argv() { - utf8_argv out; - int wargc = 0; - LPWSTR* wargv = CommandLineToArgvW(GetCommandLineW(), &wargc); - if (!wargv) return out; - - out.buf.reserve(wargc); - for (int i = 0; i < wargc; ++i) { - int n = WideCharToMultiByte(CP_UTF8, WC_ERR_INVALID_CHARS, wargv[i], -1, nullptr, 0, nullptr, nullptr); - if (n <= 0) { out.buf.emplace_back(); continue; } - auto& s = out.buf.emplace_back(); - s.resize(static_cast(n - 1)); - (void)WideCharToMultiByte(CP_UTF8, 0, wargv[i], -1, s.data(), n, nullptr, nullptr); - } - LocalFree(wargv); - - out.ptrs.reserve(out.buf.size() + 1); - for (auto& s : out.buf) out.ptrs.push_back(s.data()); - out.ptrs.push_back(nullptr); - return out; -} -#endif - bool common_params_parse(int argc, char ** argv, common_params & params, llama_example ex, void(*print_usage)(int, char **)) { -#ifdef _WIN32 - auto utf8 = make_utf8_argv(); - // repair argv only when it matches the process command line - if (static_cast(utf8.buf.size()) == argc) { - argv = utf8.ptrs.data(); - } -#endif - auto ctx_arg = common_params_parser_init(params, ex, print_usage); const common_params params_org = ctx_arg.params; // the example can modify the default params