Report actual filename in errors.
authorRyan C. Gordon <icculus@icculus.org>
Wed, 24 Mar 2010 10:09:52 -0400
changeset 902 cff5841d29e7
parent 901 a9f799b93150
child 903 c5cb0a6381fe
Report actual filename in errors.
utils/testparse.c
--- a/utils/testparse.c	Wed Mar 24 09:58:32 2010 -0400
+++ b/utils/testparse.c	Wed Mar 24 10:09:52 2010 -0400
@@ -54,7 +54,8 @@
 } // shader_type
 
 
-static int do_parse(const unsigned char *buf, const int len, const char *prof)
+static int do_parse(const char *fname, const unsigned char *buf,
+                    const int len, const char *prof)
 {
     const MOJOSHADER_parseData *pd;
     int retval = 0;
@@ -67,7 +68,7 @@
         for (i = 0; i < pd->error_count; i++)
         {
             printf("%s:%d: ERROR: %s\n",
-                    pd->errors[i].filename ? pd->errors[i].filename : "???",
+                    pd->errors[i].filename ? pd->errors[i].filename : fname,
                     pd->errors[i].error_position,
                     pd->errors[i].error);
         } // for
@@ -228,7 +229,7 @@
                 unsigned char *buf = (unsigned char *) malloc(1000000);
                 int rc = fread(buf, 1, 1000000, io);
                 fclose(io);
-                if (!do_parse(buf, rc, profile))
+                if (!do_parse(argv[i], buf, rc, profile))
                     retval = 1;
                 free(buf);
             } // else