Revision: 28417
          http://sourceforge.net/p/bibdesk/svn/28417
Author:   hofman
Date:     2023-11-04 10:40:23 +0000 (Sat, 04 Nov 2023)
Log Message:
-----------
conditionally add some backwards compatible code

Modified Paths:
--------------
    trunk/bibdesk_vendorsrc/amaxwell/FileView/FVAccessibilityIconElement.m
    trunk/bibdesk_vendorsrc/amaxwell/FileView/FVCacheFile.mm
    trunk/bibdesk_vendorsrc/amaxwell/FileView/FVFileView.m

Modified: trunk/bibdesk_vendorsrc/amaxwell/FileView/FVAccessibilityIconElement.m
===================================================================
--- trunk/bibdesk_vendorsrc/amaxwell/FileView/FVAccessibilityIconElement.m      
2023-11-04 10:24:07 UTC (rev 28416)
+++ trunk/bibdesk_vendorsrc/amaxwell/FileView/FVAccessibilityIconElement.m      
2023-11-04 10:40:23 UTC (rev 28417)
@@ -204,7 +204,11 @@
         if (title == nil)
             title = [aURL lastPathComponent];
     } else {
+#if defined(MAC_OS_X_VERSION_10_9) && MAC_OS_X_VERSION_MIN_REQUIRED >= 
MAC_OS_X_VERSION_10_9
         title = [[aURL absoluteString] stringByRemovingPercentEncoding];
+#else
+        title = [[aURL absoluteString] 
stringByReplacingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
+#endif
     }
     return title;
 }

Modified: trunk/bibdesk_vendorsrc/amaxwell/FileView/FVCacheFile.mm
===================================================================
--- trunk/bibdesk_vendorsrc/amaxwell/FileView/FVCacheFile.mm    2023-11-04 
10:24:07 UTC (rev 28416)
+++ trunk/bibdesk_vendorsrc/amaxwell/FileView/FVCacheFile.mm    2023-11-04 
10:40:23 UTC (rev 28417)
@@ -42,7 +42,11 @@
 
 #import <string>
 #import <sys/stat.h>
+#if defined(MAC_OS_X_VERSION_10_13) && MAC_OS_X_VERSION_MIN_REQUIRED >= 
MAC_OS_X_VERSION_10_13
 #import <os/log.h>
+#else
+#import <asl.h>
+#endif
 #import <zlib.h>
 #import <sys/mman.h>
 
@@ -85,7 +89,9 @@
 
 static NSInteger FVCacheLogLevel = 0;
 
+#if defined(MAC_OS_X_VERSION_10_13) && MAC_OS_X_VERSION_MIN_REQUIRED >= 
MAC_OS_X_VERSION_10_13
 static os_log_t logger;
+#endif
 
 + (void)initialize
 {
@@ -97,8 +103,10 @@
     // 2 - print URL each as it's added
     FVCacheLogLevel = [[NSUserDefaults standardUserDefaults] 
integerForKey:@"FVCacheLogLevel"];
     
+#if defined(MAC_OS_X_VERSION_10_13) && MAC_OS_X_VERSION_MIN_REQUIRED >= 
MAC_OS_X_VERSION_10_13
     if (FVCacheLogLevel > 0)
         logger = os_log_create("com.mac.amaxwell.fileview", "FileViewCache");
+#endif
 }
 
 #pragma clang diagnostic push
@@ -195,8 +203,18 @@
             double mbSize = double(fsize) / 1024 / 1024;
             
             const char *cacheName = [_cacheName UTF8String];
+#if defined(MAC_OS_X_VERSION_10_13) && MAC_OS_X_VERSION_MIN_REQUIRED >= 
MAC_OS_X_VERSION_10_13
             os_log_error(logger, "%s: removing %s with cache size = %.2f 
MB\n", cacheName, path, mbSize);
             os_log_error(logger, "%s: final cache content (compressed): %s\n", 
cacheName, [[_eventTable description] UTF8String]);
+#else
+            aslclient client = asl_open("FileViewCache", NULL, 
ASL_OPT_NO_DELAY);
+            aslmsg m = asl_new(ASL_TYPE_MSG);
+            asl_set(m, ASL_KEY_SENDER, "FileViewCache");
+            asl_log(client, m, ASL_LEVEL_ERR, "%s: removing %s with cache size 
= %.2f MB\n", cacheName, path, mbSize);
+            asl_log(client, m, ASL_LEVEL_ERR, "%s: final cache content 
(compressed): %s\n", cacheName, [[_eventTable description] UTF8String]);
+            asl_free(m);
+            asl_close(client);
+#endif
         }
         else {
             std::string errMsg = std::string("stat failed \"") + path + "\"";
@@ -269,7 +287,16 @@
     if (scheme) CFRelease(scheme);
     
     if (FVCacheLogLevel > 1) {
+#if defined(MAC_OS_X_VERSION_10_13) && MAC_OS_X_VERSION_MIN_REQUIRED >= 
MAC_OS_X_VERSION_10_13
         os_log_error(logger, "caching image for %s, size = %.2f kBytes\n", 
[[key description] UTF8String], kbytes);
+#else
+        aslclient client = asl_open("FileViewCache", NULL, ASL_OPT_NO_DELAY);
+        aslmsg m = asl_new(ASL_TYPE_MSG);
+        asl_set(m, ASL_KEY_SENDER, "FileViewCache");
+        asl_log(client, m, ASL_LEVEL_ERR, "caching image for %s, size = %.2f 
kBytes\n", [[key description] UTF8String], kbytes);
+        asl_free(m);
+        asl_close(client);
+#endif
     }
 }
 

Modified: trunk/bibdesk_vendorsrc/amaxwell/FileView/FVFileView.m
===================================================================
--- trunk/bibdesk_vendorsrc/amaxwell/FileView/FVFileView.m      2023-11-04 
10:24:07 UTC (rev 28416)
+++ trunk/bibdesk_vendorsrc/amaxwell/FileView/FVFileView.m      2023-11-04 
10:40:23 UTC (rev 28417)
@@ -3294,7 +3294,11 @@
         if (name == nil)
             name = [[theURL path] lastPathComponent];
     } else {
+#if defined(MAC_OS_X_VERSION_10_9) && MAC_OS_X_VERSION_MIN_REQUIRED >= 
MAC_OS_X_VERSION_10_9
         name = [[theURL absoluteString] stringByRemovingPercentEncoding];
+#else
+        name = [[theURL absoluteString] 
stringByReplacingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
+#endif
     }
     if (isTitle && [_dataSource 
respondsToSelector:@selector(fileView:subtitleAtIndex:)]) {
         NSString *subtitle = [self subtitleAtIndex:i];
@@ -4872,7 +4876,11 @@
             NSRange range = [name rangeOfString:@"://"];
             if (range.location != NSNotFound)
                 name = [name substringFromIndex:NSMaxRange(range)];
+#if defined(MAC_OS_X_VERSION_10_9) && MAC_OS_X_VERSION_MIN_REQUIRED >= 
MAC_OS_X_VERSION_10_9
             _name = [[name stringByRemovingPercentEncoding] copyWithZone:[self 
zone]];
+#else
+            _name = [[name 
stringByReplacingPercentEscapesUsingEncoding:NSUTF8StringEncoding] 
copyWithZone:[self zone]];
+#endif
         }
         _label = [FVFinderLabel finderLabelForURL:aURL];
     }

This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.



_______________________________________________
Bibdesk-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bibdesk-commit

Reply via email to