Commit 71025ac3 authored by darin's avatar darin
Browse files

Reviewed by Maciej.

	- fixed 3128858 -- Supply Finder bits for decoded BinHex files

        * Downloads.subproj/WebBinHexDecoder.h: Add a _finderFlags field.
        * Downloads.subproj/WebBinHexDecoder.m:
        (-[WebBinHexDecoder decodeHeader]): Decode Finder flags.
        (-[WebBinHexDecoder fileAttributes]): Put Finder flags in dictionary.

        * Downloads.subproj/WebMacBinaryDecoder.m: Tweaked things for no good reason.
	(It is good to always import your own header first as a check that it's self-sufficient).

        * WebKit.pbproj/project.pbxproj: Let Electron wipe the slate clean of pre-Electron iniquity.


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@3079 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent a93db722
2002-12-16 Darin Adler <darin@apple.com>
Reviewed by Maciej.
- fixed 3128858 -- Supply Finder bits for decoded BinHex files
* Downloads.subproj/WebBinHexDecoder.h: Add a _finderFlags field.
* Downloads.subproj/WebBinHexDecoder.m:
(-[WebBinHexDecoder decodeHeader]): Decode Finder flags.
(-[WebBinHexDecoder fileAttributes]): Put Finder flags in dictionary.
* Downloads.subproj/WebMacBinaryDecoder.m: Tweaked things for no good reason.
(It is good to always import your own header first as a check that it's self-sufficient).
* WebKit.pbproj/project.pbxproj: Let Electron wipe the slate clean of pre-Electron iniquity.
2002-12-15 Chris Blumenberg <cblu@apple.com>
Fixed: 3094928 - Apply Finder bits to decoded downloads
......
......@@ -36,6 +36,7 @@
unsigned char _name[64];
OSType _fileType;
OSType _fileCreator;
uint32_t _finderFlags;
int _dataForkLengthRemaining;
int _resourceForkLengthRemaining;
......
......@@ -12,6 +12,7 @@
#import "WebBinHexDecoder.h"
#import <WebFoundation/WebAssertions.h>
#import <WebFoundation/WebNSFileManagerExtras.h>
#define SKIP_CHARACTER 0x40
#define END_CHARACTER 0x41
......@@ -251,9 +252,14 @@ - (void)decodeHeader
memcpy(_name, header.name, header.name[0] + 1);
_fileType = (((((header.remainder[1] << 8) | header.remainder[2]) << 8) | header.remainder[3]) << 8) | header.remainder[4];
_fileCreator = (((((header.remainder[5] << 8) | header.remainder[6]) << 8) | header.remainder[7]) << 8) | header.remainder[8];
_finderFlags = (header.remainder[9] << 8) | header.remainder[10];
_dataForkLengthRemaining = (((((header.remainder[11] << 8) | header.remainder[12]) << 8) | header.remainder[13]) << 8) | header.remainder[14];
_resourceForkLengthRemaining = (((((header.remainder[15] << 8) | header.remainder[16]) << 8) | header.remainder[17]) << 8) | header.remainder[18];
// Mask off to the only fields in BinHex that we want to respect.
// Most flags just aren't supported in BinHex files even though there's a 16-bit field.
_finderFlags &= kHasBundle | kIsStationery;
// Reset the CRC so it's ready to compute a fork CRC.
_CRC = 0;
}
......@@ -357,6 +363,7 @@ - (NSDictionary *)fileAttributes
return [NSDictionary dictionaryWithObjectsAndKeys:
[NSNumber numberWithUnsignedLong:_fileType], NSFileHFSTypeCode,
[NSNumber numberWithUnsignedLong:_fileCreator], NSFileHFSCreatorCode,
[NSNumber numberWithUnsignedShort:_finderFlags], WebFinderInfo,
nil];
}
......
......@@ -17,8 +17,8 @@
int _dataForkLength;
int _resourceForkLength;
u_int16_t _finderInfo;
u_int16_t _extendedFinderInfo;
u_int16_t _finderFlags;
u_int16_t _extendedFinderFlags;
u_int32_t _creationDate;
u_int32_t _modificationDate;
OSType _fileType;
......
......@@ -7,12 +7,13 @@
// This decoder decodes MacBinary II and might also work for MacBinary III.
// There's also MacBinary I, which we do not attempt to support.
#import <WebKit/WebDownloadDecoder.h>
#import <WebKit/WebMacBinaryDecoder.h>
#import <WebFoundation/WebAssertions.h>
#import <WebFoundation/WebNSFileManagerExtras.h>
#import <WebKit/WebDownloadDecoder.h>
#import "crc16.h"
#define HEADER_SIZE 128
......@@ -97,12 +98,12 @@ - (BOOL)decodeData:(NSData *)data dataForkData:(NSData **)dataForkData resourceF
_resourceForkLength = (((((header[87] << 8) | header[88]) << 8) | header[89]) << 8) | header[90];
_creationDate = (((((header[91] << 8) | header[92]) << 8) | header[93]) << 8) | header[94];
_modificationDate = (((((header[95] << 8) | header[96]) << 8) | header[97]) << 8) | header[98];
_finderInfo = ((header[73] << 8) | header[101]);
_extendedFinderInfo = header[107];
_finderFlags = (header[73] << 8) | header[101];
_extendedFinderFlags = header[107];
// Clear reserved bits or bits not applicable after transfer as defined in Finder.h.
_finderInfo &= kColor | kIsShared | kHasCustomIcon | kIsStationery | kHasBundle | kIsAlias;
_extendedFinderInfo &= kExtendedFlagHasCustomBadge | kExtendedFlagHasRoutingInfo;
_finderFlags &= kColor | kIsShared | kHasCustomIcon | kIsStationery | kHasBundle | kIsAlias;
_extendedFinderFlags &= kExtendedFlagHasCustomBadge | kExtendedFlagHasRoutingInfo;
// MacBinary III.
if (header[102] == 'm' && header[103] == 'B' && header[104] == 'I' && header[105] == 'N') {
......@@ -153,14 +154,13 @@ - (NSDictionary *)fileAttributes
{
ASSERT(_offset >= HEADER_SIZE);
// FIXME: What about other parts of Finder info? Bundle bit, for example.
return [NSDictionary dictionaryWithObjectsAndKeys:
[NSDate dateWithTimeIntervalSinceReferenceDate:kCFAbsoluteTimeIntervalSince1904 + _creationDate], NSFileCreationDate,
[NSDate dateWithTimeIntervalSinceReferenceDate:kCFAbsoluteTimeIntervalSince1904 + _modificationDate], NSFileModificationDate,
[NSNumber numberWithUnsignedLong:_fileType], NSFileHFSTypeCode,
[NSNumber numberWithUnsignedLong:_fileCreator], NSFileHFSCreatorCode,
[NSNumber numberWithUnsignedShort:_finderInfo], WebFinderInfo,
[NSNumber numberWithUnsignedShort:_extendedFinderInfo], WebExtendedFinderInfo,
[NSNumber numberWithUnsignedShort:_finderFlags], WebFinderInfo,
[NSNumber numberWithUnsignedShort:_extendedFinderFlags], WebExtendedFinderInfo,
nil];
}
......
......@@ -185,7 +185,6 @@
</dict>
</plist>
";
shouldUseHeadermap = 0;
};
0867D69DFE84028FC02AAC07 = {
buildActionMask = 2147483647;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment