Merge pull request #598 from Dmitry-Me/fallThroughComments

Annotate fall throughs with comments
This commit is contained in:
Lee Thomason 2017-08-07 13:49:56 -07:00 committed by GitHub
commit 68edbcee49
1 changed files with 5 additions and 1 deletions

View File

@ -424,20 +424,24 @@ void XMLUtil::ConvertUTF32ToUTF8( unsigned long input, char* output, int* length
output += *length;
// Scary scary fall throughs.
// Scary scary fall throughs are annotated with carefully designed comments
// to suppress compiler warnings such as -Wimplicit-fallthrough in gcc
switch (*length) {
case 4:
--output;
*output = (char)((input | BYTE_MARK) & BYTE_MASK);
input >>= 6;
//fall through
case 3:
--output;
*output = (char)((input | BYTE_MARK) & BYTE_MASK);
input >>= 6;
//fall through
case 2:
--output;
*output = (char)((input | BYTE_MARK) & BYTE_MASK);
input >>= 6;
//fall through
case 1:
--output;
*output = (char)(input | FIRST_BYTE_MARK[*length]);