From fcd8c9606e5912f35130ae24fdb8fbb4eaf52441 Mon Sep 17 00:00:00 2001 From: lethosor Date: Sat, 12 May 2018 18:46:58 -0400 Subject: [PATCH] Fix some warnings on OS X --- depends/clsocket | 2 +- library/Process-darwin.cpp | 27 +++++++++------------------ 2 files changed, 10 insertions(+), 19 deletions(-) diff --git a/depends/clsocket b/depends/clsocket index f638c8ea7..6a9153d05 160000 --- a/depends/clsocket +++ b/depends/clsocket @@ -1 +1 @@ -Subproject commit f638c8ea7f9c50fe7f64159c9f173846856f87a6 +Subproject commit 6a9153d053a250be34996b3fd86ac1166c3e17cb diff --git a/library/Process-darwin.cpp b/library/Process-darwin.cpp index 69defbf92..2091d9a96 100644 --- a/library/Process-darwin.cpp +++ b/library/Process-darwin.cpp @@ -208,8 +208,10 @@ void Process::getMemRanges( vector & ranges ) if (log_ranges) { fprintf(stderr, - "%p-%p %8uK %c%c%c/%c%c%c %11s %6s %10s uwir=%hu sub=%u dlname: %s\n", - address, (address + vmsize), (vmsize >> 10), + "%p-%p %8zuK %c%c%c/%c%c%c %11s %6s %10s uwir=%hu sub=%u dlname: %s\n", + (void*)address, + (void*)(address + vmsize), + size_t(vmsize >> 10), (info.protection & VM_PROT_READ) ? 'r' : '-', (info.protection & VM_PROT_WRITE) ? 'w' : '-', (info.protection & VM_PROT_EXECUTE) ? 'x' : '-', @@ -250,22 +252,6 @@ int Process::adjustOffset(int offset, bool /*to_file*/) return offset; } -static int getdir (string dir, vector &files) -{ - DIR *dp; - struct dirent *dirp; - if((dp = opendir(dir.c_str())) == NULL) - { - cout << "Error(" << errno << ") opening " << dir << endl; - return errno; - } - while ((dirp = readdir(dp)) != NULL) { - files.push_back(string(dirp->d_name)); - } - closedir(dp); - return 0; -} - uint32_t Process::getTickCount() { struct timeval tp; @@ -289,6 +275,11 @@ string Process::getPath() if (_NSGetExecutablePath(path, &size) == 0) { real_path = realpath(path, NULL); } + else { + fprintf(stderr, "_NSGetExecutablePath failed!\n"); + cached_path = "."; + return cached_path; + } std::string path_string(real_path); int last_slash = path_string.find_last_of("/"); cached_path = path_string.substr(0,last_slash);