From e5d48797d9866c155e3a4af8a6dd614a8978d428 Mon Sep 17 00:00:00 2001 From: Johannes Schickel Date: Wed, 15 Feb 2012 00:44:19 +0100 Subject: OPENGL: Let getGlErrStr return a Common::String. This also makes getGlErrStr use Common::String::format instead of snprintf. --- backends/graphics/opengl/glerrorcheck.cpp | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) (limited to 'backends/graphics/opengl') diff --git a/backends/graphics/opengl/glerrorcheck.cpp b/backends/graphics/opengl/glerrorcheck.cpp index 682207c7ef..439593577d 100644 --- a/backends/graphics/opengl/glerrorcheck.cpp +++ b/backends/graphics/opengl/glerrorcheck.cpp @@ -26,6 +26,7 @@ #include "backends/graphics/opengl/glerrorcheck.h" #include "common/textconsole.h" +#include "common/str.h" #ifdef WIN32 #if defined(ARRAYSIZE) && !defined(_WINDOWS_) @@ -44,7 +45,7 @@ #include #endif -static const char *getGlErrStr(GLenum error) { +static Common::String getGlErrStr(GLenum error) { switch (error) { case GL_NO_ERROR: return "GL_NO_ERROR"; case GL_INVALID_ENUM: return "GL_INVALID_ENUM"; @@ -54,16 +55,13 @@ static const char *getGlErrStr(GLenum error) { case GL_OUT_OF_MEMORY: return "GL_OUT_OF_MEMORY"; } - // FIXME: Convert to use Common::String::format() - static char buf[40]; - snprintf(buf, sizeof(buf), "(Unknown GL error code 0x%x)", error); - return buf; + return Common::String::format("(Unknown GL error code 0x%x)", error); } void checkGlError(const char *file, int line) { GLenum error = glGetError(); if (error != GL_NO_ERROR) - warning("%s:%d: GL error: %s", file, line, getGlErrStr(error)); + warning("%s:%d: GL error: %s", file, line, getGlErrStr(error).c_str()); } #endif -- cgit v1.2.3