diff --git a/src/mbgl/shader/shader.cpp b/src/mbgl/shader/shader.cpp index 62edf1d38..87e841f42 100644 --- a/src/mbgl/shader/shader.cpp +++ b/src/mbgl/shader/shader.cpp @@ -35,6 +35,7 @@ Shader::Shader(const char *name_, const GLchar *vertSource, const GLchar *fragSo std::unique_ptr binary = mbgl::util::make_unique(binaryLength); binaryFile.read(binary.get(), binaryLength); + binaryFile.close(); MBGL_CHECK_ERROR(gl::ProgramBinary(program, binaryFormat, binary.get(), binaryLength)); @@ -44,8 +45,6 @@ Shader::Shader(const char *name_, const GLchar *vertSource, const GLchar *fragSo if (status == GL_TRUE) { skipCompile = true; } - - binaryFile.close(); } GLuint vertShader = 0; @@ -142,7 +141,7 @@ bool Shader::compileShader(GLuint *shader, GLenum type, const GLchar *source) { *shader = MBGL_CHECK_ERROR(glCreateShader(type)); const GLchar *strings[] = { source }; - const GLsizei lengths[] = { (GLsizei)std::strlen(source) }; + const GLsizei lengths[] = { static_cast(std::strlen(source)) }; MBGL_CHECK_ERROR(glShaderSource(*shader, 1, strings, lengths)); MBGL_CHECK_ERROR(glCompileShader(*shader));