Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(283)

Issue 681123006: Fix a 'type-limits' warning in StringSlicer::FindValidBoundaryAfter (Closed)

Created:
6 years, 1 month ago by Ben Chan
Modified:
6 years, 1 month ago
CC:
chromium-reviews, Chris Masone
Base URL:
https://chromium.googlesource.com/chromium/src.git@master
Project:
chromium
Visibility:
Public.

Description

Fix a 'type-limits' warning in StringSlicer::FindValidBoundaryAfter StringSlicer::FindValidBoundaryAfter passes a size_t value to the 'length' argument of U16_SET_CP_LIMIT, which expects the argument to be an int32. When compiling with -Werror=type-limits, that results in the following compilation error: ../../ui/gfx/text_elider.cc: In member function 'size_t gfx::StringSlicer::FindValidBoundaryAfter(size_t) const': ../../ui/gfx/text_elider.cc:150:59: error: comparison of unsigned expression < 0 is always false [-Werror=type-limits] U16_SET_CP_LIMIT(text_.data(), 0, index, text_.length()); ^ ../../third_party/icu/source/common/unicode/utf16.h:618:41: note: in definition of macro 'U16_SET_CP_LIMIT' if((start)<(i) && ((i)<(length) || (length)<0) && U16_IS_LEAD((s)[(i)-1]) && U16_IS_TRAIL((s)[i])) { \ ^ This CL fixes the 'type-limits' warning above. BUG=424334, 427726 TEST=Build successfully with '-Werror=type-limits' using the GN flow. Committed: https://crrev.com/492b0cf0da08a9d102bb5465b298b797ef312068 Cr-Commit-Position: refs/heads/master@{#301935}

Patch Set 1 #

Total comments: 1

Patch Set 2 : #

Total comments: 2

Patch Set 3 : #

Patch Set 4 : #

Patch Set 5 : #

Total comments: 1

Patch Set 6 : #

Total comments: 7
Unified diffs Side-by-side diffs Delta from patch set Stats (+8 lines, -3 lines) Patch
M ui/gfx/text_elider.cc View 1 2 3 4 5 2 chunks +8 lines, -3 lines 7 comments Download

Messages

Total messages: 37 (9 generated)
Ben Chan
Disabling type-limits check would be too aggressive, so I think we could either do static_cast<int>(text_.length()) ...
6 years, 1 month ago (2014-10-29 00:32:37 UTC) #2
Ben Chan
adding a few more reviewers as I'm not sure who's the main reviewer for this ...
6 years, 1 month ago (2014-10-29 16:52:00 UTC) #4
msw
Peter is working on similar issues, so he may have some advice. I suspect the ...
6 years, 1 month ago (2014-10-29 16:54:58 UTC) #6
Peter Kasting
https://codereview.chromium.org/681123006/diff/1/ui/gfx/text_elider.cc File ui/gfx/text_elider.cc (right): https://codereview.chromium.org/681123006/diff/1/ui/gfx/text_elider.cc#newcode151 ui/gfx/text_elider.cc:151: #endif Definitely don't fix the warning this way -- ...
6 years, 1 month ago (2014-10-29 17:08:00 UTC) #7
Ben Chan
On 2014/10/29 17:08:00, Peter Kasting wrote: > https://codereview.chromium.org/681123006/diff/1/ui/gfx/text_elider.cc > File ui/gfx/text_elider.cc (right): > > https://codereview.chromium.org/681123006/diff/1/ui/gfx/text_elider.cc#newcode151 ...
6 years, 1 month ago (2014-10-29 17:21:11 UTC) #8
Peter Kasting
LGTM with comment https://codereview.chromium.org/681123006/diff/20001/ui/gfx/text_elider.cc File ui/gfx/text_elider.cc (right): https://codereview.chromium.org/681123006/diff/20001/ui/gfx/text_elider.cc#newcode150 ui/gfx/text_elider.cc:150: U16_SET_CP_LIMIT(text_.data(), 0, index, -1); For safety, ...
6 years, 1 month ago (2014-10-29 17:33:38 UTC) #9
Ben Chan
https://codereview.chromium.org/681123006/diff/20001/ui/gfx/text_elider.cc File ui/gfx/text_elider.cc (right): https://codereview.chromium.org/681123006/diff/20001/ui/gfx/text_elider.cc#newcode150 ui/gfx/text_elider.cc:150: U16_SET_CP_LIMIT(text_.data(), 0, index, -1); On 2014/10/29 17:33:38, Peter Kasting ...
6 years, 1 month ago (2014-10-29 17:36:01 UTC) #10
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/681123006/40001
6 years, 1 month ago (2014-10-29 17:39:56 UTC) #12
commit-bot: I haz the power
Try jobs failed on following builders: android_chromium_gn_compile_dbg on tryserver.chromium.linux (http://build.chromium.org/p/tryserver.chromium.linux/builders/android_chromium_gn_compile_dbg/builds/12559) android_dbg_tests_recipe on tryserver.chromium.linux (http://build.chromium.org/p/tryserver.chromium.linux/builders/android_dbg_tests_recipe/builds/23329) linux_chromium_gn_rel ...
6 years, 1 month ago (2014-10-29 17:48:35 UTC) #14
Ben Chan
On 2014/10/29 17:48:35, I haz the power (commit-bot) wrote: > Try jobs failed on following ...
6 years, 1 month ago (2014-10-29 18:02:22 UTC) #15
Peter Kasting
On 2014/10/29 18:02:22, Ben Chan wrote: > On 2014/10/29 17:48:35, I haz the power (commit-bot) ...
6 years, 1 month ago (2014-10-29 18:03:31 UTC) #16
Ben Chan
On 2014/10/29 18:03:31, Peter Kasting wrote: > On 2014/10/29 18:02:22, Ben Chan wrote: > > ...
6 years, 1 month ago (2014-10-29 18:17:36 UTC) #18
Peter Kasting
Still LGTM
6 years, 1 month ago (2014-10-29 18:30:04 UTC) #19
Ben Chan
On 2014/10/29 18:30:04, Peter Kasting wrote: > Still LGTM sorry, should have realized the side-effect ...
6 years, 1 month ago (2014-10-29 19:13:23 UTC) #20
Peter Kasting
I hang my head for having signed off on the previous version. Sloppy. https://codereview.chromium.org/681123006/diff/100001/ui/gfx/text_elider.cc File ...
6 years, 1 month ago (2014-10-29 19:17:26 UTC) #21
Ben Chan
On 2014/10/29 19:17:26, Peter Kasting wrote: > I hang my head for having signed off ...
6 years, 1 month ago (2014-10-29 19:23:24 UTC) #22
Ben Chan
On 2014/10/29 19:23:24, Ben Chan wrote: > On 2014/10/29 19:17:26, Peter Kasting wrote: > > ...
6 years, 1 month ago (2014-10-29 19:59:36 UTC) #23
Peter Kasting
LGTM
6 years, 1 month ago (2014-10-29 20:00:04 UTC) #24
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/681123006/120001
6 years, 1 month ago (2014-10-29 20:01:47 UTC) #26
commit-bot: I haz the power
Try jobs failed on following builders: chromium_presubmit on tryserver.chromium.linux (http://build.chromium.org/p/tryserver.chromium.linux/builders/chromium_presubmit/builds/21017)
6 years, 1 month ago (2014-10-29 20:12:19 UTC) #28
Ben Chan
On 2014/10/29 20:12:19, I haz the power (commit-bot) wrote: > Try jobs failed on following ...
6 years, 1 month ago (2014-10-29 20:26:02 UTC) #29
msw
https://codereview.chromium.org/681123006/diff/120001/ui/gfx/text_elider.cc File ui/gfx/text_elider.cc (right): https://codereview.chromium.org/681123006/diff/120001/ui/gfx/text_elider.cc#newcode155 ui/gfx/text_elider.cc:155: U16_SET_CP_LIMIT(text_.data(), 0, text_index, text_length); Didn't Peter suggest using c_str() ...
6 years, 1 month ago (2014-10-29 20:46:44 UTC) #30
Ben Chan
https://codereview.chromium.org/681123006/diff/120001/ui/gfx/text_elider.cc File ui/gfx/text_elider.cc (right): https://codereview.chromium.org/681123006/diff/120001/ui/gfx/text_elider.cc#newcode155 ui/gfx/text_elider.cc:155: U16_SET_CP_LIMIT(text_.data(), 0, text_index, text_length); On 2014/10/29 20:46:43, msw wrote: ...
6 years, 1 month ago (2014-10-29 21:08:30 UTC) #31
msw
lgtm https://codereview.chromium.org/681123006/diff/120001/ui/gfx/text_elider.cc File ui/gfx/text_elider.cc (right): https://codereview.chromium.org/681123006/diff/120001/ui/gfx/text_elider.cc#newcode155 ui/gfx/text_elider.cc:155: U16_SET_CP_LIMIT(text_.data(), 0, text_index, text_length); On 2014/10/29 21:08:30, Ben ...
6 years, 1 month ago (2014-10-29 21:15:46 UTC) #32
Ben Chan
https://codereview.chromium.org/681123006/diff/120001/ui/gfx/text_elider.cc File ui/gfx/text_elider.cc (right): https://codereview.chromium.org/681123006/diff/120001/ui/gfx/text_elider.cc#newcode155 ui/gfx/text_elider.cc:155: U16_SET_CP_LIMIT(text_.data(), 0, text_index, text_length); On 2014/10/29 21:15:46, msw wrote: ...
6 years, 1 month ago (2014-10-29 21:23:37 UTC) #33
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/681123006/120001
6 years, 1 month ago (2014-10-29 21:27:21 UTC) #35
commit-bot: I haz the power
Committed patchset #6 (id:120001)
6 years, 1 month ago (2014-10-29 21:33:35 UTC) #36
commit-bot: I haz the power
6 years, 1 month ago (2014-10-29 21:34:36 UTC) #37
Message was sent while issue was closed.
Patchset 6 (id:??) landed as
https://crrev.com/492b0cf0da08a9d102bb5465b298b797ef312068
Cr-Commit-Position: refs/heads/master@{#301935}

Powered by Google App Engine
This is Rietveld 408576698