intl/uconv/ucvko/nsUnicodeToCP949.cpp

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 /* -*- 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