From b29dd370f7b0115fba6561117420d8e08b7d5ab9 Mon Sep 17 00:00:00 2001 From: lovechinamo Date: Wed, 15 Jun 2022 20:45:49 +0800 Subject: [PATCH 1/8] Signed-off-by: lovechinamo Changes to be committed: --- .../inputmethod_controller/src/input_method_controller.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/frameworks/inputmethod_controller/src/input_method_controller.cpp b/frameworks/inputmethod_controller/src/input_method_controller.cpp index ed07a7d..81cce85 100644 --- a/frameworks/inputmethod_controller/src/input_method_controller.cpp +++ b/frameworks/inputmethod_controller/src/input_method_controller.cpp @@ -386,7 +386,7 @@ using namespace MessageID; { IMSA_HILOGI("InputMethodController::GetTextBeforeCursor"); if (!mTextString.empty()) { - int32_t endPos = (mSelectNewEnd+number(mTextString.size())) ? (mSelectNewEnd + number) : mTextString.size(); return mTextString.substr(mSelectNewEnd, endPos); } return u""; From f65e2b80e33e6f2553e64d44a708d3046fecbd5b Mon Sep 17 00:00:00 2001 From: lovechinamo Date: Thu, 16 Jun 2022 09:00:22 +0800 Subject: [PATCH 2/8] Signed-off-by: lovechinamo Changes to be committed: --- .../inputmethod_controller/src/input_method_controller.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/frameworks/inputmethod_controller/src/input_method_controller.cpp b/frameworks/inputmethod_controller/src/input_method_controller.cpp index 81cce85..8e9811b 100644 --- a/frameworks/inputmethod_controller/src/input_method_controller.cpp +++ b/frameworks/inputmethod_controller/src/input_method_controller.cpp @@ -386,7 +386,8 @@ using namespace MessageID; { IMSA_HILOGI("InputMethodController::GetTextBeforeCursor"); if (!mTextString.empty()) { - int32_t endPos = (mSelectNewEnd+number < static_cast(mTextString.size())) ? (mSelectNewEnd + number) : mTextString.size(); + int32_t endPos = (mSelectNewEnd+number < static_cast(mTextString.size())) ? \ + (mSelectNewEnd + number) : mTextString.size(); return mTextString.substr(mSelectNewEnd, endPos); } return u""; From 83d7f0b7077209994e4767bbd01d3cdf3add6f80 Mon Sep 17 00:00:00 2001 From: lovechinamo Date: Thu, 16 Jun 2022 19:49:38 +0800 Subject: [PATCH 3/8] Signed-off-by: lovechinamo Changes to be committed: modified: frameworks/inputmethod_controller/src/input_method_controller.cpp --- .../inputmethod_controller/src/input_method_controller.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/frameworks/inputmethod_controller/src/input_method_controller.cpp b/frameworks/inputmethod_controller/src/input_method_controller.cpp index 8e9811b..0e448ec 100644 --- a/frameworks/inputmethod_controller/src/input_method_controller.cpp +++ b/frameworks/inputmethod_controller/src/input_method_controller.cpp @@ -386,7 +386,7 @@ using namespace MessageID; { IMSA_HILOGI("InputMethodController::GetTextBeforeCursor"); if (!mTextString.empty()) { - int32_t endPos = (mSelectNewEnd+number < static_cast(mTextString.size())) ? \ + int32_t endPos = (mSelectNewEnd+number < static_cast(mTextString.size())) ? (mSelectNewEnd + number) : mTextString.size(); return mTextString.substr(mSelectNewEnd, endPos); } From b357835cc0e02df2078a6ff024febfa3e0966739 Mon Sep 17 00:00:00 2001 From: lovechinamo Date: Thu, 16 Jun 2022 20:47:47 +0800 Subject: [PATCH 4/8] Signed-off-by: lovechinamo Changes to be committed: --- .idea/.gitignore | 0 .idea/miscservices_inputmethod_1.iml | 8 +++ .idea/modules.xml | 8 +++ .idea/vcs.xml | 6 +++ .idea/workspace.xml | 54 +++++++++++++++++++ .../src/input_method_controller.cpp | 5 +- 6 files changed, 79 insertions(+), 2 deletions(-) create mode 100644 .idea/.gitignore create mode 100644 .idea/miscservices_inputmethod_1.iml create mode 100644 .idea/modules.xml create mode 100644 .idea/vcs.xml create mode 100644 .idea/workspace.xml diff --git a/.idea/.gitignore b/.idea/.gitignore new file mode 100644 index 0000000..e69de29 diff --git a/.idea/miscservices_inputmethod_1.iml b/.idea/miscservices_inputmethod_1.iml new file mode 100644 index 0000000..bc2cd87 --- /dev/null +++ b/.idea/miscservices_inputmethod_1.iml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml new file mode 100644 index 0000000..2add3f4 --- /dev/null +++ b/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 0000000..94a25f7 --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/.idea/workspace.xml b/.idea/workspace.xml new file mode 100644 index 0000000..e13c448 --- /dev/null +++ b/.idea/workspace.xml @@ -0,0 +1,54 @@ + + + + + + + + + + + + + + + + + + + + + { + "keyToString": { + "RunOnceActivity.OpenProjectViewOnStart": "true", + "RunOnceActivity.ShowReadmeOnStart": "true", + "RunOnceActivity.cidr.known.project.marker": "true", + "WebServerToolWindowFactoryState": "false", + "cf.first.check.clang-format": "false", + "cidr.known.project.marker": "true" + } +} + + + + + 1655383172519 + + + + \ No newline at end of file diff --git a/frameworks/inputmethod_controller/src/input_method_controller.cpp b/frameworks/inputmethod_controller/src/input_method_controller.cpp index 0e448ec..53adcf5 100644 --- a/frameworks/inputmethod_controller/src/input_method_controller.cpp +++ b/frameworks/inputmethod_controller/src/input_method_controller.cpp @@ -386,8 +386,9 @@ using namespace MessageID; { IMSA_HILOGI("InputMethodController::GetTextBeforeCursor"); if (!mTextString.empty()) { - int32_t endPos = (mSelectNewEnd+number < static_cast(mTextString.size())) ? - (mSelectNewEnd + number) : mTextString.size(); + int32_t endPos = (mSelectNewEnd + number < static_cast(mTextString.size())) + ? (mSelectNewEnd + number) + : mTextString.size(); return mTextString.substr(mSelectNewEnd, endPos); } return u""; From ba18cd0cd5d89e625d31c7403b513360acae16e8 Mon Sep 17 00:00:00 2001 From: lovechinamo Date: Thu, 16 Jun 2022 20:48:36 +0800 Subject: [PATCH 5/8] Signed-off-by: lovechinamo Changes to be committed: --- .idea/.gitignore | 0 .idea/miscservices_inputmethod_1.iml | 8 ----- .idea/modules.xml | 8 ----- .idea/vcs.xml | 6 ---- .idea/workspace.xml | 54 ---------------------------- 5 files changed, 76 deletions(-) delete mode 100644 .idea/.gitignore delete mode 100644 .idea/miscservices_inputmethod_1.iml delete mode 100644 .idea/modules.xml delete mode 100644 .idea/vcs.xml delete mode 100644 .idea/workspace.xml diff --git a/.idea/.gitignore b/.idea/.gitignore deleted file mode 100644 index e69de29..0000000 diff --git a/.idea/miscservices_inputmethod_1.iml b/.idea/miscservices_inputmethod_1.iml deleted file mode 100644 index bc2cd87..0000000 --- a/.idea/miscservices_inputmethod_1.iml +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - - \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml deleted file mode 100644 index 2add3f4..0000000 --- a/.idea/modules.xml +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - - \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml deleted file mode 100644 index 94a25f7..0000000 --- a/.idea/vcs.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/.idea/workspace.xml b/.idea/workspace.xml deleted file mode 100644 index e13c448..0000000 --- a/.idea/workspace.xml +++ /dev/null @@ -1,54 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - { - "keyToString": { - "RunOnceActivity.OpenProjectViewOnStart": "true", - "RunOnceActivity.ShowReadmeOnStart": "true", - "RunOnceActivity.cidr.known.project.marker": "true", - "WebServerToolWindowFactoryState": "false", - "cf.first.check.clang-format": "false", - "cidr.known.project.marker": "true" - } -} - - - - - 1655383172519 - - - - \ No newline at end of file From c2b2e4fe98478e42b3e4bf7ee58e9fcaaa02b8c6 Mon Sep 17 00:00:00 2001 From: lovechinamo Date: Mon, 20 Jun 2022 16:48:26 +0800 Subject: [PATCH 6/8] Signed-off-by: lovechinamo Changes to be committed: modified: input_method_controller.cpp --- .../inputmethod_controller/src/input_method_controller.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/frameworks/inputmethod_controller/src/input_method_controller.cpp b/frameworks/inputmethod_controller/src/input_method_controller.cpp index 53adcf5..4795055 100644 --- a/frameworks/inputmethod_controller/src/input_method_controller.cpp +++ b/frameworks/inputmethod_controller/src/input_method_controller.cpp @@ -384,8 +384,9 @@ using namespace MessageID; std::u16string InputMethodController::GetTextAfterCursor(int32_t number) { + constexpr unsigned int MAX_INT32_T = 2147483647; IMSA_HILOGI("InputMethodController::GetTextBeforeCursor"); - if (!mTextString.empty()) { + if (!mTextString.empty() && mTextString.size <= MAX_INT32_T) { int32_t endPos = (mSelectNewEnd + number < static_cast(mTextString.size())) ? (mSelectNewEnd + number) : mTextString.size(); From 71a492787d4911ad80cdc702859e46990dd79409 Mon Sep 17 00:00:00 2001 From: lovechinamo Date: Mon, 20 Jun 2022 21:24:41 +0800 Subject: [PATCH 7/8] Signed-off-by: lovechinamo Changes to be committed: modified: frameworks/inputmethod_controller/src/input_method_controller.cpp --- .../inputmethod_controller/src/input_method_controller.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/frameworks/inputmethod_controller/src/input_method_controller.cpp b/frameworks/inputmethod_controller/src/input_method_controller.cpp index 4795055..a6d91e3 100644 --- a/frameworks/inputmethod_controller/src/input_method_controller.cpp +++ b/frameworks/inputmethod_controller/src/input_method_controller.cpp @@ -386,7 +386,7 @@ using namespace MessageID; { constexpr unsigned int MAX_INT32_T = 2147483647; IMSA_HILOGI("InputMethodController::GetTextBeforeCursor"); - if (!mTextString.empty() && mTextString.size <= MAX_INT32_T) { + if (!mTextString.empty() && mTextString.size() <= MAX_INT32_T) { int32_t endPos = (mSelectNewEnd + number < static_cast(mTextString.size())) ? (mSelectNewEnd + number) : mTextString.size(); From 5bc93d5484d3aeea64877ad82f0a4efcae805543 Mon Sep 17 00:00:00 2001 From: lovechinamo Date: Tue, 21 Jun 2022 18:38:21 +0800 Subject: [PATCH 8/8] Signed-off-by: lovechinamo Changes to be committed: modified: frameworks/inputmethod_controller/src/input_method_controller.cpp --- .../inputmethod_controller/src/input_method_controller.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/frameworks/inputmethod_controller/src/input_method_controller.cpp b/frameworks/inputmethod_controller/src/input_method_controller.cpp index a6d91e3..39d051d 100644 --- a/frameworks/inputmethod_controller/src/input_method_controller.cpp +++ b/frameworks/inputmethod_controller/src/input_method_controller.cpp @@ -384,9 +384,8 @@ using namespace MessageID; std::u16string InputMethodController::GetTextAfterCursor(int32_t number) { - constexpr unsigned int MAX_INT32_T = 2147483647; IMSA_HILOGI("InputMethodController::GetTextBeforeCursor"); - if (!mTextString.empty() && mTextString.size() <= MAX_INT32_T) { + if (!mTextString.empty() && mTextString.size() <= INT_MAX) { int32_t endPos = (mSelectNewEnd + number < static_cast(mTextString.size())) ? (mSelectNewEnd + number) : mTextString.size();