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)
size_t vertexShaderSize = vertexExecutable->shaderExecutable()->getLength();
stream.writeInt(vertexShaderSize);
unsigned char *vertexBlob = static_cast<unsigned char *>(vertexExecutable->shaderExecutable()->getFunction());
const uint8_t *vertexBlob = vertexExecutable->shaderExecutable()->getFunction();
stream.writeBytes(vertexBlob, vertexShaderSize);
}
......@@ -1530,7 +1530,7 @@ bool ProgramBinary::save(void* binary, GLsizei bufSize, GLsizei *length)
size_t pixelShaderSize = pixelExecutable->shaderExecutable()->getLength();
stream.writeInt(pixelShaderSize);
unsigned char *pixelBlob = static_cast<unsigned char *>(pixelExecutable->shaderExecutable()->getFunction());
const uint8_t *pixelBlob = pixelExecutable->shaderExecutable()->getFunction();
stream.writeBytes(pixelBlob, pixelShaderSize);
}
......@@ -1539,7 +1539,7 @@ bool ProgramBinary::save(void* binary, GLsizei bufSize, GLsizei *length)
if (mGeometryExecutable != NULL && geometryShaderSize > 0)
{
unsigned char *geometryBlob = static_cast<unsigned char *>(mGeometryExecutable->getFunction());
const uint8_t *geometryBlob = mGeometryExecutable->getFunction();
stream.writeBytes(geometryBlob, geometryShaderSize);
}
......
......@@ -19,32 +19,28 @@ namespace rx
class ShaderExecutable
{
public:
ShaderExecutable(const void *function, size_t length) : mLength(length)
ShaderExecutable(const void *function, size_t length)
: mFunctionBuffer(length)
{
mFunction = new char[length];
memcpy(mFunction, function, length);
}
virtual ~ShaderExecutable()
{
delete[] mFunction;
memcpy(mFunctionBuffer.data(), function, length);
}
void *getFunction() const
virtual ~ShaderExecutable() {}
const uint8_t *getFunction() const
{
return mFunction;
return mFunctionBuffer.data();
}
size_t getLength() const
{
return mLength;
return mFunctionBuffer.size();
}
private:
DISALLOW_COPY_AND_ASSIGN(ShaderExecutable);
void *mFunction;
const size_t mLength;
std::vector<uint8_t> mFunctionBuffer;
};
class UniformStorage
......
......@@ -23,7 +23,7 @@ namespace rx
template <typename mapType>
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);
}
......
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