From 481c3e82e2dcbcb676501f18bc8f58900071b935 Mon Sep 17 00:00:00 2001 From: "pkasting@chromium.org" Date: Fri, 18 Jul 2014 01:40:47 +0000 Subject: Fixes for re-enabling more MSVC level 4 warnings: misc edition #2 This contains fixes for the following sorts of issues: * Assignment inside conditional * Taking the address of a temporary * Octal escape sequence terminated by decimal number * Signedness mismatch * Possibly-uninitialized local variable This also contains a small number of cleanups to nearby code (e.g. no else after return). BUG=81439 TEST=none Review URL: https://codereview.chromium.org/382673002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@283967 0039d316-1c4b-4281-b951-d872f2087c98 --- win8/metro_driver/ime/text_store.cc | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) (limited to 'win8') diff --git a/win8/metro_driver/ime/text_store.cc b/win8/metro_driver/ime/text_store.cc index e406e1b..0c0389b 100644 --- a/win8/metro_driver/ime/text_store.cc +++ b/win8/metro_driver/ime/text_store.cc @@ -765,7 +765,7 @@ bool TextStore::GetCompositionStatus( while (true) { base::win::ScopedComPtr range; if (ranges->Next(1, range.Receive(), NULL) != S_OK) - break; + return true; base::win::ScopedVariant value; base::win::ScopedComPtr enum_prop_value; if (FAILED(track_property->GetValue(read_only_edit_cookie, range, @@ -777,16 +777,16 @@ bool TextStore::GetCompositionStatus( TF_PROPERTYVAL property_value; bool is_composition = false; - bool has_display_attribute = false; - TF_DISPLAYATTRIBUTE display_attribute; + metro_viewer::UnderlineInfo underline; while (enum_prop_value->Next(1, &property_value, NULL) == S_OK) { if (IsEqualGUID(property_value.guidId, GUID_PROP_COMPOSING)) { is_composition = (property_value.varValue.lVal == TRUE); } else if (IsEqualGUID(property_value.guidId, GUID_PROP_ATTRIBUTE)) { TfGuidAtom guid_atom = static_cast(property_value.varValue.lVal); + TF_DISPLAYATTRIBUTE display_attribute; if (GetDisplayAttribute(guid_atom, &display_attribute)) - has_display_attribute = true; + underline.thick = !!display_attribute.fBoldLine; } VariantClear(&property_value.varValue); } @@ -795,18 +795,14 @@ bool TextStore::GetCompositionStatus( range_acp.QueryFrom(range); LONG start_pos, length; range_acp->GetExtent(&start_pos, &length); - if (!is_composition) { - if (*committed_size < static_cast(start_pos + length)) - *committed_size = start_pos + length; - } else { - metro_viewer::UnderlineInfo underline; + if (is_composition) { underline.start_offset = start_pos; underline.end_offset = start_pos + length; - underline.thick = !!display_attribute.fBoldLine; undelines->push_back(underline); + } else if (*committed_size < static_cast(start_pos + length)) { + *committed_size = start_pos + length; } } - return true; } bool TextStore::CancelComposition() { -- cgit v1.1