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

Unified Diff: ui/app_list/speech_ui_model.cc

Issue 1477533002: Remove kint16max. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@kint8max
Patch Set: includes Created 5 years, 1 month 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 | « net/disk_cache/blockfile/file_lock.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/app_list/speech_ui_model.cc
diff --git a/ui/app_list/speech_ui_model.cc b/ui/app_list/speech_ui_model.cc
index 12ac66d3f03c44478177a7ca680a9093c263c57a..927619df3294aaa755c0bb4f80474b7a9651f2f1 100644
--- a/ui/app_list/speech_ui_model.cc
+++ b/ui/app_list/speech_ui_model.cc
@@ -4,14 +4,17 @@
#include "ui/app_list/speech_ui_model.h"
+#include <stdint.h>
+
#include <algorithm>
+#include <limits>
namespace app_list {
namespace {
// The default sound level, just gotten from the developer device.
-const int16 kDefaultSoundLevel = 200;
+const int16_t kDefaultSoundLevel = 200;
} // namespace
@@ -37,7 +40,7 @@ void SpeechUIModel::SetSpeechResult(const base::string16& result,
OnSpeechResult(result, is_final));
}
-void SpeechUIModel::UpdateSoundLevel(int16 level) {
+void SpeechUIModel::UpdateSoundLevel(int16_t level) {
if (sound_level_ == level)
return;
@@ -54,18 +57,17 @@ void SpeechUIModel::UpdateSoundLevel(int16 level) {
if (maximum_sound_level_ < minimum_sound_level_) {
maximum_sound_level_ = std::max(
- static_cast<int16>(minimum_sound_level_ + kDefaultSoundLevel),
- kint16max);
+ static_cast<int16_t>(minimum_sound_level_ + kDefaultSoundLevel),
+ std::numeric_limits<int16_t>::max());
}
- int16 range = maximum_sound_level_ - minimum_sound_level_;
- uint8 visible_level = 0;
+ int16_t range = maximum_sound_level_ - minimum_sound_level_;
+ uint8_t visible_level = 0;
if (range > 0) {
- int16 visible_level_in_range =
- std::min(std::max(minimum_sound_level_, sound_level_),
- maximum_sound_level_);
- visible_level =
- (visible_level_in_range - minimum_sound_level_) * kuint8max / range;
+ int16_t visible_level_in_range = std::min(
+ std::max(minimum_sound_level_, sound_level_), maximum_sound_level_);
+ visible_level = (visible_level_in_range - minimum_sound_level_) *
+ std::numeric_limits<uint8_t>::max() / range;
}
FOR_EACH_OBSERVER(SpeechUIModelObserver,
« no previous file with comments | « net/disk_cache/blockfile/file_lock.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698