~ubuntu-branches/ubuntu/precise/p7zip/precise-updates

« back to all changes in this revision

Viewing changes to CPP/7zip/Archive/Com/ComIn.h

  • Committer: Bazaar Package Importer
  • Author(s): Mohammed Adnène Trojette
  • Date: 2007-09-16 23:19:51 UTC
  • mfrom: (1.1.8 upstream)
  • Revision ID: james.westby@ubuntu.com-20070916231951-r2g4o2gbgx6ucv2u
Tags: 4.55~dfsg.1-2
* Bump debhelper compatibility to 5.
* Our Makefile is called makefile. (Closes: #442697)

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
// Archive/ComIn.h
 
2
 
 
3
#ifndef __ARCHIVE_COM_IN_H
 
4
#define __ARCHIVE_COM_IN_H
 
5
 
 
6
#include "Common/MyString.h"
 
7
#include "Common/Buffer.h"
 
8
 
 
9
namespace NArchive {
 
10
namespace NCom {
 
11
 
 
12
struct CUInt32Buf
 
13
{
 
14
  UInt32 *_buf;
 
15
public:
 
16
  CUInt32Buf(): _buf(0) {}
 
17
  ~CUInt32Buf() { Free(); }
 
18
  void Free();
 
19
  bool Allocate(UInt32 numItems);
 
20
  operator UInt32 *() const { return _buf; };
 
21
};
 
22
 
 
23
namespace NFatID
 
24
{
 
25
  const UInt32 kFree       = 0xFFFFFFFF;
 
26
  const UInt32 kEndOfChain = 0xFFFFFFFE;
 
27
  const UInt32 kFatSector  = 0xFFFFFFFD;
 
28
  const UInt32 kMatSector  = 0xFFFFFFFC;
 
29
  const UInt32 kMaxValue   = 0xFFFFFFFA;
 
30
}
 
31
 
 
32
namespace NItemType
 
33
{
 
34
  const Byte kEmpty = 0;
 
35
  const Byte kStorage = 1;
 
36
  const Byte kStream = 2;
 
37
  const Byte kLockBytes = 3;
 
38
  const Byte kProperty = 4;
 
39
  const Byte kRootStorage = 5;
 
40
}
 
41
 
 
42
const UInt32 kNameSizeMax = 64;
 
43
 
 
44
struct CItem
 
45
{
 
46
  Byte Name[kNameSizeMax];
 
47
  // UInt16 NameSize;
 
48
  // UInt32 Flags;
 
49
  FILETIME CreationTime;
 
50
  FILETIME LastWriteTime;
 
51
  UInt64 Size;
 
52
  UInt32 LeftDid;
 
53
  UInt32 RightDid;
 
54
  UInt32 SonDid;
 
55
  UInt32 Sid;
 
56
  Byte Type;
 
57
 
 
58
  bool IsEmpty() const { return Type == NItemType::kEmpty; }
 
59
  bool IsDir() const { return Type == NItemType::kStorage || Type == NItemType::kRootStorage; }
 
60
};
 
61
 
 
62
struct CRef
 
63
{
 
64
  int Parent;
 
65
  UInt32 Did;
 
66
};
 
67
 
 
68
class CDatabase
 
69
{
 
70
public:
 
71
  HRESULT AddNode(int parent, UInt32 did);
 
72
 
 
73
  CUInt32Buf Fat;
 
74
  UInt32 FatSize;
 
75
  
 
76
  CUInt32Buf MiniSids;
 
77
  UInt32 NumSectorsInMiniStream;
 
78
 
 
79
  CUInt32Buf Mat;
 
80
  UInt32 MatSize;
 
81
 
 
82
  CObjectVector<CItem> Items;
 
83
  CRecordVector<CRef> Refs;
 
84
 
 
85
  UInt32 LongStreamMinSize;
 
86
  int SectorSizeBits;
 
87
  int MiniSectorSizeBits;
 
88
 
 
89
  void Clear()
 
90
  {
 
91
    Fat.Free();
 
92
    MiniSids.Free();
 
93
    Mat.Free();
 
94
    Items.Clear();
 
95
    Refs.Clear();
 
96
  }
 
97
 
 
98
  bool IsLargeStream(UInt64 size) { return size >= LongStreamMinSize; }
 
99
  UString GetItemPath(UInt32 index) const;
 
100
};
 
101
 
 
102
HRESULT OpenArchive(IInStream *inStream, CDatabase &database);
 
103
 
 
104
}}
 
105
  
 
106
#endif