[GRASS-SVN] r40910 - grass/trunk/lib/segment

svn_grass at osgeo.org svn_grass at osgeo.org
Wed Feb 10 09:26:41 EST 2010


Author: mmetz
Date: 2010-02-10 09:26:37 -0500 (Wed, 10 Feb 2010)
New Revision: 40910

Modified:
   grass/trunk/lib/segment/format.c
Log:
fix nonsense if statements

Modified: grass/trunk/lib/segment/format.c
===================================================================
--- grass/trunk/lib/segment/format.c	2010-02-10 13:59:05 UTC (rev 40909)
+++ grass/trunk/lib/segment/format.c	2010-02-10 14:26:37 UTC (rev 40910)
@@ -119,20 +119,7 @@
 	return -3;
     }
 
-    /* no LFS, file size within 2GB limit ? */
-    if (sizeof(off_t) == 4) {
-	double file_size;
-
-	file_size = (double) nrows * ncols * len;
-
-	if (file_size > INT_MAX) {
-	    G_warning("segment file size would be %.2fGB, but file size limit is 2GB", file_size / (1 << 30));
-	    G_warning("please recompile with LFS");
-	    G_fatal_error("can not create temporary segment file");
-	}
-    }
-
-    if (lseek(fd, 0L, SEEK_SET) == (off_t) - 1) {
+    if (lseek(fd, 0L, SEEK_SET) == (off_t) -1) {
 	G_warning("Segment_format: %s", strerror(errno));
 	return -1;
     }
@@ -170,15 +157,12 @@
 
 static int write_int(int fd, int n)
 {
-    int x;
-    int bytes_wrote;
-
-    x = n;
-
-    if ((bytes_wrote = write(fd, &x, sizeof(int)) == sizeof(int)) < 0)
+    if (write(fd, &n, sizeof(int)) != sizeof(int)) {
 	G_warning("%s", strerror(errno));
+	return 0;
+    }
 
-    return bytes_wrote;
+    return 1;
 }
 
 



More information about the grass-commit mailing list