Skip to content

Commit a9eb1ec

Browse files
committed
Fixed more default cases.
1 parent 6ffff91 commit a9eb1ec

1 file changed

Lines changed: 14 additions & 9 deletions

File tree

src/lib_json/json_value.cpp

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -723,9 +723,9 @@ Value::asInt() const
723723
case booleanValue:
724724
return value_.bool_ ? 1 : 0;
725725
default:
726-
JSON_FAIL_MESSAGE("Value is not convertible to Int.");
726+
break;
727727
}
728-
JSON_ASSERT_UNREACHABLE;
728+
JSON_FAIL_MESSAGE("Value is not convertible to Int.");
729729
return 0;
730730
}
731731

@@ -749,9 +749,9 @@ Value::asUInt() const
749749
case booleanValue:
750750
return value_.bool_ ? 1 : 0;
751751
default:
752-
JSON_FAIL_MESSAGE("Value is not convertible to UInt.");
752+
break;
753753
}
754-
JSON_ASSERT_UNREACHABLE;
754+
JSON_FAIL_MESSAGE("Value is not convertible to UInt.");
755755
return 0;
756756
}
757757

@@ -776,9 +776,9 @@ Value::asInt64() const
776776
case booleanValue:
777777
return value_.bool_ ? 1 : 0;
778778
default:
779-
JSON_FAIL_MESSAGE("Value is not convertible to Int64.");
779+
break;
780780
}
781-
JSON_ASSERT_UNREACHABLE;
781+
JSON_FAIL_MESSAGE("Value is not convertible to Int64.");
782782
return 0;
783783
}
784784

@@ -803,7 +803,7 @@ Value::asUInt64() const
803803
default:
804804
break;
805805
}
806-
JSON_ASSERT_UNREACHABLE;
806+
JSON_FAIL_MESSAGE("Value is not convertible to UInt64.");
807807
return 0;
808808
}
809809
# endif // if defined(JSON_HAS_INT64)
@@ -851,9 +851,10 @@ Value::asDouble() const
851851
case booleanValue:
852852
return value_.bool_ ? 1.0 : 0.0;
853853
default:
854-
JSON_FAIL_MESSAGE("Value is not convertible to double.");
854+
break;
855855
}
856-
return 0; // unreachable;
856+
JSON_FAIL_MESSAGE("Value is not convertible to double.");
857+
return 0;
857858
}
858859

859860
float
@@ -875,6 +876,8 @@ Value::asFloat() const
875876
return 0.0;
876877
case booleanValue:
877878
return value_.bool_ ? 1.0f : 0.0f;
879+
default:
880+
break;
878881
}
879882
JSON_FAIL_MESSAGE("Value is not convertible to float.");
880883
return 0.0f;
@@ -895,6 +898,8 @@ Value::asBool() const
895898
return value_.uint_ ? true : false;
896899
case realValue:
897900
return value_.real_ ? true : false;
901+
default:
902+
break;
898903
}
899904
JSON_FAIL_MESSAGE("Value is not convertible to bool.");
900905
return false;

0 commit comments

Comments
 (0)