13.07.2015 Views

Beginning Objective-C pdf - EBook Free Download

Beginning Objective-C pdf - EBook Free Download

Beginning Objective-C pdf - EBook Free Download

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

CHAPTER 5: Using the Filesystem 121{}if ( error != NULL )*error = [NSError errorWithDomain: NSPOSIXErrorDomaincode: errnouserInfo: nil];return ( NO );return ( YES );}- (NSSet *) extendedAttributeNames: (NSError **) error{if ( [self isFileURL] == NO ){if ( error != NULL )*error = [NSError errorWithDomain: NSPOSIXErrorDomaincode: EINVALuserInfo: nil];return ( nil );}const char * path = [[[self filePathURL] path] fileSystemRepresentation];ssize_t size = listxattr(path, NULL, 0, 0);if ( size == 0 )return ( nil );if ( size < 0 ){if ( error != NULL )*error = [NSError errorWithDomain: NSPOSIXErrorDomaincode: errnouserInfo: nil];return ( nil );}NSMutableSet * result = [NSMutableSet new];NSMutableData * buffer = [[NSMutableData alloc] initWithLength: size];if ( listxattr(path, [buffer mutableBytes], size, 0) < 0 ){if ( error != NULL )*error = [NSError errorWithDomain: NSPOSIXErrorDomaincode: errnouserInfo: nil];return ( nil );}const char * p = [buffer bytes];const char * e = p + size;while ( p < e ){[result addObject: [NSString stringWithUTF8String: p]];}www.it-ebooks.info

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!