Win: Fix compilation error on Windows (xgl_helper.py).
authorIan Elliott <ian@LunarG.com>
Thu, 26 Feb 2015 00:40:38 +0000 (17:40 -0700)
committerIan Elliott <ian@LunarG.com>
Thu, 26 Feb 2015 00:40:38 +0000 (17:40 -0700)
Visual Studio doesn't like the following code construct:

    if (<some test>)
        return <something>;
    <type> variable [= <intial-value>];

We have to use curly-braces, as in:

    if (<some test>) {
        return <something>;
    }
    <type> variable [= <intial-value>];

xgl_helper.py

index 6b6a1d1..a4cf237 100755 (executable)
@@ -615,8 +615,9 @@ class StructWrapperGen:
         # Add function to dynamically print out unknown struct
         sh_funcs.append("char* dynamic_display(const void* pStruct, const char* prefix)\n{\n")
         sh_funcs.append("    // Cast to APP_INFO ptr initially just to pull sType off struct\n")
-        sh_funcs.append("    if (pStruct == NULL)\n")
+        sh_funcs.append("    if (pStruct == NULL) {\n")
         sh_funcs.append("        return NULL;\n")
+        sh_funcs.append("    }\n")
         sh_funcs.append("    XGL_STRUCTURE_TYPE sType = ((XGL_APPLICATION_INFO*)pStruct)->sType;\n")
         sh_funcs.append('    char indent[100];\n    strcpy(indent, "    ");\n    strcat(indent, prefix);\n')
         sh_funcs.append("    switch (sType)\n    {\n")
@@ -760,8 +761,9 @@ class StructWrapperGen:
         # Add function to dynamically print out unknown struct
         sh_funcs.append("string dynamic_display(const void* pStruct, const string prefix)\n{")
         sh_funcs.append("    // Cast to APP_INFO ptr initially just to pull sType off struct")
-        sh_funcs.append("    if (pStruct == NULL)")
+        sh_funcs.append("    if (pStruct == NULL) {\n")
         sh_funcs.append("        return NULL;")
+        sh_funcs.append("    }\n")
         sh_funcs.append("    XGL_STRUCTURE_TYPE sType = ((XGL_APPLICATION_INFO*)pStruct)->sType;")
         sh_funcs.append('    string indent = "    ";')
         sh_funcs.append('    indent += prefix;')