Skip to content

Commit

Permalink
Fix Windows build break due to strchr losing const
Browse files Browse the repository at this point in the history
Mingw32 headers and Apple libc++ both strip const from strchr.  Store
the result into a const char* to restore const to the pointer.
  • Loading branch information
vLKp committed Jan 14, 2015
1 parent 24bdbfb commit ea3c789
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion similar/main/mission.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -924,7 +924,11 @@ static int load_mission(const mle *mission)
break;
const auto &line = buf.line();
const auto lb = line.begin();
const auto t = strchr(lb, ',');
/* No auto: returned value must be type const char*
* Modern glibc maintains const-ness of the input.
* Apple libc++ and mingw32 do not.
*/
const char *const t = strchr(lb, ',');
if (!t)
break;
auto a = [](char c) {
Expand Down

0 comments on commit ea3c789

Please sign in to comment.