From: jsteube Date: Fri, 8 Jul 2016 21:14:57 +0000 (+0200) Subject: Replace DARWIN macro with __APPLE__ X-Git-Url: https://www.flypig.org.uk/git/?p=hashcat.git;a=commitdiff_plain;h=96f2ade4bbf76f083b2039a99e3452053817909f Replace DARWIN macro with __APPLE__ As discussed on https://github.com/hashcat/hashcat/pull/409 --- diff --git a/docs/changes.txt b/docs/changes.txt index e84cf3a..9e84431 100644 --- a/docs/changes.txt +++ b/docs/changes.txt @@ -10,6 +10,7 @@ - The Time.Estimated attribute in status display should also show --runtime limit if user set it - Fix some strict aliasing rule violation on older compilers - Fix some variable initializers on older compilers +- Replace DARWIN macro with __APPLE__ ## ## Bugs diff --git a/include/common.h b/include/common.h index ff9cd4a..91cb370 100644 --- a/include/common.h +++ b/include/common.h @@ -45,7 +45,7 @@ #include #endif -#ifdef DARWIN +#ifdef __APPLE__ #include #include #include @@ -64,7 +64,7 @@ typedef void *ADL_LIB; typedef void *NVAPI_LIB; typedef void *NVML_LIB; typedef void *XNVCTRL_LIB; -#ifdef DARWIN +#ifdef __APPLE__ #define __stdcall #endif #endif diff --git a/include/ext_OpenCL.h b/include/ext_OpenCL.h index ae07285..c3598c9 100644 --- a/include/ext_OpenCL.h +++ b/include/ext_OpenCL.h @@ -13,7 +13,7 @@ #define CL_USE_DEPRECATED_OPENCL_1_2_APIS #define CL_USE_DEPRECATED_OPENCL_2_0_APIS -#ifdef DARWIN +#ifdef __APPLE__ #include #endif diff --git a/include/shared.h b/include/shared.h index b0b3565..b973130 100644 --- a/include/shared.h +++ b/include/shared.h @@ -46,7 +46,7 @@ #define hc_thread_mutex_delete(m) pthread_mutex_destroy (&m) #endif -#ifdef DARWIN +#ifdef __APPLE__ typedef struct cpu_set { uint32_t count; diff --git a/src/Makefile b/src/Makefile index b6730b8..6cd6684 100644 --- a/src/Makefile +++ b/src/Makefile @@ -113,7 +113,7 @@ BINARY_NATIVE := $(PROG_NAME) ifeq ($(UNAME),Darwin) export MACOSX_DEPLOYMENT_TARGET=10.9 -CFLAGS_NATIVE := -D_POSIX -DDARWIN +CFLAGS_NATIVE := -D_POSIX CFLAGS_NATIVE += $(CFLAGS) LFLAGS_NATIVE := -lpthread LFLAGS_NATIVE += $(LDFLAGS) diff --git a/src/ext_OpenCL.c b/src/ext_OpenCL.c index 9986c46..9bbca71 100644 --- a/src/ext_OpenCL.c +++ b/src/ext_OpenCL.c @@ -69,7 +69,7 @@ int ocl_init (OCL_PTR *ocl) #ifdef _WIN ocl->lib = hc_dlopen ("OpenCL"); - #elif DARWIN + #elif __APPLE__ ocl->lib = hc_dlopen ("/System/Library/Frameworks/OpenCL.framework/OpenCL", RTLD_NOW); #else ocl->lib = hc_dlopen ("libOpenCL.so", RTLD_NOW); diff --git a/src/hashcat.c b/src/hashcat.c index 59e682a..0049333 100644 --- a/src/hashcat.c +++ b/src/hashcat.c @@ -6,7 +6,11 @@ * License.....: MIT */ -#if defined(DARWIN) || defined(__FreeBSD__) +#ifdef __APPLE__ +#include +#endif + +#ifdef __FreeBSD__ #include #endif diff --git a/src/shared.c b/src/shared.c index 86ddc01..f4c76f9 100644 --- a/src/shared.c +++ b/src/shared.c @@ -6,7 +6,7 @@ * License.....: MIT */ -#ifdef DARWIN +#ifdef __APPLE__ #include #endif @@ -2387,7 +2387,7 @@ int tty_fix() } #endif -#if defined(DARWIN) || defined(__FreeBSD__) +#if defined(__APPLE__) || defined(__FreeBSD__) static struct termios savemodes; static int havemodes = 0; @@ -4365,7 +4365,7 @@ char *get_exec_path () const int len = GetModuleFileName (NULL, exec_path, exec_path_len - 1); - #elif DARWIN + #elif __APPLE__ uint size = exec_path_len; @@ -4519,7 +4519,7 @@ void truecrypt_crc32 (const char *filename, u8 keytab[64]) myfree (buf); } -#ifdef DARWIN +#ifdef __APPLE__ int pthread_setaffinity_np (pthread_t thread, size_t cpu_size, cpu_set_t *cpu_set) { int core; @@ -5794,11 +5794,14 @@ char **scan_directory (const char *path) if ((d = opendir (tmp_path)) != NULL) { - #ifdef DARWIN + #ifdef __APPLE__ + struct dirent e; - for (;;) { + for (;;) + { memset (&e, 0, sizeof (e)); + struct dirent *de = NULL; if (readdir_r (d, &e, &de) != 0) @@ -5809,12 +5812,16 @@ char **scan_directory (const char *path) } if (de == NULL) break; + #else + struct dirent *de; while ((de = readdir (d)) != NULL) { + #endif + if ((strcmp (de->d_name, ".") == 0) || (strcmp (de->d_name, "..") == 0)) continue; int path_size = strlen (tmp_path) + 1 + strlen (de->d_name);