boostorg / boostorg/process

v1.81: boost\process\detail\windows\environment.hpp reports a compilation error in Windows wide-byte environment

Open
#371 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
C++
Stars
145
Forks
151
PR merge metrics
No merged PRs in 30d

Description

There are two errors in compilation, namely line 68 and line 248. I see that the compilation error on line 68 has been corrected, and the compilation error on line 248 has not been changed.

Statement error after `if (itr == _data.end())`.

```cpp
template
inline auto basic_environment_impl::get(const string_type &id) -> string_type
{
if (id.size() >= _data.size()) //ok, so it's impossible id is in there.
return string_type(_data.data());

if (std::equal(id.begin(), id.end(), _data.begin()) && (_data[id.size()] == equal_sign()))
return string_type(_data.data()); //null-char is handled by the string.

std::vector seq = {'\0'}; //using a vector, because strings might cause problems with nullchars
seq.insert(seq.end(), id.begin(), id.end());
seq.push_back('=');

auto itr = std::search(_data.begin(), _data.end(), seq.begin(), seq.end());

if (itr == _data.end()) //not found
// The original statement is: return "";
// I changed it locally to: return string_type{};
return string_type{};

itr += seq.size(); //advance to the value behind the '='; the std::string will take care of finding the null-char.

return string_type(&*itr);
}
```

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.