intl/uconv/util/umap.h

Tue, 06 Jan 2015 21:39:09 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Tue, 06 Jan 2015 21:39:09 +0100
branch
TOR_BUG_9701
changeset 8
97036ab72558
permissions
-rw-r--r--

Conditionally force memory storage according to privacy.thirdparty.isolate;
This solves Tor bug #9701, complying with disk avoidance documented in
https://www.torproject.org/projects/torbrowser/design/#disk-avoidance.

     1 /* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
     2 /* This Source Code Form is subject to the terms of the Mozilla Public
     3  * License, v. 2.0. If a copy of the MPL was not distributed with this
     4  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
     5 #ifndef __UMAP__
     6 #define __UMAP__
     8 #define NOMAPPING 0xfffd
    10 enum {
    11 	uFormat0Tag = 0,
    12 	uFormat1Tag,
    13 	uFormat2Tag,
    14 	uNumFormatTag
    15 };
    17 typedef struct {
    18 		uint16_t srcBegin;		/* 2 byte	*/
    19 		uint16_t srcEnd;			/* 2 byte	*/
    20 		uint16_t destBegin;		/* 2 byte	*/
    21 } uFormat0;
    23 typedef struct {
    24 		uint16_t srcBegin;		/* 2 byte	*/
    25 		uint16_t srcEnd;			/* 2 byte	*/
    26 		uint16_t	mappingOffset;	/* 2 byte	*/
    27 } uFormat1;
    29 typedef struct {
    30 		uint16_t srcBegin;		/* 2 byte	*/
    31 		uint16_t srcEnd;			/* 2 byte	-waste	*/
    32 		uint16_t destBegin;		/* 2 byte	*/
    33 } uFormat2;
    35 typedef struct  {
    36 	union {
    37 		uFormat0	format0;
    38 		uFormat1	format1;
    39 		uFormat2	format2;
    40 	} fmt;
    41 } uMapCell;
    43 #define UMAPCELL_SIZE (3*sizeof(uint16_t))
    45 typedef struct  {
    46 	uint16_t 		itemOfList;
    47 	uint16_t		offsetToFormatArray;
    48 	uint16_t		offsetToMapCellArray;
    49 	uint16_t		offsetToMappingTable;
    50 	uint16_t		data[1];
    51 } uTable;
    53 #endif

mercurial