diff --git a/crnlib/crn_file_utils.cpp b/crnlib/crn_file_utils.cpp index 0405c37b..f6cc22fe 100644 --- a/crnlib/crn_file_utils.cpp +++ b/crnlib/crn_file_utils.cpp @@ -347,23 +347,23 @@ bool file_utils::full_path(dynamic_string& path) { if (!p) return false; #else - char buf[PATH_MAX]; - char* p; + char* p = nullptr; dynamic_string pn, fn; split_path(path.get_ptr(), pn, fn); if ((fn == ".") || (fn == "..")) { - p = realpath(path.get_ptr(), buf); + p = realpath(path.get_ptr(), NULL); if (!p) return false; - path.set(buf); + path.set(p); } else { if (pn.is_empty()) pn = "./"; - p = realpath(pn.get_ptr(), buf); + p = realpath(pn.get_ptr(), NULL); if (!p) return false; - combine_path(path, buf, fn.get_ptr()); + combine_path(path, p, fn.get_ptr()); } + free(p); #endif return true; diff --git a/crnlib/crn_timer.cpp b/crnlib/crn_timer.cpp index 044c6b8c..70bea900 100644 --- a/crnlib/crn_timer.cpp +++ b/crnlib/crn_timer.cpp @@ -4,7 +4,7 @@ #include "crn_timer.h" #include -#if defined(__FreeBSD__) +#if !defined(CRNLIB_USE_WIN32_API) #include "sys/time.h" #endif @@ -27,7 +27,6 @@ inline void query_counter_frequency(timer_ticks* pTicks) { QueryPerformanceFrequency(reinterpret_cast(pTicks)); } #elif defined(__GNUC__) -#include inline void query_counter(timer_ticks* pTicks) { struct timeval cur_time; gettimeofday(&cur_time, NULL);