diff options
author | Campbell Barton <ideasman42@gmail.com> | 2013-07-13 16:58:00 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2013-07-13 16:58:00 +0400 |
commit | 0ea078ad03b53d860a427dbf8cad1b7f8002dd7c (patch) | |
tree | 2745d07ba8170a129fd280af878f6273307074b7 /source/blender/imbuf/intern/util.c | |
parent | fe76c4ec8efd097f31362f77794c835e4e6d7171 (diff) |
fix for 2 bugs in animation playback
- reading bmp images was failing (needed to increase the size of the header to 64 bytes)
- the dnd image was being incorrectly checked (was always returning true even when none was used).
Diffstat (limited to 'source/blender/imbuf/intern/util.c')
-rw-r--r-- | source/blender/imbuf/intern/util.c | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/source/blender/imbuf/intern/util.c b/source/blender/imbuf/intern/util.c index 234d80bf782..4ec5879cfac 100644 --- a/source/blender/imbuf/intern/util.c +++ b/source/blender/imbuf/intern/util.c @@ -158,9 +158,13 @@ const char *imb_ext_audio[] = { static int IMB_ispic_name(const char *name) { + /* increased from 32 to 64 because of the bitmaps header size */ +#define HEADER_SIZE 64 + + unsigned char buf[HEADER_SIZE]; ImFileType *type; struct stat st; - int fp, buf[10]; + int fp; if (UTIL_DEBUG) printf("IMB_ispic_name: loading %s\n", name); @@ -172,7 +176,8 @@ static int IMB_ispic_name(const char *name) if ((fp = BLI_open(name, O_BINARY | O_RDONLY, 0)) < 0) return FALSE; - if (read(fp, buf, 32) != 32) { + memset(buf, 0, sizeof(buf)); + if (read(fp, buf, HEADER_SIZE) <= 0) { close(fp); return FALSE; } @@ -180,14 +185,18 @@ static int IMB_ispic_name(const char *name) close(fp); /* XXX move this exception */ - if ((BIG_LONG(buf[0]) & 0xfffffff0) == 0xffd8ffe0) + if ((BIG_LONG(((int *)buf)[0]) & 0xfffffff0) == 0xffd8ffe0) return JPG; - for (type = IMB_FILE_TYPES; type->is_a; type++) - if (type->is_a((uchar *)buf)) + for (type = IMB_FILE_TYPES; type->is_a; type++) { + if (type->is_a(buf)) { return type->filetype; + } + } return FALSE; + +#undef HEADER_SIZE } int IMB_ispic(const char *filename) |