瀏覽代碼

Vlib: Do not check mtime because mtime is changed by copy

git-svn-id: https://svn.osgeo.org/grass/grass/trunk@42320 15284696-431f-4ddb-bdfa-cd5b030d7da7
Markus Metz 15 年之前
父節點
當前提交
ef84fecce5
共有 2 個文件被更改,包括 5 次插入26 次删除
  1. 4 21
      lib/vector/Vlib/open.c
  2. 1 5
      lib/vector/Vlib/open_nat.c

+ 4 - 21
lib/vector/Vlib/open.c

@@ -776,27 +776,10 @@ int Vect_coor_info(const struct Map_info *Map, struct Coor_info *Info)
 
 
     switch (Map->format) {
     switch (Map->format) {
     case GV_FORMAT_NATIVE:
     case GV_FORMAT_NATIVE:
-	sprintf(buf, "%s/%s", GV_DIRECTORY, Map->name);
-	G__file_name(path, buf, GV_COOR_ELEMENT, Map->mapset);
-	G_debug(1, "get coor info: %s", path);
-	if (0 != stat(path, &stat_buf)) {
-	    G_warning(_("Unable to stat file <%s>"), path);
-	    Info->size = -1L;
-	    Info->mtime = -1L;
-	}
-	else {
-	    Info->size = (off_t) stat_buf.st_size;	/* file size */
-	    Info->mtime = (long)stat_buf.st_mtime;	/* last modified time */
-	}
-	/* stat does not give correct size on MINGW 
-	 * if the file is opened */
-#ifdef __MINGW32__
-	if (Map->open == VECT_OPEN_CODE) {
-	    dig_fseek(&(Map->dig_fp), 0L, SEEK_END);
-	    G_debug(2, "dig_ftell = %d", dig_ftell(&(Map->dig_fp)));
-	    Info->size = dig_ftell(&(Map->dig_fp));
-	}
-#endif
+	dig_fseek(&(Map->dig_fp), 0L, SEEK_END);
+	G_debug(2, "dig_ftell = %d", dig_ftell(&(Map->dig_fp)));
+	Info->size = dig_ftell(&(Map->dig_fp));
+	Info->mtime = 0L;
 	break;
 	break;
     case GV_FORMAT_OGR:
     case GV_FORMAT_OGR:
     case GV_FORMAT_OGR_DIRECT:
     case GV_FORMAT_OGR_DIRECT:

+ 1 - 5
lib/vector/Vlib/open_nat.c

@@ -59,10 +59,6 @@ int V1_open_old_nat(struct Map_info *Map, int update)
         return -1;
         return -1;
     }
     }
 
 
-    /* needed to determine file size, Map->head.size will be updated by dig__read_head(Map) */
-    Vect_coor_info(Map, &CInfo);
-    Map->head.size = CInfo.size;
-
     if (!(dig__read_head(Map)))
     if (!(dig__read_head(Map)))
 	return (-1);
 	return (-1);
 
 
@@ -103,7 +99,7 @@ int V1_open_new_nat(struct Map_info *Map, const char *name, int with_z)
     Map->head.Back_Major = GV_COOR_EARLIEST_MAJOR;
     Map->head.Back_Major = GV_COOR_EARLIEST_MAJOR;
     Map->head.Back_Minor = GV_COOR_EARLIEST_MINOR;
     Map->head.Back_Minor = GV_COOR_EARLIEST_MINOR;
 
 
-    /* TODO open better */
+    /* TODO: open better */
     dig_file_init(&(Map->dig_fp));
     dig_file_init(&(Map->dig_fp));
     Map->dig_fp.file = G_fopen_new(buf, GV_COOR_ELEMENT);
     Map->dig_fp.file = G_fopen_new(buf, GV_COOR_ELEMENT);
     if (Map->dig_fp.file == NULL)
     if (Map->dig_fp.file == NULL)