From 3c012fef2bb72c8ec1faa73e11ee35539b2559d6 Mon Sep 17 00:00:00 2001 From: Tom Sepez Date: Wed, 22 Jul 2015 15:14:14 -0700 Subject: Re-land else-after-returns Revert "Revert "Fix else-after-returns throughout pdfium."" This reverts commit 4eb4d7f6c707cc2c23c806aa540d055c8832b55d. Fix one naming conflict. TBR=thestig@chromium.org Review URL: https://codereview.chromium.org/1243953004 . --- core/src/fxcrt/fx_basic_array.cpp | 3 ++- core/src/fxcrt/fx_basic_bstring.cpp | 11 ++++++----- core/src/fxcrt/fx_basic_util.cpp | 24 ++++++++++++------------ core/src/fxcrt/fx_basic_wstring.cpp | 9 ++++++--- 4 files changed, 26 insertions(+), 21 deletions(-) (limited to 'core/src/fxcrt') diff --git a/core/src/fxcrt/fx_basic_array.cpp b/core/src/fxcrt/fx_basic_array.cpp index 56b2f57f3c..4ab34bb022 100644 --- a/core/src/fxcrt/fx_basic_array.cpp +++ b/core/src/fxcrt/fx_basic_array.cpp @@ -243,7 +243,8 @@ void** CFX_BaseSegmentedArray::GetIndex(int seg_index) const ASSERT(m_IndexDepth != 0); if (m_IndexDepth == 1) { return (void**)m_pIndex; - } else if (m_IndexDepth == 2) { + } + if (m_IndexDepth == 2) { return (void**)((void**)m_pIndex)[seg_index / m_IndexSize]; } int tree_size = 1; diff --git a/core/src/fxcrt/fx_basic_bstring.cpp b/core/src/fxcrt/fx_basic_bstring.cpp index 9f54414110..5eeb33b049 100644 --- a/core/src/fxcrt/fx_basic_bstring.cpp +++ b/core/src/fxcrt/fx_basic_bstring.cpp @@ -132,10 +132,9 @@ CFX_ByteString::CFX_ByteString(const CFX_ByteStringC& stringSrc) if (stringSrc.IsEmpty()) { m_pData = NULL; return; - } else { - m_pData = NULL; - *this = stringSrc; } + m_pData = NULL; + *this = stringSrc; } CFX_ByteString::CFX_ByteString(const CFX_ByteStringC& str1, const CFX_ByteStringC& str2) { @@ -971,13 +970,15 @@ int CFX_ByteString::Compare(const CFX_ByteStringC& str) const for (int i = 0; i < min_len; i ++) { if ((uint8_t)m_pData->m_String[i] < str.GetAt(i)) { return -1; - } else if ((uint8_t)m_pData->m_String[i] > str.GetAt(i)) { + } + if ((uint8_t)m_pData->m_String[i] > str.GetAt(i)) { return 1; } } if (this_len < that_len) { return -1; - } else if (this_len > that_len) { + } + if (this_len > that_len) { return 1; } return 0; diff --git a/core/src/fxcrt/fx_basic_util.cpp b/core/src/fxcrt/fx_basic_util.cpp index f23bf4bc27..26eeacce1b 100644 --- a/core/src/fxcrt/fx_basic_util.cpp +++ b/core/src/fxcrt/fx_basic_util.cpp @@ -457,18 +457,18 @@ CFX_Matrix_3by3 CFX_Matrix_3by3::Inverse() FX_FLOAT det = a*(e*i - f*h) - b*(i*d - f*g) + c*(d*h - e*g); if (FXSYS_fabs(det) < 0.0000001) return CFX_Matrix_3by3(); - else - return CFX_Matrix_3by3( - (e*i - f*h) / det, - -(b*i - c*h) / det, - (b*f - c*e) / det, - -(d*i - f*g) / det, - (a*i - c*g) / det, - -(a*f - c*d) / det, - (d*h - e*g) / det, - -(a*h - b*g) / det, - (a*e - b*d) / det - ); + + return CFX_Matrix_3by3( + (e*i - f*h) / det, + -(b*i - c*h) / det, + (b*f - c*e) / det, + -(d*i - f*g) / det, + (a*i - c*g) / det, + -(a*f - c*d) / det, + (d*h - e*g) / det, + -(a*h - b*g) / det, + (a*e - b*d) / det + ); } CFX_Matrix_3by3 CFX_Matrix_3by3::Multiply(const CFX_Matrix_3by3 &m) diff --git a/core/src/fxcrt/fx_basic_wstring.cpp b/core/src/fxcrt/fx_basic_wstring.cpp index 2442daed27..b6b595588d 100644 --- a/core/src/fxcrt/fx_basic_wstring.cpp +++ b/core/src/fxcrt/fx_basic_wstring.cpp @@ -485,7 +485,8 @@ int CFX_WideString::Compare(const CFX_WideString& str) const return 0; } return -1; - } else if (str.m_pData == NULL) { + } + if (str.m_pData == NULL) { return 1; } int this_len = m_pData->m_nDataLength; @@ -494,13 +495,15 @@ int CFX_WideString::Compare(const CFX_WideString& str) const for (int i = 0; i < min_len; i ++) { if (m_pData->m_String[i] < str.m_pData->m_String[i]) { return -1; - } else if (m_pData->m_String[i] > str.m_pData->m_String[i]) { + } + if (m_pData->m_String[i] > str.m_pData->m_String[i]) { return 1; } } if (this_len < that_len) { return -1; - } else if (this_len > that_len) { + } + if (this_len > that_len) { return 1; } return 0; -- cgit v1.2.3