Kill off some usages of c_str.

Also changes some function params, but this is ok.
Some simplifications were also able to be made (ie. killing off strcmps with ==, etc).
This commit is contained in:
Lioncash
2014-03-12 15:33:41 -04:00
parent dccc6d8b47
commit a82675b7d5
170 changed files with 812 additions and 704 deletions

View File

@ -7,7 +7,7 @@
#include "VideoCommon/RenderBase.h"
// Show the current FPS
void cInterfaceEGL::UpdateFPSDisplay(const char *text)
void cInterfaceEGL::UpdateFPSDisplay(const std::string& text)
{
Platform.UpdateFPSDisplay(text);
}
@ -20,7 +20,7 @@ void cInterfaceEGL::SwapInterval(int Interval)
eglSwapInterval(GLWin.egl_dpy, Interval);
}
void* cInterfaceEGL::GetFuncAddress(std::string name)
void* cInterfaceEGL::GetFuncAddress(const std::string& name)
{
return (void*)eglGetProcAddress(name.c_str());
}

View File

@ -5,6 +5,7 @@
#pragma once
#include <EGL/egl.h>
#include <string>
#include "Core/ConfigManager.h"
#include "DolphinWX/GLInterface/InterfaceBase.h"
@ -26,7 +27,7 @@ public:
EGLDisplay EGLGetDisplay(void);
EGLNativeWindowType CreateWindow(void);
void DestroyWindow(void);
void UpdateFPSDisplay(const char *text);
void UpdateFPSDisplay(const std::string& text);
void ToggleFullscreen(bool fullscreen);
void SwapBuffers();
};
@ -41,8 +42,8 @@ public:
void SwapInterval(int Interval);
void Swap();
void SetMode(u32 mode) { s_opengl_mode = mode; }
void UpdateFPSDisplay(const char *Text);
void* GetFuncAddress(std::string name);
void UpdateFPSDisplay(const std::string& text);
void* GetFuncAddress(const std::string& name);
bool Create(void *&window_handle);
bool MakeCurrent();
void Shutdown();

View File

@ -2,6 +2,8 @@
// Licensed under GPLv2
// Refer to the license.txt file included.
#include <string>
#include "Core/Host.h"
#include "DolphinWX/GLInterface/GLInterface.h"
@ -13,9 +15,9 @@ typedef int ( * PFNGLXSWAPINTERVALSGIPROC) (int interval);
PFNGLXSWAPINTERVALSGIPROC glXSwapIntervalSGI = nullptr;
// Show the current FPS
void cInterfaceGLX::UpdateFPSDisplay(const char *text)
void cInterfaceGLX::UpdateFPSDisplay(const std::string& text)
{
XStoreName(GLWin.evdpy, GLWin.win, text);
XStoreName(GLWin.evdpy, GLWin.win, text.c_str());
}
void cInterfaceGLX::SwapInterval(int Interval)

View File

@ -4,6 +4,8 @@
#pragma once
#include <string>
#include "DolphinWX/GLInterface/InterfaceBase.h"
#include "DolphinWX/GLInterface/X11_Util.h"
@ -15,7 +17,7 @@ public:
friend class cX11Window;
void SwapInterval(int Interval) override;
void Swap() override;
void UpdateFPSDisplay(const char *Text) override;
void UpdateFPSDisplay(const std::string& text) override;
void* GetFuncAddress(std::string name) override;
bool Create(void *&window_handle) override;
bool MakeCurrent() override;

View File

@ -4,6 +4,8 @@
#pragma once
#include <string>
#include "Common/Common.h"
enum GLInterfaceMode {
@ -23,7 +25,7 @@ protected:
u32 s_opengl_mode;
public:
virtual void Swap() {}
virtual void UpdateFPSDisplay(const char *Text) {}
virtual void UpdateFPSDisplay(const std::string& 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 nullptr; }

View File

@ -2,6 +2,7 @@
// Licensed under GPLv2
// Refer to the license.txt file included.
#include <string>
#include "Core/Host.h"
#include "DolphinWX/GLInterface/GLInterface.h"
@ -185,7 +186,7 @@ void cPlatform::DestroyWindow(void)
#endif
}
void cPlatform::UpdateFPSDisplay(const char *text)
void cPlatform::UpdateFPSDisplay(const std::string& text)
{
#if HAVE_WAYLAND
if (cPlatform::platform == EGL_PLATFORM_WAYLAND)

View File

@ -2,6 +2,8 @@
// Licensed under GPLv2
// Refer to the license.txt file included.
#include <string>
#include "Core/Host.h"
#include "DolphinWX/GLInterface/GLInterface.h"
@ -55,11 +57,9 @@ bool cInterfaceWGL::PeekMessages()
}
// Show the current FPS
void cInterfaceWGL::UpdateFPSDisplay(const char *text)
void cInterfaceWGL::UpdateFPSDisplay(const std::string& text)
{
TCHAR temp[512];
swprintf_s(temp, sizeof(temp)/sizeof(TCHAR), _T("%hs"), text);
EmuWindow::SetWindowText(temp);
EmuWindow::SetWindowText(text);
}
// Create rendering window.

View File

@ -4,6 +4,7 @@
#pragma once
#include <string>
#include "DolphinWX/GLInterface/InterfaceBase.h"
class cInterfaceWGL : public cInterfaceBase
@ -11,7 +12,7 @@ class cInterfaceWGL : public cInterfaceBase
public:
void SwapInterval(int Interval);
void Swap();
void UpdateFPSDisplay(const char *Text);
void UpdateFPSDisplay(const std::string& text);
void* GetFuncAddress(std::string name);
bool Create(void *&window_handle);
bool MakeCurrent();

View File

@ -379,9 +379,9 @@ void cWaylandInterface::DestroyWindow(void)
wl_surface_destroy(GLWin.wl_surface);
}
void cWaylandInterface::UpdateFPSDisplay(const char *text)
void cWaylandInterface::UpdateFPSDisplay(const std::string& text)
{
wl_shell_surface_set_title(GLWin.wl_shell_surface, text);
wl_shell_surface_set_title(GLWin.wl_shell_surface, text.c_str());
}
void cWaylandInterface::ToggleFullscreen(bool fullscreen)

View File

@ -4,6 +4,7 @@
#pragma once
#include <string>
#include <wayland-client.h>
#include <wayland-cursor.h>
#include <wayland-egl.h>
@ -22,7 +23,7 @@ public:
void *EGLGetDisplay(void);
void *CreateWindow(void);
void DestroyWindow(void);
void UpdateFPSDisplay(const char *text);
void UpdateFPSDisplay(const std::string& text);
void ToggleFullscreen(bool fullscreen);
void SwapBuffers();
};

View File

@ -106,9 +106,9 @@ void cXInterface::DestroyWindow(void)
XFreeColormap(GLWin.evdpy, GLWin.attr.colormap);
}
void cXInterface::UpdateFPSDisplay(const char *text)
void cXInterface::UpdateFPSDisplay(const std::string& text)
{
XStoreName(GLWin.evdpy, GLWin.win, text);
XStoreName(GLWin.evdpy, GLWin.win, text.c_str());
}
void cXInterface::SwapBuffers()

View File

@ -4,6 +4,7 @@
#pragma once
#include <string>
#include <X11/keysym.h>
#include <X11/Xlib.h>
#include <X11/Xutil.h>
@ -19,7 +20,7 @@ public:
void *EGLGetDisplay(void);
void *CreateWindow(void);
void DestroyWindow(void);
void UpdateFPSDisplay(const char *text);
void UpdateFPSDisplay(const std::string& text);
void SwapBuffers();
};
#else