Skip to content

Commit

Permalink
Fix linux compilation
Browse files Browse the repository at this point in the history
  • Loading branch information
myrsloik committed May 14, 2024
1 parent d4d3e76 commit b5d23c4
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
3 changes: 3 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
r69
now always sets console output codepage to utf8 in windows

r68:
fixed portable base path detection, was broken in r67
fixed is_inspectable, was broken in r67
Expand Down
10 changes: 5 additions & 5 deletions src/vspipe/vspipe.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -688,7 +688,7 @@ static void printHelp() {
);
}

static int parseOptions(VSPipeOptions &opts, int argc, const char **argv) {
static int parseOptions(VSPipeOptions &opts, int argc, char **argv) {
for (int arg = 1; arg < argc; arg++) {
std::string_view argString = argv[arg];
if (argString == "-v" || argString == "--version") {
Expand Down Expand Up @@ -886,19 +886,19 @@ static int parseOptions(VSPipeOptions &opts, int argc, const char **argv) {
}

#ifdef VS_TARGET_OS_WINDOWS
int main8(int argc, const char **argv);
int main8(int argc, char **argv);

int wmain(int argc, wchar_t **argv) {
std::vector<std::string> argv8storage;
std::vector<const char *> argv8;
std::vector<char *> argv8;
for (int i = 0; i < argc; i++)
argv8storage.push_back(utf16_to_utf8(argv[i]));
for (int i = 0; i < argc; i++)
argv8.push_back(argv8storage[i].c_str());
argv8.push_back(const_cast<char *>(argv8storage[i].c_str()));
return main8(argc, argv8.data());
}

static int main8(int argc, const char **argv) {
static int main8(int argc, char **argv) {
SetConsoleCtrlHandler(HandlerRoutine, TRUE);
if (GetConsoleOutputCP() != CP_UTF8 && !SetConsoleOutputCP(CP_UTF8))
fprintf(stderr, "Failed to set UTF-8 console codepage, some characters may not be correctly displayed\n");
Expand Down

0 comments on commit b5d23c4

Please sign in to comment.