clang-modernize -use-nullptr

and s/\bNULL\b/nullptr/g for *.cpp/h/mm files not compiled on my machine
This commit is contained in:
Tillmann Karras 2014-03-09 21:14:26 +01:00
commit d802d39281
292 changed files with 1526 additions and 1526 deletions

View file

@ -31,7 +31,7 @@ void cInterfaceEGL::DetectMode()
return;
EGLint num_configs;
EGLConfig *config = NULL;
EGLConfig *config = nullptr;
bool supportsGL = false, supportsGLES2 = false, supportsGLES3 = false;
// attributes for a visual in RGBA format with at least
@ -43,7 +43,7 @@ void cInterfaceEGL::DetectMode()
EGL_NONE };
// Get how many configs there are
if (!eglChooseConfig( GLWin.egl_dpy, attribs, NULL, 0, &num_configs))
if (!eglChooseConfig( GLWin.egl_dpy, attribs, nullptr, 0, &num_configs))
{
INFO_LOG(VIDEO, "Error: couldn't get an EGL visual config\n");
goto err_exit;
@ -186,7 +186,7 @@ bool cInterfaceEGL::Create(void *&window_handle)
GLWin.native_window = Platform.CreateWindow();
GLWin.egl_surf = eglCreateWindowSurface(GLWin.egl_dpy, config, GLWin.native_window, NULL);
GLWin.egl_surf = eglCreateWindowSurface(GLWin.egl_dpy, config, GLWin.native_window, nullptr);
if (!GLWin.egl_surf)
{
INFO_LOG(VIDEO, "Error: eglCreateWindowSurface failed\n");
@ -218,6 +218,6 @@ void cInterfaceEGL::Shutdown()
NOTICE_LOG(VIDEO, "Could not destroy window surface.");
if(!eglTerminate(GLWin.egl_dpy))
NOTICE_LOG(VIDEO, "Could not destroy display connection.");
GLWin.egl_ctx = NULL;
GLWin.egl_ctx = nullptr;
}
}

View file

