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

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

Issue 1297713003: Don't bother checking pointers before delete[] and FX_Free(). (Closed) Base URL: https://pdfium.googlesource.com/pdfium@master
Patch Set: rebase Created 5 years, 4 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
« no previous file with comments | « core/src/fpdfapi/fpdf_render/fpdf_render_text.cpp ('k') | core/src/fxcodec/codec/codec_int.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "../../../third_party/base/nonstd_unique_ptr.h" 7 #include "../../../third_party/base/nonstd_unique_ptr.h"
8 #include "../../include/fpdfapi/fpdf_page.h" 8 #include "../../include/fpdfapi/fpdf_page.h"
9 #include "../../include/fpdfapi/fpdf_pageobj.h" 9 #include "../../include/fpdfapi/fpdf_pageobj.h"
10 #include "../../include/fpdfapi/fpdf_resource.h" 10 #include "../../include/fpdfapi/fpdf_resource.h"
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
97 char_box.bottom * pText->m_TextState.GetFontSize() / 1000; 97 char_box.bottom * pText->m_TextState.GetFontSize() / 1000;
98 cc++; 98 cc++;
99 FX_FLOAT char_origx, char_origy; 99 FX_FLOAT char_origx, char_origy;
100 matrix.Transform(char_left, 0, char_origx, char_origy); 100 matrix.Transform(char_left, 0, char_origx, char_origy);
101 matrix.TransformRect(char_left, char_right, char_top, char_bottom); 101 matrix.TransformRect(char_left, char_right, char_top, char_bottom);
102 CFX_ByteString str; 102 CFX_ByteString str;
103 pFont->AppendChar(str, charcode); 103 pFont->AppendChar(str, charcode);
104 InsertTextBox(NULL, char_origy, char_left, char_right, char_top, 104 InsertTextBox(NULL, char_origy, char_left, char_right, char_top,
105 char_bottom, spacew, fontsize_v, str, pFont); 105 char_bottom, spacew, fontsize_v, str, pFont);
106 } 106 }
107 if (pPosArray) { 107 FX_Free(pPosArray);
108 FX_Free(pPosArray);
109 }
110 return; 108 return;
111 } 109 }
112 FX_FLOAT ratio_h = fontsize_h / pText->m_TextState.GetFontSize(); 110 FX_FLOAT ratio_h = fontsize_h / pText->m_TextState.GetFontSize();
113 for (int ii = 0; ii < count * 2; ii++) { 111 for (int ii = 0; ii < count * 2; ii++) {
114 pPosArray[ii] *= ratio_h; 112 pPosArray[ii] *= ratio_h;
115 } 113 }
116 FX_FLOAT baseline = pText->m_PosY; 114 FX_FLOAT baseline = pText->m_PosY;
117 CTextBaseLine* pBaseLine = NULL; 115 CTextBaseLine* pBaseLine = NULL;
118 FX_FLOAT topy = pText->m_Top; 116 FX_FLOAT topy = pText->m_Top;
119 FX_FLOAT bottomy = pText->m_Bottom; 117 FX_FLOAT bottomy = pText->m_Bottom;
(...skipping 675 matching lines...) Expand 10 before | Expand all | Expand 10 after
795 FX_DWORD flags) { 793 FX_DWORD flags) {
796 buffer.EstimateSize(0, 10240); 794 buffer.EstimateSize(0, 10240);
797 CPDF_Page page; 795 CPDF_Page page;
798 page.Load(pDoc, pPage); 796 page.Load(pDoc, pPage);
799 CPDF_ParseOptions options; 797 CPDF_ParseOptions options;
800 options.m_bTextOnly = TRUE; 798 options.m_bTextOnly = TRUE;
801 options.m_bSeparateForm = FALSE; 799 options.m_bSeparateForm = FALSE;
802 page.ParseContent(&options); 800 page.ParseContent(&options);
803 _PDF_GetTextStream_Unicode(buffer, &page, TRUE, NULL); 801 _PDF_GetTextStream_Unicode(buffer, &page, TRUE, NULL);
804 } 802 }
OLDNEW
« no previous file with comments | « core/src/fpdfapi/fpdf_render/fpdf_render_text.cpp ('k') | core/src/fxcodec/codec/codec_int.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698