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

Side by Side Diff: core/src/fxcrt/fx_extension.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/fxcrt/fx_basic_wstring.cpp ('k') | core/src/fxcrt/fx_xml_parser.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 "core/include/fxcrt/fx_basic.h" 7 #include "core/include/fxcrt/fx_basic.h"
8 #include "core/include/fxcrt/fx_ext.h" 8 #include "core/include/fxcrt/fx_ext.h"
9 #include "extension.h" 9 #include "extension.h"
10 10
(...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after
268 ; 268 ;
269 ::srand((tmCur << 16) | (tmLast & 0xFFFF)); 269 ::srand((tmCur << 16) | (tmLast & 0xFFFF));
270 #endif 270 #endif
271 while (iCount-- > 0) { 271 while (iCount-- > 0) {
272 *pBuffer++ = (FX_DWORD)((::rand() << 16) | (::rand() & 0xFFFF)); 272 *pBuffer++ = (FX_DWORD)((::rand() << 16) | (::rand() & 0xFFFF));
273 } 273 }
274 } 274 }
275 #if _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_ 275 #if _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_
276 FX_BOOL FX_GenerateCryptoRandom(FX_DWORD* pBuffer, int32_t iCount) { 276 FX_BOOL FX_GenerateCryptoRandom(FX_DWORD* pBuffer, int32_t iCount) {
277 HCRYPTPROV hCP = NULL; 277 HCRYPTPROV hCP = NULL;
278 if (!::CryptAcquireContext(&hCP, NULL, NULL, PROV_RSA_FULL, 0) || 278 if (!::CryptAcquireContext(&hCP, NULL, NULL, PROV_RSA_FULL, 0) || !hCP) {
279 hCP == NULL) {
280 return FALSE; 279 return FALSE;
281 } 280 }
282 ::CryptGenRandom(hCP, iCount * sizeof(FX_DWORD), (uint8_t*)pBuffer); 281 ::CryptGenRandom(hCP, iCount * sizeof(FX_DWORD), (uint8_t*)pBuffer);
283 ::CryptReleaseContext(hCP, 0); 282 ::CryptReleaseContext(hCP, 0);
284 return TRUE; 283 return TRUE;
285 } 284 }
286 #endif 285 #endif
287 void FX_Random_GenerateCrypto(FX_DWORD* pBuffer, int32_t iCount) { 286 void FX_Random_GenerateCrypto(FX_DWORD* pBuffer, int32_t iCount) {
288 #if _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_ 287 #if _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_
289 FX_GenerateCryptoRandom(pBuffer, iCount); 288 FX_GenerateCryptoRandom(pBuffer, iCount);
290 #else 289 #else
291 FX_Random_GenerateBase(pBuffer, iCount); 290 FX_Random_GenerateBase(pBuffer, iCount);
292 #endif 291 #endif
293 } 292 }
OLDNEW
« no previous file with comments | « core/src/fxcrt/fx_basic_wstring.cpp ('k') | core/src/fxcrt/fx_xml_parser.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698