@ -10,7 +10,7 @@
#include "VideoCommon/VideoConfig.h"
typedef int ( * PFNGLXSWAPINTERVALSGIPROC) (int interval);
PFNGLXSWAPINTERVALSGIPROC glXSwapIntervalSGI = NULL;
PFNGLXSWAPINTERVALSGIPROC glXSwapIntervalSGI = nullptr;
// Show the current FPS
void cInterfaceGLX::UpdateFPSDisplay(const char *text)
@ -71,8 +71,8 @@ bool cInterfaceGLX::Create(void *&window_handle)
GLX_DOUBLEBUFFER,
None };
GLWin.dpy = XOpenDisplay(0);
GLWin.evdpy = XOpenDisplay(0);
GLWin.dpy = XOpenDisplay(nullptr);
GLWin.evdpy = XOpenDisplay(nullptr);
GLWin.parent = (Window)window_handle;
GLWin.screen = DefaultScreen(GLWin.dpy);
if (GLWin.parent == 0)
@ -83,17 +83,17 @@ bool cInterfaceGLX::Create(void *&window_handle)
// Get an appropriate visual
GLWin.vi = glXChooseVisual(GLWin.dpy, GLWin.screen, attrListDbl);
if (GLWin.vi == NULL)
if (GLWin.vi == nullptr)
{
GLWin.vi = glXChooseVisual(GLWin.dpy, GLWin.screen, attrListSgl);
if (GLWin.vi != NULL)
if (GLWin.vi != nullptr)
{
ERROR_LOG(VIDEO, "Only single buffered visual!");
}
else
{
GLWin.vi = glXChooseVisual(GLWin.dpy, GLWin.screen, attrListDefault);
if (GLWin.vi == NULL)
if (GLWin.vi == nullptr)
{
ERROR_LOG(VIDEO, "Could not choose visual (glXChooseVisual)");
return false;
@ -104,7 +104,7 @@ bool cInterfaceGLX::Create(void *&window_handle)
NOTICE_LOG(VIDEO, "Got double buffered visual!");
// Create a GLX context.
GLWin.ctx = glXCreateContext(GLWin.dpy, GLWin.vi, 0, GL_TRUE);
GLWin.ctx = glXCreateContext(GLWin.dpy, GLWin.vi, nullptr, GL_TRUE);
if (!GLWin.ctx)
{
PanicAlert("Unable to create GLX context.");
@ -142,7 +142,7 @@ bool cInterfaceGLX::MakeCurrent()
bool cInterfaceGLX::ClearCurrent()
{
return glXMakeCurrent(GLWin.dpy, None, NULL);
return glXMakeCurrent(GLWin.dpy, None, nullptr);
}
@ -155,7 +155,7 @@ void cInterfaceGLX::Shutdown()
glXDestroyContext(GLWin.dpy, GLWin.ctx);
XCloseDisplay(GLWin.dpy);
XCloseDisplay(GLWin.evdpy);
GLWin.ctx = NULL;
GLWin.ctx = nullptr;
}
}

View file

@ -26,7 +26,7 @@ public:
virtual void UpdateFPSDisplay(const char *Text) {}
virtual void SetMode(u32 mode) { s_opengl_mode = GLInterfaceMode::MODE_OPENGL; }
virtual u32 GetMode() { return s_opengl_mode; }
virtual void* GetFuncAddress(std::string name) { return NULL; }
virtual void* GetFuncAddress(std::string name) { return nullptr; }
virtual bool Create(void *&window_handle) { return true; }
virtual bool MakeCurrent() { return true; }
virtual bool ClearCurrent() { return true; }

View file

@ -62,7 +62,7 @@ bool cPlatform::SelectDisplay(void)
#endif
platform_env);
free(platform_env);
platform_env = NULL;
platform_env = nullptr;
}
#if HAVE_WAYLAND
if (wayland_possible)
@ -154,7 +154,7 @@ EGLDisplay cPlatform::EGLGetDisplay(void)
#ifdef ANDROID
return eglGetDisplay(EGL_DEFAULT_DISPLAY);
#endif
return NULL;
return nullptr;
}
EGLNativeWindowType cPlatform::CreateWindow(void)

View file

