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

Unified Diff: ui/events/keycodes/keyboard_code_conversion.cc

Issue 660173002: Type conversion fixes, ui/ edition. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ui/events/keycodes/dom4/keycode_converter.cc ('k') | ui/events/latency_info.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/events/keycodes/keyboard_code_conversion.cc
diff --git a/ui/events/keycodes/keyboard_code_conversion.cc b/ui/events/keycodes/keyboard_code_conversion.cc
index a812b51db3ff39d6c12691ed325cfe412c9423ff..e7b067c5c9f75470a7bd654d3cabd586c3d5868a 100644
--- a/ui/events/keycodes/keyboard_code_conversion.cc
+++ b/ui/events/keycodes/keyboard_code_conversion.cc
@@ -14,8 +14,10 @@ uint16 GetCharacterFromKeyCode(KeyboardCode key_code, int flags) {
const bool upper = shift ^ ((flags & EF_CAPS_LOCK_DOWN) != 0);
// Following Windows behavior to map ctrl-a ~ ctrl-z to \x01 ~ \x1A.
- if (key_code >= VKEY_A && key_code <= VKEY_Z)
- return key_code - VKEY_A + (ctrl ? 1 : (upper ? 'A' : 'a'));
+ if (key_code >= VKEY_A && key_code <= VKEY_Z) {
+ return static_cast<uint16>
+ (key_code - VKEY_A + (ctrl ? 1 : (upper ? 'A' : 'a')));
+ }
// Other ctrl characters
if (ctrl) {
@@ -65,7 +67,7 @@ uint16 GetCharacterFromKeyCode(KeyboardCode key_code, int flags) {
return shift ? ")!@#$%^&*("[key_code - VKEY_0] :
static_cast<uint16>(key_code);
} else if (key_code >= VKEY_NUMPAD0 && key_code <= VKEY_NUMPAD9) {
- return key_code - VKEY_NUMPAD0 + '0';
+ return static_cast<uint16>(key_code - VKEY_NUMPAD0 + '0');
}
switch (key_code) {
« no previous file with comments | « ui/events/keycodes/dom4/keycode_converter.cc ('k') | ui/events/latency_info.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698