patchGnash - The GNU Flash player - Patches: patch #8276, Document some switch/case...

 
 

You are not allowed to post comments on this tracker with your current authentication level.

patch #8276: Document some switch/case fallthrough cases (avoid Coverity defect reports)

Submitter:  Petter Reinholdtsen <pere>
Submitted:  Tue 14 Jan 2014 03:11:33 PM UTC
   
 
Category:  core Priority:  5 - Normal
Status:  Done Privacy:  Public
Assigned to:  None Open/Closed:  Closed

Wed 15 Jan 2014 11:24:48 AM UTC, comment #2: 

Please also update the "Status" parameter of tickets you close

Sandro Santilli <strk>
Group Member
Wed 15 Jan 2014 10:55:50 AM UTC, comment #1: 

Patch commited.

Petter Reinholdtsen <pere>
Group Member
Tue 14 Jan 2014 03:11:33 PM UTC, original submission:  

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:

Petter Reinholdtsen <pere>
Group Member

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by strk (Posted a comment)
  • -email is unavailable- added by pere (Submitted the item)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

     

    Follow 2 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2014-01-15 strk StatusNone Done
    2014-01-15 pere Open/ClosedOpen Closed

    Back to the top

    Powered by Savane 3.13-4b48.
    Corresponding source code