Fix some warnings on OS X

develop
lethosor 2018-05-12 18:46:58 -04:00
parent e9ec08f419
commit fcd8c9606e
2 changed files with 10 additions and 19 deletions

@ -1 +1 @@
Subproject commit f638c8ea7f9c50fe7f64159c9f173846856f87a6 Subproject commit 6a9153d053a250be34996b3fd86ac1166c3e17cb

@ -208,8 +208,10 @@ void Process::getMemRanges( vector<t_memrange> & ranges )
if (log_ranges) if (log_ranges)
{ {
fprintf(stderr, fprintf(stderr,
"%p-%p %8uK %c%c%c/%c%c%c %11s %6s %10s uwir=%hu sub=%u dlname: %s\n", "%p-%p %8zuK %c%c%c/%c%c%c %11s %6s %10s uwir=%hu sub=%u dlname: %s\n",
address, (address + vmsize), (vmsize >> 10), (void*)address,
(void*)(address + vmsize),
size_t(vmsize >> 10),
(info.protection & VM_PROT_READ) ? 'r' : '-', (info.protection & VM_PROT_READ) ? 'r' : '-',
(info.protection & VM_PROT_WRITE) ? 'w' : '-', (info.protection & VM_PROT_WRITE) ? 'w' : '-',
(info.protection & VM_PROT_EXECUTE) ? 'x' : '-', (info.protection & VM_PROT_EXECUTE) ? 'x' : '-',
@ -250,22 +252,6 @@ int Process::adjustOffset(int offset, bool /*to_file*/)
return offset; return offset;
} }
static int getdir (string dir, vector<string> &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() uint32_t Process::getTickCount()
{ {
struct timeval tp; struct timeval tp;
@ -289,6 +275,11 @@ string Process::getPath()
if (_NSGetExecutablePath(path, &size) == 0) { if (_NSGetExecutablePath(path, &size) == 0) {
real_path = realpath(path, NULL); real_path = realpath(path, NULL);
} }
else {
fprintf(stderr, "_NSGetExecutablePath failed!\n");
cached_path = ".";
return cached_path;
}
std::string path_string(real_path); std::string path_string(real_path);
int last_slash = path_string.find_last_of("/"); int last_slash = path_string.find_last_of("/");
cached_path = path_string.substr(0,last_slash); cached_path = path_string.substr(0,last_slash);