intl/uconv/ucvja/nsUnicodeToEUCJP.cpp

Thu, 22 Jan 2015 13:21:57 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 22 Jan 2015 13:21:57 +0100
branch
TOR_BUG_9701
changeset 15
b8a032363ba2
permissions
-rw-r--r--

Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6

     1 /* -*- Mode: C++; tab-width: 2; 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/. */
     6 #include "nsUnicodeToEUCJP.h"
     7 #include "nsUCVJADll.h"
     8 #include "nsUCConstructors.h"
    10 //----------------------------------------------------------------------
    11 // Global functions and data [declaration]
    13 // Shift Table
    14 static const int16_t g0201ShiftOutTable[] =  {
    15         2,
    16         ShiftOutCell(u1ByteChar,         1, 0x00, 0x00, 0x00, 0x7F),
    17         ShiftOutCell(u1BytePrefix8EChar, 2, 0x00, 0xA1, 0x00, 0xDF)
    18 };
    20 #define SIZE_OF_EUCJP_TABLES 3
    21 static const uScanClassID gScanClassIDs[SIZE_OF_EUCJP_TABLES] = {
    22   u2BytesGRCharset,
    23   u2BytesGRCharset,
    24   uMultibytesCharset
    25 };
    27 static const int16_t *gShiftTables[SIZE_OF_EUCJP_TABLES] =  {
    28     0,
    29     0,
    30     g0201ShiftOutTable
    31 };
    33 static const uint16_t *gMappingTables[SIZE_OF_EUCJP_TABLES] = {
    34     g_uf0208Mapping,
    35     g_uf0208extMapping,
    36     g_uf0201Mapping
    37 };
    39 nsresult
    40 nsUnicodeToEUCJPConstructor(nsISupports *aOuter, REFNSIID aIID,
    41                             void **aResult)
    42 {
    43     return CreateMultiTableEncoder(SIZE_OF_EUCJP_TABLES,
    44                                    (uScanClassID*) gScanClassIDs,
    45                                    (uShiftOutTable**) gShiftTables, 
    46                                    (uMappingTable**) gMappingTables,
    47                                    3 /* max length = src * 3 */,
    48                                    aOuter, aIID, aResult);
    49 }

mercurial