Fix else-after-returns throughout pdfium.
[pdfium.git] / core / src / fxge / win32 / fx_win32_dwrite.cpp
index 0849583..65a35d8 100644 (file)
@@ -1,7 +1,7 @@
 // Copyright 2014 PDFium Authors. All rights reserved.
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
+
 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
 
 #include "../../../include/fxge/fx_ge.h"
@@ -70,7 +70,7 @@ private:
     ULONG refCount_;
     static IDWriteFontFileLoader* instance_;
 };
-class CDwFontContext 
+class CDwFontContext
 {
 public:
     CDwFontContext(IDWriteFactory* dwriteFactory);
@@ -82,7 +82,7 @@ private:
     HRESULT hr_;
     IDWriteFactory* dwriteFactory_;
 };
-class CDwGdiTextRenderer 
+class CDwGdiTextRenderer
 {
 public:
     CDwGdiTextRenderer(
@@ -90,7 +90,7 @@ public:
         IDWriteBitmapRenderTarget* bitmapRenderTarget,
         IDWriteRenderingParams* renderingParams
     );
-    CDwGdiTextRenderer::~CDwGdiTextRenderer();
+    ~CDwGdiTextRenderer();
     HRESULT STDMETHODCALLTYPE DrawGlyphRun(
         const FX_RECT& text_bbox,
         __in_opt CFX_ClipRgn* pClipRgn,
@@ -128,7 +128,7 @@ CDWriteExt::~CDWriteExt()
 {
     Unload();
 }
-LPVOID CDWriteExt::DwCreateFontFaceFromStream(FX_LPBYTE pData, FX_DWORD size, int simulation_style)
+LPVOID CDWriteExt::DwCreateFontFaceFromStream(uint8_t* pData, FX_DWORD size, int simulation_style)
 {
     IDWriteFactory* pDwFactory = (IDWriteFactory*)m_pDWriteFactory;
     IDWriteFontFile* pDwFontFile = NULL;
@@ -262,9 +262,7 @@ FX_BOOL     CDWriteExt::DwRendingString(void* renderTarget, CFX_ClipRgn* pClipRgn, F
 }
 void CDWriteExt::DwDeleteRenderingTarget(void* renderTarget)
 {
-    if (renderTarget) {
-        delete (CDwGdiTextRenderer*)renderTarget;
-    }
+    delete (CDwGdiTextRenderer*)renderTarget;
 }
 void CDWriteExt::DwDeleteFont(void* pFont)
 {
@@ -284,10 +282,9 @@ HRESULT STDMETHODCALLTYPE CDwFontFileStream::QueryInterface(REFIID iid, void** p
         *ppvObject = this;
         AddRef();
         return S_OK;
-    } else {
-        *ppvObject = NULL;
-        return E_NOINTERFACE;
     }
+    *ppvObject = NULL;
+    return E_NOINTERFACE;
 }
 ULONG STDMETHODCALLTYPE CDwFontFileStream::AddRef()
 {
@@ -308,16 +305,14 @@ HRESULT STDMETHODCALLTYPE CDwFontFileStream::ReadFileFragment(
     OUT void** fragmentContext
 )
 {
-    if (fileOffset <= resourceSize_ &&
-            fragmentSize <= resourceSize_ - fileOffset) {
-        *fragmentStart = static_cast<FX_BYTE const*>(resourcePtr_) + static_cast<size_t>(fileOffset);
+    if (fileOffset <= resourceSize_ && fragmentSize <= resourceSize_ - fileOffset) {
+        *fragmentStart = static_cast<uint8_t const*>(resourcePtr_) + static_cast<size_t>(fileOffset);
         *fragmentContext = NULL;
         return S_OK;
-    } else {
-        *fragmentStart = NULL;
-        *fragmentContext = NULL;
-        return E_FAIL;
     }
+    *fragmentStart = NULL;
+    *fragmentContext = NULL;
+    return E_FAIL;
 }
 void STDMETHODCALLTYPE CDwFontFileStream::ReleaseFileFragment(void* fragmentContext)
 {
@@ -343,10 +338,9 @@ HRESULT STDMETHODCALLTYPE CDwFontFileLoader::QueryInterface(REFIID iid, void** p
         *ppvObject = this;
         AddRef();
         return S_OK;
-    } else {
-        *ppvObject = NULL;
-        return E_NOINTERFACE;
     }
+    *ppvObject = NULL;
+    return E_NOINTERFACE;
 }
 ULONG STDMETHODCALLTYPE CDwFontFileLoader::AddRef()
 {
@@ -433,7 +427,7 @@ STDMETHODIMP CDwGdiTextRenderer::DrawGlyphRun(
         bitmap.bmWidth,
         bitmap.bmHeight,
         bitmap.bmBitsPixel == 24 ? FXDIB_Rgb : FXDIB_Rgb32,
-        (FX_LPBYTE)bitmap.bmBits
+        (uint8_t*)bitmap.bmBits
     );
     dib.CompositeBitmap(
         text_bbox.left,