summaryrefslogtreecommitdiffstats
path: root/vcl/opengl/win
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2016-10-14 16:44:22 +0200
committerStephan Bergmann <sbergman@redhat.com>2016-10-15 07:59:13 +0000
commit48b1c8898d2f5a54435d23c412a0c65b553ef46d (patch)
treeef87e03b112f675718ee542d86d42ed7c8beb4fb /vcl/opengl/win
parentclang-cl loplugin: tools (diff)
downloadcore-48b1c8898d2f5a54435d23c412a0c65b553ef46d.tar.gz
core-48b1c8898d2f5a54435d23c412a0c65b553ef46d.zip
clang-cl loplugin: vcl
Change-Id: I40f8a6fef9d66b28a1d72551a6873b041b38b09e Reviewed-on: https://gerrit.libreoffice.org/29841 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
Diffstat (limited to 'vcl/opengl/win')
-rw-r--r--vcl/opengl/win/WinDeviceInfo.cxx32
-rw-r--r--vcl/opengl/win/blocklist_parser.cxx8
-rw-r--r--vcl/opengl/win/gdiimpl.cxx76
3 files changed, 58 insertions, 58 deletions
diff --git a/vcl/opengl/win/WinDeviceInfo.cxx b/vcl/opengl/win/WinDeviceInfo.cxx
index bdafb6ef7a14..fcf3347a1e7a 100644
--- a/vcl/opengl/win/WinDeviceInfo.cxx
+++ b/vcl/opengl/win/WinDeviceInfo.cxx
@@ -67,7 +67,7 @@ bool GetKeyValue(const WCHAR* keyLocation, const WCHAR* keyName, OUString& destS
// We only use this for vram size
dwcbData = sizeof(dValue);
result = RegQueryValueExW(key, keyName, nullptr, &resultType,
- (LPBYTE)&dValue, &dwcbData);
+ reinterpret_cast<LPBYTE>(&dValue), &dwcbData);
if (result == ERROR_SUCCESS && resultType == REG_DWORD)
{
dValue = dValue / 1024 / 1024;
@@ -86,7 +86,7 @@ bool GetKeyValue(const WCHAR* keyLocation, const WCHAR* keyName, OUString& destS
dwcbData = sizeof(wCharValue);
result = RegQueryValueExW(key, keyName, nullptr, &resultType,
- (LPBYTE)wCharValue, &dwcbData);
+ reinterpret_cast<LPBYTE>(wCharValue), &dwcbData);
if (result == ERROR_SUCCESS && resultType == REG_MULTI_SZ)
{
// This bit here could probably be cleaner.
@@ -401,8 +401,8 @@ private:
}
bool WinOpenGLDeviceInfo::FindBlocklistedDeviceInList(std::vector<wgl::DriverInfo>& aDeviceInfos,
- OUString sDriverVersion, OUString sAdapterVendorID,
- OUString sAdapterDeviceID, uint32_t nWindowsVersion)
+ OUString const & sDriverVersion, OUString const & sAdapterVendorID,
+ OUString const & sAdapterDeviceID, uint32_t nWindowsVersion)
{
uint64_t driverVersion;
wgl::ParseDriverVersion(sDriverVersion, driverVersion);
@@ -509,7 +509,7 @@ OUString getCacheFolder()
return url;
}
-void writeToLog(SvStream& rStrm, const char* pKey, const OUString rVal)
+void writeToLog(SvStream& rStrm, const char* pKey, const OUString & rVal)
{
rStrm.WriteCharPtr(pKey);
rStrm.WriteCharPtr(": ");
@@ -636,7 +636,7 @@ void WinOpenGLDeviceInfo::GetData()
&devinfoData,
SPDRP_DRIVER,
nullptr,
- (PBYTE)value,
+ reinterpret_cast<PBYTE>(value),
sizeof(value),
nullptr))
{
@@ -648,7 +648,7 @@ void WinOpenGLDeviceInfo::GetData()
/* we've found the driver we're looking for */
dwcbData = sizeof(value);
result = RegQueryValueExW(key, L"DriverVersion", nullptr, nullptr,
- (LPBYTE)value, &dwcbData);
+ reinterpret_cast<LPBYTE>(value), &dwcbData);
if (result == ERROR_SUCCESS)
{
maDriverVersion = OUString(value);
@@ -660,7 +660,7 @@ void WinOpenGLDeviceInfo::GetData()
}
dwcbData = sizeof(value);
result = RegQueryValueExW(key, L"DriverDate", nullptr, nullptr,
- (LPBYTE)value, &dwcbData);
+ reinterpret_cast<LPBYTE>(value), &dwcbData);
if (result == ERROR_SUCCESS)
{
maDriverDate = value;
@@ -725,7 +725,7 @@ void WinOpenGLDeviceInfo::GetData()
&devinfoData,
SPDRP_DRIVER,
nullptr,
- (PBYTE)value,
+ reinterpret_cast<PBYTE>(value),
sizeof(value),
nullptr))
{
@@ -736,7 +736,7 @@ void WinOpenGLDeviceInfo::GetData()
{
dwcbData = sizeof(value);
result = RegQueryValueExW(key, L"MatchingDeviceId", nullptr,
- nullptr, (LPBYTE)value, &dwcbData);
+ nullptr, reinterpret_cast<LPBYTE>(value), &dwcbData);
if (result != ERROR_SUCCESS)
{
continue;
@@ -765,7 +765,7 @@ void WinOpenGLDeviceInfo::GetData()
}
dwcbData = sizeof(value);
result = RegQueryValueExW(key, L"DriverVersion", nullptr, nullptr,
- (LPBYTE)value, &dwcbData);
+ reinterpret_cast<LPBYTE>(value), &dwcbData);
if (result != ERROR_SUCCESS)
{
RegCloseKey(key);
@@ -774,7 +774,7 @@ void WinOpenGLDeviceInfo::GetData()
aDriverVersion2 = value;
dwcbData = sizeof(value);
result = RegQueryValueExW(key, L"DriverDate", nullptr, nullptr,
- (LPBYTE)value, &dwcbData);
+ reinterpret_cast<LPBYTE>(value), &dwcbData);
if (result != ERROR_SUCCESS)
{
RegCloseKey(key);
@@ -783,12 +783,12 @@ void WinOpenGLDeviceInfo::GetData()
aDriverDate2 = value;
dwcbData = sizeof(value);
result = RegQueryValueExW(key, L"Device Description", nullptr,
- nullptr, (LPBYTE)value, &dwcbData);
+ nullptr, reinterpret_cast<LPBYTE>(value), &dwcbData);
if (result != ERROR_SUCCESS)
{
dwcbData = sizeof(value);
result = RegQueryValueExW(key, L"DriverDesc", nullptr, nullptr,
- (LPBYTE)value, &dwcbData);
+ reinterpret_cast<LPBYTE>(value), &dwcbData);
}
RegCloseKey(key);
if (result == ERROR_SUCCESS)
@@ -816,7 +816,7 @@ void WinOpenGLDeviceInfo::GetData()
// Macro for assigning a device vendor id to a string.
#define DECLARE_VENDOR_ID(name, deviceId) \
case name: \
- *mpDeviceVendors[id] = OUString(deviceId); \
+ *mpDeviceVendors[id] = deviceId; \
break;
OUString WinOpenGLDeviceInfo::GetDeviceVendor(wgl::DeviceVendor id)
@@ -866,7 +866,7 @@ void WinOpenGLDeviceInfo::FillBlacklist()
}
catch (...)
{
- SAL_WARN("vcl.opengl.win", "error parsing blacklist");
+ SAL_WARN("vcl.opengl", "error parsing blacklist");
maDriverInfo.clear();
}
}
diff --git a/vcl/opengl/win/blocklist_parser.cxx b/vcl/opengl/win/blocklist_parser.cxx
index eb140a1c47d7..2f72472cdf70 100644
--- a/vcl/opengl/win/blocklist_parser.cxx
+++ b/vcl/opengl/win/blocklist_parser.cxx
@@ -153,9 +153,7 @@ uint64_t getVersion(const OString& rString)
return nVersion;
}
-}
-
-void WinBlocklistParser::handleDevices(wgl::DriverInfo& rDriver, xmlreader::XmlReader& rReader)
+void handleDevices(wgl::DriverInfo& rDriver, xmlreader::XmlReader& rReader)
{
int nLevel = 1;
bool bInMsg = false;
@@ -212,6 +210,8 @@ void WinBlocklistParser::handleDevices(wgl::DriverInfo& rDriver, xmlreader::XmlR
}
}
+}
+
void WinBlocklistParser::handleEntry(wgl::DriverInfo& rDriver, xmlreader::XmlReader& rReader)
{
if (meBlockType == BlockType::WHITELIST)
@@ -271,7 +271,7 @@ void WinBlocklistParser::handleEntry(wgl::DriverInfo& rDriver, xmlreader::XmlRea
else
{
OString aAttrName(name.begin, name.length);
- SAL_WARN("vcl.opengl.win", "unsupported attribute: " << aAttrName);
+ SAL_WARN("vcl.opengl", "unsupported attribute: " << aAttrName);
}
}
diff --git a/vcl/opengl/win/gdiimpl.cxx b/vcl/opengl/win/gdiimpl.cxx
index d1e83d3aab69..6470bd093cff 100644
--- a/vcl/opengl/win/gdiimpl.cxx
+++ b/vcl/opengl/win/gdiimpl.cxx
@@ -31,9 +31,9 @@ public:
};
GLWinWindow::GLWinWindow()
- : hWnd(NULL)
- , hDC(NULL)
- , hRC(NULL)
+ : hWnd(nullptr)
+ , hDC(nullptr)
+ , hRC(nullptr)
{
}
@@ -70,7 +70,7 @@ void WinOpenGLContext::resetCurrent()
OpenGLZone aZone;
- wglMakeCurrent(NULL, NULL);
+ wglMakeCurrent(nullptr, nullptr);
}
bool WinOpenGLContext::isCurrent()
@@ -82,7 +82,7 @@ bool WinOpenGLContext::isCurrent()
bool WinOpenGLContext::isAnyCurrent()
{
- return wglGetCurrentContext() != NULL;
+ return wglGetCurrentContext() != nullptr;
}
void WinOpenGLContext::makeCurrent()
@@ -140,11 +140,11 @@ void WinOpenGLContext::destroyCurrentContext()
if (itr != g_vShareList.end())
g_vShareList.erase(itr);
- if (wglGetCurrentContext() != NULL)
- wglMakeCurrent(NULL, NULL);
+ if (wglGetCurrentContext() != nullptr)
+ wglMakeCurrent(nullptr, nullptr);
wglDeleteContext( m_aGLWin.hRC );
ReleaseDC( m_aGLWin.hWnd, m_aGLWin.hDC );
- m_aGLWin.hRC = 0;
+ m_aGLWin.hRC = nullptr;
}
}
@@ -174,14 +174,14 @@ bool InitTempWindow(HWND& hwnd, int width, int height, const PIXELFORMATDESCRIPT
wc.style = 0;
wc.lpfnWndProc = WndProc;
wc.cbClsExtra = wc.cbWndExtra = 0;
- wc.hInstance = NULL;
- wc.hIcon = NULL;
- wc.hCursor = NULL;
- wc.hbrBackground = NULL;
- wc.lpszMenuName = NULL;
- wc.lpszClassName = (LPCSTR)"GLRenderer";
+ wc.hInstance = nullptr;
+ wc.hIcon = nullptr;
+ wc.hCursor = nullptr;
+ wc.hbrBackground = nullptr;
+ wc.lpszMenuName = nullptr;
+ wc.lpszClassName = "GLRenderer";
RegisterClass(&wc);
- hwnd = CreateWindow(wc.lpszClassName, NULL, WS_DISABLED, 0, 0, width, height, NULL, NULL, wc.hInstance, NULL);
+ hwnd = CreateWindow(wc.lpszClassName, nullptr, WS_DISABLED, 0, 0, width, height, nullptr, nullptr, wc.hInstance, nullptr);
glWin.hDC = GetDC(hwnd);
int nPixelFormat = ChoosePixelFormat(glWin.hDC, &pfd);
@@ -208,7 +208,7 @@ bool InitTempWindow(HWND& hwnd, int width, int height, const PIXELFORMATDESCRIPT
ret = wglMakeCurrent(glWin.hDC, glWin.hRC);
if(!ret)
{
- wglMakeCurrent(NULL, NULL);
+ wglMakeCurrent(nullptr, nullptr);
wglDeleteContext(glWin.hRC);
ReleaseDC(hwnd, glWin.hDC);
DestroyWindow(hwnd);
@@ -223,18 +223,18 @@ bool WGLisExtensionSupported(const char *extension)
OpenGLZone aZone;
const size_t extlen = strlen(extension);
- const char *supported = NULL;
+ const char *supported = nullptr;
// Try to use wglGetExtensionStringARB on current DC, if possible
PROC wglGetExtString = wglGetProcAddress("wglGetExtensionsStringARB");
if (wglGetExtString)
- supported = ((char*(__stdcall*)(HDC))wglGetExtString)(wglGetCurrentDC());
+ supported = reinterpret_cast<char*(__stdcall*)(HDC)>(wglGetExtString)(wglGetCurrentDC());
// If that failed, try standard OpenGL extensions string
- if (supported == NULL)
- supported = (char*)glGetString(GL_EXTENSIONS);
+ if (supported == nullptr)
+ supported = reinterpret_cast<char const *>(glGetString(GL_EXTENSIONS));
// If that failed too, must be no extensions supported
- if (supported == NULL)
+ if (supported == nullptr)
return false;
// Begin examination at start of string, increment by 1 on false match
@@ -243,8 +243,8 @@ bool WGLisExtensionSupported(const char *extension)
// Advance p up to the next possible match
p = strstr(p, extension);
- if (p == NULL)
- return 0; // No Match
+ if (p == nullptr)
+ return false; // No Match
// Make sure that match is at the start of the string or that
// the previous char is a space, or else we could accidentally
@@ -253,7 +253,7 @@ bool WGLisExtensionSupported(const char *extension)
// Also, make sure that the following character is space or null
// or else "wglExtensionTwo" might match "wglExtension"
if ((p==supported || p[-1]==' ') && (p[extlen]=='\0' || p[extlen]==' '))
- return 1; // Match
+ return true; // Match
}
}
@@ -262,7 +262,7 @@ bool InitMultisample(const PIXELFORMATDESCRIPTOR& pfd, int& rPixelFormat,
{
OpenGLZone aZone;
- HWND hWnd = NULL;
+ HWND hWnd = nullptr;
GLWinWindow glWin;
// Create a temp window to check whether support multi-sample, if support, get the format
if (!InitTempWindow(hWnd, 32, 32, pfd, glWin))
@@ -275,17 +275,17 @@ bool InitMultisample(const PIXELFORMATDESCRIPTOR& pfd, int& rPixelFormat,
if (!WGLisExtensionSupported("WGL_ARB_multisample"))
{
SAL_WARN("vcl.opengl", "Device doesn't support multisample");
- wglMakeCurrent(NULL, NULL);
+ wglMakeCurrent(nullptr, nullptr);
wglDeleteContext(glWin.hRC);
ReleaseDC(hWnd, glWin.hDC);
DestroyWindow(hWnd);
return false;
}
// Get our pixel format
- PFNWGLCHOOSEPIXELFORMATARBPROC fn_wglChoosePixelFormatARB = (PFNWGLCHOOSEPIXELFORMATARBPROC)wglGetProcAddress("wglChoosePixelFormatARB");
+ PFNWGLCHOOSEPIXELFORMATARBPROC fn_wglChoosePixelFormatARB = reinterpret_cast<PFNWGLCHOOSEPIXELFORMATARBPROC>(wglGetProcAddress("wglChoosePixelFormatARB"));
if (!fn_wglChoosePixelFormatARB)
{
- wglMakeCurrent(NULL, NULL);
+ wglMakeCurrent(nullptr, nullptr);
wglDeleteContext(glWin.hRC);
ReleaseDC(hWnd, glWin.hDC);
DestroyWindow(hWnd);
@@ -341,7 +341,7 @@ bool InitMultisample(const PIXELFORMATDESCRIPTOR& pfd, int& rPixelFormat,
{
bArbMultisampleSupported = true;
rPixelFormat = pixelFormat;
- wglMakeCurrent(NULL, NULL);
+ wglMakeCurrent(nullptr, nullptr);
wglDeleteContext(glWin.hRC);
ReleaseDC(hWnd, glWin.hDC);
DestroyWindow(hWnd);
@@ -355,14 +355,14 @@ bool InitMultisample(const PIXELFORMATDESCRIPTOR& pfd, int& rPixelFormat,
{
bArbMultisampleSupported = true;
rPixelFormat = pixelFormat;
- wglMakeCurrent(NULL, NULL);
+ wglMakeCurrent(nullptr, nullptr);
wglDeleteContext(glWin.hRC);
ReleaseDC(hWnd, glWin.hDC);
DestroyWindow(hWnd);
return bArbMultisampleSupported;
}
// Return the valid format
- wglMakeCurrent(NULL, NULL);
+ wglMakeCurrent(nullptr, nullptr);
wglDeleteContext(glWin.hRC);
ReleaseDC(hWnd, glWin.hDC);
DestroyWindow(hWnd);
@@ -555,7 +555,7 @@ bool WinOpenGLContext::ImplInit()
}
HGLRC hTempRC = wglCreateContext(m_aGLWin.hDC);
- if (hTempRC == NULL)
+ if (hTempRC == nullptr)
{
SAL_WARN("vcl.opengl", "wglCreateContext failed: "<< WindowsErrorString(GetLastError()));
if (bFirstCall)
@@ -581,13 +581,13 @@ bool WinOpenGLContext::ImplInit()
return false;
}
- HGLRC hSharedCtx = 0;
+ HGLRC hSharedCtx = nullptr;
if (!g_vShareList.empty())
hSharedCtx = g_vShareList.front();
if (!wglCreateContextAttribsARB)
{
- wglMakeCurrent(NULL, NULL);
+ wglMakeCurrent(nullptr, nullptr);
wglDeleteContext(hTempRC);
if (bFirstCall)
disableOpenGLAndTerminateForRestart();
@@ -605,10 +605,10 @@ bool WinOpenGLContext::ImplInit()
0
};
m_aGLWin.hRC = wglCreateContextAttribsARB(m_aGLWin.hDC, hSharedCtx, attribs);
- if (m_aGLWin.hRC == 0)
+ if (m_aGLWin.hRC == nullptr)
{
SAL_WARN("vcl.opengl", "wglCreateContextAttribsARB failed: "<< WindowsErrorString(GetLastError()));
- wglMakeCurrent(NULL, NULL);
+ wglMakeCurrent(nullptr, nullptr);
wglDeleteContext(hTempRC);
if (bFirstCall)
disableOpenGLAndTerminateForRestart();
@@ -618,7 +618,7 @@ bool WinOpenGLContext::ImplInit()
if (!compiledShaderBinariesWork())
{
- wglMakeCurrent(NULL, NULL);
+ wglMakeCurrent(nullptr, nullptr);
wglDeleteContext(hTempRC);
if (bFirstCall)
disableOpenGLAndTerminateForRestart();
@@ -626,7 +626,7 @@ bool WinOpenGLContext::ImplInit()
return false;
}
- wglMakeCurrent(NULL, NULL);
+ wglMakeCurrent(nullptr, nullptr);
wglDeleteContext(hTempRC);
if (!wglMakeCurrent(m_aGLWin.hDC, m_aGLWin.hRC))