From 478c05fcab6cb4137b9cbaf55fdcdb6ff74107c0 Mon Sep 17 00:00:00 2001 From: Jay Berkenbilt Date: Fri, 29 Nov 2013 22:08:25 -0500 Subject: Allow -DNO_GET_ENVIRONMENT to avoid GetEnvironmentVariable If NO_GET_ENVIRONMENT is #defined at compile time on Windows, do not call GetEnvironmentVariable. QUtil::get_env will always return false. This option is not available through configure. This was added to support a specific user's requirements to avoid calling GetEnvironmentVariable from the Windows API. Nothing in qpdf outside the test coverage system in qtest relies on QUtil::get_env. --- libqpdf/QUtil.cc | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'libqpdf/QUtil.cc') diff --git a/libqpdf/QUtil.cc b/libqpdf/QUtil.cc index cf455061..01e0b6e7 100644 --- a/libqpdf/QUtil.cc +++ b/libqpdf/QUtil.cc @@ -7,6 +7,7 @@ #include #include #include +#include #include #include #include @@ -262,6 +263,9 @@ QUtil::get_env(std::string const& var, std::string* value) { // This was basically ripped out of wxWindows. #ifdef _WIN32 +# ifdef NO_GET_ENVIRONMENT + return false; +# else // first get the size of the buffer DWORD len = ::GetEnvironmentVariable(var.c_str(), NULL, 0); if (len == 0) @@ -279,6 +283,7 @@ QUtil::get_env(std::string const& var, std::string* value) } return true; +# endif #else char* p = getenv(var.c_str()); if (p == 0) -- cgit v1.2.3-54-g00ecf