[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [15374] branches/soc-2008-quorn/source/ blender: Fixed own platform bug with stat/fstat.

Ian Thompson quornian at googlemail.com
Sat Jun 28 02:08:36 CEST 2008


Revision: 15374
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=15374
Author:   quorn
Date:     2008-06-28 02:07:22 +0200 (Sat, 28 Jun 2008)

Log Message:
-----------
Fixed own platform bug with stat/fstat.

Modified Paths:
--------------
    branches/soc-2008-quorn/source/blender/blenkernel/intern/text.c
    branches/soc-2008-quorn/source/blender/src/drawtext.c

Modified: branches/soc-2008-quorn/source/blender/blenkernel/intern/text.c
===================================================================
--- branches/soc-2008-quorn/source/blender/blenkernel/intern/text.c	2008-06-27 23:01:33 UTC (rev 15373)
+++ branches/soc-2008-quorn/source/blender/blenkernel/intern/text.c	2008-06-28 00:07:22 UTC (rev 15374)
@@ -217,7 +217,7 @@
 	TextLine *tmp;
 	char sfile[FILE_MAXFILE];
 	char str[FILE_MAXDIR+FILE_MAXFILE];
-	struct stat fst;
+	struct stat st;
 
 	if (!text || !text->name) return 0;
 	
@@ -253,9 +253,6 @@
 	fseek(fp, 0L, SEEK_SET);	
 
 	text->undo_pos= -1;
-
-	res= fstat(fp->_file, &fst);
-	text->mtime= fst.st_mtime;
 	
 	buffer= MEM_mallocN(len, "text_buffer");
 	// under windows fread can return less then len bytes because
@@ -263,6 +260,9 @@
 	len = fread(buffer, 1, len, fp);
 
 	fclose(fp);
+
+	res= stat(str, &st);
+	text->mtime= st.st_mtime;
 	
 	text->nlines=0;
 	i=0;
@@ -320,7 +320,7 @@
 	Text *ta;
 	char sfile[FILE_MAXFILE];
 	char str[FILE_MAXDIR+FILE_MAXFILE];
-	struct stat fst;
+	struct stat st;
 
 	BLI_strncpy(str, file, FILE_MAXDIR+FILE_MAXFILE);
 	if (G.scene) /* can be NULL (bg mode) */
@@ -346,9 +346,6 @@
 	ta->name= MEM_mallocN(strlen(file)+1, "text_name");
 	strcpy(ta->name, file);
 
-	res= fstat(fp->_file, &fst);
-	ta->mtime= fst.st_mtime;
-
 	ta->undo_pos= -1;
 	ta->undo_len= TXT_INIT_UNDO;
 	ta->undo_buf= MEM_mallocN(ta->undo_len, "undo buf");
@@ -359,6 +356,9 @@
 	len = fread(buffer, 1, len, fp);
 
 	fclose(fp);
+
+	res= stat(str, &st);
+	ta->mtime= st.st_mtime;
 	
 	ta->nlines=0;
 	i=0;

Modified: branches/soc-2008-quorn/source/blender/src/drawtext.c
===================================================================
--- branches/soc-2008-quorn/source/blender/src/drawtext.c	2008-06-27 23:01:33 UTC (rev 15373)
+++ branches/soc-2008-quorn/source/blender/src/drawtext.c	2008-06-28 00:07:22 UTC (rev 15374)
@@ -1316,7 +1316,7 @@
 	FILE *fp;
 	TextLine *tmp;
 	int res;
-	struct stat fst;
+	struct stat st;
 	
 	/* Do we need to get a filename? */
 	if (text->flags & TXT_ISMEM) {
@@ -1352,8 +1352,8 @@
 	
 	fclose (fp);
 
-	res= stat(text->name, &fst);
-	text->mtime= fst.st_mtime;
+	res= stat(text->name, &st);
+	text->mtime= st.st_mtime;
 	
 	if (text->flags & TXT_ISDIRTY) text->flags ^= TXT_ISDIRTY;
 }





More information about the Bf-blender-cvs mailing list