Skip to content

Commit 37b3519

Browse files
authored
style(clang-tidy): fix cppcoreguidelines init variables (#1698)
fixes: #1663 Signed-off-by: Balakrishna Avulapati <bavulapati@gmail.com>
1 parent 2d79503 commit 37b3519

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

src/core/json/json_value.cc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -359,7 +359,7 @@ auto JSON::operator-=(const JSON &substractive) -> JSON & {
359359
return false;
360360
} else if (this->is_real()) {
361361
const auto value{this->to_real()};
362-
Real integral;
362+
Real integral = 0.0;
363363
return !std::isinf(value) && !std::isnan(value) &&
364364
std::modf(value, &integral) == 0.0;
365365
} else {
@@ -659,14 +659,14 @@ JSON::at(const String &key,
659659
const auto dividend_value{this->as_real()};
660660

661661
// Every real number that represents an integral is divisible by 0.5.
662-
Real dividend_integral;
662+
Real dividend_integral = 0;
663663
if (std::modf(dividend_value, &dividend_integral) == 0.0 &&
664664
divisor_value == 0.5) {
665665
return true;
666666
}
667667

668668
const auto division{dividend_value / divisor_value};
669-
Real integral;
669+
Real integral = 0;
670670
return !std::isinf(division) && !std::isnan(division) &&
671671
std::modf(division, &integral) == 0.0;
672672
}

src/core/uri/uri.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ static auto uri_normalize(UriUriA *uri) -> void {
2121
}
2222

2323
static auto uri_to_string(const UriUriA *const uri) -> std::string {
24-
int size;
24+
int size = 0;
2525
if (uriToStringCharsRequiredA(uri, &size) != URI_SUCCESS) {
2626
throw sourcemeta::core::URIError{"Could not determine URI size"};
2727
}
@@ -49,7 +49,7 @@ static auto uri_text_range(const UriTextRangeA *const range)
4949
}
5050

5151
static auto uri_parse(const std::string &data, UriUriA *uri) -> void {
52-
const char *error_position;
52+
const char *error_position = nullptr;
5353
switch (uriParseSingleUriA(uri, data.c_str(), &error_position)) {
5454
case URI_ERROR_SYNTAX:
5555
// TODO: Test the positions of this error

0 commit comments

Comments
 (0)