Fix compile when NO_OS_DEPENDENCE is defined

pull/778/head
Jeffrey Walton 2019-01-08 17:03:45 -05:00
parent 3a18d73cc1
commit 6d5316812f
No known key found for this signature in database
GPG Key ID: B36AB348921B1838
2 changed files with 13 additions and 14 deletions

View File

@ -44,7 +44,7 @@
#include <set> #include <set>
// Friendly name // Friendly name
#define LIBRARY_NAME "Crypto++ Library" #define LIBRARY_DESC "Crypto++ Library"
typedef std::set<std::string> SymbolMap; typedef std::set<std::string> SymbolMap;
const int ErrorSuccess = 0; const int ErrorSuccess = 0;
@ -190,7 +190,7 @@ int main(int argc, char* argv[])
name.erase(pos); name.erase(pos);
outfile << "LIBRARY " << name << std::endl; outfile << "LIBRARY " << name << std::endl;
outfile << "DESCRIPTION \"" << LIBRARY_NAME << "\"" << std::endl; outfile << "DESCRIPTION \"" << LIBRARY_DESC << "\"" << std::endl;
outfile << "EXPORTS" << std::endl; outfile << "EXPORTS" << std::endl;
outfile << std::endl; outfile << std::endl;

View File

@ -448,22 +448,21 @@ int scoped_main(int argc, char *argv[])
void SetArgvPathHint(const char* argv0, std::string& pathHint) 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. // OS X and Solaris provide a larger path using pathconf than MAX_PATH.
// Also see https://stackoverflow.com/a/33249023/608639 for FreeBSD. // Also see https://stackoverflow.com/a/33249023/608639 for FreeBSD.
#if defined(UNIX_PATH_FAMILY) #if defined(_PC_PATH_MAX)
size_t path_max = 0;
long ret = pathconf(argv0, _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 (SafeConvert(ret, path_max) == false)
{ path_max = old_path_max;
# if defined(MAX_PATH)
path_max = MAX_PATH;
# else
path_max = 4096;
# endif
}
#else
// Windows and others?
size_t path_max = MAX_PATH;
#endif #endif
const size_t argLen = std::strlen(argv0); const size_t argLen = std::strlen(argv0);