mojoshader.c
changeset 1161 6085abb2edaa
parent 1160 24ee60c85ec3
child 1162 de0613aa8f07
--- a/mojoshader.c	Tue May 24 01:05:54 2016 -0400
+++ b/mojoshader.c	Fri May 27 13:54:16 2016 -0400
@@ -10457,7 +10457,7 @@
         memset(info->members, '\0', len);
     } // else
 
-    int i;
+    unsigned int i;
     const uint32 *member = (const uint32 *) (start + typeptr[6]);
     for (i = 0; i < info->member_count; i++)
     {
@@ -11171,7 +11171,7 @@
 static void free_sym_typeinfo(MOJOSHADER_free f, void *d,
                               MOJOSHADER_symbolTypeInfo *typeinfo)
 {
-    int i;
+    unsigned int i;
     for (i = 0; i < typeinfo->member_count; i++)
     {
         f((void *) typeinfo->members[i].name, d);
@@ -12052,6 +12052,14 @@
     // !!! FIXME: This is copypasta ripped from parse_preshader -flibit
     int i;
 
+    // All sections of a preshader are packed into separate comment tokens,
+    //  inside the containing comment token block. Find them all before
+    //  we start, so we don't care about the order they appear in the file.
+    PreshaderBlockInfo ctab = { 0, 0, 0 };
+    PreshaderBlockInfo prsi = { 0, 0, 0 };
+    PreshaderBlockInfo fxlc = { 0, 0, 0 };
+    PreshaderBlockInfo clit = { 0, 0, 0 };
+
     const uint32 *tokens = (const uint32 *) buf;
     uint32 tokcount = _len / 4;
 
@@ -12077,14 +12085,6 @@
     tokens++;
     tokcount++;
 
-    // All sections of a preshader are packed into separate comment tokens,
-    //  inside the containing comment token block. Find them all before
-    //  we start, so we don't care about the order they appear in the file.
-    PreshaderBlockInfo ctab = { 0, 0, 0 };
-    PreshaderBlockInfo prsi = { 0, 0, 0 };
-    PreshaderBlockInfo fxlc = { 0, 0, 0 };
-    PreshaderBlockInfo clit = { 0, 0, 0 };
-
     while (tokcount > 0)
     {
         uint32 subtokcount = 0;
@@ -12401,13 +12401,15 @@
                               MOJOSHADER_free f,
                               void *d)
 {
-    int i, j;
+    unsigned int i, j;
     if (preshader != NULL)
     {
         f((void *) preshader->literals, d);
         for (i = 0; i < preshader->instruction_count; i++)
+        {
             for (j = 0; j < preshader->instructions[i].operand_count; j++)
                 f((void *) preshader->instructions[i].operands[j].array_registers, d);
+        } // for
         f((void *) preshader->instructions, d);
         f((void *) preshader->registers, d);
         free_symbols(f, d, preshader->symbols, preshader->symbol_count);