[Libreoffice-commits] core.git: 3 commits - vcl/source

Stephan Bergmann sbergman at redhat.com
Fri Sep 4 08:29:27 PDT 2015


 vcl/source/fontsubset/cff.cxx |   23 +++++++++--------------
 1 file changed, 9 insertions(+), 14 deletions(-)

New commits:
commit f2ac9caf85d717d417ea7221316ae43b1418548f
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Fri Sep 4 17:28:58 2015 +0200

    Reduce nVal scope
    
    Change-Id: Id5756033ccfbe392ae8264afbd3e2e0afd487f6b

diff --git a/vcl/source/fontsubset/cff.cxx b/vcl/source/fontsubset/cff.cxx
index 093cd09..f026a67 100644
--- a/vcl/source/fontsubset/cff.cxx
+++ b/vcl/source/fontsubset/cff.cxx
@@ -506,7 +506,6 @@ void CffSubsetterContext::setCharStringType( int nVal)
 
 void CffSubsetterContext::readDictOp()
 {
-    ValType nVal = 0;
     const U8 c = *mpReadPtr;
     if( c <= 21 ) {
         int nOpId = *(mpReadPtr++);
@@ -534,8 +533,8 @@ void CffSubsetterContext::readDictOp()
             default: break; // TODO: handle more boolean dictops?
             }
             break;
-        case 'n':   // dict-op number
-            nVal = popVal();
+        case 'n': { // dict-op number
+            ValType nVal = popVal();
             nInt = static_cast<int>(nVal);
             switch( nOpId) {
             case  10: mpCffLocal->maStemStdHW = nVal; break;    // "StdHW"
@@ -555,7 +554,7 @@ void CffSubsetterContext::readDictOp()
             case 937: mnFDSelectBase = nInt; break;             // "nFDSelect"
             default: break; // TODO: handle more numeric dictops?
             }
-            break;
+            } break;
         case 'a': { // array
             switch( nOpId) {
             case   5: maFontBBox.clear(); break;     // "FontBBox"
@@ -563,7 +562,7 @@ void CffSubsetterContext::readDictOp()
             default: break; // TODO: reset other arrays?
             }
             for( int i = 0; i < size(); ++i ) {
-                nVal = getVal(i);
+                ValType nVal = getVal(i);
                 switch( nOpId) {
                 case   5: maFontBBox.push_back( nVal); break;     // "FontBBox"
                 case 907: maFontMatrix.push_back( nVal); break; // "FontMatrix"
@@ -573,7 +572,7 @@ void CffSubsetterContext::readDictOp()
             clear();
             } break;
         case 'd': { // delta array
-            nVal = 0;
+            ValType nVal = 0;
             for( int i = 0; i < size(); ++i ) {
                 nVal += getVal(i);
                 switch( nOpId) {
@@ -626,13 +625,13 @@ void CffSubsetterContext::readDictOp()
         if( (sizeof(nS32) != 4) && (nS32 & (1U<<31)))
             nS32 |= (~0U) << 31;    // assuming 2s complement
         mpReadPtr += 4;
-        nVal = static_cast<ValType>(nS32);
+        ValType nVal = static_cast<ValType>(nS32);
         push( nVal );
     } else if( c == 30) {       // real number
         ++mpReadPtr; // skip 30
         const RealType fReal = readRealVal();
         // push value onto stack
-        nVal = fReal;
+        ValType nVal = fReal;
         push( nVal);
     }
 }
commit 8fde3dd4da0bffb5294109b5ee5c4441eb558a5d
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Fri Sep 4 17:26:05 2015 +0200

    Uniformly use if --- else if brachnes here
    
    Change-Id: I80d9d0d4c4d56aa8d52dc2e108a9b24025fb0f76

diff --git a/vcl/source/fontsubset/cff.cxx b/vcl/source/fontsubset/cff.cxx
index ead725a..093cd09 100644
--- a/vcl/source/fontsubset/cff.cxx
+++ b/vcl/source/fontsubset/cff.cxx
@@ -614,11 +614,7 @@ void CffSubsetterContext::readDictOp()
             setCharStringType( nInt );
             break;
         }
-
-        return;
-    }
-
-    if( (c >= 32) || (c == 28) ) {
+    } else if( (c >= 32) || (c == 28) ) {
 //      --mpReadPtr;
         read2push();
     } else if( c == 29 ) {      // longint
commit 9909bcb88ec68d52a0f863319d9b4d12cc90b20c
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Fri Sep 4 17:25:10 2015 +0200

    clang-tidy clang-analyzer-deadcode.DeadStores
    
    Change-Id: I1588f55b4be2d32dcafae27ac45eb5def1407fa6

diff --git a/vcl/source/fontsubset/cff.cxx b/vcl/source/fontsubset/cff.cxx
index a4cbf53..ead725a 100644
--- a/vcl/source/fontsubset/cff.cxx
+++ b/vcl/source/fontsubset/cff.cxx
@@ -606,7 +606,7 @@ void CffSubsetterContext::readDictOp()
             int nSid2 = popInt();
             (void)nSid1; // TODO: use
             (void)nSid2; // TODO: use
-            nVal = popVal();
+            popVal();
             mbCIDFont = true;
             } break;
         case 't':   // CharstringType


More information about the Libreoffice-commits mailing list