OSDN Git Service

Fix C++11 strict string literal const correctness.
authorNicolas Capens <capn@google.com>
Mon, 20 Mar 2017 15:29:52 +0000 (11:29 -0400)
committerNicolas Capens <capn@google.com>
Mon, 20 Mar 2017 18:39:43 +0000 (18:39 +0000)
String literals are const in C++11, and should only be assigned to
const pointers.

Bug swiftshader:33

Change-Id: Iefe0a1c06d58dffb69d7fbe199a2f0aa8bf3bcb1
Reviewed-on: https://swiftshader-review.googlesource.com/8990
Tested-by: Nicolas Capens <capn@google.com>
Reviewed-by: Alexis Hétu <sugoi@google.com>
src/OpenGL/libGL/Shader.cpp
tests/OGLSimpleCube/OGLSimpleCube.cpp

index 14983bd..3a6b2cd 100644 (file)
@@ -197,7 +197,7 @@ void Shader::compile()
        TranslatorASM *compiler = createCompiler(getType());
 
        // Ensure we don't pass a nullptr source to the compiler
-       char *source = "\0";
+       const char *source = "\0";
        if(mSource)
        {
                source = mSource;
index afa63f1..bfcf569 100644 (file)
@@ -37,7 +37,7 @@ Inspired by http://www.cs.rit.edu/~ncs/Courses/570/UserGuide/OpenGLonWin-11.html
 LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam);
 
 const char *className = "OpenGL";
-char *windowName = "OpenGL Cube";
+const char *windowName = "OpenGL Cube";
 int winX = 0, winY = 0;
 int winWidth = 300, winHeight = 300;
 float angle = 0.1f;