diff --git a/TestPrograms/dump2def.cxx b/TestPrograms/dump2def.cxx index 86936364..97bc7580 100644 --- a/TestPrograms/dump2def.cxx +++ b/TestPrograms/dump2def.cxx @@ -44,7 +44,7 @@ #include // Friendly name -#define LIBRARY_NAME "Crypto++ Library" +#define LIBRARY_DESC "Crypto++ Library" typedef std::set SymbolMap; const int ErrorSuccess = 0; @@ -190,7 +190,7 @@ int main(int argc, char* argv[]) name.erase(pos); outfile << "LIBRARY " << name << std::endl; - outfile << "DESCRIPTION \"" << LIBRARY_NAME << "\"" << std::endl; + outfile << "DESCRIPTION \"" << LIBRARY_DESC << "\"" << std::endl; outfile << "EXPORTS" << std::endl; outfile << std::endl; diff --git a/test.cpp b/test.cpp index 8ca5e6e2..c284b1b0 100644 --- a/test.cpp +++ b/test.cpp @@ -448,22 +448,21 @@ int scoped_main(int argc, char *argv[]) void SetArgvPathHint(const char* argv0, std::string& pathHint) { +# if (PATH_MAX > 0) // Posix + size_t path_max = (size_t)PATH_MAX; +#elif (MAX_PATH > 0) // Microsoft + size_t path_max = (size_t)MAX_PATH; +#else + size_t path_max = 260; +#endif + // OS X and Solaris provide a larger path using pathconf than MAX_PATH. // Also see https://stackoverflow.com/a/33249023/608639 for FreeBSD. -#if defined(UNIX_PATH_FAMILY) - size_t path_max = 0; +#if defined(_PC_PATH_MAX) long ret = pathconf(argv0, _PC_PATH_MAX); + const size_t old_path_max = path_max; if (SafeConvert(ret, path_max) == false) - { -# if defined(MAX_PATH) - path_max = MAX_PATH; -# else - path_max = 4096; -# endif - } -#else - // Windows and others? - size_t path_max = MAX_PATH; + path_max = old_path_max; #endif const size_t argLen = std::strlen(argv0);