Skip to content

Commit d15c970

Browse files
authored
fix cppcoreguidelines-init-variables checks (#1821)
Refs: #1663 Signed-off-by: Balakrishna Avulapati <ba@bavulapati.com>
1 parent e263eca commit d15c970

File tree

4 files changed

+5
-5
lines changed

4 files changed

+5
-5
lines changed

src/core/json/parser.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -681,7 +681,7 @@ auto internal_parse_json(
681681
std::stack<std::reference_wrapper<Result>> frames;
682682
std::optional<Result> result;
683683
typename Result::String key{""};
684-
typename JSON::Char character;
684+
typename JSON::Char character = 0;
685685

686686
/*
687687
* Parse any JSON document

src/core/jsonpointer/parser.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ namespace sourcemeta::core {
4444
auto parse_pointer(std::basic_istream<JSON::Char, JSON::CharTraits> &stream)
4545
-> Pointer {
4646
Pointer result;
47-
JSON::Char character;
47+
JSON::Char character = 0;
4848
std::basic_stringstream<JSON::Char> string;
4949
std::uint64_t column{0};
5050

src/core/uri/escaping.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ auto uri_escape(const char character, std::ostream &output,
7575

7676
auto uri_escape(std::istream &input, std::ostream &output,
7777
const URIEscapeMode mode) -> void {
78-
char character;
78+
char character = 0;
7979
while (input.get(character)) {
8080
uri_escape(character, output, mode);
8181
}

src/core/uri/uri.cc

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

2525
auto uri_to_string(const UriUriA *const uri) -> std::string {
26-
int size;
26+
int size = 0;
2727
if (uriToStringCharsRequiredA(uri, &size) != URI_SUCCESS) {
2828
throw sourcemeta::core::URIError{"Could not determine URI size"};
2929
}
@@ -51,7 +51,7 @@ auto uri_text_range(const UriTextRangeA *const range)
5151
}
5252

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

0 commit comments

Comments
 (0)