]> git.lyx.org Git - lyx.git/commitdiff
#6961 correct the big-endian conversion of UInt32
authorPatrick de Visschere <pdvisschere@edpnet.be>
Sun, 8 Sep 2019 09:11:00 +0000 (11:11 +0200)
committerStephan Witt <switt@lyx.org>
Fri, 20 Sep 2019 17:57:01 +0000 (19:57 +0200)
This is a patch from Patrick de Visschere. Thanks.

(cherry picked from commit b70c3796a1f8752e0001701546f55a0d5feaf152)

src/support/linkback/LinkBackProxy.m
src/support/linkback/LinkBackServer.m
status.23x

index bf150c9ad618fcc8d8a2221bad5c82cc69777b17..574d5713cf5f0da015152b269e44c89d1f548a0a 100644 (file)
@@ -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);
                // 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;
                if (pdfLen >= [data length] - 4) {
                        NSLog(@"Invalid file %@ for LinkBack", fileName);
                        return NO;
                [file writeData:pdfData];
                [file writeData:linkBackData];
 
                [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];
                NSData * lenData = [NSData dataWithBytes:&pdfLen length:4];
                [file writeData:lenData];
                [file closeFile];
index dc8708d66d9674407eab1b88b4ee4de3b455a443..d089fca7715b126c19f4830a111c4cff4315a12b 100644 (file)
@@ -154,7 +154,6 @@ NSString* FindLinkBackServer(NSString* bundleIdentifier, NSString* serverName, N
 
 void LinkBackRunAppNotFoundPanel(NSString* appName, NSURL* url)
 {
 
 void LinkBackRunAppNotFoundPanel(NSString* appName, NSURL* url)
 {
-       int result ;
 
        // strings for panel
        NSBundle* b = [NSBundle bundleForClass: [LinkBack class]] ;
 
        // strings for panel
        NSBundle* b = [NSBundle bundleForClass: [LinkBack class]] ;
@@ -172,10 +171,16 @@ void LinkBackRunAppNotFoundPanel(NSString* appName, NSURL* url)
 
        title = [NSString stringWithFormat: title, appName] ;
 
 
        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
 }
 
 + (LinkBackServer*)LinkBackServerWithName:(NSString*)aName inApplication:(NSString*)bundleIdentifier launchIfNeeded:(BOOL)flag fallbackURL:(NSURL*)url appName:(NSString*)appName
index 6b2b027d81e0199d7da85442a50f385c8b73e744..66371093507cfba62915f24d2dadff730205c294 100644 (file)
@@ -108,6 +108,8 @@ What's new
 - Do not create unnecessary directories when exporting from the command
   line (bug 11636).
 
 - 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
 
 
 * USER INTERFACE