Revision: 57217
          http://sourceforge.net/p/brlcad/code/57217
Author:   brlcad
Date:     2013-08-28 12:34:51 +0000 (Wed, 28 Aug 2013)
Log Message:
-----------
close the texture file fd, reduce var scope

Modified Paths:
--------------
    brlcad/trunk/src/conv/g-vrml.c

Modified: brlcad/trunk/src/conv/g-vrml.c
===================================================================
--- brlcad/trunk/src/conv/g-vrml.c      2013-08-28 12:31:08 UTC (rev 57216)
+++ brlcad/trunk/src/conv/g-vrml.c      2013-08-28 12:34:51 UTC (rev 57217)
@@ -955,15 +955,16 @@
            }
            if (strlen(mat.tx_file)) {
                int tex_fd;
-               int nbytes;
-               long tex_len;
-               long bytes_read = 0;
                unsigned char tex_buf[TXT_BUF_LEN * 3];
 
                if ((tex_fd = open(mat.tx_file, O_RDONLY | O_BINARY)) == (-1)) {
                    bu_log("Cannot open texture file (%s)\n", mat.tx_file);
                    perror("g-vrml: ");
                } else {
+                   long tex_len;
+                   long bytes_read = 0;
+                   long bytes_to_go = 0;
+
                    /* Johns note - need to check (test) the texture stuff */
                    fprintf(fp_out, "\t\t\t\ttextureTransform TextureTransform 
{\n");
                    fprintf(fp_out, "\t\t\t\t\tscale 1.33333 
1.33333\n\t\t\t\t}\n");
@@ -973,7 +974,7 @@
                    fprintf(fp_out, "\t\t\t\t\timage %d %d %d\n", mat.tx_w, 
mat.tx_n, 3);
                    tex_len = mat.tx_w*mat.tx_n * 3;
                    while (bytes_read < tex_len) {
-                       long bytes_to_go=tex_len;
+                       int nbytes;
                        long readval;
 
                        bytes_to_go = tex_len - bytes_read;
@@ -997,6 +998,8 @@
                        }
                    }
                    fprintf(fp_out, "\t\t\t\t}\n");
+
+                   close(tex_fd);
                }
            }
        } else if (mater->ma_color_valid) {

This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.


------------------------------------------------------------------------------
Learn the latest--Visual Studio 2012, SharePoint 2013, SQL 2012, more!
Discover the easy way to master current and previous Microsoft technologies
and advance your career. Get an incredible 1,500+ hours of step-by-step
tutorial videos with LearnDevNow. Subscribe today and save!
http://pubads.g.doubleclick.net/gampad/clk?id=58040911&iu=/4140/ostg.clktrk
_______________________________________________
BRL-CAD Source Commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/brlcad-commits

Reply via email to