summaryrefslogtreecommitdiff
path: root/platform/uwp/app.cpp
diff options
context:
space:
mode:
authorRémi Verschelde <rverschelde@gmail.com>2017-03-05 16:44:50 +0100
committerRémi Verschelde <rverschelde@gmail.com>2017-03-05 16:44:50 +0100
commit5dbf1809c6e3e905b94b8764e99491e608122261 (patch)
tree5e5a5360db15d86d59ec8c6e4f7eb511388c5a9a /platform/uwp/app.cpp
parent45438e9918d421b244bfd7776a30e67dc7f2d3e3 (diff)
A Whole New World (clang-format edition)
I can show you the code Pretty, with proper whitespace Tell me, coder, now when did You last write readable code? I can open your eyes Make you see your bad indent Force you to respect the style The core devs agreed upon A whole new world A new fantastic code format A de facto standard With some sugar Enforced with clang-format A whole new world A dazzling style we all dreamed of And when we read it through It's crystal clear That now we're in a whole new world of code
Diffstat (limited to 'platform/uwp/app.cpp')
-rw-r--r--platform/uwp/app.cpp281
1 files changed, 122 insertions, 159 deletions
diff --git a/platform/uwp/app.cpp b/platform/uwp/app.cpp
index 0bae148c6b..35b25b1de5 100644
--- a/platform/uwp/app.cpp
+++ b/platform/uwp/app.cpp
@@ -32,10 +32,10 @@
#include "app.h"
-#include "main/main.h"
#include "core/os/dir_access.h"
#include "core/os/file_access.h"
#include "core/os/keyboard.h"
+#include "main/main.h"
#include "platform/windows/key_mapping_win.h"
@@ -56,126 +56,113 @@ using namespace Microsoft::WRL;
using namespace GodotUWP;
// Helper to convert a length in device-independent pixels (DIPs) to a length in physical pixels.
-inline float ConvertDipsToPixels(float dips, float dpi)
-{
- static const float dipsPerInch = 96.0f;
- return floor(dips * dpi / dipsPerInch + 0.5f); // Round to nearest integer.
+inline float ConvertDipsToPixels(float dips, float dpi) {
+ static const float dipsPerInch = 96.0f;
+ return floor(dips * dpi / dipsPerInch + 0.5f); // Round to nearest integer.
}
// Implementation of the IFrameworkViewSource interface, necessary to run our app.
-ref class GodotUWPViewSource sealed : Windows::ApplicationModel::Core::IFrameworkViewSource
-{
+ref class GodotUWPViewSource sealed : Windows::ApplicationModel::Core::IFrameworkViewSource {
public:
- virtual Windows::ApplicationModel::Core::IFrameworkView^ CreateView()
- {
- return ref new App();
- }
+ virtual Windows::ApplicationModel::Core::IFrameworkView ^ CreateView() {
+ return ref new App();
+ }
};
// The main function creates an IFrameworkViewSource for our app, and runs the app.
-[Platform::MTAThread]
-int main(Platform::Array<Platform::String^>^)
-{
- auto godotApplicationSource = ref new GodotUWPViewSource();
- CoreApplication::Run(godotApplicationSource);
- return 0;
+[Platform::MTAThread] int main(Platform::Array<Platform::String ^> ^) {
+ auto godotApplicationSource = ref new GodotUWPViewSource();
+ CoreApplication::Run(godotApplicationSource);
+ return 0;
}
-App::App() :
- mWindowClosed(false),
- mWindowVisible(true),
- mWindowWidth(0),
- mWindowHeight(0),
- mEglDisplay(EGL_NO_DISPLAY),
- mEglContext(EGL_NO_CONTEXT),
- mEglSurface(EGL_NO_SURFACE),
- number_of_contacts(0)
-{
+App::App()
+ : mWindowClosed(false),
+ mWindowVisible(true),
+ mWindowWidth(0),
+ mWindowHeight(0),
+ mEglDisplay(EGL_NO_DISPLAY),
+ mEglContext(EGL_NO_CONTEXT),
+ mEglSurface(EGL_NO_SURFACE),
+ number_of_contacts(0) {
}
// The first method called when the IFrameworkView is being created.
-void App::Initialize(CoreApplicationView^ applicationView)
-{
- // Register event handlers for app lifecycle. This example includes Activated, so that we
- // can make the CoreWindow active and start rendering on the window.
- applicationView->Activated +=
- ref new TypedEventHandler<CoreApplicationView^, IActivatedEventArgs^>(this, &App::OnActivated);
+void App::Initialize(CoreApplicationView ^ applicationView) {
+ // Register event handlers for app lifecycle. This example includes Activated, so that we
+ // can make the CoreWindow active and start rendering on the window.
+ applicationView->Activated +=
+ ref new TypedEventHandler<CoreApplicationView ^, IActivatedEventArgs ^>(this, &App::OnActivated);
- // Logic for other event handlers could go here.
- // Information about the Suspending and Resuming event handlers can be found here:
- // http://msdn.microsoft.com/en-us/library/windows/apps/xaml/hh994930.aspx
+ // Logic for other event handlers could go here.
+ // Information about the Suspending and Resuming event handlers can be found here:
+ // http://msdn.microsoft.com/en-us/library/windows/apps/xaml/hh994930.aspx
os = new OSUWP;
-
}
// Called when the CoreWindow object is created (or re-created).
-void App::SetWindow(CoreWindow^ p_window)
-{
+void App::SetWindow(CoreWindow ^ p_window) {
window = p_window;
- window->VisibilityChanged +=
- ref new TypedEventHandler<CoreWindow^, VisibilityChangedEventArgs^>(this, &App::OnVisibilityChanged);
+ window->VisibilityChanged +=
+ ref new TypedEventHandler<CoreWindow ^, VisibilityChangedEventArgs ^>(this, &App::OnVisibilityChanged);
- window->Closed +=
- ref new TypedEventHandler<CoreWindow^, CoreWindowEventArgs^>(this, &App::OnWindowClosed);
+ window->Closed +=
+ ref new TypedEventHandler<CoreWindow ^, CoreWindowEventArgs ^>(this, &App::OnWindowClosed);
- window->SizeChanged +=
- ref new TypedEventHandler<CoreWindow^, WindowSizeChangedEventArgs^>(this, &App::OnWindowSizeChanged);
+ window->SizeChanged +=
+ ref new TypedEventHandler<CoreWindow ^, WindowSizeChangedEventArgs ^>(this, &App::OnWindowSizeChanged);
#if !(WINAPI_FAMILY == WINAPI_FAMILY_PHONE_APP)
- // Disable all pointer visual feedback for better performance when touching.
- // This is not supported on Windows Phone applications.
- auto pointerVisualizationSettings = PointerVisualizationSettings::GetForCurrentView();
- pointerVisualizationSettings->IsContactFeedbackEnabled = false;
- pointerVisualizationSettings->IsBarrelButtonFeedbackEnabled = false;
+ // Disable all pointer visual feedback for better performance when touching.
+ // This is not supported on Windows Phone applications.
+ auto pointerVisualizationSettings = PointerVisualizationSettings::GetForCurrentView();
+ pointerVisualizationSettings->IsContactFeedbackEnabled = false;
+ pointerVisualizationSettings->IsBarrelButtonFeedbackEnabled = false;
#endif
-
window->PointerPressed +=
- ref new TypedEventHandler<CoreWindow^, PointerEventArgs^>(this, &App::OnPointerPressed);
+ ref new TypedEventHandler<CoreWindow ^, PointerEventArgs ^>(this, &App::OnPointerPressed);
window->PointerMoved +=
- ref new TypedEventHandler<CoreWindow^, PointerEventArgs^>(this, &App::OnPointerMoved);
+ ref new TypedEventHandler<CoreWindow ^, PointerEventArgs ^>(this, &App::OnPointerMoved);
window->PointerReleased +=
- ref new TypedEventHandler<CoreWindow^, PointerEventArgs^>(this, &App::OnPointerReleased);
+ ref new TypedEventHandler<CoreWindow ^, PointerEventArgs ^>(this, &App::OnPointerReleased);
window->PointerWheelChanged +=
- ref new TypedEventHandler<CoreWindow^, PointerEventArgs^>(this, &App::OnPointerWheelChanged);
+ ref new TypedEventHandler<CoreWindow ^, PointerEventArgs ^>(this, &App::OnPointerWheelChanged);
mouseChangedNotifier = SignalNotifier::AttachToEvent(L"os_mouse_mode_changed", ref new SignalHandler(
- this, &App::OnMouseModeChanged
- ));
+ this, &App::OnMouseModeChanged));
mouseChangedNotifier->Enable();
window->CharacterReceived +=
- ref new TypedEventHandler<CoreWindow^, CharacterReceivedEventArgs^>(this, &App::OnCharacterReceived);
+ ref new TypedEventHandler<CoreWindow ^, CharacterReceivedEventArgs ^>(this, &App::OnCharacterReceived);
window->KeyDown +=
- ref new TypedEventHandler<CoreWindow^, KeyEventArgs^>(this, &App::OnKeyDown);
+ ref new TypedEventHandler<CoreWindow ^, KeyEventArgs ^>(this, &App::OnKeyDown);
window->KeyUp +=
- ref new TypedEventHandler<CoreWindow^, KeyEventArgs^>(this, &App::OnKeyUp);
-
+ ref new TypedEventHandler<CoreWindow ^, KeyEventArgs ^>(this, &App::OnKeyUp);
unsigned int argc;
- char** argv = get_command_line(&argc);
+ char **argv = get_command_line(&argc);
Main::setup("uwp", argc, argv, false);
// The CoreWindow has been created, so EGL can be initialized.
- ContextEGL* context = memnew(ContextEGL(window));
+ ContextEGL *context = memnew(ContextEGL(window));
os->set_gl_context(context);
UpdateWindowSize(Size(window->Bounds.Width, window->Bounds.Height));
Main::setup2();
}
-static int _get_button(Windows::UI::Input::PointerPoint ^pt) {
+static int _get_button(Windows::UI::Input::PointerPoint ^ pt) {
using namespace Windows::UI::Input;
#if WINAPI_FAMILY == WINAPI_FAMILY_PHONE_APP
return BUTTON_LEFT;
#else
- switch (pt->Properties->PointerUpdateKind)
- {
+ switch (pt->Properties->PointerUpdateKind) {
case PointerUpdateKind::LeftButtonPressed:
case PointerUpdateKind::LeftButtonReleased:
return BUTTON_LEFT;
@@ -204,7 +191,7 @@ static int _get_button(Windows::UI::Input::PointerPoint ^pt) {
return 0;
};
-static bool _is_touch(Windows::UI::Input::PointerPoint ^pointerPoint) {
+static bool _is_touch(Windows::UI::Input::PointerPoint ^ pointerPoint) {
#if WINAPI_FAMILY == WINAPI_FAMILY_PHONE_APP
return true;
#else
@@ -219,20 +206,18 @@ static bool _is_touch(Windows::UI::Input::PointerPoint ^pointerPoint) {
#endif
}
-
-static Windows::Foundation::Point _get_pixel_position(CoreWindow^ window, Windows::Foundation::Point rawPosition, OS* os) {
+static Windows::Foundation::Point _get_pixel_position(CoreWindow ^ window, Windows::Foundation::Point rawPosition, OS *os) {
Windows::Foundation::Point outputPosition;
- // Compute coordinates normalized from 0..1.
- // If the coordinates need to be sized to the SDL window,
- // we'll do that after.
- #if 1 || WINAPI_FAMILY != WINAPI_FAMILY_PHONE_APP
+// Compute coordinates normalized from 0..1.
+// If the coordinates need to be sized to the SDL window,
+// we'll do that after.
+#if 1 || WINAPI_FAMILY != WINAPI_FAMILY_PHONE_APP
outputPosition.X = rawPosition.X / window->Bounds.Width;
outputPosition.Y = rawPosition.Y / window->Bounds.Height;
- #else
- switch (DisplayProperties::CurrentOrientation)
- {
+#else
+ switch (DisplayProperties::CurrentOrientation) {
case DisplayOrientations::Portrait:
outputPosition.X = rawPosition.X / window->Bounds.Width;
outputPosition.Y = rawPosition.Y / window->Bounds.Height;
@@ -252,7 +237,7 @@ static Windows::Foundation::Point _get_pixel_position(CoreWindow^ window, Window
default:
break;
}
- #endif
+#endif
OS::VideoMode vm = os->get_video_mode();
outputPosition.X *= vm.width;
@@ -266,9 +251,9 @@ static int _get_finger(uint32_t p_touch_id) {
return p_touch_id % 31; // for now
};
-void App::pointer_event(Windows::UI::Core::CoreWindow^ sender, Windows::UI::Core::PointerEventArgs^ args, bool p_pressed, bool p_is_wheel) {
+void App::pointer_event(Windows::UI::Core::CoreWindow ^ sender, Windows::UI::Core::PointerEventArgs ^ args, bool p_pressed, bool p_is_wheel) {
- Windows::UI::Input::PointerPoint ^point = args->CurrentPoint;
+ Windows::UI::Input::PointerPoint ^ point = args->CurrentPoint;
Windows::Foundation::Point pos = _get_pixel_position(window, point->Position, os);
int but = _get_button(point);
if (_is_touch(point)) {
@@ -314,56 +299,51 @@ void App::pointer_event(Windows::UI::Core::CoreWindow^ sender, Windows::UI::Core
os->input_event(event);
};
-
-void App::OnPointerPressed(Windows::UI::Core::CoreWindow^ sender, Windows::UI::Core::PointerEventArgs^ args) {
+void App::OnPointerPressed(Windows::UI::Core::CoreWindow ^ sender, Windows::UI::Core::PointerEventArgs ^ args) {
number_of_contacts++;
pointer_event(sender, args, true);
};
-
-void App::OnPointerReleased(Windows::UI::Core::CoreWindow^ sender, Windows::UI::Core::PointerEventArgs^ args) {
+void App::OnPointerReleased(Windows::UI::Core::CoreWindow ^ sender, Windows::UI::Core::PointerEventArgs ^ args) {
number_of_contacts--;
pointer_event(sender, args, false);
};
-void App::OnPointerWheelChanged(Windows::UI::Core::CoreWindow^ sender, Windows::UI::Core::PointerEventArgs^ args) {
+void App::OnPointerWheelChanged(Windows::UI::Core::CoreWindow ^ sender, Windows::UI::Core::PointerEventArgs ^ args) {
pointer_event(sender, args, true, true);
}
-void App::OnMouseModeChanged(Windows::System::Threading::Core::SignalNotifier^ signalNotifier, bool timedOut) {
+void App::OnMouseModeChanged(Windows::System::Threading::Core::SignalNotifier ^ signalNotifier, bool timedOut) {
OS::MouseMode mode = os->get_mouse_mode();
- SignalNotifier^ notifier = mouseChangedNotifier;
+ SignalNotifier ^ notifier = mouseChangedNotifier;
window->Dispatcher->RunAsync(
- CoreDispatcherPriority::High,
- ref new DispatchedHandler(
- [mode, notifier, this]() {
- if (mode == OS::MOUSE_MODE_CAPTURED) {
+ CoreDispatcherPriority::High,
+ ref new DispatchedHandler(
+ [mode, notifier, this]() {
+ if (mode == OS::MOUSE_MODE_CAPTURED) {
- this->MouseMovedToken = MouseDevice::GetForCurrentView()->MouseMoved +=
- ref new TypedEventHandler<MouseDevice^, MouseEventArgs^>(this, &App::OnMouseMoved);
+ this->MouseMovedToken = MouseDevice::GetForCurrentView()->MouseMoved +=
+ ref new TypedEventHandler<MouseDevice ^, MouseEventArgs ^>(this, &App::OnMouseMoved);
- } else {
+ } else {
- MouseDevice::GetForCurrentView()->MouseMoved -= MouseMovedToken;
+ MouseDevice::GetForCurrentView()->MouseMoved -= MouseMovedToken;
+ }
- }
-
- notifier->Enable();
- }));
+ notifier->Enable();
+ }));
ResetEvent(os->mouse_mode_changed);
-
-
}
-void App::OnPointerMoved(Windows::UI::Core::CoreWindow^ sender, Windows::UI::Core::PointerEventArgs^ args) {
+void App::OnPointerMoved(Windows::UI::Core::CoreWindow ^ sender, Windows::UI::Core::PointerEventArgs ^ args) {
- Windows::UI::Input::PointerPoint ^point = args->CurrentPoint;
+ Windows::UI::Input::PointerPoint ^ point = args->CurrentPoint;
Windows::Foundation::Point pos = _get_pixel_position(window, point->Position, os);
if (point->IsInContact && _is_touch(point)) {
@@ -400,7 +380,6 @@ void App::OnPointerMoved(Windows::UI::Core::CoreWindow^ sender, Windows::UI::Cor
last_mouse_pos = pos;
os->input_event(event);
-
}
void App::OnMouseMoved(MouseDevice ^ mouse_device, MouseEventArgs ^ args) {
@@ -428,8 +407,7 @@ void App::OnMouseMoved(MouseDevice ^ mouse_device, MouseEventArgs ^ args) {
os->input_event(event);
}
-void App::key_event(Windows::UI::Core::CoreWindow^ sender, bool p_pressed, Windows::UI::Core::KeyEventArgs^ key_args, Windows::UI::Core::CharacterReceivedEventArgs^ char_args)
-{
+void App::key_event(Windows::UI::Core::CoreWindow ^ sender, bool p_pressed, Windows::UI::Core::KeyEventArgs ^ key_args, Windows::UI::Core::CharacterReceivedEventArgs ^ char_args) {
OSUWP::KeyEvent ke;
@@ -442,9 +420,9 @@ void App::key_event(Windows::UI::Core::CoreWindow^ sender, bool p_pressed, Windo
ke.mod_state = mod;
ke.pressed = p_pressed;
-
+
if (key_args != nullptr) {
-
+
ke.type = OSUWP::KeyEvent::MessageType::KEY_EVENT_MESSAGE;
ke.unicode = 0;
ke.scancode = KeyMappingWindows::get_keysym((unsigned int)key_args->VirtualKey);
@@ -459,92 +437,78 @@ void App::key_event(Windows::UI::Core::CoreWindow^ sender, bool p_pressed, Windo
}
os->queue_key_event(ke);
-
}
-void App::OnKeyDown(CoreWindow^ sender, KeyEventArgs^ args)
-{
+void App::OnKeyDown(CoreWindow ^ sender, KeyEventArgs ^ args) {
key_event(sender, true, args);
}
-void App::OnKeyUp(CoreWindow^ sender, KeyEventArgs^ args)
-{
+void App::OnKeyUp(CoreWindow ^ sender, KeyEventArgs ^ args) {
key_event(sender, false, args);
}
-void App::OnCharacterReceived(CoreWindow^ sender, CharacterReceivedEventArgs^ args)
-{
+void App::OnCharacterReceived(CoreWindow ^ sender, CharacterReceivedEventArgs ^ args) {
key_event(sender, true, nullptr, args);
}
-
// Initializes scene resources
-void App::Load(Platform::String^ entryPoint)
-{
-
+void App::Load(Platform::String ^ entryPoint) {
}
// This method is called after the window becomes active.
-void App::Run()
-{
+void App::Run() {
if (Main::start())
os->run();
}
// Terminate events do not cause Uninitialize to be called. It will be called if your IFrameworkView
// class is torn down while the app is in the foreground.
-void App::Uninitialize()
-{
+void App::Uninitialize() {
Main::cleanup();
delete os;
}
// Application lifecycle event handler.
-void App::OnActivated(CoreApplicationView^ applicationView, IActivatedEventArgs^ args)
-{
- // Run() won't start until the CoreWindow is activated.
- CoreWindow::GetForCurrentThread()->Activate();
+void App::OnActivated(CoreApplicationView ^ applicationView, IActivatedEventArgs ^ args) {
+ // Run() won't start until the CoreWindow is activated.
+ CoreWindow::GetForCurrentThread()->Activate();
}
// Window event handlers.
-void App::OnVisibilityChanged(CoreWindow^ sender, VisibilityChangedEventArgs^ args)
-{
- mWindowVisible = args->Visible;
+void App::OnVisibilityChanged(CoreWindow ^ sender, VisibilityChangedEventArgs ^ args) {
+ mWindowVisible = args->Visible;
}
-void App::OnWindowClosed(CoreWindow^ sender, CoreWindowEventArgs^ args)
-{
- mWindowClosed = true;
+void App::OnWindowClosed(CoreWindow ^ sender, CoreWindowEventArgs ^ args) {
+ mWindowClosed = true;
}
-void App::OnWindowSizeChanged(CoreWindow^ sender, WindowSizeChangedEventArgs^ args)
-{
+void App::OnWindowSizeChanged(CoreWindow ^ sender, WindowSizeChangedEventArgs ^ args) {
#if (WINAPI_FAMILY == WINAPI_FAMILY_PC_APP)
- // On Windows 8.1, apps are resized when they are snapped alongside other apps, or when the device is rotated.
- // The default framebuffer will be automatically resized when either of these occur.
- // In particular, on a 90 degree rotation, the default framebuffer's width and height will switch.
- UpdateWindowSize(args->Size);
+ // On Windows 8.1, apps are resized when they are snapped alongside other apps, or when the device is rotated.
+ // The default framebuffer will be automatically resized when either of these occur.
+ // In particular, on a 90 degree rotation, the default framebuffer's width and height will switch.
+ UpdateWindowSize(args->Size);
#else if (WINAPI_FAMILY == WINAPI_FAMILY_PHONE_APP)
- // On Windows Phone 8.1, the window size changes when the device is rotated.
- // The default framebuffer will not be automatically resized when this occurs.
- // It is therefore up to the app to handle rotation-specific logic in its rendering code.
+ // On Windows Phone 8.1, the window size changes when the device is rotated.
+ // The default framebuffer will not be automatically resized when this occurs.
+ // It is therefore up to the app to handle rotation-specific logic in its rendering code.
//os->screen_size_changed();
UpdateWindowSize(args->Size);
#endif
}
-void App::UpdateWindowSize(Size size)
-{
+void App::UpdateWindowSize(Size size) {
float dpi;
#if (WINAPI_FAMILY == WINAPI_FAMILY_PC_APP)
- DisplayInformation^ currentDisplayInformation = DisplayInformation::GetForCurrentView();
+ DisplayInformation ^ currentDisplayInformation = DisplayInformation::GetForCurrentView();
dpi = currentDisplayInformation->LogicalDpi;
#else if (WINAPI_FAMILY == WINAPI_FAMILY_PHONE_APP)
dpi = DisplayProperties::LogicalDpi;
#endif
Size pixelSize(ConvertDipsToPixels(size.Width, dpi), ConvertDipsToPixels(size.Height, dpi));
- mWindowWidth = static_cast<GLsizei>(pixelSize.Width);
- mWindowHeight = static_cast<GLsizei>(pixelSize.Height);
+ mWindowWidth = static_cast<GLsizei>(pixelSize.Width);
+ mWindowHeight = static_cast<GLsizei>(pixelSize.Height);
OS::VideoMode vm;
vm.width = mWindowWidth;
@@ -554,12 +518,12 @@ void App::UpdateWindowSize(Size size)
os->set_video_mode(vm);
}
-char** App::get_command_line(unsigned int* out_argc) {
+char **App::get_command_line(unsigned int *out_argc) {
- static char* fail_cl[] = { "-path", "game", NULL };
+ static char *fail_cl[] = { "-path", "game", NULL };
*out_argc = 2;
- FILE* f = _wfopen(L"__cl__.cl", L"rb");
+ FILE *f = _wfopen(L"__cl__.cl", L"rb");
if (f == NULL) {
@@ -573,12 +537,12 @@ char** App::get_command_line(unsigned int* out_argc) {
uint8_t len[4];
int r = fread(len, sizeof(uint8_t), 4, f);
- Platform::Collections::Vector<Platform::String^> cl;
+ Platform::Collections::Vector<Platform::String ^> cl;
if (r < 4) {
fclose(f);
wprintf(L"Wrong cmdline length.");
- return(fail_cl);
+ return (fail_cl);
}
int argc = READ_LE_4(len);
@@ -590,7 +554,7 @@ char** App::get_command_line(unsigned int* out_argc) {
if (r < 4) {
fclose(f);
wprintf(L"Wrong cmdline param length.");
- return(fail_cl);
+ return (fail_cl);
}
int strlen = READ_LE_4(len);
@@ -598,17 +562,17 @@ char** App::get_command_line(unsigned int* out_argc) {
if (strlen > CMD_MAX_LEN) {
fclose(f);
wprintf(L"Wrong command length.");
- return(fail_cl);
+ return (fail_cl);
}
- char* arg = new char[strlen + 1];
+ char *arg = new char[strlen + 1];
r = fread(arg, sizeof(char), strlen, f);
arg[strlen] = '\0';
if (r == strlen) {
int warg_size = MultiByteToWideChar(CP_UTF8, 0, arg, -1, NULL, 0);
- wchar_t* warg = new wchar_t[warg_size];
+ wchar_t *warg = new wchar_t[warg_size];
MultiByteToWideChar(CP_UTF8, 0, arg, -1, warg, warg_size);
@@ -619,7 +583,7 @@ char** App::get_command_line(unsigned int* out_argc) {
delete[] arg;
fclose(f);
wprintf(L"Error reading command.");
- return(fail_cl);
+ return (fail_cl);
}
}
@@ -628,17 +592,16 @@ char** App::get_command_line(unsigned int* out_argc) {
fclose(f);
- char** ret = new char*[cl.Size + 1];
+ char **ret = new char *[cl.Size + 1];
for (int i = 0; i < cl.Size; i++) {
int arg_size = WideCharToMultiByte(CP_UTF8, 0, cl.GetAt(i)->Data(), -1, NULL, 0, NULL, NULL);
- char* arg = new char[arg_size];
+ char *arg = new char[arg_size];
WideCharToMultiByte(CP_UTF8, 0, cl.GetAt(i)->Data(), -1, arg, arg_size, NULL, NULL);
ret[i] = arg;
-
}
ret[cl.Size] = NULL;
*out_argc = cl.Size;