norepi / macfuse

Automatically exported from code.google.com/p/macfuse
Other
0 stars 0 forks source link

Enhance GMAppleDouble Class #347

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
The GMAppleDouble class could be made much more useful by providing an inverse 
to the data: 
method.

First, move the GMAppleDoubleEntry interface to the GMAppleDouble,h header file 
(instead of 
declaring it privately in the implementation file).

Second, in the GMAppleDouble interface, make the entries_ instance variable 
@public.

Finally, add the method below to the GMAppleDouble class.

Doing all this will give a programmatic version of the 
SplitForks/FixupResourceForks tools.

====

- (id)initWithData:(NSData *)data {
    if ((self = [self init])) {
        DoubleHeader header;
        NSUInteger offset = sizeof(header);
        [data getBytes:&header length:offset];
        if ((header.magicNumber == htonl(0x00051607)) && (header.versionNumber == 
htonl(0x00020000))) {
            UInt16 count = ntohs(header.numberOfEntries);
            for (UInt16 i = 0; i < count; i++) {
                DoubleEntryHeader entryHeader;
                [data getBytes:&entryHeader range:NSMakeRange(offset, sizeof(entryHeader))];
                offset += sizeof(entryHeader);
                [entries_ addObject:[GMAppleDoubleEntry 
entryWithID:ntohl(entryHeader.entryID) data:[data 
subdataWithRange:NSMakeRange(ntohl(entryHeader.offset), 
ntohl(entryHeader.length))]]];
            }
        }
    }
    return self;  
}

Original issue reported on code.google.com by kolpa...@voodooergonomics.com on 5 May 2008 at 6:59

GoogleCodeExporter commented 8 years ago
It occurs to me that, instead of making the entries_ ivar @public, you could 
provide an accessor method to it.

Original comment by kolpa...@voodooergonomics.com on 5 May 2008 at 7:24

GoogleCodeExporter commented 8 years ago
I've changed this to an enhancement request, and reduced to low-priority since 
it
isn't directly needed to implement a user-space file system. That said, I'll 
probably
be able to find some time to do this before the next release of MacFUSE Core.

Original comment by inaddr...@gmail.com on 5 May 2008 at 8:15

GoogleCodeExporter commented 8 years ago
I've submitted changes to GMAppleDouble.{h,m} to add support for this. It will 
be in
the next release, but you can use it now if you pull down the head of the tree.
Please let me know if the changes don't work for what you are trying to do.

Original comment by inaddr...@gmail.com on 7 May 2008 at 5:25