From 85c6d6739a81098c35cb35c3430f038ed4f5ddab Mon Sep 17 00:00:00 2001 From: "thakis@chromium.org" Date: Sat, 27 Feb 2010 02:14:42 +0000 Subject: "/b/slave/chromium-rel-linux/build/src/gpu/command_buffer/client/gles2_demo_cc.cc:50:warning: 'length' may be used uninitialized in this function" Revert 40193 - Added support for glGetString, glGetShaderSource, glGetProgramInfoLog and glGetShaderInfoLog This turned up lots of issues. * glGetShaderiv needed to be wrapped so it returns the size of the shader the user passed in. Not the munged shader sent to GL. * Another issue that came up is that client side validation is needed to ensure that the client side GLES2Implementation does not generate bad commands. For example, calling glUniform1iv with a negative count would generate a bad command. The service side would see that and think the program was malicious and stop processing commands. So, that means I had to add some client side validation and wrap glGetError on the client side so I can synthisize GL errors there. TEST=lots of unit tests. BUG=none Review URL: http://codereview.chromium.org/661220 TBR=gman@chromium.org Review URL: http://codereview.chromium.org/660229 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@40198 0039d316-1c4b-4281-b951-d872f2087c98 --- gpu/command_buffer/service/common_decoder.cc | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) (limited to 'gpu/command_buffer/service/common_decoder.cc') diff --git a/gpu/command_buffer/service/common_decoder.cc b/gpu/command_buffer/service/common_decoder.cc index 06d368d..4452e39 100644 --- a/gpu/command_buffer/service/common_decoder.cc +++ b/gpu/command_buffer/service/common_decoder.cc @@ -8,7 +8,7 @@ namespace gpu { -void* CommonDecoder::Bucket::GetData(size_t offset, size_t size) const { +const void* CommonDecoder::Bucket::GetData(size_t offset, size_t size) const { if (OffsetSizeValid(offset, size)) { return data_.get() + offset; } @@ -33,10 +33,8 @@ bool CommonDecoder::Bucket::SetData( } void CommonDecoder::Bucket::SetFromString(const std::string& str) { - // Strings are passed NULL terminated to distinguish between empty string - // and no string. - SetSize(str.size() + 1); - SetData(str.c_str(), 0, str.size() + 1); + SetSize(str.size()); + SetData(str.c_str(), 0, str.size()); } void* CommonDecoder::GetAddressAndCheckSize(unsigned int shm_id, -- cgit v1.1