summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--BUILD.gn2
-rw-r--r--core/fpdftext/fpdf_text_int.cpp3
-rw-r--r--core/fpdftext/fpdf_text_int.h (renamed from core/fpdftext/text_int.h)8
-rw-r--r--core/fpdftext/fpdf_text_int_unittest.cpp4
-rw-r--r--core/fpdftext/unicodenormalization.cpp30
-rw-r--r--core/fpdftext/unicodenormalization.h14
-rw-r--r--pdfium.gyp3
7 files changed, 31 insertions, 33 deletions
diff --git a/BUILD.gn b/BUILD.gn
index c9c5b016aa..41322669a5 100644
--- a/BUILD.gn
+++ b/BUILD.gn
@@ -390,11 +390,13 @@ static_library("fpdfapi") {
static_library("fpdftext") {
sources = [
"core/fpdftext/fpdf_text_int.cpp",
+ "core/fpdftext/fpdf_text_int.h",
"core/fpdftext/include/ipdf_linkextract.h",
"core/fpdftext/include/ipdf_textpage.h",
"core/fpdftext/include/ipdf_textpagefind.h",
"core/fpdftext/text_int.h",
"core/fpdftext/unicodenormalization.cpp",
+ "core/fpdftext/unicodenormalization.h",
"core/fpdftext/unicodenormalizationdata.cpp",
"core/fpdftext/unicodenormalizationdata.h",
]
diff --git a/core/fpdftext/fpdf_text_int.cpp b/core/fpdftext/fpdf_text_int.cpp
index 1bd544c444..f862af9fbe 100644
--- a/core/fpdftext/fpdf_text_int.cpp
+++ b/core/fpdftext/fpdf_text_int.cpp
@@ -4,7 +4,7 @@
// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
-#include "core/fpdftext/text_int.h"
+#include "core/fpdftext/fpdf_text_int.h"
#include <algorithm>
#include <cctype>
@@ -16,6 +16,7 @@
#include "core/fpdftext/include/ipdf_linkextract.h"
#include "core/fpdftext/include/ipdf_textpage.h"
#include "core/fpdftext/include/ipdf_textpagefind.h"
+#include "core/fpdftext/unicodenormalization.h"
#include "core/include/fpdfapi/cpdf_dictionary.h"
#include "core/include/fpdfapi/cpdf_string.h"
#include "core/include/fpdfapi/fpdf_module.h"
diff --git a/core/fpdftext/text_int.h b/core/fpdftext/fpdf_text_int.h
index 42e254ee63..7ebf653f27 100644
--- a/core/fpdftext/text_int.h
+++ b/core/fpdftext/fpdf_text_int.h
@@ -4,8 +4,8 @@
// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
-#ifndef CORE_FPDFTEXT_TEXT_INT_H_
-#define CORE_FPDFTEXT_TEXT_INT_H_
+#ifndef CORE_FPDFTEXT_FPDF_TEXT_INT_H_
+#define CORE_FPDFTEXT_FPDF_TEXT_INT_H_
#include <deque>
#include <vector>
@@ -241,6 +241,4 @@ class CPDF_LinkExtract : public IPDF_LinkExtract {
bool m_bIsParsed;
};
-FX_STRSIZE FX_Unicode_GetNormalization(FX_WCHAR wch, FX_WCHAR* pDst);
-
-#endif // CORE_FPDFTEXT_TEXT_INT_H_
+#endif // CORE_FPDFTEXT_FPDF_TEXT_INT_H_
diff --git a/core/fpdftext/fpdf_text_int_unittest.cpp b/core/fpdftext/fpdf_text_int_unittest.cpp
index d114ba75ce..c1c29cde97 100644
--- a/core/fpdftext/fpdf_text_int_unittest.cpp
+++ b/core/fpdftext/fpdf_text_int_unittest.cpp
@@ -2,9 +2,9 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "testing/gtest/include/gtest/gtest.h"
+#include "core/fpdftext/fpdf_text_int.h"
-#include "core/fpdftext/text_int.h"
+#include "testing/gtest/include/gtest/gtest.h"
// Class to help test functions in CPDF_LinkExtract class.
class CPDF_TestLinkExtract : public CPDF_LinkExtract {
diff --git a/core/fpdftext/unicodenormalization.cpp b/core/fpdftext/unicodenormalization.cpp
index 6ede1365c4..b8e8eb98d3 100644
--- a/core/fpdftext/unicodenormalization.cpp
+++ b/core/fpdftext/unicodenormalization.cpp
@@ -4,13 +4,19 @@
// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
+#include "core/fpdftext/unicodenormalization.h"
+
#include "core/fpdftext/unicodenormalizationdata.h"
#include "core/include/fxcrt/fx_string.h"
+namespace {
+
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};
+} // namespace
+
FX_STRSIZE FX_Unicode_GetNormalization(FX_WCHAR wch, FX_WCHAR* pDst) {
wch = wch & 0xFFFF;
FX_WCHAR wFind = g_UnicodeData_Normalization[wch];
@@ -42,27 +48,3 @@ FX_STRSIZE FX_Unicode_GetNormalization(FX_WCHAR wch, FX_WCHAR* pDst) {
}
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;
-}
diff --git a/core/fpdftext/unicodenormalization.h b/core/fpdftext/unicodenormalization.h
new file mode 100644
index 0000000000..d9beafbd41
--- /dev/null
+++ b/core/fpdftext/unicodenormalization.h
@@ -0,0 +1,14 @@
+// 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
+
+#ifndef CORE_FPDFTEXT_UNICODENORMALIZATION_H_
+#define CORE_FPDFTEXT_UNICODENORMALIZATION_H_
+
+#include "core/include/fxcrt/fx_system.h"
+
+FX_STRSIZE FX_Unicode_GetNormalization(FX_WCHAR wch, FX_WCHAR* pDst);
+
+#endif // CORE_FPDFTEXT_UNICODENORMALIZATION_H_
diff --git a/pdfium.gyp b/pdfium.gyp
index 9d986b29eb..acd17f36ac 100644
--- a/pdfium.gyp
+++ b/pdfium.gyp
@@ -407,8 +407,9 @@
'core/fpdftext/include/ipdf_textpage.h',
'core/fpdftext/include/ipdf_textpagefind.h',
'core/fpdftext/fpdf_text_int.cpp',
- 'core/fpdftext/text_int.h',
+ 'core/fpdftext/fpdf_text_int.h',
'core/fpdftext/unicodenormalization.cpp',
+ 'core/fpdftext/unicodenormalization.h',
'core/fpdftext/unicodenormalizationdata.cpp',
'core/fpdftext/unicodenormalizationdata.h',
],