From 1471a6dc80672a3b8feb68c0a012cb7544dc8fa9 Mon Sep 17 00:00:00 2001 From: Philip Lamb Date: Wed, 16 Dec 2020 11:36:55 +1300 Subject: [PATCH 1/3] Replace use of c++ keyword 'default' in c++ code and C APIs. Also correct obsolete use of qualified name in member declaration. --- ports/libsimpleservo/capi/src/lib.rs | 2 +- support/hololens/ServoApp/App.h | 2 +- support/hololens/ServoApp/ServoControl/Servo.cpp | 4 ++-- support/hololens/ServoApp/ServoControl/ServoControl.cpp | 4 ++-- support/hololens/ServoApp/ServoControl/ServoControl.h | 2 +- 5 files changed, 7 insertions(+), 7 deletions(-) diff --git a/ports/libsimpleservo/capi/src/lib.rs b/ports/libsimpleservo/capi/src/lib.rs index 4fa94965502..69c543000e2 100644 --- a/ports/libsimpleservo/capi/src/lib.rs +++ b/ports/libsimpleservo/capi/src/lib.rs @@ -218,7 +218,7 @@ pub struct CHostCallbacks { pub prompt_yes_no: extern "C" fn(message: *const c_char, trusted: bool) -> CPromptResult, pub prompt_input: extern "C" fn( message: *const c_char, - default: *const c_char, + def: *const c_char, trusted: bool, ) -> *const c_char, pub on_devtools_started: diff --git a/support/hololens/ServoApp/App.h b/support/hololens/ServoApp/App.h index 3820da8b952..f0d4c5ca855 100644 --- a/support/hololens/ServoApp/App.h +++ b/support/hololens/ServoApp/App.h @@ -16,7 +16,7 @@ struct App : AppT { void createRootFrame(Controls::Frame &, bool, IInspectable const &); void OnLaunched(LaunchActivatedEventArgs const &); - void App::OnActivated(IActivatedEventArgs const &); + void OnActivated(IActivatedEventArgs const &); void OnSuspending(IInspectable const &, SuspendingEventArgs const &); void OnNavigationFailed(IInspectable const &, Navigation::NavigationFailedEventArgs const &); diff --git a/support/hololens/ServoApp/ServoControl/Servo.cpp b/support/hololens/ServoApp/ServoControl/Servo.cpp index fa6fa5dff12..be2c60908a7 100644 --- a/support/hololens/ServoApp/ServoControl/Servo.cpp +++ b/support/hololens/ServoApp/ServoControl/Servo.cpp @@ -152,10 +152,10 @@ Servo::PromptResult prompt_yes_no(const char *message, bool trusted) { return sServo->Delegate().OnServoPromptYesNo(char2hstring(message), trusted); } -const char *prompt_input(const char *message, const char *default, +const char *prompt_input(const char *message, const char *def, bool trusted) { auto input = sServo->Delegate().OnServoPromptInput( - char2hstring(message), char2hstring(default), trusted); + char2hstring(message), char2hstring(def), trusted); if (input.has_value()) { return *hstring2char(*input); } else { diff --git a/support/hololens/ServoApp/ServoControl/ServoControl.cpp b/support/hololens/ServoApp/ServoControl/ServoControl.cpp index 12684efe149..12b2ab36217 100644 --- a/support/hololens/ServoApp/ServoControl/ServoControl.cpp +++ b/support/hololens/ServoApp/ServoControl/ServoControl.cpp @@ -671,13 +671,13 @@ Servo::PromptResult ServoControl::OnServoPromptYesNo(winrt::hstring message, } std::optional ServoControl::OnServoPromptInput(winrt::hstring message, - winrt::hstring default, + winrt::hstring def, bool trusted) { auto titlefmt = format(mL10NStrings->PromptTitle.c_str(), mCurrentUrl.c_str()); hstring title{trusted ? L"" : titlefmt}; auto [button, string] = PromptSync(title, message, mL10NStrings->PromptOk, - mL10NStrings->PromptCancel, default); + mL10NStrings->PromptCancel, def); return string; } diff --git a/support/hololens/ServoApp/ServoControl/ServoControl.h b/support/hololens/ServoApp/ServoControl/ServoControl.h index dda8a1ad91f..9431be41b15 100644 --- a/support/hololens/ServoApp/ServoControl/ServoControl.h +++ b/support/hololens/ServoApp/ServoControl/ServoControl.h @@ -239,7 +239,7 @@ private: bool mTransient = false; std::optional mInitUrl = {}; - Windows::UI::Xaml::Controls::SwapChainPanel ServoControl::Panel(); + Windows::UI::Xaml::Controls::SwapChainPanel Panel(); void CreateNativeWindow(); EGLNativeWindowType GetNativeWindow(); void RecoverFromLostDevice(); From 6125057c0424acca0f407d1e5c63b236b39b809a Mon Sep 17 00:00:00 2001 From: Philip Lamb Date: Wed, 16 Dec 2020 16:04:53 +1300 Subject: [PATCH 2/3] formatting. --- ports/libsimpleservo/capi/src/lib.rs | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/ports/libsimpleservo/capi/src/lib.rs b/ports/libsimpleservo/capi/src/lib.rs index 69c543000e2..9710b5e1241 100644 --- a/ports/libsimpleservo/capi/src/lib.rs +++ b/ports/libsimpleservo/capi/src/lib.rs @@ -216,11 +216,8 @@ pub struct CHostCallbacks { pub prompt_alert: extern "C" fn(message: *const c_char, trusted: bool), pub prompt_ok_cancel: extern "C" fn(message: *const c_char, trusted: bool) -> CPromptResult, pub prompt_yes_no: extern "C" fn(message: *const c_char, trusted: bool) -> CPromptResult, - pub prompt_input: extern "C" fn( - message: *const c_char, - def: *const c_char, - trusted: bool, - ) -> *const c_char, + pub prompt_input: + extern "C" fn(message: *const c_char, def: *const c_char, trusted: bool) -> *const c_char, pub on_devtools_started: extern "C" fn(result: CDevtoolsServerState, port: c_uint, token: *const c_char), pub show_context_menu: From c88b55286f96f5d8343de024f77625c396eba424 Mon Sep 17 00:00:00 2001 From: Philip Lamb Date: Thu, 17 Dec 2020 10:15:34 +1300 Subject: [PATCH 3/3] clang-format --- support/hololens/ServoApp/ServoControl/Servo.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/support/hololens/ServoApp/ServoControl/Servo.cpp b/support/hololens/ServoApp/ServoControl/Servo.cpp index be2c60908a7..33b675b98e2 100644 --- a/support/hololens/ServoApp/ServoControl/Servo.cpp +++ b/support/hololens/ServoApp/ServoControl/Servo.cpp @@ -152,8 +152,7 @@ Servo::PromptResult prompt_yes_no(const char *message, bool trusted) { return sServo->Delegate().OnServoPromptYesNo(char2hstring(message), trusted); } -const char *prompt_input(const char *message, const char *def, - bool trusted) { +const char *prompt_input(const char *message, const char *def, bool trusted) { auto input = sServo->Delegate().OnServoPromptInput( char2hstring(message), char2hstring(def), trusted); if (input.has_value()) {