Source

SOExtendedAttributes / NSURL+SOExtendedAttributes.m

Diff from to

NSURL+SOExtendedAttributes.m

         if (bufferSize == 0) return attributeNames;
         
         /* Problemo? Bail now with the POSIX error. */
-        if (bufferSize == -1) 
+        if (bufferSize == -1)
         {
             attributeNames = nil;
-           if (outError) *outError = SOPOSIXErrorForURL(self);
+            if (outError) *outError = SOPOSIXErrorForURL(self);
             return nil;
         }
         
         /* Parse the name buffer for attribute names.
          
-         Iterate the buffer character by character, looking for a NULL byte. 
-         When found, collect the range of bytes into an NSString and cache in our names list. 
+         Iterate the buffer character by character, looking for a NULL byte.
+         When found, collect the range of bytes into an NSString and cache in our names list.
          */
         
         uintptr_t ptr_startOfBuffer = (uintptr_t)[namesBuffer mutableBytes];
     
     @autoreleasepool
     {
-        NSArray *attributeNames = [self namesOfExtendedAttributesWithError:outError];        
+        NSArray *attributeNames = [self namesOfExtendedAttributesWithError:outError];
         if (attributeNames == nil) return nil;
         
         /* Pull the value for each found extended attribute. */
         {
             NSMutableDictionary *errInfo = [NSMutableDictionary dictionary];
             [errInfo setObject:self forKey:NSURLErrorKey];
-            [errInfo setObject:collectedErrors forKey:NSUnderlyingErrorKey];                                
+            [errInfo setObject:collectedErrors forKey:NSUnderlyingErrorKey];
             *outError = [NSError errorWithDomain:SOExtendedAttributesErrorDomain code:SOExtendedAttributesGetValueError userInfo:errInfo];
         }
     }
     
     BOOL hasErrors = [collectedErrors count] > 0;
     if (hasErrors && outError)
-    {        
+    {
         NSMutableDictionary *errInfo = [NSMutableDictionary dictionary];
         [errInfo setObject:self forKey:NSURLErrorKey];
-        [errInfo setObject:collectedErrors forKey:NSUnderlyingErrorKey];                                
+        [errInfo setObject:collectedErrors forKey:NSUnderlyingErrorKey];
         *outError = [NSError errorWithDomain:SOExtendedAttributesErrorDomain code:SOExtendedAttributesSetValueError userInfo:errInfo];
         return NO;
     }
     
     id retrievedValue = nil;
     
-    @autoreleasepool 
+    @autoreleasepool
     {
         /* Get the size of the attribute value and pull it into an NSData is possible */
         
         /* Problemo? Bail out with error, ditching all collected attributes */
         
         if (dataSize == -1)
-        {        
+        {
             data = nil;
             if (outError) *outError = SOPOSIXErrorForURL(self);
+            
+        } else {
+            
+            /* Translate from encoded binary plist */
+            
+            retrievedValue = [NSPropertyListSerialization propertyListWithData:data options:NSPropertyListImmutable format:NULL error:outError];
         }
-        
-        /* Translate from encoded binary plist */
-        
-        retrievedValue = [NSPropertyListSerialization propertyListWithData:data options:NSPropertyListImmutable format:NULL error:outError];
     }
     
     return retrievedValue;
     if (err != 0)
     {
         /* Ignore any ENOATTR error ('attribute not found'), but capture and return all others. */
-        if (errno != ENOATTR) 
+        if (errno != ENOATTR)
         {
             if (outError) *outError = SOPOSIXErrorForURL(self);
             return NO;
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.