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

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

Issue 1520063002: Get rid of most instance of 'foo == NULL' (Closed) Base URL: https://pdfium.googlesource.com/pdfium@bstr_isnull
Patch Set: rebase Created 5 years 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/fpdftext/fpdf_text_search.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 <cctype> 7 #include <cctype>
8 #include <cwctype> 8 #include <cwctype>
9 #include <algorithm> 9 #include <algorithm>
10 10
(...skipping 2446 matching lines...) Expand 10 before | Expand all | Expand 10 after
2457 char_right >= L'0' && char_right <= L'9') { 2457 char_right >= L'0' && char_right <= L'9') {
2458 return FALSE; 2458 return FALSE;
2459 } 2459 }
2460 } 2460 }
2461 return TRUE; 2461 return TRUE;
2462 } 2462 }
2463 FX_BOOL CPDF_TextPageFind::ExtractSubString(CFX_WideString& rString, 2463 FX_BOOL CPDF_TextPageFind::ExtractSubString(CFX_WideString& rString,
2464 const FX_WCHAR* lpszFullString, 2464 const FX_WCHAR* lpszFullString,
2465 int iSubString, 2465 int iSubString,
2466 FX_WCHAR chSep) { 2466 FX_WCHAR chSep) {
2467 if (lpszFullString == NULL) { 2467 if (!lpszFullString) {
2468 return FALSE; 2468 return FALSE;
2469 } 2469 }
2470 while (iSubString--) { 2470 while (iSubString--) {
2471 lpszFullString = FXSYS_wcschr(lpszFullString, chSep); 2471 lpszFullString = FXSYS_wcschr(lpszFullString, chSep);
2472 if (lpszFullString == NULL) { 2472 if (!lpszFullString) {
2473 rString.Empty(); 2473 rString.Empty();
2474 return FALSE; 2474 return FALSE;
2475 } 2475 }
2476 lpszFullString++; 2476 lpszFullString++;
2477 while (*lpszFullString == chSep) { 2477 while (*lpszFullString == chSep) {
2478 lpszFullString++; 2478 lpszFullString++;
2479 } 2479 }
2480 } 2480 }
2481 const FX_WCHAR* lpchEnd = FXSYS_wcschr(lpszFullString, chSep); 2481 const FX_WCHAR* lpchEnd = FXSYS_wcschr(lpszFullString, chSep);
2482 int nLen = (lpchEnd == NULL) ? (int)FXSYS_wcslen(lpszFullString) 2482 int nLen = lpchEnd ? (int)(lpchEnd - lpszFullString)
2483 : (int)(lpchEnd - lpszFullString); 2483 : (int)FXSYS_wcslen(lpszFullString);
2484 ASSERT(nLen >= 0); 2484 ASSERT(nLen >= 0);
2485 FXSYS_memcpy(rString.GetBuffer(nLen), lpszFullString, 2485 FXSYS_memcpy(rString.GetBuffer(nLen), lpszFullString,
2486 nLen * sizeof(FX_WCHAR)); 2486 nLen * sizeof(FX_WCHAR));
2487 rString.ReleaseBuffer(); 2487 rString.ReleaseBuffer();
2488 return TRUE; 2488 return TRUE;
2489 } 2489 }
2490 CFX_WideString CPDF_TextPageFind::MakeReverse(const CFX_WideString& str) { 2490 CFX_WideString CPDF_TextPageFind::MakeReverse(const CFX_WideString& str) {
2491 CFX_WideString str2; 2491 CFX_WideString str2;
2492 str2.Empty(); 2492 str2.Empty();
2493 int nlen = str.GetLength(); 2493 int nlen = str.GetLength();
(...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after
2726 if (!m_bIsParsed || index < 0 || index >= m_LinkList.GetSize()) { 2726 if (!m_bIsParsed || index < 0 || index >= m_LinkList.GetSize()) {
2727 return; 2727 return;
2728 } 2728 }
2729 CPDF_LinkExt* link = NULL; 2729 CPDF_LinkExt* link = NULL;
2730 link = m_LinkList.GetAt(index); 2730 link = m_LinkList.GetAt(index);
2731 if (!link) { 2731 if (!link) {
2732 return; 2732 return;
2733 } 2733 }
2734 m_pTextPage->GetRectArray(link->m_Start, link->m_Count, rects); 2734 m_pTextPage->GetRectArray(link->m_Start, link->m_Count, rects);
2735 } 2735 }
OLDNEW
« no previous file with comments | « core/src/fpdftext/fpdf_text.cpp ('k') | core/src/fpdftext/fpdf_text_search.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698