Revision: 5244
          http://skim-app.svn.sourceforge.net/skim-app/?rev=5244&view=rev
Author:   hofman
Date:     2009-03-03 23:22:54 +0000 (Tue, 03 Mar 2009)

Log Message:
-----------
remove password ivar

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

Modified: trunk/SKPDFDocument.m
===================================================================
--- trunk/SKPDFDocument.m       2009-03-03 18:18:22 UTC (rev 5243)
+++ trunk/SKPDFDocument.m       2009-03-03 23:22:54 UTC (rev 5244)
@@ -97,7 +97,6 @@
 - (void)setNoteDicts:(NSArray *)array;
 - (void)setOpenMetaTags:(NSArray *)array;
 - (void)setOpenMetaRating:(double)rating;
-- (void)setPassword:(NSString *)newPassword;
 
 - (void)tryToUnlockDocument:(PDFDocument *)document;
 
@@ -128,7 +127,6 @@
     [watchedFile release];
     [pdfData release];
     [pdfDocument release];
-    [password release];
     [noteDicts release];
     [openMetaTags release];
     [readNotesAccessoryView release];
@@ -613,13 +611,6 @@
     openMetaRating = rating;
 }
 
-- (void)setPassword:(NSString *)newPassword {
-    if (password != newPassword) {
-        [password release];
-        password = [newPassword retain];
-    }
-}
-
 - (BOOL)readFromData:(NSData *)data ofType:(NSString *)docType error:(NSError 
**)outError;
 {
     BOOL didRead = NO;
@@ -937,8 +928,8 @@
     
     if (didConvert) {
         pdfDoc = [[PDFDocument alloc] initWithData:pdfData];
-        if ([pdfDoc isLocked] && password)
-            [pdfDoc unlockWithPassword:password];
+        if ([pdfDoc isLocked])
+            [self tryToUnlockDocument:pdfDoc];
         count = [pdfDoc pageCount];
         for (i = 0; i < count; i++) {
             PDFPage *page = [pdfDoc pageAtIndex:i];
@@ -1746,8 +1737,6 @@
     if ([[self pdfDocument] isLocked])
         return;
     
-    [self setPassword:aPassword];
-    
     int saveOption = [[NSUserDefaults standardUserDefaults] 
integerForKey:SKSavePasswordOptionKey];
     if (saveOption != NSAlertAlternateReturn) {
         const char *serviceName = [self keychainServiceName];
@@ -1787,7 +1776,7 @@
                     err = SecKeychainItemModifyAttributesAndData(itemRef, 
&attributes, strlen(passwordData), passwordData);
                 } else if(err == errSecItemNotFound){
                     // password not on keychain, so add it
-                    passwordData = [password UTF8String];
+                    passwordData = [aPassword UTF8String];
                     err = SecKeychainAddGenericPassword(NULL, 
strlen(serviceName), serviceName, strlen(userName), userName, 
strlen(passwordData), passwordData, &itemRef);    
                     if (err == noErr && comment != NULL) {
                         SecKeychainAttribute attrs[] = { { 
kSecCommentItemAttr, strlen(comment), (char *)comment } };
@@ -1816,8 +1805,7 @@
                 data = [NSData dataWithBytes:passwordData 
length:passwordLength];
                 SecKeychainItemFreeContent(NULL, passwordData);
                 aPassword = [[[NSString alloc] initWithData:data 
encoding:NSUTF8StringEncoding] autorelease];
-                if ([document unlockWithPassword:aPassword])
-                    [self setPassword:aPassword];
+                [document unlockWithPassword:aPassword];
             }
         }
     }


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

------------------------------------------------------------------------------
Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA
-OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise
-Strategies to boost innovation and cut costs with open source participation
-Receive a $600 discount off the registration fee with the source code: SFAD
http://p.sf.net/sfu/XcvMzF8H
_______________________________________________
Skim-app-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/skim-app-commit

Reply via email to