From ced6d20295a8263757d57c02a07ffcb66688a163 Mon Sep 17 00:00:00 2001 From: Craig Robbins Date: Fri, 6 Mar 2015 20:21:51 +1000 Subject: For usages of assert() that are meant to persist in Release builds (when NDEBUG is defined), replace those usages with persistent alternatives --- src/porting.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'src/porting.cpp') diff --git a/src/porting.cpp b/src/porting.cpp index 8a685539b..6d0ab78c4 100644 --- a/src/porting.cpp +++ b/src/porting.cpp @@ -391,7 +391,7 @@ void initializePaths() //TODO: Test this code char buf[BUFSIZ]; uint32_t len = sizeof(buf); - assert(_NSGetExecutablePath(buf, &len) != -1); + FATAL_ERROR_IF(_NSGetExecutablePath(buf, &len) == -1, ""); pathRemoveFile(buf, '/'); @@ -411,7 +411,7 @@ void initializePaths() mib[1] = KERN_PROC; mib[2] = KERN_PROC_PATHNAME; mib[3] = -1; - assert(sysctl(mib, 4, buf, &len, NULL, 0) != -1); + FATAL_ERROR_IF(sysctl(mib, 4, buf, &len, NULL, 0) == -1, ""); pathRemoveFile(buf, '/'); @@ -446,13 +446,13 @@ void initializePaths() */ #if defined(_WIN32) - const DWORD buflen = 1000; + const DWORD buflen = 1000; // FIXME: Surely there is a better way to do this char buf[buflen]; DWORD len; // Find path of executable and set path_share relative to it len = GetModuleFileName(GetModuleHandle(NULL), buf, buflen); - assert(len < buflen); + FATAL_ERROR_IF(len >= buflen, "Overlow"); pathRemoveFile(buf, '\\'); // Use ".\bin\.." @@ -460,7 +460,7 @@ void initializePaths() // Use "C:\Documents and Settings\user\Application Data\" len = GetEnvironmentVariable("APPDATA", buf, buflen); - assert(len < buflen); + FATAL_ERROR_IF(len >= buflen, "Overlow"); path_user = std::string(buf) + DIR_DELIM + PROJECT_NAME; /* @@ -476,7 +476,7 @@ void initializePaths() if (readlink("/proc/self/exe", buf, BUFSIZ-1) == -1) { errorstream << "Unable to read bindir "<< std::endl; #ifndef __ANDROID__ - assert("Unable to read bindir" == 0); + FATAL_ERROR("Unable to read bindir"); #endif } else { pathRemoveFile(buf, '/'); -- cgit v1.2.3