Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(263)

Side by Side Diff: core/src/fpdftext/fpdf_text.cpp

Issue 1547833002: Switch from nonstd::unique_ptr to std::unique_ptr. (Closed) Base URL: https://pdfium.googlesource.com/pdfium@master
Patch Set: Created 4 years, 12 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 <cctype>
8 #include <cwctype>
9 #include <memory>
10
7 #include "core/include/fpdfapi/fpdf_page.h" 11 #include "core/include/fpdfapi/fpdf_page.h"
8 #include "core/include/fpdfapi/fpdf_pageobj.h" 12 #include "core/include/fpdfapi/fpdf_pageobj.h"
9 #include "core/include/fpdfapi/fpdf_resource.h" 13 #include "core/include/fpdfapi/fpdf_resource.h"
10 #include "core/include/fpdftext/fpdf_text.h" 14 #include "core/include/fpdftext/fpdf_text.h"
11 #include "core/include/fxcrt/fx_bidi.h" 15 #include "core/include/fxcrt/fx_bidi.h"
12 #include "core/include/fxcrt/fx_ucd.h" 16 #include "core/include/fxcrt/fx_ucd.h"
13 #include "text_int.h" 17 #include "text_int.h"
14 #include "third_party/base/nonstd_unique_ptr.h"
15 #include "txtproc.h" 18 #include "txtproc.h"
16 19
17 #include <cctype>
18 #include <cwctype>
19
20 CFX_ByteString CharFromUnicodeAlt(FX_WCHAR unicode, 20 CFX_ByteString CharFromUnicodeAlt(FX_WCHAR unicode,
21 int destcp, 21 int destcp,
22 const FX_CHAR* defchar) { 22 const FX_CHAR* defchar) {
23 if (destcp == 0) { 23 if (destcp == 0) {
24 if (unicode < 0x80) { 24 if (unicode < 0x80) {
25 return CFX_ByteString((char)unicode); 25 return CFX_ByteString((char)unicode);
26 } 26 }
27 const FX_CHAR* altstr = FCS_GetAltStr(unicode); 27 const FX_CHAR* altstr = FCS_GetAltStr(unicode);
28 return CFX_ByteString(altstr ? altstr : defchar); 28 return CFX_ByteString(altstr ? altstr : defchar);
29 } 29 }
(...skipping 277 matching lines...) Expand 10 before | Expand all | Expand 10 after
307 for (int nIndex = 0; nIndex < nCount; nIndex++) { 307 for (int nIndex = 0; nIndex < nCount; nIndex++) {
308 sDest += pDst[nIndex]; 308 sDest += pDst[nIndex];
309 } 309 }
310 delete[] pDst; 310 delete[] pDst;
311 } 311 }
312 void NormalizeString(CFX_WideString& str) { 312 void NormalizeString(CFX_WideString& str) {
313 if (str.GetLength() <= 0) { 313 if (str.GetLength() <= 0) {
314 return; 314 return;
315 } 315 }
316 CFX_WideString sBuffer; 316 CFX_WideString sBuffer;
317 nonstd::unique_ptr<CFX_BidiChar> pBidiChar(new CFX_BidiChar); 317 std::unique_ptr<CFX_BidiChar> pBidiChar(new CFX_BidiChar);
318 CFX_WordArray order; 318 CFX_WordArray order;
319 FX_BOOL bR2L = FALSE; 319 FX_BOOL bR2L = FALSE;
320 int32_t start = 0, count = 0, i = 0; 320 int32_t start = 0, count = 0, i = 0;
321 int nR2L = 0, nL2R = 0; 321 int nR2L = 0, nL2R = 0;
322 for (i = 0; i < str.GetLength(); i++) { 322 for (i = 0; i < str.GetLength(); i++) {
323 if (pBidiChar->AppendChar(str.GetAt(i))) { 323 if (pBidiChar->AppendChar(str.GetAt(i))) {
324 CFX_BidiChar::Direction ret = pBidiChar->GetBidiInfo(&start, &count); 324 CFX_BidiChar::Direction ret = pBidiChar->GetBidiInfo(&start, &count);
325 order.Add(start); 325 order.Add(start);
326 order.Add(count); 326 order.Add(count);
327 order.Add(ret); 327 order.Add(ret);
(...skipping 452 matching lines...) Expand 10 before | Expand all | Expand 10 after
780 FX_DWORD flags) { 780 FX_DWORD flags) {
781 buffer.EstimateSize(0, 10240); 781 buffer.EstimateSize(0, 10240);
782 CPDF_Page page; 782 CPDF_Page page;
783 page.Load(pDoc, pPage); 783 page.Load(pDoc, pPage);
784 CPDF_ParseOptions options; 784 CPDF_ParseOptions options;
785 options.m_bTextOnly = TRUE; 785 options.m_bTextOnly = TRUE;
786 options.m_bSeparateForm = FALSE; 786 options.m_bSeparateForm = FALSE;
787 page.ParseContent(&options); 787 page.ParseContent(&options);
788 GetTextStream_Unicode(buffer, &page, TRUE, NULL); 788 GetTextStream_Unicode(buffer, &page, TRUE, NULL);
789 } 789 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698