mailnews/import/src/ImportCharSet.cpp
author Mozilla Releng Treescript <release+treescript@mozilla.org>
Thu, 04 Mar 2021 08:37:39 +0000
changeset 41382 e0ef3b915829de67a19cf5690bffbe145d12d20b
parent 36453 65b0b80b1b8ff39661452ada6a41cc1f148dd115
permissions -rw-r--r--
no bug - Bumping Thunderbird l10n changesets r=release a=l10n-bump DONTBUILD ast -> 85a961d250a508f263c17cad193a1e22d2c3cda4 el -> e854408efa0e739e3c22f0d8ab9d4b627927aa0b fr -> 110114d176859c191c39d7457f76c5c9247b6a25 it -> 3ab129cf7624f59655156d7a11dfbee4999e9359 pt-BR -> d8b467ec60373a43391d3d3f9f4f773e301076a1 pt-PT -> eb0f997231b20e39cfe263e5168f2c9f6f8aadc1 zh-CN -> 177af21d2e347c7735cc5282b0fa3d5949ff94dc

/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */

#include "ImportCharSet.h"

char ImportCharSet::m_upperCaseMap[256];
char ImportCharSet::m_Ascii[256] = {0};  // the initialiser makes it strong

class UInitMaps {
 public:
  UInitMaps();
};

UInitMaps gInitMaps;

UInitMaps::UInitMaps() {
  int i;

  for (i = 0; i < 256; i++) ImportCharSet::m_upperCaseMap[i] = i;
  for (i = 'a'; i <= 'z'; i++) ImportCharSet::m_upperCaseMap[i] = i - 'a' + 'A';

  for (i = 0; i < 256; i++) ImportCharSet::m_Ascii[i] = 0;

  for (i = ImportCharSet::cUpperAChar; i <= ImportCharSet::cUpperZChar; i++)
    ImportCharSet::m_Ascii[i] |=
        (ImportCharSet::cAlphaNumChar | ImportCharSet::cAlphaChar);
  for (i = ImportCharSet::cLowerAChar; i <= ImportCharSet::cLowerZChar; i++)
    ImportCharSet::m_Ascii[i] |=
        (ImportCharSet::cAlphaNumChar | ImportCharSet::cAlphaChar);
  for (i = ImportCharSet::cZeroChar; i <= ImportCharSet::cNineChar; i++)
    ImportCharSet::m_Ascii[i] |=
        (ImportCharSet::cAlphaNumChar | ImportCharSet::cDigitChar);

  ImportCharSet::m_Ascii[ImportCharSet::cTabChar] |=
      ImportCharSet::cWhiteSpaceChar;
  ImportCharSet::m_Ascii[ImportCharSet::cCRChar] |=
      ImportCharSet::cWhiteSpaceChar;
  ImportCharSet::m_Ascii[ImportCharSet::cLinefeedChar] |=
      ImportCharSet::cWhiteSpaceChar;
  ImportCharSet::m_Ascii[ImportCharSet::cSpaceChar] |=
      ImportCharSet::cWhiteSpaceChar;

  ImportCharSet::m_Ascii[uint8_t('(')] |= ImportCharSet::c822SpecialChar;
  ImportCharSet::m_Ascii[uint8_t(')')] |= ImportCharSet::c822SpecialChar;
  ImportCharSet::m_Ascii[uint8_t('<')] |= ImportCharSet::c822SpecialChar;
  ImportCharSet::m_Ascii[uint8_t('>')] |= ImportCharSet::c822SpecialChar;
  ImportCharSet::m_Ascii[uint8_t('@')] |= ImportCharSet::c822SpecialChar;
  ImportCharSet::m_Ascii[uint8_t(',')] |= ImportCharSet::c822SpecialChar;
  ImportCharSet::m_Ascii[uint8_t(';')] |= ImportCharSet::c822SpecialChar;
  ImportCharSet::m_Ascii[uint8_t(':')] |= ImportCharSet::c822SpecialChar;
  ImportCharSet::m_Ascii[uint8_t('\\')] |= ImportCharSet::c822SpecialChar;
  ImportCharSet::m_Ascii[uint8_t('"')] |= ImportCharSet::c822SpecialChar;
  ImportCharSet::m_Ascii[uint8_t('.')] |= ImportCharSet::c822SpecialChar;
  ImportCharSet::m_Ascii[uint8_t('[')] |= ImportCharSet::c822SpecialChar;
  ImportCharSet::m_Ascii[uint8_t(']')] |= ImportCharSet::c822SpecialChar;
}