[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [58214] trunk/blender/source/blender: fix for 2 bugs in animation playback
Campbell Barton
ideasman42 at gmail.com
Sat Jul 13 14:58:00 CEST 2013
Revision: 58214
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=58214
Author: campbellbarton
Date: 2013-07-13 12:58:00 +0000 (Sat, 13 Jul 2013)
Log Message:
-----------
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).
Modified Paths:
--------------
trunk/blender/source/blender/imbuf/intern/util.c
trunk/blender/source/blender/windowmanager/intern/wm_playanim.c
Modified: trunk/blender/source/blender/imbuf/intern/util.c
===================================================================
--- trunk/blender/source/blender/imbuf/intern/util.c 2013-07-13 12:14:04 UTC (rev 58213)
+++ trunk/blender/source/blender/imbuf/intern/util.c 2013-07-13 12:58:00 UTC (rev 58214)
@@ -158,9 +158,13 @@
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 @@
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 @@
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)
Modified: trunk/blender/source/blender/windowmanager/intern/wm_playanim.c
===================================================================
--- trunk/blender/source/blender/windowmanager/intern/wm_playanim.c 2013-07-13 12:14:04 UTC (rev 58213)
+++ trunk/blender/source/blender/windowmanager/intern/wm_playanim.c 2013-07-13 12:58:00 UTC (rev 58214)
@@ -940,6 +940,7 @@
}
}
else if (!IMB_ispic(filepath)) {
+ printf("%s: '%s' not an image file\n", __func__, filepath);
exit(1);
}
@@ -949,7 +950,7 @@
}
if (ibuf == NULL) {
- printf("couldn't open %s\n", filepath);
+ printf("%s: '%s' couldn't open\n", __func__, filepath);
exit(1);
}
@@ -1190,7 +1191,7 @@
GHOST_DisposeWindow(g_WS.ghost_system, g_WS.ghost_window);
/* early exit, IMB and BKE should be exited only in end */
- if (ps.dropped_file) {
+ if (ps.dropped_file[0]) {
BLI_strncpy(filepath, ps.dropped_file, sizeof(filepath));
return filepath;
}
More information about the Bf-blender-cvs
mailing list