intl/uconv/ucvko/nsUnicodeToCP949.cpp

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/. */
     7 #include "nsUnicodeToCP949.h"
     8 #include "nsUCvKODll.h"
     9 #include "nsUCConstructors.h"
    11 //----------------------------------------------------------------------
    12 // Global functions and data [declaration]
    15 // Unicode Hangul syllables (not enumerated in KS X 1001) to CP949 : 8822 of them
    16 static const uint16_t g_ufCP949NoKSCHangulMapping[] = {
    17 #include "u20cp949hangul.uf"
    18 };
    22 static const uint16_t *g_CP949MappingTable[3] = {
    23   g_ASCIIMappingTable,
    24   g_ufKSC5601Mapping,
    25   g_ufCP949NoKSCHangulMapping
    26 };
    28 static const uScanClassID g_CP949ScanClassTable[3] =  {
    29   u1ByteCharset,
    30   u2BytesGRCharset,
    31   u2BytesCharset
    32 };
    34 nsresult
    35 nsUnicodeToCP949Constructor(nsISupports *aOuter, REFNSIID aIID,
    36                             void **aResult)
    37 {
    38   return CreateMultiTableEncoder(3,
    39                                  (uScanClassID*) g_CP949ScanClassTable, 
    40                                  (uMappingTable**) g_CP949MappingTable,
    41                                  2 /* max len = src * 2 */,
    42                                  aOuter, aIID, aResult);
    43 }

mercurial