Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NodeTreeBase: Suppress code analysis report about invalid lifetime #1173

Merged
merged 1 commit into from Jun 3, 2023

Conversation

ma8ma
Copy link
Collaborator

@ma8ma ma8ma commented Jun 3, 2023

std::string_viewからポインターを取得する箇所でスコープ外のローカル変数を示すポインターを使用していると指摘されたため引数をconst char*std::size_tに分けてメンバー関数に渡すようにコードを書き換えてcppcheckのレポートを抑制します。

cppcheck 2.10のレポート

src/dbtree/nodetreebase.cpp:2083:31: error: Using object that points
to local variable 'str_mail' that is out of scope. [invalidLifetime]
(snip)

`std::string_view`からポインターを取得する箇所でスコープ外の
ローカル変数を示すポインターを使用していると指摘されたため
引数を`const char*`と`std::size_t`に分けてメンバー関数に渡すように
コードを書き換えてcppcheckのレポートを抑制します。

cppcheck 2.10のレポート
```
src/dbtree/nodetreebase.cpp:2083:31: error: Using object that points
to local variable 'str_mail' that is out of scope. [invalidLifetime]
(snip)
```
@ma8ma ma8ma added the refactoring コードの整理 (バグ修正でも機能変更でもない) label Jun 3, 2023
@ma8ma ma8ma merged commit 6750924 into master Jun 3, 2023
20 checks passed
@ma8ma ma8ma deleted the nodetreebase-suppress-code-analysis-report branch June 3, 2023 13:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
refactoring コードの整理 (バグ修正でも機能変更でもない)
Projects
No open projects
Development

Successfully merging this pull request may close these issues.

None yet

1 participant