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

Use _putenv_s() on Windows in fuzztest_helpers #2014

Merged
merged 1 commit into from
Feb 15, 2024
Merged
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
8 changes: 7 additions & 1 deletion tests/gtest/avif_fuzztest_helpers.cc
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,13 @@ class Environment : public ::testing::Environment {
public:
Environment(const char* name, const char* value)
: name_(name), value_(value) {}
void SetUp() override { setenv(name_, value_, 1); }
void SetUp() override {
#ifdef WIN32
Copy link
Collaborator

Choose a reason for hiding this comment

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

Please change WIN32 to _WIN32 . The compiler predefined macro is named _WIN32 .

_putenv_s(name_, value_); // Defined in stdlib.h.
#else
setenv(name_, value_, /*__replace=*/1);
Copy link
Collaborator

Choose a reason for hiding this comment

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

The third parameter is documented as overwrite in the posix docs.

#endif
}

private:
const char* name_;
Expand Down
Loading