Replace DARWIN macro with __APPLE__
authorjsteube <jens.steube@gmail.com>
Fri, 8 Jul 2016 21:14:57 +0000 (23:14 +0200)
committerjsteube <jens.steube@gmail.com>
Fri, 8 Jul 2016 21:14:57 +0000 (23:14 +0200)
As discussed on https://github.com/hashcat/hashcat/pull/409

docs/changes.txt
include/common.h
include/ext_OpenCL.h
include/shared.h
src/Makefile
src/ext_OpenCL.c
src/hashcat.c
src/shared.c

index e84cf3a..9e84431 100644 (file)
@@ -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
index ff9cd4a..91cb370 100644 (file)
@@ -45,7 +45,7 @@
 #include <sys/ioctl.h>
 #endif
 
-#ifdef DARWIN
+#ifdef __APPLE__
 #include <termios.h>
 #include <sys/ioctl.h>
 #include <mach-o/dyld.h>
@@ -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
index ae07285..c3598c9 100644 (file)
@@ -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 <OpenCL/cl.h>
 #endif
 
index b0b3565..b973130 100644 (file)
@@ -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;
index b6730b8..6cd6684 100644 (file)
@@ -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)
index 9986c46..9bbca71 100644 (file)
@@ -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);
index 59e682a..0049333 100644 (file)
@@ -6,7 +6,11 @@
  * License.....: MIT
  */
 
-#if defined(DARWIN) || defined(__FreeBSD__)
+#ifdef __APPLE__
+#include <stdio.h>
+#endif
+
+#ifdef __FreeBSD__
 #include <stdio.h>
 #endif
 
index 86ddc01..f4c76f9 100644 (file)
@@ -6,7 +6,7 @@
  * License.....: MIT
  */
 
-#ifdef DARWIN
+#ifdef __APPLE__
 #include <stdio.h>
 #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);