summaryrefslogtreecommitdiffstats
path: root/gpu/command_buffer/common/gles2_cmd_utils.cc
diff options
context:
space:
mode:
authorboliu@chromium.org <boliu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-02-06 11:38:50 +0000
committerboliu@chromium.org <boliu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-02-06 11:38:50 +0000
commitfbb9ee0842eaf89576930fdab88ead289dfb7bcf (patch)
tree6efe0a0cd682952b93d05a9455064f0b4008547e /gpu/command_buffer/common/gles2_cmd_utils.cc
parent57fc120e7e409691c96ce4eeae28986b3a241d80 (diff)
downloadchromium_src-fbb9ee0842eaf89576930fdab88ead289dfb7bcf.zip
chromium_src-fbb9ee0842eaf89576930fdab88ead289dfb7bcf.tar.gz
chromium_src-fbb9ee0842eaf89576930fdab88ead289dfb7bcf.tar.bz2
Use sstream over sprintf
gcc warns about sprintf being unsafe in some cases. Also snprintf is not available under windows. BUG= Review URL: https://codereview.chromium.org/152843003 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@249365 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'gpu/command_buffer/common/gles2_cmd_utils.cc')
-rw-r--r--gpu/command_buffer/common/gles2_cmd_utils.cc10
1 files changed, 6 insertions, 4 deletions
diff --git a/gpu/command_buffer/common/gles2_cmd_utils.cc b/gpu/command_buffer/common/gles2_cmd_utils.cc
index b7d5e52..f310d47 100644
--- a/gpu/command_buffer/common/gles2_cmd_utils.cc
+++ b/gpu/command_buffer/common/gles2_cmd_utils.cc
@@ -5,7 +5,7 @@
// This file is here so other GLES2 related files can have a common set of
// includes where appropriate.
-#include <stdio.h>
+#include <sstream>
#include <GLES2/gl2.h>
#include <GLES2/gl2ext.h>
#include <GLES2/gl2extchromium.h>
@@ -692,9 +692,11 @@ std::string GLES2Util::GetStringEnum(uint32 value) {
return entry->name;
}
}
- char buffer[20];
- sprintf(buffer, (value < 0x10000) ? "0x%04x" : "0x%08x", value);
- return buffer;
+ std::stringstream ss;
+ ss.fill('0');
+ ss.width(value < 0x10000 ? 4 : 8);
+ ss << std::hex << value;
+ return "0x" + ss.str();
}
std::string GLES2Util::GetStringError(uint32 value) {