Index: webrtc/examples/peerconnection/client/main_wnd.cc |
diff --git a/webrtc/examples/peerconnection/client/main_wnd.cc b/webrtc/examples/peerconnection/client/main_wnd.cc |
index a869f5b0311f7a86d477883605ee95d618f959cd..da3af2ce6d8f42747735e4a8773098e28a002262 100644 |
--- a/webrtc/examples/peerconnection/client/main_wnd.cc |
+++ b/webrtc/examples/peerconnection/client/main_wnd.cc |
@@ -67,12 +67,24 @@ void AddListBoxItem(HWND listbox, const std::string& str, LPARAM item_data) { |
} // namespace |
-MainWnd::MainWnd(const char* server, int port, bool auto_connect, |
+MainWnd::MainWnd(const char* server, |
+ int port, |
+ bool auto_connect, |
bool auto_call) |
- : ui_(CONNECT_TO_SERVER), wnd_(NULL), edit1_(NULL), edit2_(NULL), |
- label1_(NULL), label2_(NULL), button_(NULL), listbox_(NULL), |
- destroyed_(false), callback_(NULL), nested_msg_(NULL), |
- server_(server), auto_connect_(auto_connect), auto_call_(auto_call) { |
+ : ui_(CONNECT_TO_SERVER), |
+ wnd_(nullptr), |
+ edit1_(nullptr), |
+ edit2_(nullptr), |
+ label1_(nullptr), |
+ label2_(nullptr), |
+ button_(nullptr), |
+ listbox_(nullptr), |
+ destroyed_(false), |
+ callback_(nullptr), |
+ nested_msg_(nullptr), |
+ server_(server), |
+ auto_connect_(auto_connect), |
+ auto_call_(auto_call) { |
char buffer[10] = {0}; |
sprintfn(buffer, sizeof(buffer), "%i", port); |
port_ = buffer; |
@@ -83,15 +95,16 @@ MainWnd::~MainWnd() { |
} |
bool MainWnd::Create() { |
- RTC_DCHECK(wnd_ == NULL); |
+ RTC_DCHECK(wnd_ == nullptr); |
if (!RegisterWindowClass()) |
return false; |
ui_thread_id_ = ::GetCurrentThreadId(); |
wnd_ = ::CreateWindowExW(WS_EX_OVERLAPPEDWINDOW, kClassName, L"WebRTC", |
- WS_OVERLAPPEDWINDOW | WS_VISIBLE | WS_CLIPCHILDREN, |
- CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, |
- NULL, NULL, GetModuleHandle(NULL), this); |
+ WS_OVERLAPPEDWINDOW | WS_VISIBLE | WS_CLIPCHILDREN, |
+ CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, |
+ CW_USEDEFAULT, nullptr, nullptr, |
+ GetModuleHandle(nullptr), this); |
::SendMessage(wnd_, WM_SETFONT, reinterpret_cast<WPARAM>(GetDefaultFont()), |
TRUE); |
@@ -99,7 +112,7 @@ bool MainWnd::Create() { |
CreateChildWindows(); |
SwitchToConnectUI(); |
- return wnd_ != NULL; |
+ return wnd_ != nullptr; |
} |
bool MainWnd::Destroy() { |
@@ -137,7 +150,7 @@ bool MainWnd::PreTranslateMessage(MSG* msg) { |
} |
} |
} |
- } else if (msg->hwnd == NULL && msg->message == UI_THREAD_CALLBACK) { |
+ } else if (msg->hwnd == nullptr && msg->message == UI_THREAD_CALLBACK) { |
callback_->UIThreadCallback(static_cast<int>(msg->wParam), |
reinterpret_cast<void*>(msg->lParam)); |
ret = true; |
@@ -238,7 +251,7 @@ void MainWnd::OnPaint() { |
int width = bmi.bmiHeader.biWidth; |
const uint8_t* image = remote_renderer->image(); |
- if (image != NULL) { |
+ if (image != nullptr) { |
HDC dc_mem = ::CreateCompatibleDC(ps.hdc); |
::SetStretchBltMode(dc_mem, HALFTONE); |
@@ -246,8 +259,8 @@ void MainWnd::OnPaint() { |
HDC all_dc[] = { ps.hdc, dc_mem }; |
for (int i = 0; i < arraysize(all_dc); ++i) { |
SetMapMode(all_dc[i], MM_ISOTROPIC); |
- SetWindowExtEx(all_dc[i], width, height, NULL); |
- SetViewportExtEx(all_dc[i], rc.right, rc.bottom, NULL); |
+ SetWindowExtEx(all_dc[i], width, height, nullptr); |
+ SetViewportExtEx(all_dc[i], rc.right, rc.bottom, nullptr); |
} |
HBITMAP bmp_mem = ::CreateCompatibleBitmap(ps.hdc, rc.right, rc.bottom); |
@@ -413,9 +426,9 @@ LRESULT CALLBACK MainWnd::WndProc(HWND hwnd, UINT msg, WPARAM wp, LPARAM lp) { |
result = ::DefWindowProc(hwnd, msg, wp, lp); |
} |
- if (me->destroyed_ && prev_nested_msg == NULL) { |
+ if (me->destroyed_ && prev_nested_msg == nullptr) { |
me->OnDestroyed(); |
- me->wnd_ = NULL; |
+ me->wnd_ = nullptr; |
me->destroyed_ = false; |
} |
@@ -434,9 +447,9 @@ bool MainWnd::RegisterWindowClass() { |
WNDCLASSEX wcex = { sizeof(WNDCLASSEX) }; |
wcex.style = CS_DBLCLKS; |
- wcex.hInstance = GetModuleHandle(NULL); |
+ wcex.hInstance = GetModuleHandle(nullptr); |
wcex.hbrBackground = reinterpret_cast<HBRUSH>(COLOR_WINDOW + 1); |
- wcex.hCursor = ::LoadCursor(NULL, IDC_ARROW); |
+ wcex.hCursor = ::LoadCursor(nullptr, IDC_ARROW); |
wcex.lpfnWndProc = &WndProc; |
wcex.lpszClassName = kClassName; |
wnd_class_ = ::RegisterClassEx(&wcex); |
@@ -452,10 +465,9 @@ void MainWnd::CreateChildWindow(HWND* wnd, MainWnd::ChildWindowID id, |
// Child windows are invisible at first, and shown after being resized. |
DWORD style = WS_CHILD | control_style; |
- *wnd = ::CreateWindowEx(ex_style, class_name, L"", style, |
- 100, 100, 100, 100, wnd_, |
- reinterpret_cast<HMENU>(id), |
- GetModuleHandle(NULL), NULL); |
+ *wnd = ::CreateWindowEx(ex_style, class_name, L"", style, 100, 100, 100, 100, |
+ wnd_, reinterpret_cast<HMENU>(id), |
+ GetModuleHandle(nullptr), nullptr); |
RTC_DCHECK(::IsWindow(*wnd) != FALSE); |
::SendMessage(*wnd, WM_SETFONT, reinterpret_cast<WPARAM>(GetDefaultFont()), |
TRUE); |
@@ -532,7 +544,7 @@ void MainWnd::LayoutPeerListUI(bool show) { |
::ShowWindow(listbox_, SW_SHOWNA); |
} else { |
::ShowWindow(listbox_, SW_HIDE); |
- InvalidateRect(wnd_, NULL, TRUE); |
+ InvalidateRect(wnd_, nullptr, TRUE); |
} |
} |
@@ -614,7 +626,7 @@ void MainWnd::VideoRenderer::OnFrame( |
SetSize(buffer->width(), buffer->height()); |
- RTC_DCHECK(image_.get() != NULL); |
+ RTC_DCHECK(image_.get() != nullptr); |
libyuv::I420ToARGB(buffer->DataY(), buffer->StrideY(), |
buffer->DataU(), buffer->StrideU(), |
buffer->DataV(), buffer->StrideV(), |
@@ -623,5 +635,5 @@ void MainWnd::VideoRenderer::OnFrame( |
bmi_.bmiHeader.biBitCount / 8, |
buffer->width(), buffer->height()); |
} |
- InvalidateRect(wnd_, NULL, TRUE); |
+ InvalidateRect(wnd_, nullptr, TRUE); |
} |