intl/icu/source/common/ucmndata.h

Sat, 03 Jan 2015 20:18:00 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Sat, 03 Jan 2015 20:18:00 +0100
branch
TOR_BUG_3246
changeset 7
129ffea94266
permissions
-rw-r--r--

Conditionally enable double key logic according to:
private browsing mode or privacy.thirdparty.isolate preference and
implement in GetCookieStringCommon and FindCookie where it counts...
With some reservations of how to convince FindCookie users to test
condition and pass a nullptr when disabling double key logic.

     1 /*
     2 ******************************************************************************
     3 *
     4 *   Copyright (C) 1999-2011, International Business Machines
     5 *   Corporation and others.  All Rights Reserved.
     6 *
     7 ******************************************************************************/
    10 /*----------------------------------------------------------------------------------
    11  *
    12  *   UCommonData   An abstract interface for dealing with ICU Common Data Files.
    13  *                 ICU Common Data Files are a grouping of a number of individual
    14  *                 data items (resources, converters, tables, anything) into a
    15  *                 single file or dll.  The combined format includes a table of
    16  *                 contents for locating the individual items by name.
    17  *
    18  *                 Two formats for the table of contents are supported, which is
    19  *                 why there is an abstract inteface involved.
    20  *
    21  *                 These functions are part of the ICU internal implementation, and
    22  *                 are not inteded to be used directly by applications.
    23  */
    25 #ifndef __UCMNDATA_H__
    26 #define __UCMNDATA_H__
    28 #include "unicode/udata.h"
    29 #include "umapfile.h"
    32 #define COMMON_DATA_NAME U_ICUDATA_NAME
    34 typedef struct  {
    35     uint16_t    headerSize;
    36     uint8_t     magic1;
    37     uint8_t     magic2;
    38 } MappedData;
    41 typedef struct  {
    42     MappedData  dataHeader;
    43     UDataInfo   info;
    44 } DataHeader;
    46 typedef struct {
    47     uint32_t nameOffset;
    48     uint32_t dataOffset;
    49 } UDataOffsetTOCEntry;
    51 typedef struct {
    52     uint32_t count;
    53     UDataOffsetTOCEntry entry[2];    /* Actual size of array is from count. */
    54 } UDataOffsetTOC;
    56 /**
    57  * Get the header size from a const DataHeader *udh.
    58  * Handles opposite-endian data.
    59  *
    60  * @internal
    61  */
    62 U_CFUNC uint16_t
    63 udata_getHeaderSize(const DataHeader *udh);
    65 /**
    66  * Get the UDataInfo.size from a const UDataInfo *info.
    67  * Handles opposite-endian data.
    68  *
    69  * @internal
    70  */
    71 U_CFUNC uint16_t
    72 udata_getInfoSize(const UDataInfo *info);
    74 U_CDECL_BEGIN
    75 /*
    76  *  "Virtual" functions for data lookup.
    77  *  To call one, given a UDataMemory *p, the code looks like this:
    78  *     p->vFuncs.Lookup(p, tocEntryName, pErrorCode);
    79  *          (I sure do wish this was written in C++, not C)
    80  */
    82 typedef const DataHeader *
    83 (U_CALLCONV * LookupFn)(const UDataMemory *pData,
    84                         const char *tocEntryName,
    85                         int32_t *pLength,
    86                         UErrorCode *pErrorCode);
    88 typedef uint32_t
    89 (U_CALLCONV * NumEntriesFn)(const UDataMemory *pData);
    91 U_CDECL_END
    93 typedef struct {
    94     LookupFn      Lookup;
    95     NumEntriesFn  NumEntries; 
    96 } commonDataFuncs;
    99 /*
   100  *  Functions to check whether a UDataMemory refers to memory containing 
   101  *     a recognizable header and table of contents a Common Data Format
   102  *
   103  *     If a valid header and TOC are found,
   104  *         set the CommonDataFuncs function dispatch vector in the UDataMemory
   105  *             to point to the right functions for the TOC type.
   106  *     otherwise
   107  *         set an errorcode.
   108  */
   109 U_CFUNC void udata_checkCommonData(UDataMemory *pData, UErrorCode *pErrorCode);
   111 #endif

mercurial