Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/common
Original file line number Diff line number Diff line change
Expand Up @@ -105,10 +105,10 @@ else ifeq ($(BUILD_ENV_),Cygwin)
CP_CXXFLAGS += -MMD -MP -std=c++11 -U__STRICT_ANSI__
# Cygwin-g++ has problems with statically linking exception code.
# If linking fails, remove -static.
LINKFLAGS = -static -std=c++11
LINKFLAGS = -std=c++11
LINKLIB = ar rcT $@ $^
LINKBIN = $(CXX) $(LINKFLAGS) -o $@ -Wl,--start-group $^ -Wl,--end-group $(LIBS)
LINKNATIVE = $(HOSTCXX) -std=c++11 -o $@ $^ -static
LINKBIN = $(CXX) $(LINKFLAGS) -o $@ -Wl,--start-group $^ -Wl,--end-group -limagehlp $(LIBS)
LINKNATIVE = $(HOSTCXX) -std=c++11 -o $@ $^
ifeq ($(origin CC),default)
#CC = gcc
CC = x86_64-w64-mingw32-gcc
Expand Down
5 changes: 3 additions & 2 deletions src/util/invariant.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ Author: Martin Brain, martin.brain@diffblue.com
// clang-format off
#include <windows.h>
#include <dbghelp.h>
#include <imagehlp.h>
// clang-format on
#endif

Expand Down Expand Up @@ -117,9 +118,9 @@ void print_backtrace(
// for the rationale behind the size of 'symbol'
const auto max_name_len = 255;
auto symbol = static_cast<SYMBOL_INFO *>(
calloc(sizeof SYMBOL_INFO + (max_name_len - 1) * sizeof(TCHAR), 1));
calloc(sizeof(SYMBOL_INFO) + (max_name_len - 1) * sizeof(TCHAR), 1));
symbol->MaxNameLen = max_name_len;
symbol->SizeOfStruct = sizeof SYMBOL_INFO;
symbol->SizeOfStruct = sizeof(SYMBOL_INFO);

for(std::size_t i = 0; i < number_of_frames; i++)
{
Expand Down
37 changes: 2 additions & 35 deletions src/util/run.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -448,43 +448,10 @@ int run(
#endif
}

#ifndef _WIN32
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change doesn't look like "just a small change" at all?

/// quote a string for bash and CMD
static std::string shell_quote(const std::string &src)
{
#ifdef _WIN32
// first check if quoting is needed at all

if(src.find(' ')==std::string::npos &&
src.find('"')==std::string::npos &&
src.find('&')==std::string::npos &&
src.find('|')==std::string::npos &&
src.find('(')==std::string::npos &&
src.find(')')==std::string::npos &&
src.find('<')==std::string::npos &&
src.find('>')==std::string::npos &&
src.find('^')==std::string::npos)
{
// seems fine -- return as is
return src;
}

std::string result;

result+='"';

for(const char ch : src)
{
if(ch=='"')
result+='"'; // quotes are doubled
result+=ch;
}

result+='"';

return result;

#else

// first check if quoting is needed at all

if(src.find(' ')==std::string::npos &&
Expand Down Expand Up @@ -519,8 +486,8 @@ static std::string shell_quote(const std::string &src)
result+='\'';

return result;
#endif
}
#endif

int run(
const std::string &what,
Expand Down