commit 37f987afc981ae8dfbf697e097b7b18c7404f544
Author: Patrick de Visschere <[email protected]>
Date: Sun Sep 8 11:11:00 2019 +0200
#6961 correct the big-endian conversion of UInt32
This is a patch from Patrick de Visschere. Thanks.
(cherry picked from commit b70c3796a1f8752e0001701546f55a0d5feaf152)
---
src/support/linkback/LinkBackProxy.m | 4 ++--
src/support/linkback/LinkBackServer.m | 15 ++++++++++-----
status.23x | 2 ++
3 files changed, 14 insertions(+), 7 deletions(-)
diff --git a/src/support/linkback/LinkBackProxy.m
b/src/support/linkback/LinkBackProxy.m
index bf150c9..574d571 100644
--- a/src/support/linkback/LinkBackProxy.m
+++ b/src/support/linkback/LinkBackProxy.m
@@ -65,7 +65,7 @@
// The pdf data length are the last 4 bytes.
UInt32 pdfLen = 0;
pdfLen = *(UInt32 const *)(((UInt8 const *)[data bytes]) +
[data length] - 4);
- pdfLen = NSSwapBigLongToHost(pdfLen); // make it big endian
+ pdfLen = NSSwapBigIntToHost(pdfLen); // make it big endian
if (pdfLen >= [data length] - 4) {
NSLog(@"Invalid file %@ for LinkBack", fileName);
return NO;
@@ -154,7 +154,7 @@
[file writeData:pdfData];
[file writeData:linkBackData];
- UInt32 pdfLen = NSSwapHostLongToBig([pdfData length]); // big
endian
+ UInt32 pdfLen = NSSwapHostIntToBig([pdfData length]); // big
endian
NSData * lenData = [NSData dataWithBytes:&pdfLen length:4];
[file writeData:lenData];
[file closeFile];
diff --git a/src/support/linkback/LinkBackServer.m
b/src/support/linkback/LinkBackServer.m
index dc8708d..d089fca 100644
--- a/src/support/linkback/LinkBackServer.m
+++ b/src/support/linkback/LinkBackServer.m
@@ -154,7 +154,6 @@ NSString* FindLinkBackServer(NSString* bundleIdentifier,
NSString* serverName, N
void LinkBackRunAppNotFoundPanel(NSString* appName, NSURL* url)
{
- int result ;
// strings for panel
NSBundle* b = [NSBundle bundleForClass: [LinkBack class]] ;
@@ -172,10 +171,16 @@ void LinkBackRunAppNotFoundPanel(NSString* appName,
NSURL* url)
title = [NSString stringWithFormat: title, appName] ;
- result = NSRunCriticalAlertPanel(title, @"%@", ok, urlstr, nil, msg) ;
- if (NSAlertAlternateReturn == result) {
- [[NSWorkspace sharedWorkspace] openURL: url] ;
- }
+ NSAlert* alert = [[NSAlert alloc] init];
+ [alert setAlertStyle:NSAlertStyleCritical];
+ [alert setMessageText:title];
+ [alert setInformativeText:[NSString stringWithFormat:@"%@", msg]];
+ [alert addButtonWithTitle:ok];
+ [alert addButtonWithTitle:urlstr];
+ [alert beginSheetModalForWindow:[NSApp mainWindow]
completionHandler:^(NSModalResponse returnCode) {
+ if (returnCode == NSAlertSecondButtonReturn)
+ [[NSWorkspace sharedWorkspace] openURL: url] ;
+ }];
}
+ (LinkBackServer*)LinkBackServerWithName:(NSString*)aName
inApplication:(NSString*)bundleIdentifier launchIfNeeded:(BOOL)flag
fallbackURL:(NSURL*)url appName:(NSString*)appName
diff --git a/status.23x b/status.23x
index 6b2b027..6637109 100644
--- a/status.23x
+++ b/status.23x
@@ -108,6 +108,8 @@ What's new
- Do not create unnecessary directories when exporting from the command
line (bug 11636).
+- Fix problem with included objects with Linkback service on Mac (bug 6961).
+
* USER INTERFACE