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

Obsolete bool value in IMEManager::Update_Candidate_List #1083

Open
xezon opened this issue Feb 4, 2024 · 0 comments
Open

Obsolete bool value in IMEManager::Update_Candidate_List #1083

xezon opened this issue Feb 4, 2024 · 0 comments

Comments

@xezon
Copy link
Contributor

xezon commented Feb 4, 2024

void IMEManager::Update_Candidate_List(int candidate_flags)
{
...
                    if (list != nullptr) {
                        memset(list, 0, size);
                        bool b2 = true;
                        DWORD size2;

                        if (is_unicode) {
                            size2 = ImmGetCandidateListW(m_context, index, list, size);
                        } else {
                            size2 = ImmGetCandidateListA(m_context, index, list, size);
                        }

                        if (size2 == 0 || size2 > size) {
                            captainslog_dbgassert(size2 < size, "IME candidate buffer overrun");
                            b2 = false;
                        }

                        if (b2 && list->dwStyle && list->dwStyle != IME_CAND_CODE) {
                            if (list->dwPageStart > list->dwSelection
                                || list->dwSelection >= list->dwPageSize + list->dwPageStart) {
                                list->dwPageStart = list->dwPageSize * (list->dwSelection / list->dwPageSize);
                            }
...

b2 can be removed by using else if, making code simpler.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant