Commit cafa2102 by Jamie Madill

Fix Clang warnings.

MSVC's more permissing validator missed a dependent typename, and deleting a void pointer. BUG=angle:703,704 Change-Id: I227b94c9c1590973d7b11b0ed0bfda32f2a71cec Reviewed-on: https://chromium-review.googlesource.com/209613Tested-by: 's avatarJamie Madill <jmadill@chromium.org> Reviewed-by: 's avatarGeoff Lang <geofflang@chromium.org>
parent 5063f55a
...@@ -1497,7 +1497,7 @@ bool ProgramBinary::save(void* binary, GLsizei bufSize, GLsizei *length) ...@@ -1497,7 +1497,7 @@ bool ProgramBinary::save(void* binary, GLsizei bufSize, GLsizei *length)
size_t vertexShaderSize = vertexExecutable->shaderExecutable()->getLength(); size_t vertexShaderSize = vertexExecutable->shaderExecutable()->getLength();
stream.writeInt(vertexShaderSize); stream.writeInt(vertexShaderSize);
unsigned char *vertexBlob = static_cast<unsigned char *>(vertexExecutable->shaderExecutable()->getFunction()); const uint8_t *vertexBlob = vertexExecutable->shaderExecutable()->getFunction();
stream.writeBytes(vertexBlob, vertexShaderSize); stream.writeBytes(vertexBlob, vertexShaderSize);
} }
...@@ -1530,7 +1530,7 @@ bool ProgramBinary::save(void* binary, GLsizei bufSize, GLsizei *length) ...@@ -1530,7 +1530,7 @@ bool ProgramBinary::save(void* binary, GLsizei bufSize, GLsizei *length)
size_t pixelShaderSize = pixelExecutable->shaderExecutable()->getLength(); size_t pixelShaderSize = pixelExecutable->shaderExecutable()->getLength();
stream.writeInt(pixelShaderSize); stream.writeInt(pixelShaderSize);
unsigned char *pixelBlob = static_cast<unsigned char *>(pixelExecutable->shaderExecutable()->getFunction()); const uint8_t *pixelBlob = pixelExecutable->shaderExecutable()->getFunction();
stream.writeBytes(pixelBlob, pixelShaderSize); stream.writeBytes(pixelBlob, pixelShaderSize);
} }
...@@ -1539,7 +1539,7 @@ bool ProgramBinary::save(void* binary, GLsizei bufSize, GLsizei *length) ...@@ -1539,7 +1539,7 @@ bool ProgramBinary::save(void* binary, GLsizei bufSize, GLsizei *length)
if (mGeometryExecutable != NULL && geometryShaderSize > 0) if (mGeometryExecutable != NULL && geometryShaderSize > 0)
{ {
unsigned char *geometryBlob = static_cast<unsigned char *>(mGeometryExecutable->getFunction()); const uint8_t *geometryBlob = mGeometryExecutable->getFunction();
stream.writeBytes(geometryBlob, geometryShaderSize); stream.writeBytes(geometryBlob, geometryShaderSize);
} }
......
...@@ -19,32 +19,28 @@ namespace rx ...@@ -19,32 +19,28 @@ namespace rx
class ShaderExecutable class ShaderExecutable
{ {
public: public:
ShaderExecutable(const void *function, size_t length) : mLength(length) ShaderExecutable(const void *function, size_t length)
: mFunctionBuffer(length)
{ {
mFunction = new char[length]; memcpy(mFunctionBuffer.data(), function, length);
memcpy(mFunction, function, length);
}
virtual ~ShaderExecutable()
{
delete[] mFunction;
} }
void *getFunction() const virtual ~ShaderExecutable() {}
const uint8_t *getFunction() const
{ {
return mFunction; return mFunctionBuffer.data();
} }
size_t getLength() const size_t getLength() const
{ {
return mLength; return mFunctionBuffer.size();
} }
private: private:
DISALLOW_COPY_AND_ASSIGN(ShaderExecutable); DISALLOW_COPY_AND_ASSIGN(ShaderExecutable);
void *mFunction; std::vector<uint8_t> mFunctionBuffer;
const size_t mLength;
}; };
class UniformStorage class UniformStorage
......
...@@ -23,7 +23,7 @@ namespace rx ...@@ -23,7 +23,7 @@ namespace rx
template <typename mapType> template <typename mapType>
static void ClearStateMap(mapType &map) static void ClearStateMap(mapType &map)
{ {
for (mapType::iterator i = map.begin(); i != map.end(); i++) for (typename mapType::iterator i = map.begin(); i != map.end(); i++)
{ {
SafeRelease(i->second.first); SafeRelease(i->second.first);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment