]> source.dussan.org Git - tigervnc.git/commitdiff
Explicitly mark switch case fall through
authorPierre Ossman <ossman@cendio.se>
Wed, 4 Jan 2023 15:26:02 +0000 (16:26 +0100)
committerPierre Ossman <ossman@cendio.se>
Thu, 5 Jan 2023 15:43:34 +0000 (16:43 +0100)
This allows us to separate accidental fall through from explicit ones,
which allows us to turn on such checks in the compiler.

common/rfb/CSecurityRSAAES.cxx
common/rfb/JpegCompressor.cxx
common/rfb/PixelFormat.inl
vncviewer/DesktopWindow.cxx
vncviewer/OptionsDialog.cxx
win/winvnc/STrayIcon.cxx

index 208bcc2f4e876639d21d25a4c289c4d3d57d8784..c84422b677ddfa2a19abb12871d5d70e22dbff8d 100644 (file)
@@ -106,17 +106,20 @@ bool CSecurityRSAAES::processMsg()
       writePublicKey();
       writeRandom();
       state = ReadRandom;
+      /* fall through */
     case ReadRandom:
       if (!readRandom())
         return false;
       setCipher();
       writeHash();
       state = ReadHash;
+      /* fall through */
     case ReadHash:
       if (!readHash())
         return false;
       clearSecrets();
       state = ReadSubtype;
+      /* fall through */
     case ReadSubtype:
       if (!readSubtype())
         return false;
index 0ecc6de937e90168367c0f10fa17d7aff8c9ed70..24a62a865d42d3cf7b3c8409157a316c0df06475 100644 (file)
@@ -232,6 +232,7 @@ void JpegCompressor::compress(const rdr::U8 *buf, int stride, const Rect& r,
     break;
   case subsampleGray:
     jpeg_set_colorspace(cinfo, JCS_GRAYSCALE);
+    // fall through
   default:
     cinfo->comp_info[0].h_samp_factor = 1;
     cinfo->comp_info[0].v_samp_factor = 1;
index 5a40379a37fe6b2b0153082a1898e0c956c67c27..3a0bfe4974bf02067301e55a1e5161812887583b 100644 (file)
@@ -30,8 +30,10 @@ inline Pixel PixelFormat::pixelFromBuffer(const rdr::U8* buffer) const
     case 32:
       p |= ((Pixel)*(buffer++)) << 24;
       p |= ((Pixel)*(buffer++)) << 16;
+      /* fall through */
     case 16:
       p |= ((Pixel)*(buffer++)) << 8;
+      /* fall through */
     case 8:
       p |= *buffer;
     }
@@ -57,8 +59,10 @@ inline void PixelFormat::bufferFromPixel(rdr::U8* buffer, Pixel p) const
     case 32:
       *(buffer++) = (p >> 24) & 0xff;
       *(buffer++) = (p >> 16) & 0xff;
+      /* fall through */
     case 16:
       *(buffer++) = (p >>  8) & 0xff;
+      /* fall through */
     case 8:
       *(buffer++) = (p >>  0) & 0xff;
     }
index 1bd66b9284a3f5232d6084fd10b4b544a6705fe1..70573a28bc864d8c5123164a3d8a3270d4d4ae6c 100644 (file)
@@ -840,6 +840,7 @@ int DesktopWindow::handle(int event)
   case FL_ENTER:
       if (keyboardGrabbed)
           grabPointer();
+      /* fall through */
   case FL_LEAVE:
   case FL_DRAG:
   case FL_MOVE:
index c756f3a8befce7abd2be3709a3ebeb5bc8433f00..d0481708724f0dc7829c07ffb0e1dc4428fc08d7 100644 (file)
@@ -295,6 +295,7 @@ void OptionsDialog::loadOptions(void)
     case secTypeRA2ne:
     case secTypeRAne256:
       authVncCheckbox->value(true);
+      /* fall through */
     case secTypeDH:
     case secTypeMSLogonII:
       encNoneCheckbox->value(true);
index 83afbed280d58ff41c1f2ab2960a56ae95a1cab7..2cf2475291f7cce864a052c84a5644097fb5b312 100644 (file)
@@ -189,6 +189,7 @@ public:
           return thread.server.disconnectClients("IPC disconnect") ? 1 : 0;
         case 3:
           thread.server.setClientsStatus(&CPanel->ListConnStatus);
+          /* fall through */
         case 4:
           thread.server.getClientsInfo(&LCInfo);
           CPanel->UpdateListView(&LCInfo);