diff options
author | Dan Sinclair <dsinclair@chromium.org> | 2016-03-14 13:35:12 -0400 |
---|---|---|
committer | Dan Sinclair <dsinclair@chromium.org> | 2016-03-14 13:35:12 -0400 |
commit | 764ec513eecbebd12781bcc96ce81ed5e736ee92 (patch) | |
tree | 12763fde4be1f10ea1183d92185917b2b587e00b /core/src/fpdftext/unicodenormalization.cpp | |
parent | 97da97662417085774f75c26e535c6fbe70266ae (diff) | |
download | pdfium-764ec513eecbebd12781bcc96ce81ed5e736ee92.tar.xz |
Move core/src/ up to core/.
This CL moves the core/src/ files up to core/ and fixes up the include guards,
includes and build files.
R=tsepez@chromium.org
Review URL: https://codereview.chromium.org/1800523005 .
Diffstat (limited to 'core/src/fpdftext/unicodenormalization.cpp')
-rw-r--r-- | core/src/fpdftext/unicodenormalization.cpp | 71 |
1 files changed, 0 insertions, 71 deletions
diff --git a/core/src/fpdftext/unicodenormalization.cpp b/core/src/fpdftext/unicodenormalization.cpp deleted file mode 100644 index d3b404dfcf..0000000000 --- a/core/src/fpdftext/unicodenormalization.cpp +++ /dev/null @@ -1,71 +0,0 @@ -// Copyright 2014 PDFium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com - -#include "core/include/fxcrt/fx_string.h" -#include "core/src/fpdftext/unicodenormalizationdata.h" - -const FX_WCHAR* const g_UnicodeData_Normalization_Maps[5] = { - nullptr, - g_UnicodeData_Normalization_Map1, - g_UnicodeData_Normalization_Map2, - g_UnicodeData_Normalization_Map3, - g_UnicodeData_Normalization_Map4}; - -FX_STRSIZE FX_Unicode_GetNormalization(FX_WCHAR wch, FX_WCHAR* pDst) { - wch = wch & 0xFFFF; - FX_WCHAR wFind = g_UnicodeData_Normalization[wch]; - if (!wFind) { - if (pDst) { - *pDst = wch; - } - return 1; - } - if (wFind >= 0x8000) { - wch = wFind - 0x8000; - wFind = 1; - } else { - wch = wFind & 0x0FFF; - wFind >>= 12; - } - const FX_WCHAR* pMap = g_UnicodeData_Normalization_Maps[wFind]; - if (pMap == g_UnicodeData_Normalization_Map4) { - pMap = g_UnicodeData_Normalization_Map4 + wch; - wFind = (FX_WCHAR)(*pMap++); - } else { - pMap += wch; - } - if (pDst) { - FX_WCHAR n = wFind; - while (n--) { - *pDst++ = *pMap++; - } - } - return (FX_STRSIZE)wFind; -} -FX_STRSIZE FX_WideString_GetNormalization(const CFX_WideStringC& wsSrc, - FX_WCHAR* pDst) { - FX_STRSIZE nCount = 0; - for (FX_STRSIZE len = 0; len < wsSrc.GetLength(); len++) { - FX_WCHAR wch = wsSrc.GetAt(len); - if (pDst) { - nCount += FX_Unicode_GetNormalization(wch, pDst + nCount); - } else { - nCount += FX_Unicode_GetNormalization(wch, pDst); - } - } - return nCount; -} -FX_STRSIZE FX_WideString_GetNormalization(const CFX_WideStringC& wsSrc, - CFX_WideString& wsDst) { - FX_STRSIZE nLen = FX_WideString_GetNormalization(wsSrc, (FX_WCHAR*)NULL); - if (!nLen) { - return 0; - } - FX_WCHAR* pBuf = wsDst.GetBuffer(nLen); - FX_WideString_GetNormalization(wsSrc, pBuf); - wsDst.ReleaseBuffer(nLen); - return nLen; -} |