Various fixes related to the C++11/14 update (see issue #3140)

- Convert scoped_ptr to std::unique_ptr from <memory>
- Convert arraysize to base::size from include/base/cef_cxx17_backports.h
- Convert NULL to nullptr
- Include include/base/cef_callback.h instead of include/base/cef_bind.h
- Implicit conversion of CefRefPtr<T> or scoped_refptr<T> to T* is gone;
  use .get() instead

See the issue for additional details.
This commit is contained in:
Marshall Greenblatt
2021-06-17 16:08:01 -04:00
parent 5d438ced79
commit 17fc2b3e3b
141 changed files with 580 additions and 627 deletions

View File

@@ -34,7 +34,7 @@ void SetUserDataPtr(HWND hWnd, void* ptr) {
WNDPROC SetWndProcPtr(HWND hWnd, WNDPROC wndProc) {
WNDPROC old =
reinterpret_cast<WNDPROC>(::GetWindowLongPtr(hWnd, GWLP_WNDPROC));
CHECK(old != NULL);
CHECK(old != nullptr);
LONG_PTR result = ::SetWindowLongPtr(hWnd, GWLP_WNDPROC,
reinterpret_cast<LONG_PTR>(wndProc));
CHECK(result != 0 || GetLastError() == ERROR_SUCCESS);
@@ -44,7 +44,7 @@ WNDPROC SetWndProcPtr(HWND hWnd, WNDPROC wndProc) {
std::wstring GetResourceString(UINT id) {
#define MAX_LOADSTRING 100
TCHAR buff[MAX_LOADSTRING] = {0};
LoadString(::GetModuleHandle(NULL), id, buff, MAX_LOADSTRING);
LoadString(::GetModuleHandle(nullptr), id, buff, MAX_LOADSTRING);
return buff;
}
@@ -163,10 +163,10 @@ float GetDeviceScaleFactor() {
// This value is safe to cache for the life time of the app since the user
// must logout to change the DPI setting. This value also applies to all
// screens.
HDC screen_dc = ::GetDC(NULL);
HDC screen_dc = ::GetDC(nullptr);
int dpi_x = GetDeviceCaps(screen_dc, LOGPIXELSX);
scale_factor = static_cast<float>(dpi_x) / 96.0f;
::ReleaseDC(NULL, screen_dc);
::ReleaseDC(nullptr, screen_dc);
initialized = true;
}