fix for various redundant checks and possibly fix some crashes in rare situations.

This commit is contained in:
Campbell Barton 2012-09-05 01:42:52 +00:00
parent 65b214ed04
commit a4b71f4e01
6 changed files with 20 additions and 25 deletions

@ -9471,9 +9471,9 @@ static void read_libraries(FileData *basefd, ListBase *mainlist)
cleanup_path(G.main->name, mainptr->curlib->filepath);
fd = blo_openblenderfile(mainptr->curlib->filepath, basefd->reports);
fd->mainlist = mainlist;
if (fd) {
fd->mainlist = mainlist;
printf("found: '%s', party on macuno!\n", mainptr->curlib->filepath);
}
}

@ -908,19 +908,19 @@ static void UI_OT_editsource(wmOperatorType *ot)
void edittranslation_find_po_file(const char *root, const char *uilng, char *path, const size_t maxlen)
{
char t[32]; /* Should be more than enough! */
char tstr[32]; /* Should be more than enough! */
/* First, full lang code. */
sprintf(t, "%s.po", uilng);
BLI_snprintf(tstr, sizeof(tstr), "%s.po", uilng);
BLI_join_dirfile(path, maxlen, root, uilng);
BLI_join_dirfile(path, maxlen, path, t);
BLI_join_dirfile(path, maxlen, path, tstr);
if (BLI_is_file(path))
return;
/* Now try without the second iso code part (_ES in es_ES). */
strncpy(t, uilng, 2);
strcpy(t + 2, uilng + 5); /* Because of some codes like sr_SR@latin... */
BLI_join_dirfile(path, maxlen, root, t);
sprintf(t, "%s.po", t);
BLI_join_dirfile(path, maxlen, path, t);
strncpy(tstr, uilng, 2);
BLI_strncpy(tstr + 2, uilng + 5, sizeof(tstr) - 2); /* Because of some codes like sr_SR@latin... */
BLI_join_dirfile(path, maxlen, root, tstr);
strcat(tstr, ".po");
BLI_join_dirfile(path, maxlen, path, tstr);
if (BLI_is_file(path))
return;
path[0] = '\0';

@ -1030,7 +1030,7 @@ void draw_mesh_paint(View3D *v3d, RegionView3D *rv3d,
if (draw_flags & DRAW_FACE_SELECT)
facemask = wpaint__setSolidDrawOptions_facemask;
if (ob && ob->mode & OB_MODE_WEIGHT_PAINT) {
if (ob->mode & OB_MODE_WEIGHT_PAINT) {
if (do_light) {
const float spec[4] = {0.47f, 0.47f, 0.47f, 0.47f};

@ -172,12 +172,13 @@ static int compare_int(const void *av, const void *bv)
static void IMB_moviecache_destructor(void *p)
{
MovieCacheItem *item = (MovieCacheItem *) p;
MovieCache *cache = item->cache_owner;
PRINT("%s: cache '%s' destroy item %p buffer %p\n", __func__, cache->name, item, item->ibuf);
MovieCacheItem *item = (MovieCacheItem *)p;
if (item && item->ibuf) {
MovieCache *cache = item->cache_owner;
PRINT("%s: cache '%s' destroy item %p buffer %p\n", __func__, cache->name, item, item->ibuf);
IMB_freeImBuf(item->ibuf);
item->ibuf = NULL;

@ -606,11 +606,9 @@ static void ntreeCompositExecTreeOld(bNodeTree *ntree, RenderData *rd, int do_pr
bNode *node;
ListBase threads;
ThreadData thdata;
int totnode, curnode, rendering= 1, n;
bNodeTreeExec *exec= ntree->execdata;
if (ntree == NULL) return;
int totnode, curnode, rendering = TRUE, n;
bNodeTreeExec *exec = ntree->execdata;
if (do_preview)
ntreeInitPreview(ntree, 0, 0);

@ -93,13 +93,9 @@ extern struct Render R;
static void init_render_texture(Render *re, Tex *tex)
{
int cfra= re->scene->r.cfra;
if (re) cfra= re->r.cfra;
/* imap test */
if (tex->ima && ELEM(tex->ima->source, IMA_SRC_MOVIE, IMA_SRC_SEQUENCE)) {
BKE_image_user_frame_calc(&tex->iuser, cfra, re?re->flag & R_SEC_FIELD:0);
BKE_image_user_frame_calc(&tex->iuser, re->r.cfra, re?re->flag & R_SEC_FIELD:0);
}
else if (tex->type==TEX_ENVMAP) {