From 740319850255d4fabf6e3cf4d37ca77857760b8b Mon Sep 17 00:00:00 2001 From: Ryan Harrison Date: Thu, 6 Jul 2017 15:42:08 -0400 Subject: Convert c-style casts in fx_memory.h into static_casts Change-Id: I53da7a36ce8503abd99f2525e8a5b394ee547b47 Reviewed-on: https://pdfium-review.googlesource.com/7353 Reviewed-by: Tom Sepez Commit-Queue: Ryan Harrison --- core/fxcrt/fx_memory.h | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/core/fxcrt/fx_memory.h b/core/fxcrt/fx_memory.h index a18d74bb23..fdf64db190 100644 --- a/core/fxcrt/fx_memory.h +++ b/core/fxcrt/fx_memory.h @@ -89,15 +89,18 @@ inline void* FX_ReallocOrDie(void* ptr, } // These never return nullptr. -#define FX_Alloc(type, size) (type*)FX_AllocOrDie(size, sizeof(type)) -#define FX_Alloc2D(type, w, h) (type*)FX_AllocOrDie2D(w, h, sizeof(type)) +#define FX_Alloc(type, size) \ + static_cast(FX_AllocOrDie(size, sizeof(type))) +#define FX_Alloc2D(type, w, h) \ + static_cast(FX_AllocOrDie2D(w, h, sizeof(type))) #define FX_Realloc(type, ptr, size) \ - (type*)FX_ReallocOrDie(ptr, size, sizeof(type)) + static_cast(FX_ReallocOrDie(ptr, size, sizeof(type))) // May return nullptr. -#define FX_TryAlloc(type, size) (type*)FX_SafeAlloc(size, sizeof(type)) +#define FX_TryAlloc(type, size) \ + static_cast(FX_SafeAlloc(size, sizeof(type))) #define FX_TryRealloc(type, ptr, size) \ - (type*)FX_SafeRealloc(ptr, size, sizeof(type)) + static_cast(FX_SafeRealloc(ptr, size, sizeof(type))) inline void FX_Free(void* ptr) { // TODO(palmer): Removing this check exposes crashes when PDFium callers -- cgit v1.2.3