Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2015-02-17 23:26:10 +0300
committerCampbell Barton <ideasman42@gmail.com>2015-02-17 23:27:27 +0300
commita9dbaf3755ac1abad109970e0fff190bb7418ac2 (patch)
tree7c3382bd34b97cfb6a41d4065a6b6cd8fca2c1cc /source/blender/imbuf/intern/thumbs.c
parente089b0e91162fb0932bdb88e9905cdd9fb6b94dd (diff)
Ensure BLI_stat() return value is checked.
also add function attrs on BLI_fileops to ensure they're used correctly.
Diffstat (limited to 'source/blender/imbuf/intern/thumbs.c')
-rw-r--r--source/blender/imbuf/intern/thumbs.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/source/blender/imbuf/intern/thumbs.c b/source/blender/imbuf/intern/thumbs.c
index 94e95c06fea..118f0405303 100644
--- a/source/blender/imbuf/intern/thumbs.c
+++ b/source/blender/imbuf/intern/thumbs.c
@@ -343,8 +343,9 @@ ImBuf *IMB_thumb_create(const char *path, ThumbSize size, ThumbSource source, Im
}
if (img != NULL) {
- BLI_stat(path, &info);
- BLI_snprintf(mtime, sizeof(mtime), "%ld", (long int)info.st_mtime);
+ if (BLI_stat(path, &info) != -1) {
+ BLI_snprintf(mtime, sizeof(mtime), "%ld", (long int)info.st_mtime);
+ }
BLI_snprintf(cwidth, sizeof(cwidth), "%d", img->x);
BLI_snprintf(cheight, sizeof(cheight), "%d", img->y);
}
@@ -363,8 +364,9 @@ ImBuf *IMB_thumb_create(const char *path, ThumbSize size, ThumbSource source, Im
}
IMB_free_anim(anim);
}
- BLI_stat(path, &info);
- BLI_snprintf(mtime, sizeof(mtime), "%ld", (long int)info.st_mtime);
+ if (BLI_stat(path, &info) != -1) {
+ BLI_snprintf(mtime, sizeof(mtime), "%ld", (long int)info.st_mtime);
+ }
}
if (!img) return NULL;
@@ -461,7 +463,7 @@ ImBuf *IMB_thumb_manage(const char *path, ThumbSize size, ThumbSource source)
BLI_stat_t st;
ImBuf *img = NULL;
- if (BLI_stat(path, &st)) {
+ if (BLI_stat(path, &st) == -1) {
return NULL;
}
if (!uri_from_filename(path, uri)) {