[Bf-blender-cvs] [67403e3] gooseberry: One more compile fix

Antony Riakiotakis noreply at git.blender.org
Thu Jul 2 16:46:15 CEST 2015


Commit: 67403e32af9ad23cadea82b856075904557635cd
Author: Antony Riakiotakis
Date:   Thu Jul 2 16:46:05 2015 +0200
Branches: gooseberry
https://developer.blender.org/rB67403e32af9ad23cadea82b856075904557635cd

One more compile fix

===================================================================

M	source/blender/blenlib/intern/BLI_filelist.c

===================================================================

diff --git a/source/blender/blenlib/intern/BLI_filelist.c b/source/blender/blenlib/intern/BLI_filelist.c
index a305ab3..0f2d8e3 100644
--- a/source/blender/blenlib/intern/BLI_filelist.c
+++ b/source/blender/blenlib/intern/BLI_filelist.c
@@ -291,21 +291,26 @@ static void bli_adddirstrings(struct BuildDirCtx *dir_ctx)
 		size = (double)file->s.st_size;
 		file->realsize = size;
 
-		if (size > 1024.0 * 1024.0 * 1024.0 * 1024.0) {
-			BLI_snprintf(file->size, sizeof(file->size), "%.1f TiB", size / (1024.0 * 1024.0 * 1024.0 * 1024.0));
-		}
-		else if (size > 1024.0 * 1024.0 * 1024.0) {
-			BLI_snprintf(file->size, sizeof(file->size), "%.1f GiB", size / (1024.0 * 1024.0 * 1024.0));
-		}
-		else if (size > 1024.0 * 1024.0) {
-			BLI_snprintf(file->size, sizeof(file->size), "%.1f MiB", size / (1024.0 * 1024.0));
-		}
-		else if (size > 1024.0) {
-			BLI_snprintf(file->size, sizeof(file->size), "%.1f KiB", size / 1024.0);
-		}
-		else {
-			BLI_snprintf(file->size, sizeof(file->size), "%d B", (int)size);
-		}
+		BLI_file_size_string(size, file->size, sizeof(file->size));
+	}
+}
+
+void BLI_file_size_string(off_t st_size, char *size, size_t len)
+{
+	if (st_size > 1024.0 * 1024.0 * 1024.0 * 1024.0) {
+		BLI_snprintf(size, len, "%.1f TiB", st_size / (1024.0 * 1024.0 * 1024.0 * 1024.0));
+	}
+	else if (st_size > 1024.0 * 1024.0 * 1024.0) {
+		BLI_snprintf(size, len, "%.1f GiB", st_size / (1024.0 * 1024.0 * 1024.0));
+	}
+	else if (st_size > 1024.0 * 1024.0) {
+		BLI_snprintf(size, len, "%.1f MiB", st_size / (1024.0 * 1024.0));
+	}
+	else if (st_size > 1024.0) {
+		BLI_snprintf(size, len, "%.1f KiB", st_size / 1024.0);
+	}
+	else {
+		BLI_snprintf(size, len, "%d B", (int)st_size);
 	}
 }




More information about the Bf-blender-cvs mailing list