Revision: 5951
          http://skim-app.svn.sourceforge.net/skim-app/?rev=5951&view=rev
Author:   hofman
Date:     2009-10-26 15:12:39 +0000 (Mon, 26 Oct 2009)

Log Message:
-----------
arch dependent macro for permissions.mode of catalog info

Modified Paths:
--------------
    trunk/SKMainDocument.m

Modified: trunk/SKMainDocument.m
===================================================================
--- trunk/SKMainDocument.m      2009-10-26 12:13:46 UTC (rev 5950)
+++ trunk/SKMainDocument.m      2009-10-26 15:12:39 UTC (rev 5951)
@@ -336,6 +336,12 @@
     [super runModalSavePanelForSaveOperation:saveOperation delegate:self 
didSaveSelector:@selector(document:didSaveFromPanel:contextInfo:) 
contextInfo:invocation];
 }
 
+#ifdef __LP64__
+#define PERMISSIONS_MODE(catalogInfo) catalogInfo.permissions.mode
+#else
+#define PERMISSIONS_MODE(catalogInfo) ((FSPermissionInfo 
*)catalogInfo.permissions)->mode;
+#endif
+
 - (void)document:(NSDocument *)doc didSave:(BOOL)didSave contextInfo:(void  
*)contextInfo {
     NSDictionary *info = [(id)contextInfo autorelease];
     NSURL *absoluteURL = [info objectForKey:@"URL"];
@@ -390,14 +396,8 @@
             FSCatalogInfoBitmap whichInfo = kFSCatInfoNone;
             if (CFURLGetFSRef((CFURLRef)absoluteURL, &fileRef) &&
                 noErr == FSGetCatalogInfo(&fileRef, kFSCatInfoNodeFlags | 
kFSCatInfoPermissions, &catalogInfo, NULL, NULL, NULL)) {
-                FSPermissionInfo *permissions;
-#ifdef __LP64__
-                permissions = &catalogInfo.permissions;
-#else
-                permissions = (FSPermissionInfo *)catalogInfo.permissions;
-#endif
                 isLocked = (catalogInfo.nodeFlags & kFSNodeLockedMask) != 0;
-                isReadOnly = (permissions->mode & 0x80) == 0;
+                isReadOnly = (PERMISSIONS_MODE(catalogInfo) & 0x80) == 0;
                 
                 if (isLocked || isReadOnly) {
                     FSCatalogInfo tmpCatalogInfo = catalogInfo;
@@ -406,11 +406,7 @@
                         whichInfo |= kFSNodeLockedMask;
                     }
                     if (isReadOnly) {
-#ifdef __LP64__
-                        tmpCatalogInfo.permissions.mode |= 0x80;
-#else
-                        ((FSPermissionInfo *)tmpCatalogInfo.permissions)->mode 
|= 0x80;
-#endif
+                        PERMISSIONS_MODE(tmpCatalogInfo) |= 0x80;
                         whichInfo |= kFSCatInfoPermissions;
                     }
                     (void)FSSetCatalogInfo(&fileRef, whichInfo, 
&tmpCatalogInfo);


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

------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay 
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
Skim-app-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/skim-app-commit

Reply via email to