]> git.tdb.fi Git - libs/gl.git/blobdiff - source/program.cpp
Read shader and program info logs directly into an std::string
[libs/gl.git] / source / program.cpp
index 116e16e7251544b902ac7082e32fb82f8c624666..6313043ea84361c3f7fbc543324c997eb56d5fc6 100644 (file)
@@ -28,17 +28,17 @@ Program::Program()
        init();
 }
 
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
 Program::Program(const ProgramBuilder::StandardFeatures &features)
 {
        init();
 
-#pragma GCC diagnostic push
-#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
        ProgramBuilder builder(features);
        builder.add_shaders(*this);
-#pragma GCC diagnostic pop
        link();
 }
+#pragma GCC diagnostic pop
 
 Program::Program(const std::string &source)
 {
@@ -333,10 +333,9 @@ bool Program::uniform_location_compare(const UniformInfo *uni1, const UniformInf
 string Program::get_info_log() const
 {
        GLsizei len = get_program_i(id, GL_INFO_LOG_LENGTH);
-       char *buf = new char[len+1];
-       glGetProgramInfoLog(id, len+1, &len, buf);
-       string log(buf, len);
-       delete[] buf;
+       string log(len+1, 0);
+       glGetProgramInfoLog(id, len+1, &len, &log[0]);
+       log.erase(len);
        return log;
 }