uriloader/exthandler/mac/nsDecodeAppleFile.h

Wed, 31 Dec 2014 07:53:36 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 07:53:36 +0100
branch
TOR_BUG_3246
changeset 5
4ab42b5ab56c
permissions
-rw-r--r--

Correct small whitespace inconsistency, lost while renaming variables.

michael@0 1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
michael@0 2 /* This Source Code Form is subject to the terms of the Mozilla Public
michael@0 3 * License, v. 2.0. If a copy of the MPL was not distributed with this
michael@0 4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
michael@0 5
michael@0 6 #ifndef nsDecodeAppleFile_h__
michael@0 7 #define nsDecodeAppleFile_h__
michael@0 8
michael@0 9 #include "nscore.h"
michael@0 10 #include "nsCOMPtr.h"
michael@0 11 #include "nsIFile.h"
michael@0 12 #include "nsILocalFileMac.h"
michael@0 13 #include "nsIOutputStream.h"
michael@0 14
michael@0 15 /*
michael@0 16 ** applefile definitions used
michael@0 17 */
michael@0 18 #if PRAGMA_STRUCT_ALIGN
michael@0 19 #pragma options align=mac68k
michael@0 20 #endif
michael@0 21
michael@0 22 #define APPLESINGLE_MAGIC 0x00051600L
michael@0 23 #define APPLEDOUBLE_MAGIC 0x00051607L
michael@0 24 #define VERSION 0x00020000
michael@0 25
michael@0 26 #define NUM_ENTRIES 6
michael@0 27
michael@0 28 #define ENT_DFORK 1L
michael@0 29 #define ENT_RFORK 2L
michael@0 30 #define ENT_NAME 3L
michael@0 31 #define ENT_COMMENT 4L
michael@0 32 #define ENT_DATES 8L
michael@0 33 #define ENT_FINFO 9L
michael@0 34
michael@0 35 #define CONVERT_TIME 1265437696L
michael@0 36
michael@0 37 /*
michael@0 38 ** data type used in the header decoder.
michael@0 39 */
michael@0 40 typedef struct ap_header
michael@0 41 {
michael@0 42 int32_t magic;
michael@0 43 int32_t version;
michael@0 44 int32_t fill[4];
michael@0 45 int16_t entriesCount;
michael@0 46
michael@0 47 } ap_header;
michael@0 48
michael@0 49 typedef struct ap_entry
michael@0 50 {
michael@0 51 int32_t id;
michael@0 52 int32_t offset;
michael@0 53 int32_t length;
michael@0 54
michael@0 55 } ap_entry;
michael@0 56
michael@0 57 typedef struct ap_dates
michael@0 58 {
michael@0 59 int32_t create, modify, backup, access;
michael@0 60
michael@0 61 } ap_dates;
michael@0 62
michael@0 63 #if PRAGMA_STRUCT_ALIGN
michael@0 64 #pragma options align=reset
michael@0 65 #endif
michael@0 66
michael@0 67 /*
michael@0 68 **Error codes
michael@0 69 */
michael@0 70 enum {
michael@0 71 errADNotEnoughData = -12099,
michael@0 72 errADNotSupported,
michael@0 73 errADBadVersion
michael@0 74 };
michael@0 75
michael@0 76
michael@0 77 class nsDecodeAppleFile : public nsIOutputStream
michael@0 78 {
michael@0 79 public:
michael@0 80 NS_DECL_THREADSAFE_ISUPPORTS
michael@0 81 NS_DECL_NSIOUTPUTSTREAM
michael@0 82
michael@0 83 nsDecodeAppleFile();
michael@0 84 virtual ~nsDecodeAppleFile();
michael@0 85
michael@0 86 nsresult Initialize(nsIOutputStream *output, nsIFile *file);
michael@0 87
michael@0 88 private:
michael@0 89 #define MAX_BUFFERSIZE 1024
michael@0 90 enum ParserState {parseHeaders, parseEntries, parseLookupPart, parsePart, parseSkipPart,
michael@0 91 parseDataFork, parseResourceFork, parseWriteThrough};
michael@0 92
michael@0 93 nsCOMPtr<nsIOutputStream> m_output;
michael@0 94 FSSpec m_fsFileSpec;
michael@0 95 SInt16 m_rfRefNum;
michael@0 96
michael@0 97 unsigned char * m_dataBuffer;
michael@0 98 int32_t m_dataBufferLength;
michael@0 99 ParserState m_state;
michael@0 100 ap_header m_headers;
michael@0 101 ap_entry * m_entries;
michael@0 102 int32_t m_offset;
michael@0 103 int32_t m_dataForkOffset;
michael@0 104 int32_t m_totalDataForkWritten;
michael@0 105 int32_t m_totalResourceForkWritten;
michael@0 106 bool m_headerOk;
michael@0 107
michael@0 108 int32_t m_currentPartID;
michael@0 109 int32_t m_currentPartLength;
michael@0 110 int32_t m_currentPartCount;
michael@0 111
michael@0 112 Str255 m_comment;
michael@0 113 ap_dates m_dates;
michael@0 114 FInfo m_finderInfo;
michael@0 115 FXInfo m_finderExtraInfo;
michael@0 116 };
michael@0 117
michael@0 118 #endif

mercurial