intl/uconv/ucvja/nsUnicodeToSJIS.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 "nsUCConstructors.h"
     7 #include "nsUnicodeToSJIS.h"
     9 //----------------------------------------------------------------------
    10 // Global functions and data [declaration]
    12 static const uint16_t g_SJISMappingTable[] = {
    13 #include "sjis.uf"
    14 };
    16 static const int16_t g_SJISShiftOutTable[] =  {
    17   4,
    18   ShiftOutCell(u1ByteChar,   1, 0x00, 0x00, 0x00, 0x7F),
    19   ShiftOutCell(u1ByteChar,   1, 0x00, 0xA1, 0x00, 0xDF),
    20   ShiftOutCell(u2BytesChar,  2, 0x81, 0x40, 0x9F, 0xFC),
    21   ShiftOutCell(u2BytesChar,  2, 0xE0, 0x40, 0xFC, 0xFC)
    22 };
    24 nsresult
    25 nsUnicodeToSJISConstructor(nsISupports *aOuter, REFNSIID aIID,
    26                             void **aResult)
    27 {
    28   return CreateTableEncoder(uMultibytesCharset,
    29                             (uShiftOutTable*) &g_SJISShiftOutTable, 
    30                             (uMappingTable*) &g_SJISMappingTable,
    31                             2 /* max length = src * 2 */,
    32                             aOuter, aIID, aResult);
    33 }

mercurial