@ -11,13 +11,13 @@
#include "VideoCommon/VertexShaderManager.h"
#include "VideoCommon/VideoConfig.h"
static HDC hDC = NULL; // Private GDI Device Context
static HGLRC hRC = NULL; // Permanent Rendering Context
static HINSTANCE dllHandle = NULL; // Handle to OpenGL32.dll
static HDC hDC = nullptr; // Private GDI Device Context
static HGLRC hRC = nullptr; // Permanent Rendering Context
static HINSTANCE dllHandle = nullptr; // Handle to OpenGL32.dll
// typedef from wglext.h
typedef BOOL(WINAPI * PFNWGLSWAPINTERVALEXTPROC) (int interval);
static PFNWGLSWAPINTERVALEXTPROC wglSwapIntervalEXT = NULL;
static PFNWGLSWAPINTERVALEXTPROC wglSwapIntervalEXT = nullptr;
void cInterfaceWGL::SwapInterval(int Interval)
{
@ -34,9 +34,9 @@ void cInterfaceWGL::Swap()
void* cInterfaceWGL::GetFuncAddress(std::string name)
{
void* func = (void*)wglGetProcAddress((LPCSTR)name.c_str());
if (func == NULL)
if (func == nullptr)
func = (void*)GetProcAddress(dllHandle, (LPCSTR)name.c_str());
return func;
return func;
}
// Draw messages on top of the screen
@ -78,7 +78,7 @@ bool cInterfaceWGL::Create(void *&window_handle)
#endif
window_handle = (void*)EmuWindow::Create((HWND)window_handle, GetModuleHandle(0), _T("Please wait..."));
if (window_handle == NULL)
if (window_handle == nullptr)
{
Host_SysMessage("failed to create window");
return false;
@ -138,7 +138,7 @@ bool cInterfaceWGL::MakeCurrent()
bool cInterfaceWGL::ClearCurrent()
{
bool success = wglMakeCurrent(hDC, NULL) ? true : false;
bool success = wglMakeCurrent(hDC, nullptr) ? true : false;
if (success)
{
// Grab the swap interval function pointer
@ -183,19 +183,19 @@ void cInterfaceWGL::Shutdown()
{
if (hRC)
{
if (!wglMakeCurrent(NULL, NULL))
if (!wglMakeCurrent(nullptr, nullptr))
NOTICE_LOG(VIDEO, "Could not release drawing context.");
if (!wglDeleteContext(hRC))
ERROR_LOG(VIDEO, "Attempt to release rendering context failed.");
hRC = NULL;
hRC = nullptr;
}
if (hDC && !ReleaseDC(EmuWindow::GetWnd(), hDC))
{
ERROR_LOG(VIDEO, "Attempt to release device context failed.");
hDC = NULL;
hDC = nullptr;
}
}

View file

@ -16,7 +16,7 @@ hide_cursor(void)
return;
wl_pointer_set_cursor(GLWin.pointer.wl_pointer,
GLWin.pointer.serial, NULL, 0, 0);
GLWin.pointer.serial, nullptr, 0, 0);
}
static void
@ -104,10 +104,10 @@ toggle_fullscreen(bool fullscreen)
if (fullscreen) {
wl_shell_surface_set_fullscreen(GLWin.wl_shell_surface,
WL_SHELL_SURFACE_FULLSCREEN_METHOD_DEFAULT,
0, NULL);
0, nullptr);
} else {
wl_shell_surface_set_toplevel(GLWin.wl_shell_surface);
handle_configure(NULL, GLWin.wl_shell_surface, 0,
handle_configure(nullptr, GLWin.wl_shell_surface, 0,
GLWin.window_size.width,
GLWin.window_size.height);
}
@ -124,7 +124,7 @@ keyboard_handle_keymap(void *data, struct wl_keyboard *keyboard,
return;
}
map_str = (char *) mmap(NULL, size, PROT_READ, MAP_SHARED, fd, 0);
map_str = (char *) mmap(nullptr, size, PROT_READ, MAP_SHARED, fd, 0);
if (map_str == MAP_FAILED) {
close(fd);
return;
@ -146,7 +146,7 @@ keyboard_handle_keymap(void *data, struct wl_keyboard *keyboard,
if (!GLWin.keyboard.xkb.state) {
fprintf(stderr, "failed to create XKB state\n");
xkb_map_unref(GLWin.keyboard.xkb.keymap);
GLWin.keyboard.xkb.keymap = NULL;
GLWin.keyboard.xkb.keymap = nullptr;
return;
}
@ -244,15 +244,15 @@ static void
seat_handle_capabilities(void *data, struct wl_seat *seat,
uint32_t caps)
{
struct wl_pointer *wl_pointer = NULL;
struct wl_keyboard *wl_keyboard = NULL;
struct wl_pointer *wl_pointer = nullptr;
struct wl_keyboard *wl_keyboard = nullptr;
if ((caps & WL_SEAT_CAPABILITY_POINTER) && !wl_pointer) {
wl_pointer = wl_seat_get_pointer(seat);
wl_pointer_add_listener(wl_pointer, &pointer_listener, 0);
} else if (!(caps & WL_SEAT_CAPABILITY_POINTER) && wl_pointer) {
wl_pointer_destroy(wl_pointer);
wl_pointer = NULL;
wl_pointer = nullptr;
}
GLWin.pointer.wl_pointer = wl_pointer;
@ -262,7 +262,7 @@ seat_handle_capabilities(void *data, struct wl_seat *seat,
wl_keyboard_add_listener(wl_keyboard, &keyboard_listener, 0);
} else if (!(caps & WL_SEAT_CAPABILITY_KEYBOARD) && wl_keyboard) {
wl_keyboard_destroy(wl_keyboard);
wl_keyboard = NULL;
wl_keyboard = nullptr;
}
GLWin.keyboard.wl_keyboard = wl_keyboard;
@ -290,7 +290,7 @@ registry_handle_global(void *data, struct wl_registry *registry,
} else if (strcmp(interface, "wl_shm") == 0) {
GLWin.wl_shm = (wl_shm *) wl_registry_bind(registry, name,
&wl_shm_interface, 1);
GLWin.wl_cursor_theme = (wl_cursor_theme *) wl_cursor_theme_load(NULL, 32, GLWin.wl_shm);
GLWin.wl_cursor_theme = (wl_cursor_theme *) wl_cursor_theme_load(nullptr, 32, GLWin.wl_shm);
GLWin.wl_cursor = (wl_cursor *)
wl_cursor_theme_get_cursor(GLWin.wl_cursor_theme, "left_ptr");
}
@ -309,7 +309,7 @@ static const struct wl_registry_listener registry_listener = {
bool cWaylandInterface::ServerConnect(void)
{
GLWin.wl_display = wl_display_connect(NULL);
GLWin.wl_display = wl_display_connect(nullptr);
if (!GLWin.wl_display)
return false;
@ -324,18 +324,18 @@ bool cWaylandInterface::Initialize(void *config)
return false;
}
GLWin.pointer.wl_pointer = NULL;
GLWin.keyboard.wl_keyboard = NULL;
GLWin.pointer.wl_pointer = nullptr;
GLWin.keyboard.wl_keyboard = nullptr;
GLWin.keyboard.xkb.context = xkb_context_new((xkb_context_flags) 0);
if (GLWin.keyboard.xkb.context == NULL) {
if (GLWin.keyboard.xkb.context == nullptr) {
fprintf(stderr, "Failed to create XKB context\n");
return NULL;
return nullptr;
}
GLWin.wl_registry = wl_display_get_registry(GLWin.wl_display);
wl_registry_add_listener(GLWin.wl_registry,
&registry_listener, NULL);
&registry_listener, nullptr);
while (!GLWin.wl_compositor)
wl_display_dispatch(GLWin.wl_display);

View file

@ -9,7 +9,7 @@
#if USE_EGL
bool cXInterface::ServerConnect(void)
{
GLWin.dpy = XOpenDisplay(NULL);
GLWin.dpy = XOpenDisplay(nullptr);
if (!GLWin.dpy)
return false;
@ -49,7 +49,7 @@ bool cXInterface::Initialize(void *config, void *window_handle)
GLWin.width = _twidth;
GLWin.height = _theight;
GLWin.evdpy = XOpenDisplay(NULL);
GLWin.evdpy = XOpenDisplay(nullptr);
GLWin.parent = (Window) window_handle;
GLWin.screen = DefaultScreen(GLWin.dpy);
@ -86,7 +86,7 @@ void *cXInterface::CreateWindow(void)
CWBorderPixel | CWBackPixel | CWColormap | CWEventMask, &GLWin.attr);
wmProtocols[0] = XInternAtom(GLWin.evdpy, "WM_DELETE_WINDOW", True);
XSetWMProtocols(GLWin.evdpy, GLWin.win, wmProtocols, 1);
XSetStandardProperties(GLWin.evdpy, GLWin.win, "GPU", "GPU", None, NULL, 0, NULL);
XSetStandardProperties(GLWin.evdpy, GLWin.win, "GPU", "GPU", None, nullptr, 0, nullptr);
XMapRaised(GLWin.evdpy, GLWin.win);
XSync(GLWin.evdpy, True);
@ -136,7 +136,7 @@ void cX11Window::CreateXWindow(void)
CWBorderPixel | CWBackPixel | CWColormap | CWEventMask, &GLWin.attr);
wmProtocols[0] = XInternAtom(GLWin.evdpy, "WM_DELETE_WINDOW", True);
XSetWMProtocols(GLWin.evdpy, GLWin.win, wmProtocols, 1);
XSetStandardProperties(GLWin.evdpy, GLWin.win, "GPU", "GPU", None, NULL, 0, NULL);
XSetStandardProperties(GLWin.evdpy, GLWin.win, "GPU", "GPU", None, nullptr, 0, nullptr);
XMapRaised(GLWin.evdpy, GLWin.win);
XSync(GLWin.evdpy, True);