VeraCrypt
aboutsummaryrefslogtreecommitdiff
path: root/src/Common/zlib/inftrees.h
blob: baa53a0b1a199ce6ea4c3f99d0306502ab4fab2c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
/* inftrees.h -- header to use inftrees.c
 * Copyright (C) 1995-2005, 2010 Mark Adler
 * For conditions of distribution and use, see copyright notice in zlib.h
 */

/* WARNING: this file should *not* be used by applications. It is
   part of the implementation of the compression library and is
   subject to change. Applications should only use zlib.h.
 */

/* Structure for decoding tables.  Each entry provides either the
   information needed to do the operation requested by the code that
   indexed that table entry, or it provides a pointer to another
   table that indexes more bits of the code.  op indicates whether
   the entry is a pointer to another table, a literal, a length or
   distance, an end-of-block, or an invalid code.  For a table
   pointer, the low four bits of op is the number of index bits of
   that table.  For a length or distance, the low four bits of op
   is the number of extra bits to get after the code.  bits is
   the number of bits in this code or part of the code to drop off
   of the bit buffer.  val is the actual byte to output in the case
   of a literal, the base length or distance, or the offset from
   the current table to the next table.  Each entry is four bytes. */
typedef struct {
    unsigned char op;           /* operation, extra bits, table bits */
    unsigned char bits;         /* bits in this part of the code */
    unsigned short val;         /* offset in table or code value */
} code;

/* op values as set by inflate_table():
    00000000 - literal
    0000tttt - table link, tttt != 0 is the number of table index bits
    0001eeee - length or distance, eeee is the number of extra bits
    01100000 - end of block
    01000000 - invalid code
 */

/* Maximum size of the dynamic table.  The maximum number of code structures is
   1444, which is the sum of 852 for literal/length codes and 592 for distance
   codes.  These values were found by exhaustive searches using the program
   examples/enough.c found in the zlib distribtution.  The arguments to that
   program are the number of symbols, the initial root table size, and the
   maximum bit length of a code.  "enough 286 9 15" for literal/length codes
   returns returns 852, and "enough 30 6 15" for distance codes returns 592.
   The initial root table size (9 or 6) is found in the fifth argument of the
   inflate_table() calls in inflate.c and infback.c.  If the root table size is
   changed, then these maximum sizes would be need to be recalculated and
   updated. */
#define ENOUGH_LENS 852
#define ENOUGH_DISTS 592
#define ENOUGH (ENOUGH_LENS+ENOUGH_DISTS)

/* Type of code to build for inflate_table() */
typedef enum {
    CODES,
    LENS,
    DISTS
} codetype;

int ZLIB_INTERNAL inflate_table OF((codetype type, unsigned short FAR *lens,
                             unsigned codes, code FAR * FAR *table,
                             unsigned FAR *bits, unsigned short FAR *work));
