<html><head><meta name="color-scheme" content="light dark"></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;">The prototype of scandir changed in the 10.8 SDK. Use the old prototype on old SDKs.
https://gitlab.com/pdfgrep/pdfgrep/-/merge_requests/14
--- src/cache.cc.orig	2024-03-15 12:58:00.000000000 +0000
+++ src/cache.cc	2024-11-27 18:10:44.792593267 +0000
@@ -35,6 +35,15 @@
 #include &lt;cerrno&gt;
 #include &lt;cstring&gt;
 
+#ifdef __APPLE__
+#include &lt;AvailabilityMacros.h&gt;
+#endif
+
+#define HAVE_NEW_SCANDIR
+#if (defined(MAC_OS_X_VERSION_MAX_ALLOWED) &amp;&amp; MAC_OS_X_VERSION_MAX_ALLOWED &lt; 1080)
+#undef HAVE_NEW_SCANDIR
+#endif
+
 using namespace std;
 
 const char *CACHE_VERSION = "1";
@@ -115,9 +124,13 @@
 
 // I feel so bad...
 static const char *cache_directory;
-static int agesort(const struct dirent ** a, const struct dirent **b) {
-	std::string A = string(cache_directory) + "/" + (*a)-&gt;d_name;
-	std::string B = string(cache_directory) + "/" + (*b)-&gt;d_name;
+#ifdef HAVE_NEW_SCANDIR
+static int agesort(const struct dirent **a, const struct dirent **b) {
+#else
+static int agesort(const void *a, const void *b) {
+#endif
+	std::string A = string(cache_directory) + "/" + (*(const struct dirent **)a)-&gt;d_name;
+	std::string B = string(cache_directory) + "/" + (*(const struct dirent **)b)-&gt;d_name;
 
 	struct stat bufa, bufb;
 	if (stat(A.c_str(), &amp;bufa) != 0) {
@@ -130,7 +143,11 @@
 	return bufb.st_mtime - bufa.st_mtime;
 }
 
-static int agefilter(const struct dirent * a) {
+#ifdef HAVE_NEW_SCANDIR
+static int agefilter(const struct dirent *a) {
+#else
+static int agefilter(struct dirent *a) {
+#endif
 	if (a-&gt;d_name[0] == '.') {
 		return 0;
 	}
</pre></body></html>