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

Side by Side Diff: core/src/fxcrt/fx_extension.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/fxcrt/fx_basic_wstring.cpp ('k') | core/src/fxcrt/fxcrt_platforms.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/fxcrt/fx_ext.h" 7 #include "../../include/fxcrt/fx_ext.h"
8 #include "extension.h" 8 #include "extension.h"
9 #if _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_ 9 #if _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_
10 #include <wincrypt.h> 10 #include <wincrypt.h>
(...skipping 269 matching lines...) Expand 10 before | Expand all | Expand 10 after
280 } 280 }
281 #ifdef __cplusplus 281 #ifdef __cplusplus
282 } 282 }
283 #endif 283 #endif
284 #ifdef __cplusplus 284 #ifdef __cplusplus
285 extern "C" { 285 extern "C" {
286 #endif 286 #endif
287 FX_LPVOID FX_Random_MT_Start(FX_DWORD dwSeed) 287 FX_LPVOID FX_Random_MT_Start(FX_DWORD dwSeed)
288 { 288 {
289 FX_LPMTRANDOMCONTEXT pContext = FX_Alloc(FX_MTRANDOMCONTEXT, 1); 289 FX_LPMTRANDOMCONTEXT pContext = FX_Alloc(FX_MTRANDOMCONTEXT, 1);
290 if (!pContext) {
291 return NULL;
292 }
293 pContext->mt[0] = dwSeed; 290 pContext->mt[0] = dwSeed;
294 FX_DWORD &i = pContext->mti; 291 FX_DWORD &i = pContext->mti;
295 FX_LPDWORD pBuf = pContext->mt; 292 FX_LPDWORD pBuf = pContext->mt;
296 for (i = 1; i < MT_N; i ++) { 293 for (i = 1; i < MT_N; i ++) {
297 pBuf[i] = (1812433253UL * (pBuf[i - 1] ^ (pBuf[i - 1] >> 30)) + i); 294 pBuf[i] = (1812433253UL * (pBuf[i - 1] ^ (pBuf[i - 1] >> 30)) + i);
298 } 295 }
299 pContext->bHaveSeed = TRUE; 296 pContext->bHaveSeed = TRUE;
300 return pContext; 297 return pContext;
301 } 298 }
302 FX_DWORD FX_Random_MT_Generate(FX_LPVOID pContext) 299 FX_DWORD FX_Random_MT_Generate(FX_LPVOID pContext)
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
425 *pBuf ++ = gs_FX_pHexChars[b & 0x0F]; 422 *pBuf ++ = gs_FX_pHexChars[b & 0x0F];
426 if (bSeparator && (i == 3 || i == 5 || i == 7 || i == 9)) { 423 if (bSeparator && (i == 3 || i == 5 || i == 7 || i == 9)) {
427 *pBuf ++ = L'-'; 424 *pBuf ++ = L'-';
428 } 425 }
429 } 426 }
430 bsStr.ReleaseBuffer(bSeparator ? 36 : 32); 427 bsStr.ReleaseBuffer(bSeparator ? 36 : 32);
431 } 428 }
432 #ifdef __cplusplus 429 #ifdef __cplusplus
433 } 430 }
434 #endif 431 #endif
OLDNEW
« no previous file with comments | « core/src/fxcrt/fx_basic_wstring.cpp ('k') | core/src/fxcrt/fxcrt_platforms.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698