various minor fixes

- collada export would run MEM_freeN on an un-initialized pointer in some cases.
- makesrna was missing a call to close a file.
- text cursor update function was missing a NULL check for st->text.
- possible (unlikely) un-initialized return value for bge python lamp.type, set error instead.
- possible (unlikely) missing NULL terminator with strncpy for ffmpeg.
This commit is contained in:
2010-04-18 09:12:18 +00:00
parent 01e2de7c53
commit 45441c07d4
6 changed files with 19 additions and 16 deletions

View File

@@ -382,7 +382,7 @@ static void set_ffmpeg_property_option(AVCodecContext* c, IDProperty * prop)
fprintf(stderr, "FFMPEG expert option: %s: ", prop->name);
strncpy(name, prop->name, 128);
BLI_strncpy(name, prop->name, sizeof(name));
param = strchr(name, ':');
@@ -1078,7 +1078,7 @@ int ffmpeg_property_add_string(RenderData *rd, const char * type, const char * s
avcodec_get_context_defaults(&c);
strncpy(name_, str, 128);
strncpy(name_, str, sizeof(name_));
name = name_;
while (*name == ' ') name++;

View File

@@ -1318,11 +1318,13 @@ void text_update_cursor_moved(bContext *C)
{
ScrArea *sa= CTX_wm_area(C);
SpaceText *st= CTX_wm_space_text(C);
Text *text= st->text;
Text *text;
ARegion *ar;
int i, x, winx= 0;
if(!st) return;
if(!st || !st->text || st->text->curl) return;
text= st->text;
for(ar=sa->regionbase.first; ar; ar= ar->next)
if(ar->regiontype==RGN_TYPE_WINDOW)
@@ -1330,8 +1332,6 @@ void text_update_cursor_moved(bContext *C)
winx -= TXT_SCROLL_WIDTH;
if(!text || !text->curl) return;
text_update_character_width(st);
i= txt_get_span(text->lines.first, text->sell);

View File

@@ -82,6 +82,7 @@ static int replace_if_different(char *tmpfile)
if(fp_new==NULL) {
/* shouldn't happen, just to be safe */
fprintf(stderr, "%s:%d, open error: \"%s\"\n", __FILE__, __LINE__, tmpfile);
fclose(fp_org);
return -1;
}

View File

@@ -1871,19 +1871,15 @@ static void WM_OT_save_mainfile(wmOperatorType *ot)
#include "../../collada/collada.h"
static int wm_collada_export_invoke(bContext *C, wmOperator *op, wmEvent *event)
{
char *path;
/* RNA_string_set(op->ptr, "path", "/tmp/test.dae"); */
{
if(!RNA_property_is_set(op->ptr, "path")) {
path = BLI_replacestr(G.sce, ".blend", ".dae");
char *path = BLI_replacestr(G.sce, ".blend", ".dae");
RNA_string_set(op->ptr, "path", path);
MEM_freeN(path);
}
WM_event_add_fileselect(C, op);
if (path) MEM_freeN(path);
return OPERATOR_RUNNING_MODAL;
}

View File

@@ -352,6 +352,11 @@ PyObject* KX_LightObject::pyattr_get_typeconst(void *self_v, const KX_PYATTRIBUT
} else if (!strcmp(type, "NORMAL")) {
retvalue = PyLong_FromSsize_t(RAS_LightObject::LIGHT_NORMAL);
}
else {
/* should never happen */
PyErr_SetString(PyExc_TypeError, "light.type: internal error, invalid light type");
retvalue = NULL;
}
return retvalue;
}

View File

@@ -48,7 +48,8 @@ bool KX_WorldIpoController::Update(double currentTime)
for (i = m_interpolators.begin(); !(i == m_interpolators.end()); ++i) {
(*i)->Execute(m_ipotime);//currentTime);
}
/* TODO, this will crash! */
KX_WorldInfo *world = NULL;
if (m_modify_mist_start) {