s="n">virtual void AppendToListCtrl (wxListCtrl *listCtrl, const vector <wstring> &itemFields, int imageIndex = -1, void *itemDataPtr = nullptr) const; virtual wxMenuItem *AppendToMenu (wxMenu &menu, const wxString &label, wxEvtHandler *handler = nullptr, wxObjectEventFunction handlerFunction = nullptr, int itemId = wxID_ANY) const; virtual bool AskYesNo (const wxString &message, bool defaultYes = false, bool warning = false) const; virtual void AutoDismountVolumes (VolumeInfoList mountedVolumes, bool alwaysForce = true); virtual void BackupVolumeHeaders (shared_ptr <VolumePath> volumePath) const; virtual void BeginBusyState () const { wxBeginBusyCursor(); } virtual void BeginInteractiveBusyState (wxWindow *window); virtual void ChangePassword (shared_ptr <VolumePath> volumePath = shared_ptr <VolumePath>(), shared_ptr <VolumePassword> password = shared_ptr <VolumePassword>(), int pim = 0, shared_ptr <Hash> currentHash = shared_ptr <Hash>(), bool truecryptMode = false, shared_ptr <KeyfileList> keyfiles = shared_ptr <KeyfileList>(), shared_ptr <VolumePassword> newPassword = shared_ptr <VolumePassword>(), int newPim = 0, shared_ptr <KeyfileList> newKeyfiles = shared_ptr <KeyfileList>(), shared_ptr <Hash> newHash = shared_ptr <Hash>()) const { ThrowTextModeRequired(); } wxHyperlinkCtrl *CreateHyperlink (wxWindow *parent, const wxString &linkUrl, const wxString &linkText) const; virtual void CreateKeyfile (shared_ptr <FilePath> keyfilePath = shared_ptr <FilePath>()) const; virtual void CreateVolume (shared_ptr <VolumeCreationOptions> options) const { ThrowTextModeRequired(); } virtual void ClearListCtrlSelection (wxListCtrl *listCtrl) const; virtual void DeleteSecurityTokenKeyfiles () const { ThrowTextModeRequired(); } virtual void DoShowError (const wxString &message) const; virtual void DoShowInfo (const wxString &message) const; virtual void DoShowString (const wxString &str) const; virtual void DoShowWarning (const wxString &message) const; virtual void EndBusyState () const { wxEndBusyCursor(); } virtual void EndInteractiveBusyState (wxWindow *window) const; virtual void ExportSecurityTokenKeyfile () const { ThrowTextModeRequired(); } virtual wxTopLevelWindow *GetActiveWindow () const; virtual shared_ptr <GetStringFunctor> GetAdminPasswordRequestHandler (); virtual int GetCharHeight (wxWindow *window) const; virtual int GetCharWidth (wxWindow *window) const; virtual int GetDefaultBorderSize () const { return 5; } virtual wxFont GetDefaultBoldFont (wxWindow *window) const; virtual wxString GetHomepageLinkURL (const wxString &linkId, const wxString &extraVars = wxEmptyString) const; virtual wxFrame *GetMainFrame () const { return mMainFrame; } virtual int GetScrollbarWidth (wxWindow *window, bool noScrollBar = false) const; virtual list <long> GetListCtrlSelectedItems (wxListCtrl *listCtrl) const; virtual wxString GetListCtrlSubItemText (wxListCtrl *listCtrl, long itemIndex, int columnIndex) const; virtual void ImportSecurityTokenKeyfiles () const { ThrowTextModeRequired(); } virtual void InitSecurityTokenLibrary () const; virtual void InsertToListCtrl (wxListCtrl *listCtrl, long itemIndex, const vector <wstring> &itemFields, int imageIndex = -1, void *itemDataPtr = nullptr) const; virtual bool IsInBackgroundMode () const { return BackgroundMode; } virtual bool IsTheOnlyTopLevelWindow (const wxWindow *window) const; virtual void ListSecurityTokenKeyfiles () const; virtual VolumeInfoList MountAllDeviceHostedVolumes (MountOptions &options) const; virtual shared_ptr <VolumeInfo> MountVolume (MountOptions &options) const; virtual void MoveListCtrlItem (wxListCtrl *listCtrl, long itemIndex, long newItemIndex) const; virtual void OnAutoDismountAllEvent (); virtual bool OnInit (); virtual void OnLogOff (); virtual void OpenDocument (wxWindow *parent, const wxFileName &document); virtual void OpenHomepageLink (wxWindow *parent, const wxString &linkId, const wxString &extraVars = wxEmptyString); virtual void OpenOnlineHelp (wxWindow *parent); virtual void OpenUserGuide (wxWindow *parent); virtual void RestoreVolumeHeaders (shared_ptr <VolumePath> volumePath) const; virtual DevicePath SelectDevice (wxWindow *parent) const; virtual DirectoryPath SelectDirectory (wxWindow *parent, const wxString &message = wxEmptyString, bool existingOnly = true) const; virtual FilePathList SelectFiles (wxWindow *parent, const wxString &caption, bool saveMode = false, bool allowMultiple = false, const list < pair <wstring, wstring> > &fileExtensions = (list < pair <wstring, wstring> > ()), const DirectoryPath &directory = DirectoryPath()) const; virtual FilePath SelectVolumeFile (wxWindow *parent, bool saveMode = false, const DirectoryPath &directory = DirectoryPath()) const; virtual void SetActiveFrame (wxFrame *frame) { ActiveFrame = frame; } virtual void SetBackgroundMode (bool state); virtual void SetListCtrlColumnWidths (wxListCtrl *listCtrl, list <int> columnWidthPermilles, bool hasVerticalScrollbar = true) const; virtual void SetListCtrlHeight (wxListCtrl *listCtrl, size_t rowCount) const; virtual void SetListCtrlWidth (wxListCtrl *listCtrl, size_t charCount, bool hasVerticalScrollbar = true) const; virtual void ShowErrorTopMost (char *langStringId) const { ShowErrorTopMost (LangString[langStringId]); } virtual void ShowErrorTopMost (const wxString &message) const; virtual void ShowInfoTopMost (char *langStringId) const { ShowInfoTopMost (LangString[langStringId]); } virtual void ShowInfoTopMost (const wxString &message) const; virtual void ShowWarningTopMost (char *langStringId) const { ShowWarningTopMost (LangString[langStringId]); } virtual void ShowWarningTopMost (const wxString &message) const; virtual bool UpdateListCtrlItem (wxListCtrl *listCtrl, long itemIndex, const vector <wstring> &itemFields) const; virtual void UserEnrichRandomPool (wxWindow *parent, shared_ptr <Hash> hash = shared_ptr <Hash>()) const; virtual void Yield () const; virtual shared_ptr <VolumeInfo> MountVolumeThread (MountOptions &options) const; WaitDialog* GetWaitDialog () { return mWaitDialog; } void ExecuteWaitThreadRoutine (wxWindow *parent, WaitThreadRoutine *pRoutine) const; #ifdef TC_MACOSX virtual void MacOpenFiles (const wxArrayString &fileNames); virtual void MacReopenApp (); static bool HandlePasswordEntryCustomEvent (wxEvent& event); static void InstallPasswordEntryCustomKeyboardShortcuts (wxWindow* window); #endif template <class T> T *GetSelectedData (wxControlWithItems *control) const { int sel = control->GetSelection(); if (sel == wxNOT_FOUND) return nullptr; return reinterpret_cast <T *> (control->GetClientData (sel)); } Event OpenVolumeSystemRequestEvent; protected: virtual void OnEndSession (wxCloseEvent& event) { OnLogOff(); } #ifdef wxHAS_POWER_EVENTS virtual void OnPowerSuspending (wxPowerEvent& event); #endif static void OnSignal (int signal); virtual void OnVolumesAutoDismounted (); virtual int ShowMessage (const wxString &message, long style, bool topMost = false) const; void ThrowTextModeRequired () const; wxFrame *ActiveFrame; bool BackgroundMode; #ifdef TC_WINDOWS unique_ptr <wxDDEServer> DDEServer; #endif wxFrame *mMainFrame; unique_ptr <wxSingleInstanceChecker> SingleInstanceChecker; mutable WaitDialog* mWaitDialog; public: #ifdef TC_MACOSX static int g_customIdCmdV; static int g_customIdCmdA; #endif private: GraphicUserInterface (const GraphicUserInterface &); GraphicUserInterface &operator= (const GraphicUserInterface &); }; struct OpenVolumeSystemRequestEventArgs : public EventArgs { OpenVolumeSystemRequestEventArgs (const wxString &volumePath) : mVolumePath (volumePath) { } wxString mVolumePath; }; class FreezeScope { public: FreezeScope (wxWindow *window) : Window (window) { Window->Freeze(); } ~FreezeScope () { Window->Thaw(); } wxWindow *Window; }; DECLARE_EVENT_TYPE (TC_EVENT_THREAD_EXITING, -1); extern GraphicUserInterface *Gui; } #endif // TC_HEADER_Main_GraphicUserInterface