| OLD | NEW |
| 1 // Copyright 2014 PDFium Authors. All rights reserved. | 1 // Copyright 2014 PDFium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com | 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com |
| 6 | 6 |
| 7 #include "../../include/fxcrt/fx_string.h" | 7 #include "../../include/fxcrt/fx_string.h" |
| 8 #include "unicodenormalizationdata.h" |
| 8 | 9 |
| 9 extern const FX_WCHAR g_UnicodeData_Normalization[]; | 10 const FX_WCHAR* const g_UnicodeData_Normalization_Maps[5] = { |
| 10 extern const FX_WCHAR g_UnicodeData_Normalization_Map1[]; | 11 nullptr, |
| 11 extern const FX_WCHAR g_UnicodeData_Normalization_Map2[]; | 12 g_UnicodeData_Normalization_Map1, |
| 12 extern const FX_WCHAR g_UnicodeData_Normalization_Map3[]; | 13 g_UnicodeData_Normalization_Map2, |
| 13 extern const FX_WCHAR g_UnicodeData_Normalization_Map4[]; | 14 g_UnicodeData_Normalization_Map3, |
| 14 const FX_WCHAR* g_UnicodeData_Normalization_Maps[5] = { | 15 g_UnicodeData_Normalization_Map4}; |
| 15 NULL, g_UnicodeData_Normalization_Map1, g_UnicodeData_Normalization_Map2, | 16 |
| 16 g_UnicodeData_Normalization_Map3, g_UnicodeData_Normalization_Map4}; | |
| 17 FX_STRSIZE FX_Unicode_GetNormalization(FX_WCHAR wch, FX_WCHAR* pDst) { | 17 FX_STRSIZE FX_Unicode_GetNormalization(FX_WCHAR wch, FX_WCHAR* pDst) { |
| 18 wch = wch & 0xFFFF; | 18 wch = wch & 0xFFFF; |
| 19 FX_WCHAR wFind = g_UnicodeData_Normalization[wch]; | 19 FX_WCHAR wFind = g_UnicodeData_Normalization[wch]; |
| 20 if (!wFind) { | 20 if (!wFind) { |
| 21 if (pDst) { | 21 if (pDst) { |
| 22 *pDst = wch; | 22 *pDst = wch; |
| 23 } | 23 } |
| 24 return 1; | 24 return 1; |
| 25 } | 25 } |
| 26 if (wFind >= 0x8000) { | 26 if (wFind >= 0x8000) { |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 62 CFX_WideString& wsDst) { | 62 CFX_WideString& wsDst) { |
| 63 FX_STRSIZE nLen = FX_WideString_GetNormalization(wsSrc, (FX_WCHAR*)NULL); | 63 FX_STRSIZE nLen = FX_WideString_GetNormalization(wsSrc, (FX_WCHAR*)NULL); |
| 64 if (!nLen) { | 64 if (!nLen) { |
| 65 return 0; | 65 return 0; |
| 66 } | 66 } |
| 67 FX_WCHAR* pBuf = wsDst.GetBuffer(nLen); | 67 FX_WCHAR* pBuf = wsDst.GetBuffer(nLen); |
| 68 FX_WideString_GetNormalization(wsSrc, pBuf); | 68 FX_WideString_GetNormalization(wsSrc, pBuf); |
| 69 wsDst.ReleaseBuffer(nLen); | 69 wsDst.ReleaseBuffer(nLen); |
| 70 return nLen; | 70 return nLen; |
| 71 } | 71 } |
| OLD | NEW |