Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
baikaishui-ks opened this issue May 14, 2024 · 0 comments

Comments

@baikaishui-ks
Copy link

baikaishui-ks commented May 14, 2024

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()).

template<typename Char>
inline auto basic_environment_impl<Char>::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<Char>()))
        return string_type(_data.data()); //null-char is handled by the string.

    std::vector<Char> 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);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant