Skip to content

Commit fc30c34

Browse files
authored
Minimize use of autos (#275)
* Remove unnecessary namespace identifiers * Minimize use of autos
1 parent dea5aae commit fc30c34

21 files changed

+95
-94
lines changed

shell/platform/tizen/accessibility_bridge_delegate_tizen.cc

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,14 @@ AccessibilityBridgeDelegateTizen::AccessibilityBridgeDelegateTizen(
1616

1717
void AccessibilityBridgeDelegateTizen::OnAccessibilityEvent(
1818
ui::AXEventGenerator::TargetedEvent targeted_event) {
19-
auto bridge = engine_->accessibility_bridge().lock();
19+
std::shared_ptr<AccessibilityBridge> bridge =
20+
engine_->accessibility_bridge().lock();
2021
if (!bridge) {
2122
FT_LOG(Error) << "Accessibility bridge is deallocated";
2223
return;
2324
}
2425

25-
auto platform_node_delegate =
26+
std::shared_ptr<FlutterPlatformNodeDelegate> platform_node_delegate =
2627
bridge->GetFlutterPlatformNodeDelegateFromID(targeted_event.node->id())
2728
.lock();
2829
if (!platform_node_delegate) {

shell/platform/tizen/channels/accessibility_channel.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ AccessibilityChannel::AccessibilityChannel(BinaryMessenger* messenger)
3939
}
4040
}
4141
}
42-
reply(flutter::EncodableValue());
42+
reply(EncodableValue());
4343
});
4444
}
4545

shell/platform/tizen/channels/app_control.cc

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -232,13 +232,13 @@ AppControlResult AppControl::AddExtraData(std::string key,
232232
}
233233

