gnash-commit
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Gnash-commit] [patch #8276] Document some switch/case fallthrough cases


From: Petter Reinholdtsen
Subject: [Gnash-commit] [patch #8276] Document some switch/case fallthrough cases (avoid Coverity defect reports)
Date: Tue, 14 Jan 2014 15:11:33 +0000
User-agent: Opera/9.80 (X11; Linux x86_64) Presto/2.12.388 Version/12.16

URL:
  <http://savannah.gnu.org/patch/?8276>

                 Summary: Document some switch/case fallthrough cases (avoid
Coverity defect reports)
                 Project: Gnash - The GNU Flash player
            Submitted by: pere
            Submitted on: Tue 14 Jan 2014 15:11:33 GMT
                Category: core
                Priority: 5 - Normal
                  Status: None
                 Privacy: Public
             Assigned to: None
        Originator Email: 
             Open/Closed: Open
         Discussion Lock: Any

    _______________________________________________________

Details:

I had a quick look at the new Coverity scan result, and decided to try
to address several detected problems with missing break in switch/case
blocks.  The following patch should solve the problem by telling
Coverity and the casual reader that these fall through cases are
intentional.  This addreses these CIDs:

  1154665 (libcore/asobj/TextFormat_as.cpp)
  1154664 (libcore/asobj/Date_as.cpp)
  1154663 (libcore/asobj/Date_as.cpp)
  1154662 (libcore/asobj/MovieClip_as.cpp)
  1149157 (libbase/RTMP.cpp)
  1149156 (libbase/RTMP.cpp)

diff --git a/libbase/RTMP.cpp b/libbase/RTMP.cpp
index cc5046f..068fc11 100644
--- a/libbase/RTMP.cpp
+++ b/libbase/RTMP.cpp
@@ -845,16 +845,20 @@ HandShaker::call()
         case 0:
             if (!stage0()) return;
             _stage = 1;
+            /* Fall through */
         case 1:
             if (!stage1()) return;
             _stage = 2;
+            /* Fall through */
         case 2:
             if (!stage2()) return;
             _stage = 3;
+            /* Fall through */
         case 3:
             if (!stage3()) return;
             log_debug("Handshake completed");
             _complete = true;
+           break;
     }
 }
 
diff --git a/libcore/asobj/Date_as.cpp b/libcore/asobj/Date_as.cpp
index 4b856e2..ee5d12b 100644
--- a/libcore/asobj/Date_as.cpp
+++ b/libcore/asobj/Date_as.cpp
@@ -463,6 +463,7 @@ date_new(const fn_call& fn)
                 log_aserror(_("Date constructor called with more than 7 "
                         "arguments"));
                 )
+                /* Fall through */
             case 7:
                 // fractions of milliseconds are ignored
                 gt.millisecond = toInt(fn.arg(6), getVM(fn));
@@ -1250,6 +1251,7 @@ date_UTC(const fn_call& fn) {
             IF_VERBOSE_ASCODING_ERRORS(
                 log_aserror(_("Date.UTC was called with more than 7
arguments"));
             )
+            /* Fall through */
         case 7:
             // millisecs is double, but fractions of millisecs are ignored.
             gt.millisecond = toInt(fn.arg(6), getVM(fn));
diff --git a/libcore/asobj/MovieClip_as.cpp b/libcore/asobj/MovieClip_as.cpp
index 087182a..3b8c0f4 100644
--- a/libcore/asobj/MovieClip_as.cpp
+++ b/libcore/asobj/MovieClip_as.cpp
@@ -1118,6 +1118,7 @@ movieclip_getURL(const fn_call& fn)
                     "dropped"), os.str());
             );
         }
+            /* Fall through */
         case 3:
             // This argument has already been handled.
         case 2:
diff --git a/libcore/asobj/TextFormat_as.cpp
b/libcore/asobj/TextFormat_as.cpp
index 7d1e60c..c09e5bb 100644
--- a/libcore/asobj/TextFormat_as.cpp
+++ b/libcore/asobj/TextFormat_as.cpp
@@ -406,6 +406,7 @@ textformat_new(const fn_call& fn)
        {
            default:
                log_error(_("Too many args (%d) passed to TextFormat"), args);
+               /* Fall through */
            case 13:
                tf->leadingSet(pixelsToTwips(toInt(fn.arg(12), getVM(fn))));
            case 12:





    _______________________________________________________

Reply to this item at:

  <http://savannah.gnu.org/patch/?8276>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.gnu.org/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]