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

article: Add const qualifier to pointer variables in local scope #1228

Merged
merged 1 commit into from Aug 19, 2023

Conversation

ma8ma
Copy link
Collaborator

@ma8ma ma8ma commented Aug 19, 2023

ローカルのポインター変数にconstを付けられるとcppcheckに指摘されたため修正します。

cppcheck 2.11.1のレポート

src/article/toolbar.cpp:62:22: style: Variable 'articleview' can be declared as pointer to const [constVariablePointer]
    ArticleViewBase* articleview = dynamic_cast< ArticleViewBase* >( view );
                     ^
src/article/drawareabase.cpp:603:29: style: Variable 'css' can be declared as pointer to const [constVariablePointer]
        CORE::CSS_PROPERTY* css = m_layout_tree->get_separator()->css;
                            ^
src/article/drawareabase.cpp:604:20: style: Variable 'rect' can be declared as pointer to const [constVariablePointer]
        RECTANGLE* rect = m_layout_tree->get_separator()->rect;
                   ^
src/article/drawareabase.cpp:4296:16: style: Variable 'rect_from' can be declared as pointer to const [constVariablePointer]
    RECTANGLE* rect_from = layout->rect;
               ^
src/article/drawareabase.cpp:4442:13: style: Variable 'layout' can be declared as pointer to const [constVariablePointer]
    LAYOUT* layout = caret_pos.layout;
            ^
src/article/articleadmin.cpp:643:21: style: Variable 'view' can be declared as pointer to const [constVariablePointer]
    SKELETON::View* view = get_current_view();
                    ^

ローカルのポインター変数にconstを付けられるとcppcheckに指摘されたため
修正します。

cppcheck 2.11.1のレポート
```
src/article/toolbar.cpp:62:22: style: Variable 'articleview' can be declared as pointer to const [constVariablePointer]
    ArticleViewBase* articleview = dynamic_cast< ArticleViewBase* >( view );
                     ^
src/article/drawareabase.cpp:603:29: style: Variable 'css' can be declared as pointer to const [constVariablePointer]
        CORE::CSS_PROPERTY* css = m_layout_tree->get_separator()->css;
                            ^
src/article/drawareabase.cpp:604:20: style: Variable 'rect' can be declared as pointer to const [constVariablePointer]
        RECTANGLE* rect = m_layout_tree->get_separator()->rect;
                   ^
src/article/drawareabase.cpp:4296:16: style: Variable 'rect_from' can be declared as pointer to const [constVariablePointer]
    RECTANGLE* rect_from = layout->rect;
               ^
src/article/drawareabase.cpp:4442:13: style: Variable 'layout' can be declared as pointer to const [constVariablePointer]
    LAYOUT* layout = caret_pos.layout;
            ^
src/article/articleadmin.cpp:643:21: style: Variable 'view' can be declared as pointer to const [constVariablePointer]
    SKELETON::View* view = get_current_view();
                    ^
```
@ma8ma ma8ma added the bug バグの追跡 label Aug 19, 2023
@ma8ma ma8ma merged commit 649b38e into master Aug 19, 2023
20 checks passed
@ma8ma ma8ma deleted the article-add-const-to-pointer-var branch August 19, 2023 14:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug バグの追跡
Projects
No open projects
Development

Successfully merging this pull request may close these issues.

None yet

1 participant