234234
AppControlResult AppControl::SetExtraData(const EncodableMap& map) {
235-
for (const auto& v : map) {
236-
if (!std::holds_alternative<std::string>(v.first)) {
235+
for (const auto& element : map) {
236+
if (!std::holds_alternative<std::string>(element.first)) {
237237
FT_LOG(Error) << "Invalid key. Omitting.";
238238
continue;
239239
}
240-
const auto& key = std::get<std::string>(v.first);
241-
AppControlResult ret = AddExtraData(key, v.second);
240+
const auto& key = std::get<std::string>(element.first);
241+
AppControlResult ret = AddExtraData(key, element.second);
242242
if (!ret) {
243243
FT_LOG(Error)
244244
<< "The value for the key " << key

shell/platform/tizen/channels/app_control_channel.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ void AppControlChannel::NotifyAppControl(void* handle) {
6565
void AppControlChannel::HandleMethodCall(
6666
const MethodCall<EncodableValue>& method_call,
6767
std::unique_ptr<MethodResult<EncodableValue>> result) {
68-
const auto& method_name = method_call.method_name();
68+
const std::string& method_name = method_call.method_name();
6969

7070
const auto* arguments = std::get_if<EncodableMap>(method_call.arguments());
7171
if (!arguments) {

shell/platform/tizen/channels/key_event_channel.cc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -238,7 +238,7 @@ const std::map<int, int> kEcoreModifierToGtkModifier = {
238238

239239
uint32_t Utf8ToUtf32CodePoint(const char* utf8) {
240240
std::wstring_convert<std::codecvt_utf8<wchar_t>, wchar_t> converter;
241-
for (auto wchar : converter.from_bytes(utf8)) {
241+
for (wchar_t wchar : converter.from_bytes(utf8)) {
242242
return wchar;
243243
}
244244
return 0;
@@ -282,7 +282,7 @@ void KeyEventChannel::SendKeyEvent(Ecore_Event_Key* key,
282282
}
283283

284284
rapidjson::Document event(rapidjson::kObjectType);
285-
auto& allocator = event.GetAllocator();
285+
rapidjson::MemoryPoolAllocator<>& allocator = event.GetAllocator();
286286
event.AddMember(kKeyMapKey, kLinuxKeyMap, allocator);
287287
event.AddMember(kToolkitKey, kGtkToolkit, allocator);
288288
event.AddMember(kUnicodeScalarValuesKey, unicode_scalar_values, allocator);
@@ -297,7 +297,7 @@ void KeyEventChannel::SendKeyEvent(Ecore_Event_Key* key,
297297
channel_->Send(event, [callback = std::move(callback)](const uint8_t* reply,
298298
size_t reply_size) {
299299
if (reply != nullptr) {
300-
auto decoded =
300+
std::unique_ptr<rapidjson::Document> decoded =
301301
JsonMessageCodec::GetInstance().DecodeMessage(reply, reply_size);
302302
bool handled = (*decoded)[kHandledKey].GetBool();
303303
callback(handled);

shell/platform/tizen/channels/platform_channel.cc

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -74,8 +74,8 @@ PlatformChannel::~PlatformChannel() {}
7474
void PlatformChannel::HandleMethodCall(
7575
const MethodCall<rapidjson::Document>& method_call,
7676
std::unique_ptr<MethodResult<rapidjson::Document>> result) {
77-
const auto& method = method_call.method_name();
78-
const auto* arguments = method_call.arguments();
77+
const std::string& method = method_call.method_name();
78+
const rapidjson::Document* arguments = method_call.arguments();
7979

8080
if (method == kSystemNavigatorPopMethod) {
8181
SystemNavigatorPop();
@@ -125,7 +125,7 @@ void PlatformChannel::HandleMethodCall(
125125
RestoreSystemUiOverlays();
126126
result->Success();
127127
} else if (method == kSetEnabledSystemUiOverlaysMethod) {
128-
const auto& list = arguments[0];
128+
const rapidjson::Document& list = arguments[0];
129129
std::vector<std::string> overlays;
130130
for (auto iter = list.Begin(); iter != list.End(); ++iter) {
131131
overlays.push_back(iter->GetString());
@@ -134,7 +134,7 @@ void PlatformChannel::HandleMethodCall(
134134
result->Success();
135135
#endif
136136
} else if (method == kSetPreferredOrientationsMethod) {
137-
const auto& list = arguments[0];
137+
const rapidjson::Document& list = arguments[0];
138138
std::vector<std::string> orientations;
139139
for (auto iter = list.Begin(); iter != list.End(); ++iter) {
140140
orientations.push_back(iter->GetString());

shell/platform/tizen/channels/platform_view_channel.cc

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,9 @@ void PlatformViewChannel::Dispose() {
3939
}
4040

4141
PlatformView* PlatformViewChannel::FindViewById(int view_id) {
42-
auto it = views_.find(view_id);
43-
if (it != views_.end()) {
44-
return it->second;
42+
auto iter = views_.find(view_id);
43+
if (iter != views_.end()) {
44+
return iter->second;
4545
}
4646
return nullptr;
4747
}
@@ -139,14 +139,14 @@ void PlatformViewChannel::OnCreate(
139139
if (params) {
140140
byte_message = *params;
141141
}
142-
auto it = view_factories_.find(*view_type);
143-
if (it != view_factories_.end()) {
142+
auto iter = view_factories_.find(*view_type);
143+
if (iter != view_factories_.end()) {
144144
PlatformView* focused_view = FindFocusedView();
145145
if (focused_view) {
146146
focused_view->SetFocus(false);
147147
}
148148
PlatformView* view =
149-
it->second->Create(*view_id, *width, *height, byte_message);
149+
iter->second->Create(*view_id, *width, *height, byte_message);
150150
if (view) {
151151
views_[*view_id] = view;
152152
result->Success(EncodableValue(view->GetTextureId()));

shell/platform/tizen/channels/settings_channel.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ SettingsChannel::~SettingsChannel() {
5050

5151
void SettingsChannel::SendSettingsEvent() {
5252
rapidjson::Document event(rapidjson::kObjectType);
53-
auto& allocator = event.GetAllocator();
53+
rapidjson::MemoryPoolAllocator<>& allocator = event.GetAllocator();
5454
event.AddMember(kTextScaleFactorKey, GetTextScaleFactor(), allocator);
5555
event.AddMember(kAlwaysUse24HourFormatKey, Prefer24HourTime(), allocator);
5656
event.AddMember(kPlatformBrightnessKey, "light", allocator);

shell/platform/tizen/channels/text_input_channel.cc

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -248,21 +248,21 @@ void TextInputChannel::HandleMethodCall(
248248
"Selection base/extent values invalid.");
249249
return;
250250
}
251-
auto selection_base_value = selection_base->value.GetInt();
252-
auto selection_extent_value = selection_extent->value.GetInt();
251+
int selection_base_value = selection_base->value.GetInt();
252+
int selection_extent_value = selection_extent->value.GetInt();
253253

254254
active_model_->SetText(text->value.GetString());
255255
active_model_->SetSelection(
256256
TextRange(selection_base_value, selection_extent_value));
257257

258258
auto composing_base = args.FindMember(kComposingBaseKey);
259259
auto composing_extent = args.FindMember(kComposingBaseKey);
260-
auto composing_base_value = composing_base != args.MemberEnd()
261-
? composing_base->value.GetInt()
262-
: -1;
263-
auto composing_extent_value = composing_extent != args.MemberEnd()
264-
? composing_extent->value.GetInt()
265-
: -1;
260+
int composing_base_value = composing_base != args.MemberEnd()
261+
? composing_base->value.GetInt()
262+
: -1;
263+
int composing_extent_value = composing_extent != args.MemberEnd()
264+
? composing_extent->value.GetInt()
265+
: -1;
266266

267267
if (composing_base_value == -1 && composing_extent_value == -1) {
268268
active_model_->EndComposing();
@@ -272,8 +272,8 @@ void TextInputChannel::HandleMethodCall(
272272
size_t cursor_offset = selection_base_value - composing_start;
273273

274274
active_model_->SetComposingRange(
275-
flutter::TextRange(static_cast<size_t>(composing_base_value),
276-
static_cast<size_t>(composing_extent_value)),
275+
TextRange(static_cast<size_t>(composing_base_value),
276+
static_cast<size_t>(composing_extent_value)),
277277
cursor_offset);
278278
}
279279
SendStateUpdate(*active_model_);
@@ -288,7 +288,7 @@ void TextInputChannel::HandleMethodCall(
288288

289289
void TextInputChannel::SendStateUpdate(const TextInputModel& model) {
290290
auto args = std::make_unique<rapidjson::Document>(rapidjson::kArrayType);
291-
auto& allocator = args->GetAllocator();
291+
rapidjson::MemoryPoolAllocator<>& allocator = args->GetAllocator();
292292
args->PushBack(client_id_, allocator);
293293

294294
TextRange selection = model.selection();
@@ -326,7 +326,7 @@ bool TextInputChannel::FilterEvent(Ecore_Event_Key* event, bool is_down) {
326326
FT_LOG(Debug) << "Entering select mode.";
327327
}
328328
#else
329-
auto device_name = ecore_device_name_get(event->dev);
329+
const char* device_name = ecore_device_name_get(event->dev);
330330
bool is_ime = device_name ? strcmp(device_name, "ime") == 0 : true;
331331
#endif
332332

@@ -422,7 +422,7 @@ void TextInputChannel::EnterPressed(TextInputModel* model, bool select) {
422422
SendStateUpdate(*model);
423423
}
424424
auto args = std::make_unique<rapidjson::Document>(rapidjson::kArrayType);
425-
auto& allocator = args->GetAllocator();
425+
rapidjson::MemoryPoolAllocator<>& allocator = args->GetAllocator();
426426
args->PushBack(client_id_, allocator);
427427
args->PushBack(rapidjson::Value(input_action_, allocator).Move(), allocator);
428428

shell/platform/tizen/channels/window_channel.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ WindowChannel::~WindowChannel() {}
3434
void WindowChannel::HandleMethodCall(
3535
const MethodCall<EncodableValue>& method_call,
3636
std::unique_ptr<MethodResult<EncodableValue>> result) {
37-
const auto& method_name = method_call.method_name();
37+
const std::string& method_name = method_call.method_name();
3838

3939
if (method_name == "getWindowGeometry") {
4040
TizenRenderer::Geometry geometry = renderer_->GetWindowGeometry();

0 commit comments

Comments
 (0)