From 74a021346d3a97cd112fa528c09ff8823d36145c Mon Sep 17 00:00:00 2001 From: etiennebatise Date: Wed, 14 Oct 2015 15:46:26 +0200 Subject: [PATCH] Add break at default switch case statements fix issue #444 --- include/rapidjson/document.h | 1 + include/rapidjson/reader.h | 15 +++++++++++---- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/include/rapidjson/document.h b/include/rapidjson/document.h index 516cb5e0c..8da86ab27 100644 --- a/include/rapidjson/document.h +++ b/include/rapidjson/document.h @@ -2101,6 +2101,7 @@ GenericValue::GenericValue(const GenericValue(&rhs.data_); + break; } } diff --git a/include/rapidjson/reader.h b/include/rapidjson/reader.h index fba9f196e..b56f3b5a0 100644 --- a/include/rapidjson/reader.h +++ b/include/rapidjson/reader.h @@ -551,7 +551,9 @@ class GenericReader { if (!handler.EndObject(memberCount)) RAPIDJSON_PARSE_ERROR(kParseErrorTermination, is.Tell()); return; - default: RAPIDJSON_PARSE_ERROR(kParseErrorObjectMissCommaOrCurlyBracket, is.Tell()); + default: + RAPIDJSON_PARSE_ERROR(kParseErrorObjectMissCommaOrCurlyBracket, is.Tell()); + break; } } } @@ -592,7 +594,9 @@ class GenericReader { if (!handler.EndArray(elementCount)) RAPIDJSON_PARSE_ERROR(kParseErrorTermination, is.Tell()); return; - default: RAPIDJSON_PARSE_ERROR(kParseErrorArrayMissCommaOrSquareBracket, is.Tell()); + default: + RAPIDJSON_PARSE_ERROR(kParseErrorArrayMissCommaOrSquareBracket, is.Tell()); + break; } } } @@ -1041,7 +1045,10 @@ class GenericReader { case '"': ParseString(is, handler); break; case '{': ParseObject(is, handler); break; case '[': ParseArray (is, handler); break; - default : ParseNumber(is, handler); + default : + ParseNumber(is, handler); + break; + } } @@ -1443,7 +1450,7 @@ class GenericReader { case IterativeParsingMemberKeyState: RAPIDJSON_PARSE_ERROR(kParseErrorObjectMissColon, is.Tell()); return; case IterativeParsingMemberValueState: RAPIDJSON_PARSE_ERROR(kParseErrorObjectMissCommaOrCurlyBracket, is.Tell()); return; case IterativeParsingElementState: RAPIDJSON_PARSE_ERROR(kParseErrorArrayMissCommaOrSquareBracket, is.Tell()); return; - default: RAPIDJSON_PARSE_ERROR(kParseErrorUnspecificSyntaxError, is.Tell()); + default: RAPIDJSON_PARSE_ERROR(kParseErrorUnspecificSyntaxError, is.Tell()); return; } }