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

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

Issue 1143663008: Merge to XFA: Remove FX_Alloc() null checks now that it can't return NULL. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@xfa
Patch Set: Rebased. Created 5 years, 7 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/fpdftext/fpdf_text.cpp ('k') | core/src/fxcodec/codec/fx_codec.cpp » ('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 "../../include/fpdfapi/fpdf_resource.h" 7 #include "../../include/fpdfapi/fpdf_resource.h"
8 #include "../../include/fpdfapi/fpdf_pageobj.h" 8 #include "../../include/fpdfapi/fpdf_pageobj.h"
9 #include "../../include/fpdftext/fpdf_text.h" 9 #include "../../include/fpdftext/fpdf_text.h"
10 #include "../../include/fpdfapi/fpdf_page.h" 10 #include "../../include/fpdfapi/fpdf_page.h"
(...skipping 1149 matching lines...) Expand 10 before | Expand all | Expand 10 after
1160 { 1160 {
1161 PAGECHAR_INFO Info = *(PAGECHAR_INFO*)m_TempCharList.GetAt(i); 1161 PAGECHAR_INFO Info = *(PAGECHAR_INFO*)m_TempCharList.GetAt(i);
1162 FX_WCHAR wChar = str.GetAt(i); 1162 FX_WCHAR wChar = str.GetAt(i);
1163 if(!IsControlChar(&Info)) { 1163 if(!IsControlChar(&Info)) {
1164 Info.m_Index = m_TextBuf.GetLength(); 1164 Info.m_Index = m_TextBuf.GetLength();
1165 if (wChar >= 0xFB00 && wChar <= 0xFB06) { 1165 if (wChar >= 0xFB00 && wChar <= 0xFB06) {
1166 FX_LPWSTR pDst = NULL; 1166 FX_LPWSTR pDst = NULL;
1167 FX_STRSIZE nCount = FX_Unicode_GetNormalization(wChar, pDst); 1167 FX_STRSIZE nCount = FX_Unicode_GetNormalization(wChar, pDst);
1168 if (nCount >= 1) { 1168 if (nCount >= 1) {
1169 pDst = FX_Alloc(FX_WCHAR, nCount); 1169 pDst = FX_Alloc(FX_WCHAR, nCount);
1170 if (!pDst) {
1171 return;
1172 }
1173 FX_Unicode_GetNormalization(wChar, pDst); 1170 FX_Unicode_GetNormalization(wChar, pDst);
1174 for (int nIndex = 0; nIndex < nCount; nIndex++) { 1171 for (int nIndex = 0; nIndex < nCount; nIndex++) {
1175 PAGECHAR_INFO Info2 = Info; 1172 PAGECHAR_INFO Info2 = Info;
1176 Info2.m_Unicode = pDst[nIndex]; 1173 Info2.m_Unicode = pDst[nIndex];
1177 Info2.m_Flag = FPDFTEXT_CHAR_PIECE; 1174 Info2.m_Flag = FPDFTEXT_CHAR_PIECE;
1178 m_TextBuf.AppendChar(Info2.m_Unicode); 1175 m_TextBuf.AppendChar(Info2.m_Unicode);
1179 if( !m_ParseOptions.m_bGetCharCodeOnly) { 1176 if( !m_ParseOptions.m_bGetCharCodeOnly) {
1180 m_charList.Add(Info2); 1177 m_charList.Add(Info2);
1181 } 1178 }
1182 } 1179 }
(...skipping 12 matching lines...) Expand all
1195 void CPDF_TextPage::AddCharInfoByRLDirection(CFX_WideString& str, int i) 1192 void CPDF_TextPage::AddCharInfoByRLDirection(CFX_WideString& str, int i)
1196 { 1193 {
1197 PAGECHAR_INFO Info = *(PAGECHAR_INFO*)m_TempCharList.GetAt(i); 1194 PAGECHAR_INFO Info = *(PAGECHAR_INFO*)m_TempCharList.GetAt(i);
1198 if(!IsControlChar(&Info)) { 1195 if(!IsControlChar(&Info)) {
1199 Info.m_Index = m_TextBuf.GetLength(); 1196 Info.m_Index = m_TextBuf.GetLength();
1200 FX_WCHAR wChar = FX_GetMirrorChar(str.GetAt(i), TRUE, FALSE); 1197 FX_WCHAR wChar = FX_GetMirrorChar(str.GetAt(i), TRUE, FALSE);
1201 FX_LPWSTR pDst = NULL; 1198 FX_LPWSTR pDst = NULL;
1202 FX_STRSIZE nCount = FX_Unicode_GetNormalization(wChar, pDst); 1199 FX_STRSIZE nCount = FX_Unicode_GetNormalization(wChar, pDst);
1203 if (nCount >= 1) { 1200 if (nCount >= 1) {
1204 pDst = FX_Alloc(FX_WCHAR, nCount); 1201 pDst = FX_Alloc(FX_WCHAR, nCount);
1205 if (!pDst) {
1206 return;
1207 }
1208 FX_Unicode_GetNormalization(wChar, pDst); 1202 FX_Unicode_GetNormalization(wChar, pDst);
1209 for (int nIndex = 0; nIndex < nCount; nIndex++) { 1203 for (int nIndex = 0; nIndex < nCount; nIndex++) {
1210 PAGECHAR_INFO Info2 = Info; 1204 PAGECHAR_INFO Info2 = Info;
1211 Info2.m_Unicode = pDst[nIndex]; 1205 Info2.m_Unicode = pDst[nIndex];
1212 Info2.m_Flag = FPDFTEXT_CHAR_PIECE; 1206 Info2.m_Flag = FPDFTEXT_CHAR_PIECE;
1213 m_TextBuf.AppendChar(Info2.m_Unicode); 1207 m_TextBuf.AppendChar(Info2.m_Unicode);
1214 if( !m_ParseOptions.m_bGetCharCodeOnly) { 1208 if( !m_ParseOptions.m_bGetCharCodeOnly) {
1215 m_charList.Add(Info2); 1209 m_charList.Add(Info2);
1216 } 1210 }
1217 } 1211 }
(...skipping 1616 matching lines...) Expand 10 before | Expand all | Expand 10 after
2834 if (!m_IsParserd || index < 0 || index >= m_LinkList.GetSize()) { 2828 if (!m_IsParserd || index < 0 || index >= m_LinkList.GetSize()) {
2835 return; 2829 return;
2836 } 2830 }
2837 CPDF_LinkExt* link = NULL; 2831 CPDF_LinkExt* link = NULL;
2838 link = m_LinkList.GetAt(index); 2832 link = m_LinkList.GetAt(index);
2839 if (!link) { 2833 if (!link) {
2840 return ; 2834 return ;
2841 } 2835 }
2842 m_pTextPage->GetRectArray(link->m_Start, link->m_Count, rects); 2836 m_pTextPage->GetRectArray(link->m_Start, link->m_Count, rects);
2843 } 2837 }
OLDNEW
« no previous file with comments | « core/src/fpdftext/fpdf_text.cpp ('k') | core/src/fxcodec/codec/fx_codec.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698