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:
Diffstat (limited to 'source/blender')
-rw-r--r--source/blender/blenkernel/BKE_fcurve.h1
-rw-r--r--source/blender/blenkernel/intern/collision.c4
-rw-r--r--source/blender/blenkernel/intern/exotic.c45
-rw-r--r--source/blender/blenkernel/intern/node.c2
-rw-r--r--source/blender/blenkernel/intern/softbody.c2
-rw-r--r--source/blender/blenkernel/intern/sound.c4
-rw-r--r--source/blender/blenkernel/intern/texture.c2
-rw-r--r--source/blender/blenkernel/intern/writeffmpeg.c1
-rw-r--r--source/blender/blenlib/intern/BLI_kdopbvh.c8
-rw-r--r--source/blender/blenlib/intern/noise.c10
-rw-r--r--source/blender/blenlib/intern/path_util.c4
-rw-r--r--source/blender/blenlib/intern/storage.c4
-rw-r--r--source/blender/blenloader/intern/readfile.c1
-rw-r--r--source/blender/editors/armature/editarmature.c2
-rw-r--r--source/blender/editors/armature/editarmature_sketch.c2
-rw-r--r--source/blender/editors/interface/interface_icons.c4
-rw-r--r--source/blender/editors/mesh/meshtools.c2
-rw-r--r--source/blender/editors/object/object_transform.c2
-rw-r--r--source/blender/editors/sculpt_paint/paint_image.c2
-rw-r--r--source/blender/editors/sculpt_paint/sculpt.c2
-rw-r--r--source/blender/editors/space_file/filelist.c2
-rw-r--r--source/blender/editors/space_sequencer/sequencer_draw.c6
-rw-r--r--source/blender/editors/space_sequencer/sequencer_edit.c8
-rw-r--r--source/blender/editors/space_view3d/view3d_draw.c4
-rw-r--r--source/blender/editors/uvedit/uvedit_parametrizer.c8
-rw-r--r--source/blender/imbuf/intern/iff.c6
-rw-r--r--source/blender/imbuf/intern/thumbs.c8
-rw-r--r--source/blender/makesrna/intern/makesrna.c6
-rw-r--r--source/blender/makesrna/intern/rna_ID.c35
-rw-r--r--source/blender/makesrna/intern/rna_actuator.c9
-rw-r--r--source/blender/makesrna/intern/rna_color.c1
-rw-r--r--source/blender/nodes/intern/TEX_nodes/TEX_output.c4
-rw-r--r--source/blender/nodes/intern/TEX_util.c41
-rw-r--r--source/blender/python/intern/bpy_interface.c4
-rw-r--r--source/blender/render/intern/raytrace/rayobject.cpp2
-rw-r--r--source/blender/render/intern/source/voxeldata.c50
36 files changed, 128 insertions, 170 deletions
diff --git a/source/blender/blenkernel/BKE_fcurve.h b/source/blender/blenkernel/BKE_fcurve.h
index 9839cde9a22..bdcfec84bdf 100644
--- a/source/blender/blenkernel/BKE_fcurve.h
+++ b/source/blender/blenkernel/BKE_fcurve.h
@@ -34,6 +34,7 @@ struct ChannelDriver;
struct DriverVar;
struct DriverTarget;
+struct bAction;
struct BezTriple;
struct StructRNA;
struct PointerRNA;
diff --git a/source/blender/blenkernel/intern/collision.c b/source/blender/blenkernel/intern/collision.c
index 2ea54ac1f03..3348f7e94c7 100644
--- a/source/blender/blenkernel/intern/collision.c
+++ b/source/blender/blenkernel/intern/collision.c
@@ -313,6 +313,7 @@ gsl_poly_solve_quadratic (double a, double b, double c,
* See Bridson et al. "Robust Treatment of Collision, Contact and Friction for Cloth Animation"
* page 4, left column
*/
+#if 0
static int cloth_get_collision_time ( double a[3], double b[3], double c[3], double d[3], double e[3], double f[3], double solution[3] )
{
int num_sols = 0;
@@ -424,6 +425,7 @@ static int cloth_get_collision_time ( double a[3], double b[3], double c[3], dou
return num_sols;
}
+#endif
// w3 is not perfect
@@ -837,6 +839,7 @@ static int cloth_collision_response_moving( ClothModifierData *clmd, CollisionMo
}
#endif
+#if 0
static float projectPointOntoLine(float *p, float *a, float *b)
{
float ba[3], pa[3];
@@ -1067,7 +1070,6 @@ static float edgedge_distance(float np11[3], float np12[3], float np21[3], float
return 0;
}
-#if 0
static int cloth_collision_moving_edges ( ClothModifierData *clmd, CollisionModifierData *collmd, CollPair *collpair )
{
EdgeCollPair edgecollpair;
diff --git a/source/blender/blenkernel/intern/exotic.c b/source/blender/blenkernel/intern/exotic.c
index 2a0759e6c36..050bf7c211f 100644
--- a/source/blender/blenkernel/intern/exotic.c
+++ b/source/blender/blenkernel/intern/exotic.c
@@ -37,6 +37,7 @@
#include <stdlib.h>
#include <fcntl.h>
#include <string.h>
+#include <errno.h>
#ifndef _WIN32
#include <unistd.h>
@@ -76,8 +77,8 @@
#include "BKE_object.h"
#include "BKE_material.h"
#include "BKE_exotic.h"
+#include "BKE_report.h"
-/* #include "BKE_error.h" */
#include "BKE_screen.h"
#include "BKE_displist.h"
#include "BKE_DerivedMesh.h"
@@ -205,18 +206,31 @@ static void read_stl_mesh_binary(Scene *scene, char *str)
unsigned int numfacets = 0, i, j, vertnum;
unsigned int maxmeshsize, nummesh, lastmeshsize;
unsigned int totvert, totface;
+ ReportList *reports= NULL; /* XXX */
fpSTL= fopen(str, "rb");
if(fpSTL==NULL) {
- //XXX error("Can't read file");
+ BKE_reportf(reports, RPT_ERROR, "Can't read file: %s.", strerror(errno));
return;
}
- fseek(fpSTL, 80, SEEK_SET);
- fread(&numfacets, 4*sizeof(char), 1, fpSTL);
+ if(fseek(fpSTL, 80, SEEK_SET) != 0) {
+ BKE_reportf(reports, RPT_ERROR, "Failed reading file: %s.", strerror(errno));
+ fclose(fpSTL);
+ return;
+ }
+
+ if(fread(&numfacets, 4*sizeof(char), 1, fpSTL) != 1) {
+ if(feof(fpSTL))
+ BKE_reportf(reports, RPT_ERROR, "Failed reading file: premature end of file.");
+ else
+ BKE_reportf(reports, RPT_ERROR, "Failed reading file: %s.", strerror(errno));
+ fclose(fpSTL);
+ return;
+ }
if (ENDIAN_ORDER==B_ENDIAN) {
- SWITCH_INT(numfacets);
- }
+ SWITCH_INT(numfacets);
+ }
maxmeshsize = MESH_MAX_VERTS/3;
@@ -318,13 +332,14 @@ static void read_stl_mesh_ascii(Scene *scene, char *str)
unsigned int numtenthousand, linenum;
unsigned int i, vertnum;
unsigned int totvert, totface;
+ ReportList *reports= NULL; /* XXX */
/* ASCII stl sucks ... we don't really know how many faces there
are until the file is done, so lets allocate faces 10000 at a time */
fpSTL= fopen(str, "r");
if(fpSTL==NULL) {
- //XXX error("Can't read file");
+ BKE_reportf(reports, RPT_ERROR, "Can't read file: %s.", strerror(errno));
return;
}
@@ -634,6 +649,7 @@ static void read_inventor(Scene *scene, char *str, struct ListBase *listb)
int file, filelen, count, lll, face, nr = 0;
int skipdata, ok, a, b, tot, first, colnr, coordtype, polytype, *idata;
struct DispList *dl;
+ ReportList *reports= NULL; /* XXX */
ivbase.first= ivbase.last= 0;
iv_curcol= 0;
@@ -641,7 +657,7 @@ static void read_inventor(Scene *scene, char *str, struct ListBase *listb)
file= open(str, O_BINARY|O_RDONLY);
if(file== -1) {
- //XXX error("Can't read file\n");
+ BKE_reportf(reports, RPT_ERROR, "Can't read file: %s.", strerror(errno));
return;
}
@@ -652,7 +668,11 @@ static void read_inventor(Scene *scene, char *str, struct ListBase *listb)
}
maindata= MEM_mallocN(filelen, "leesInventor");
- read(file, maindata, filelen);
+ if(read(file, maindata, filelen) < filelen) {
+ BKE_reportf(reports, RPT_ERROR, "Failed reading file: premature end of file.");
+ close(file);
+ return;
+ }
close(file);
iv_data_stack= MEM_mallocN(sizeof(float)*IV_MAXSTACK, "ivstack");
@@ -1895,6 +1915,7 @@ void write_stl(Scene *scene, char *str)
Base *base;
FILE *fpSTL;
int numfacets = 0;
+ ReportList *reports= NULL; /* XXX */
if(BLI_testextensie(str,".blend")) str[ strlen(str)-6]= 0;
if(BLI_testextensie(str,".ble")) str[ strlen(str)-4]= 0;
@@ -1908,7 +1929,7 @@ void write_stl(Scene *scene, char *str)
fpSTL= fopen(str, "wb");
if(fpSTL==NULL) {
- //XXX error("Can't write file");
+ BKE_reportf(reports, RPT_ERROR, "Can't open file: %s.", strerror(errno));
return;
}
strcpy(temp_dir, str);
@@ -3388,7 +3409,7 @@ static void dxf_read_polyline(Scene *scene, int noob) {
/* Blender vars */
Object *ob;
Mesh *me;
- float vert[3];
+ float vert[3] = {0};
MVert *mvert, *vtmp;
MFace *mface, *ftmp;
@@ -3613,7 +3634,7 @@ static void dxf_read_lwpolyline(Scene *scene, int noob) {
/* Blender vars */
Object *ob;
Mesh *me;
- float vert[3];
+ float vert[3] = {0};
MVert *mvert;
MFace *mface;
diff --git a/source/blender/blenkernel/intern/node.c b/source/blender/blenkernel/intern/node.c
index ec3cf453c4b..285dc101497 100644
--- a/source/blender/blenkernel/intern/node.c
+++ b/source/blender/blenkernel/intern/node.c
@@ -2872,7 +2872,7 @@ void ntreeCompositTagRender(Scene *curscene)
static int node_animation_properties(bNodeTree *ntree, bNode *node)
{
bNodeSocket *sock;
- ListBase *lb;
+ const ListBase *lb;
Link *link;
PointerRNA ptr;
PropertyRNA *prop;
diff --git a/source/blender/blenkernel/intern/softbody.c b/source/blender/blenkernel/intern/softbody.c
index a1e3dd6f963..abf76d0e998 100644
--- a/source/blender/blenkernel/intern/softbody.c
+++ b/source/blender/blenkernel/intern/softbody.c
@@ -2864,7 +2864,7 @@ static void softbody_apply_forces(Object *ob, float forcetime, int mode, float *
/* or heun ~ 2nd order runge-kutta steps, mode 1,2 */
SoftBody *sb= ob->soft; /* is supposed to be there */
BodyPoint *bp;
- float dx[3],dv[3],aabbmin[3],aabbmax[3],cm[3]={0.0f,0.0f,0.0f};
+ float dx[3]={0},dv[3],aabbmin[3],aabbmax[3],cm[3]={0.0f,0.0f,0.0f};
float timeovermass/*,freezeloc=0.00001f,freezeforce=0.00000000001f*/;
float maxerrpos= 0.0f,maxerrvel = 0.0f;
int a,fuzzy=0;
diff --git a/source/blender/blenkernel/intern/sound.c b/source/blender/blenkernel/intern/sound.c
index 7b451bd5a98..03fe1b8df7b 100644
--- a/source/blender/blenkernel/intern/sound.c
+++ b/source/blender/blenkernel/intern/sound.c
@@ -282,7 +282,7 @@ void sound_free(struct bSound* sound)
static float sound_get_volume(Scene* scene, Sequence* sequence, float time)
{
- struct FCurve* fcu = id_data_find_fcurve(scene, sequence, &RNA_Sequence, "volume", 0);
+ struct FCurve* fcu = id_data_find_fcurve(&scene->id, sequence, &RNA_Sequence, "volume", 0);
if(fcu)
return evaluate_fcurve(fcu, time * FPS);
else
@@ -386,5 +386,5 @@ void sound_seek_scene(struct bContext *C)
int sound_read_sound_buffer(bSound* sound, float* buffer, int length)
{
- AUD_readSound(sound->cache, buffer, length);
+ return AUD_readSound(sound->cache, buffer, length);
}
diff --git a/source/blender/blenkernel/intern/texture.c b/source/blender/blenkernel/intern/texture.c
index 634d9e6ce0d..fce9ed75e93 100644
--- a/source/blender/blenkernel/intern/texture.c
+++ b/source/blender/blenkernel/intern/texture.c
@@ -860,8 +860,6 @@ void set_current_lamp_texture(Lamp *la, Tex *newtex)
bNode *give_current_material_texture_node(Material *ma)
{
- bNode *node;
-
if(ma && ma->use_nodes && ma->nodetree)
return nodeGetActiveID(ma->nodetree, ID_TE);
diff --git a/source/blender/blenkernel/intern/writeffmpeg.c b/source/blender/blenkernel/intern/writeffmpeg.c
index 3aca9ffb4e7..d71836ab181 100644
--- a/source/blender/blenkernel/intern/writeffmpeg.c
+++ b/source/blender/blenkernel/intern/writeffmpeg.c
@@ -129,7 +129,6 @@ static int write_audio_frame(void)
{
AVCodecContext* c = NULL;
AVPacket pkt;
- AVStream* str = audio_stream;
c = get_codec_from_stream(audio_stream);
diff --git a/source/blender/blenlib/intern/BLI_kdopbvh.c b/source/blender/blenlib/intern/BLI_kdopbvh.c
index a91c24471bb..39f6e7a8aba 100644
--- a/source/blender/blenlib/intern/BLI_kdopbvh.c
+++ b/source/blender/blenlib/intern/BLI_kdopbvh.c
@@ -196,14 +196,14 @@ int ADJUST_MEMORY(void *local_memblock, void **memblock, int new_size, int *max_
// http://ralphunden.net/content/tutorials/a-guide-to-introsort/
// and he derived it from the SUN STL
//////////////////////////////////////////////////////////////////////////////////////////////////////
-static int size_threshold = 16;
+//static int size_threshold = 16;
/*
* Common methods for all algorithms
*/
-static int floor_lg(int a)
+/*static int floor_lg(int a)
{
return (int)(floor(log(a)/log(2)));
-}
+}*/
/*
* Insertion sort algorithm
@@ -243,6 +243,7 @@ static int bvh_partition(BVHNode **a, int lo, int hi, BVHNode * x, int axis)
/*
* Heapsort algorithm
*/
+#if 0
static void bvh_downheap(BVHNode **a, int i, int n, int lo, int axis)
{
BVHNode * d = a[lo+i-1];
@@ -274,6 +275,7 @@ static void bvh_heapsort(BVHNode **a, int lo, int hi, int axis)
bvh_downheap(a, 1,i-1,lo, axis);
}
}
+#endif
static BVHNode *bvh_medianof3(BVHNode **a, int lo, int mid, int hi, int axis) // returns Sortable
{
diff --git a/source/blender/blenlib/intern/noise.c b/source/blender/blenlib/intern/noise.c
index 66e9a65dba5..53389950734 100644
--- a/source/blender/blenlib/intern/noise.c
+++ b/source/blender/blenlib/intern/noise.c
@@ -43,8 +43,8 @@
/* local */
static float noise3_perlin(float vec[3]);
-static float turbulence_perlin(float *point, float lofreq, float hifreq);
-static float turbulencep(float noisesize, float x, float y, float z, int nr);
+//static float turbulence_perlin(float *point, float lofreq, float hifreq);
+//static float turbulencep(float noisesize, float x, float y, float z, int nr);
#define HASHVEC(x,y,z) hashvectf+3*hash[ (hash[ (hash[(z) & 255]+(y)) & 255]+(x)) & 255]
@@ -976,6 +976,7 @@ static float noise3_perlin(float vec[3])
return 1.5 * lerp(sz, c, d); /* interpolate in z */
}
+#if 0
static float turbulence_perlin(float *point, float lofreq, float hifreq)
{
float freq, t, p[3];
@@ -993,6 +994,7 @@ static float turbulence_perlin(float *point, float lofreq, float hifreq)
}
return t - 0.3; /* readjust to make mean value = 0.0 */
}
+#endif
/* for use with BLI_gNoise/gTurbulence, returns signed noise */
static float orgPerlinNoise(float x, float y, float z)
@@ -1029,7 +1031,7 @@ float BLI_hnoisep(float noisesize, float x, float y, float z)
return noise3_perlin(vec);
}
-static float turbulencep(float noisesize, float x, float y, float z, int nr)
+/*static float turbulencep(float noisesize, float x, float y, float z, int nr)
{
float vec[3];
@@ -1038,7 +1040,7 @@ static float turbulencep(float noisesize, float x, float y, float z, int nr)
vec[2]= z/noisesize;
nr++;
return turbulence_perlin(vec, 1.0, (float)(1<<nr));
-}
+}*/
/******************/
/* VORONOI/WORLEY */
diff --git a/source/blender/blenlib/intern/path_util.c b/source/blender/blenlib/intern/path_util.c
index c3ce73df6c6..6baa7084b47 100644
--- a/source/blender/blenlib/intern/path_util.c
+++ b/source/blender/blenlib/intern/path_util.c
@@ -990,11 +990,11 @@ void BLI_setenv(const char *env, const char*val)
{
/* SGI or free windows */
#if (defined(__sgi) || ((defined(WIN32) || defined(WIN64)) && defined(FREE_WINDOWS)))
- char *envstr= malloc(sizeof(char) * (strlen(env) + strlen(val) + 2)); /* one for = another for \0 */
+ char *envstr= MEM_mallocN(sizeof(char) * (strlen(env) + strlen(val) + 2), "envstr"); /* one for = another for \0 */
sprintf(envstr, "%s=%s", env, val);
putenv(envstr);
- free(envstr);
+ MEM_freeN(envstr);
/* non-free windows */
#elif (defined(WIN32) || defined(WIN64)) /* not free windows */
diff --git a/source/blender/blenlib/intern/storage.c b/source/blender/blenlib/intern/storage.c
index ee7734fb14b..f7f032a72bb 100644
--- a/source/blender/blenlib/intern/storage.c
+++ b/source/blender/blenlib/intern/storage.c
@@ -487,7 +487,7 @@ LinkNode *BLI_read_file_as_lines(char *name)
size= ftell(fp);
fseek(fp, 0, SEEK_SET);
- buf= malloc(size);
+ buf= MEM_mallocN(size, "file_as_lines");
if (buf) {
int i, last= 0;
@@ -506,7 +506,7 @@ LinkNode *BLI_read_file_as_lines(char *name)
}
}
- free(buf);
+ MEM_freeN(buf);
}
fclose(fp);
diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c
index 5938f9e6e2a..872778a4bfe 100644
--- a/source/blender/blenloader/intern/readfile.c
+++ b/source/blender/blenloader/intern/readfile.c
@@ -10599,7 +10599,6 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
if(sl->spacetype==SPACE_SEQ) {
ARegion *ar_preview;
ListBase *regionbase;
- SpaceSeq *sseq = (SpaceSeq *)sl;
if (sl == sa->spacedata.first) {
regionbase = &sa->regionbase;
diff --git a/source/blender/editors/armature/editarmature.c b/source/blender/editors/armature/editarmature.c
index b8760a85108..9f82275390b 100644
--- a/source/blender/editors/armature/editarmature.c
+++ b/source/blender/editors/armature/editarmature.c
@@ -4982,7 +4982,7 @@ static int pose_clear_rot_exec(bContext *C, wmOperator *op)
}
else {
/* perform clamping using euler form (3-components) */
- float eul[3], oldeul[3], quat1[4];
+ float eul[3], oldeul[3], quat1[4] = {0};
if (pchan->rotmode == ROT_MODE_QUAT) {
QUATCOPY(quat1, pchan->quat);
diff --git a/source/blender/editors/armature/editarmature_sketch.c b/source/blender/editors/armature/editarmature_sketch.c
index eee56070e91..75e7e9a3db8 100644
--- a/source/blender/editors/armature/editarmature_sketch.c
+++ b/source/blender/editors/armature/editarmature_sketch.c
@@ -1074,7 +1074,7 @@ int sk_getStrokeSnapPoint(bContext *C, SK_Point *pt, SK_Sketch *sketch, SK_Strok
DepthPeel *p1, *p2;
float *last_p = NULL;
float dist = FLT_MAX;
- float p[3];
+ float p[3] = {0};
float size = 0;
float mvalf[2];
diff --git a/source/blender/editors/interface/interface_icons.c b/source/blender/editors/interface/interface_icons.c
index 6c4f5564fd7..7608014b150 100644
--- a/source/blender/editors/interface/interface_icons.c
+++ b/source/blender/editors/interface/interface_icons.c
@@ -573,8 +573,8 @@ static void init_iconfile_list(struct ListBase *list)
if(!BLI_getwdN(olddir))
restoredir = 0;
totfile = BLI_getdir(icondirstr, &dir);
- if (restoredir)
- chdir(olddir);
+ if (restoredir && !chdir(olddir))
+ ; /* fix warning about checking return value */
for(i=0; i<totfile; i++) {
if( (dir[i].type & S_IFREG) ) {
diff --git a/source/blender/editors/mesh/meshtools.c b/source/blender/editors/mesh/meshtools.c
index 269fc278581..62af987c966 100644
--- a/source/blender/editors/mesh/meshtools.c
+++ b/source/blender/editors/mesh/meshtools.c
@@ -732,7 +732,7 @@ void sort_faces(Scene *scene, View3D *v3d)
if (event == 1) { /* sort on view axis */
mul_m4_v3(mat, vec);
face_sort_floats[i] = vec[2] * reverse;
- } else { /* distance from cursor*/
+ } else if(event == 2) { /* distance from cursor*/
face_sort_floats[i] = len_v3v3(cur, vec) * reverse; /* back to front */
}
}
diff --git a/source/blender/editors/object/object_transform.c b/source/blender/editors/object/object_transform.c
index 15ed20c783e..82e72136daf 100644
--- a/source/blender/editors/object/object_transform.c
+++ b/source/blender/editors/object/object_transform.c
@@ -181,7 +181,7 @@ static int object_rotation_clear_exec(bContext *C, wmOperator *op)
}
else {
/* perform clamping using euler form (3-components) */
- float eul[3], oldeul[3], quat1[4];
+ float eul[3], oldeul[3], quat1[4] = {0};
if (ob->rotmode == ROT_MODE_QUAT) {
QUATCOPY(quat1, ob->quat);
diff --git a/source/blender/editors/sculpt_paint/paint_image.c b/source/blender/editors/sculpt_paint/paint_image.c
index c5dc6f74f58..81e2b1caea2 100644
--- a/source/blender/editors/sculpt_paint/paint_image.c
+++ b/source/blender/editors/sculpt_paint/paint_image.c
@@ -3578,7 +3578,7 @@ static void *do_projectpaint_thread(void *ph_v)
rctf bucket_bounds;
/* for smear only */
- float pos_ofs[2];
+ float pos_ofs[2] = {0};
float co[2];
float mask = 1.0f; /* airbrush wont use mask */
unsigned short mask_short;
diff --git a/source/blender/editors/sculpt_paint/sculpt.c b/source/blender/editors/sculpt_paint/sculpt.c
index 1914c40f817..129d10050a5 100644
--- a/source/blender/editors/sculpt_paint/sculpt.c
+++ b/source/blender/editors/sculpt_paint/sculpt.c
@@ -1276,7 +1276,7 @@ static void do_flatten_clay_brush(Sculpt *sd, SculptSession *ss, PBVHNode **node
Brush *brush = paint_brush(&sd->paint);
float bstrength= ss->cache->bstrength;
float area_normal[3];
- float cntr[3], cntr2[3], bstr = 0;
+ float cntr[3], cntr2[3] = {0}, bstr = 0;
int n, flip = 0;
calc_area_normal(sd, ss, area_normal, nodes, totnode);
diff --git a/source/blender/editors/space_file/filelist.c b/source/blender/editors/space_file/filelist.c
index dbe9417fd2a..556ab13654b 100644
--- a/source/blender/editors/space_file/filelist.c
+++ b/source/blender/editors/space_file/filelist.c
@@ -801,7 +801,7 @@ static void filelist_read_dir(struct FileList* filelist)
BLI_hide_dot_files(filelist->hide_dot);
filelist->numfiles = BLI_getdir(filelist->dir, &(filelist->filelist));
- chdir(wdir);
+ if(!chdir(wdir)) /* fix warning about not checking return value */;
filelist_setfiletypes(filelist, G.have_quicktime);
filelist_filter(filelist);
diff --git a/source/blender/editors/space_sequencer/sequencer_draw.c b/source/blender/editors/space_sequencer/sequencer_draw.c
index 5339acf74d9..0955652c30f 100644
--- a/source/blender/editors/space_sequencer/sequencer_draw.c
+++ b/source/blender/editors/space_sequencer/sequencer_draw.c
@@ -186,12 +186,12 @@ static void drawseqwave(Sequence *seq, float x1, float y1, float x2, float y2, f
int length = floor((x2-x1)/stepsize)+1;
float ymid = (y1+y2)/2;
float yscale = (y2-y1)/2;
- float* samples = malloc(length * sizeof(float) * 2);
+ float* samples = MEM_mallocN(length * sizeof(float) * 2, "seqwave_samples");
if(!samples)
return;
if(sound_read_sound_buffer(seq->sound, samples, length) != length)
{
- free(samples);
+ MEM_freeN(samples);
return;
}
glBegin(GL_LINES);
@@ -201,7 +201,7 @@ static void drawseqwave(Sequence *seq, float x1, float y1, float x2, float y2, f
glVertex2f(x1+i*stepsize, ymid + samples[i * 2 + 1] * yscale);
}
glEnd();
- free(samples);
+ MEM_freeN(samples);
}
}
diff --git a/source/blender/editors/space_sequencer/sequencer_edit.c b/source/blender/editors/space_sequencer/sequencer_edit.c
index 4f19cfa86af..11bdbcb5314 100644
--- a/source/blender/editors/space_sequencer/sequencer_edit.c
+++ b/source/blender/editors/space_sequencer/sequencer_edit.c
@@ -2223,11 +2223,13 @@ void SEQUENCER_OT_view_all(wmOperatorType *ot)
/* view_all operator */
static int sequencer_view_all_preview_exec(bContext *C, wmOperator *op)
{
- Scene *scene= CTX_data_scene(C);
bScreen *sc= CTX_wm_screen(C);
ScrArea *area= CTX_wm_area(C);
+#if 0
ARegion *ar= CTX_wm_region(C);
SpaceSeq *sseq= area->spacedata.first;
+ Scene *scene= CTX_data_scene(C);
+#endif
View2D *v2d= UI_view2d_fromcontext(C);
v2d->cur= v2d->tot;
@@ -2528,6 +2530,7 @@ static void swap_sequence(Scene* scene, Sequence* seqa, Sequence* seqb)
calc_sequence(scene, seqa);
}
+#if 0
static Sequence* sequence_find_parent(Scene* scene, Sequence* child)
{
Editing *ed= seq_give_editing(scene, FALSE);
@@ -2542,9 +2545,10 @@ static Sequence* sequence_find_parent(Scene* scene, Sequence* child)
break;
}
}
- return parent;
+ return parent;
}
+#endif
static int sequencer_swap_exec(bContext *C, wmOperator *op)
{
diff --git a/source/blender/editors/space_view3d/view3d_draw.c b/source/blender/editors/space_view3d/view3d_draw.c
index c33f8723231..e744252889a 100644
--- a/source/blender/editors/space_view3d/view3d_draw.c
+++ b/source/blender/editors/space_view3d/view3d_draw.c
@@ -738,7 +738,7 @@ static void draw_viewport_name(ARegion *ar, View3D *v3d)
char *printable = NULL;
if (v3d->localvd) {
- printable = malloc(strlen(name) + strlen(" (Local)_")); /* '_' gives space for '\0' */
+ printable = MEM_mallocN(strlen(name) + strlen(" (Local)_"), "viewport_name"); /* '_' gives space for '\0' */
strcpy(printable, name);
strcat(printable, " (Local)");
} else {
@@ -751,7 +751,7 @@ static void draw_viewport_name(ARegion *ar, View3D *v3d)
}
if (v3d->localvd) {
- free(printable);
+ MEM_freeN(printable);
}
}
diff --git a/source/blender/editors/uvedit/uvedit_parametrizer.c b/source/blender/editors/uvedit/uvedit_parametrizer.c
index 85ccef5cd7d..2de3c60f54c 100644
--- a/source/blender/editors/uvedit/uvedit_parametrizer.c
+++ b/source/blender/editors/uvedit/uvedit_parametrizer.c
@@ -1376,11 +1376,11 @@ static void p_polygon_kernel_center(float (*points)[2], int npoints, float *cent
if (nnewpoints*2 > size) {
size *= 2;
- free(oldpoints);
- oldpoints = malloc(sizeof(float)*2*size);
+ MEM_freeN(oldpoints);
+ oldpoints = MEM_mallocN(sizeof(float)*2*size, "oldpoints");
memcpy(oldpoints, newpoints, sizeof(float)*2*nnewpoints);
- free(newpoints);
- newpoints = malloc(sizeof(float)*2*size);
+ MEM_freeN(newpoints);
+ newpoints = MEM_mallocN(sizeof(float)*2*size, "newpoints");
}
else {
float (*sw_points)[2] = oldpoints;
diff --git a/source/blender/imbuf/intern/iff.c b/source/blender/imbuf/intern/iff.c
index 5fd823e78c1..db2e54a31b6 100644
--- a/source/blender/imbuf/intern/iff.c
+++ b/source/blender/imbuf/intern/iff.c
@@ -198,16 +198,16 @@ unsigned short imb_update_iff(int file, int code)
if (code == 0) return (TRUE);
filelen-=4;
- lseek(file,4L,1);
+ if(lseek(file,4L,1) == -1) return (FALSE);
while (filelen>0){ /* seek BODY */
- read(file, buf, 8);
+ if(read(file, buf, 8) != 8) return (FALSE);
filelen -= 8;
if (buf[0] == code) break;
skip = (BIG_LONG(buf[1]) + 1) & ~1;
filelen -= skip;
- lseek(file, skip, 1);
+ if(lseek(file, skip, 1) == -1) return (FALSE);
}
if (filelen <= 0) {
printf("update_iff: couldn't find chunk\n");
diff --git a/source/blender/imbuf/intern/thumbs.c b/source/blender/imbuf/intern/thumbs.c
index 6053c5556f1..4e6230a0109 100644
--- a/source/blender/imbuf/intern/thumbs.c
+++ b/source/blender/imbuf/intern/thumbs.c
@@ -289,19 +289,19 @@ ImBuf* IMB_thumb_create(const char* dir, const char* file, ThumbSize size, Thumb
} else {
if (THB_SOURCE_IMAGE == source) {
BLI_getwdN(wdir);
- chdir(dir);
+ if(chdir(dir) != 0) return 0;
img = IMB_loadiffname(file, IB_rect | IB_imginfo);
if (img != NULL) {
stat(file, &info);
sprintf(mtime, "%ld", info.st_mtime);
sprintf(cwidth, "%d", img->x);
sprintf(cheight, "%d", img->y);
- chdir(wdir);
}
+ if(chdir(wdir) != 0) /* unlikely to happen, just silence warning */;
} else if (THB_SOURCE_MOVIE == source) {
struct anim * anim = NULL;
BLI_getwdN(wdir);
- chdir(dir);
+ if(chdir(dir) != 0) return 0;
anim = IMB_open_anim(file, IB_rect | IB_imginfo);
if (anim != NULL) {
img = IMB_anim_absolute(anim, 0);
@@ -315,7 +315,7 @@ ImBuf* IMB_thumb_create(const char* dir, const char* file, ThumbSize size, Thumb
}
stat(file, &info);
sprintf(mtime, "%ld", info.st_mtime);
- chdir(wdir);
+ if(chdir(wdir) != 0) /* unlikely to happen, just silence warning */;
}
if (!img) return 0;
diff --git a/source/blender/makesrna/intern/makesrna.c b/source/blender/makesrna/intern/makesrna.c
index 978ca0ba188..41be686048d 100644
--- a/source/blender/makesrna/intern/makesrna.c
+++ b/source/blender/makesrna/intern/makesrna.c
@@ -99,8 +99,10 @@ static int replace_if_different(char *tmpfile)
arr_new= MEM_mallocN(sizeof(char)*len_new, "rna_cmp_file_new");
arr_org= MEM_mallocN(sizeof(char)*len_org, "rna_cmp_file_org");
- fread(arr_new, sizeof(char), len_new, fp_new);
- fread(arr_org, sizeof(char), len_org, fp_org);
+ if(fread(arr_new, sizeof(char), len_new, fp_new) != len_new)
+ fprintf(stderr, "%s:%d, error reading file %s for comparison.\n", __FILE__, __LINE__, tmpfile);
+ if(fread(arr_org, sizeof(char), len_org, fp_org) != len_org)
+ fprintf(stderr, "%s:%d, error reading file %s for comparison.\n", __FILE__, __LINE__, orgfile);
fclose(fp_new);
fclose(fp_org);
diff --git a/source/blender/makesrna/intern/rna_ID.c b/source/blender/makesrna/intern/rna_ID.c
index ac354366c25..a32e12da2f6 100644
--- a/source/blender/makesrna/intern/rna_ID.c
+++ b/source/blender/makesrna/intern/rna_ID.c
@@ -246,40 +246,6 @@ ID *rna_ID_copy(ID *id)
return NULL;
}
-static int rna_IDPropertyGroup_name_length(PointerRNA *ptr)
-{
- IDProperty *group=(IDProperty*)ptr->id.data;
- IDProperty *idprop;
- idprop= IDP_GetPropertyFromGroup(group, "name");
-
- if(idprop && idprop->type == IDP_STRING)
- return strlen(idprop->data.pointer);
- else
- return 0;
-}
-
-static void rna_IDPropertyGroup_name_get(PointerRNA *ptr, char *str)
-{
- IDProperty *group=(IDProperty*)ptr->id.data;
- IDProperty *idprop;
- idprop= IDP_GetPropertyFromGroup(group, "name");
-
- if(idprop && idprop->type == IDP_STRING)
- strcpy(str, idprop->data.pointer);
- else
- str[0]= '\0';
-}
-
-void rna_IDPropertyGroup_name_set(PointerRNA *ptr, const char *value)
-{
- IDProperty *group=(IDProperty*)ptr->id.data;
- IDProperty *idprop;
- IDPropertyTemplate val = {0};
- val.str= (char *)value;
- idprop = IDP_New(IDP_STRING, val, "name");
- IDP_ReplaceInGroup(group, idprop);
-}
-
#else
static void rna_def_ID_properties(BlenderRNA *brna)
@@ -357,7 +323,6 @@ static void rna_def_ID_properties(BlenderRNA *brna)
RNA_def_property_flag(prop, PROP_EXPORT|PROP_IDPROPERTY);
//RNA_def_property_clear_flag(prop, PROP_EDITABLE);
RNA_def_property_ui_text(prop, "Name", "Unique name used in the code and scripting.");
- RNA_def_property_string_funcs(prop, "rna_IDPropertyGroup_name_get", "rna_IDPropertyGroup_name_length", "rna_IDPropertyGroup_name_set");
RNA_def_struct_name_property(srna, prop);
}
diff --git a/source/blender/makesrna/intern/rna_actuator.c b/source/blender/makesrna/intern/rna_actuator.c
index dd67f5604c0..346ecb1efa9 100644
--- a/source/blender/makesrna/intern/rna_actuator.c
+++ b/source/blender/makesrna/intern/rna_actuator.c
@@ -129,7 +129,6 @@ void rna_def_actuator(BlenderRNA *brna)
static void rna_def_object_actuator(BlenderRNA *brna)
{
StructRNA *srna;
- PropertyRNA *prop;
srna= RNA_def_struct(brna, "ObjectActuator", "Actuator");
RNA_def_struct_ui_text(srna, "Object Actuator", "Actuator to control the object movement.");
@@ -259,7 +258,6 @@ static void rna_def_camera_actuator(BlenderRNA *brna)
static void rna_def_sound_actuator(BlenderRNA *brna)
{
StructRNA *srna;
- PropertyRNA *prop;
srna= RNA_def_struct(brna, "SoundActuator", "Actuator");
RNA_def_struct_ui_text(srna, "Sound Actuator", "Actuator to ...");
@@ -271,7 +269,6 @@ static void rna_def_sound_actuator(BlenderRNA *brna)
static void rna_def_property_actuator(BlenderRNA *brna)
{
StructRNA *srna;
- PropertyRNA *prop;
srna= RNA_def_struct(brna, "PropertyActuator", "Actuator");
RNA_def_struct_ui_text(srna, "Property Actuator", "Actuator to ...");
@@ -283,7 +280,6 @@ static void rna_def_property_actuator(BlenderRNA *brna)
static void rna_def_constraint_actuator(BlenderRNA *brna)
{
StructRNA *srna;
- PropertyRNA *prop;
srna= RNA_def_struct(brna, "ConstraintActuator", "Actuator");
RNA_def_struct_ui_text(srna, "Constraint Actuator", "Actuator to ...");
@@ -295,7 +291,6 @@ static void rna_def_constraint_actuator(BlenderRNA *brna)
static void rna_def_edit_object_actuator(BlenderRNA *brna)
{
StructRNA *srna;
- PropertyRNA *prop;
srna= RNA_def_struct(brna, "EditObjectActuator", "Actuator");
RNA_def_struct_ui_text(srna, "Edit Object Actuator", "Actuator to ...");
@@ -527,7 +522,6 @@ static void rna_def_message_actuator(BlenderRNA *brna)
static void rna_def_action_actuator(BlenderRNA *brna)
{
StructRNA *srna;
- PropertyRNA *prop;
srna= RNA_def_struct(brna, "ActionActuator", "Actuator");
RNA_def_struct_ui_text(srna, "Action Actuator", "Actuator to ...");
@@ -696,7 +690,6 @@ static void rna_def_parent_actuator(BlenderRNA *brna)
static void rna_def_shape_action_actuator(BlenderRNA *brna)
{
StructRNA *srna;
- PropertyRNA *prop;
srna= RNA_def_struct(brna, "ShapeActionActuator", "Actuator");
RNA_def_struct_ui_text(srna, "Shape Action Actuator", "Actuator to ...");
@@ -708,7 +701,6 @@ static void rna_def_shape_action_actuator(BlenderRNA *brna)
static void rna_def_state_actuator(BlenderRNA *brna)
{
StructRNA *srna;
- PropertyRNA *prop;
srna= RNA_def_struct(brna, "StateActuator", "Actuator");
RNA_def_struct_ui_text(srna, "State Actuator", "Actuator to ...");
@@ -720,7 +712,6 @@ static void rna_def_state_actuator(BlenderRNA *brna)
static void rna_def_armature_actuator(BlenderRNA *brna)
{
StructRNA *srna;
- PropertyRNA *prop;
srna= RNA_def_struct(brna, "ArmatureActuator", "Actuator");
RNA_def_struct_ui_text(srna, "Armature Actuator", "Actuator to ...");
diff --git a/source/blender/makesrna/intern/rna_color.c b/source/blender/makesrna/intern/rna_color.c
index a9ef608cd6c..3ada3689d6c 100644
--- a/source/blender/makesrna/intern/rna_color.c
+++ b/source/blender/makesrna/intern/rna_color.c
@@ -232,7 +232,6 @@ static void rna_def_curvemapping(BlenderRNA *brna)
static void rna_def_histogram(BlenderRNA *brna)
{
StructRNA *srna;
- PropertyRNA *prop;
srna= RNA_def_struct(brna, "Histogram", NULL);
RNA_def_struct_ui_text(srna, "Histogram", "Statistical view of the levels of color in an image");
diff --git a/source/blender/nodes/intern/TEX_nodes/TEX_output.c b/source/blender/nodes/intern/TEX_nodes/TEX_output.c
index ab8920e67ad..62b2c3ed757 100644
--- a/source/blender/nodes/intern/TEX_nodes/TEX_output.c
+++ b/source/blender/nodes/intern/TEX_nodes/TEX_output.c
@@ -144,7 +144,7 @@ static void unique_name(bNode *node)
new_len = 31;
}
- new_name = malloc(new_len + 1);
+ new_name = MEM_mallocN(new_len + 1, "new_name");
strcpy(new_name, name);
name = new_name;
}
@@ -153,7 +153,7 @@ static void unique_name(bNode *node)
if(new_name) {
strcpy(tno->name, new_name);
- free(new_name);
+ MEM_freeN(new_name);
}
}
diff --git a/source/blender/nodes/intern/TEX_util.c b/source/blender/nodes/intern/TEX_util.c
index 8b247688e8c..97426b7d782 100644
--- a/source/blender/nodes/intern/TEX_util.c
+++ b/source/blender/nodes/intern/TEX_util.c
@@ -189,44 +189,3 @@ void ntreeTexExecTree(
ntreeExecTree(nodes, &data, thread);
}
-char* ntreeTexOutputMenu(bNodeTree *ntree)
-{
- bNode *node;
- int len = 1;
- char *str;
- char ctrl[4];
- int index = 0;
-
- for(node= ntree->nodes.first; node; node= node->next)
- if(node->type == TEX_NODE_OUTPUT) {
- len += strlen(
- ((TexNodeOutput*)node->storage)->name
- ) + strlen(" %xNNN|");
- index ++;
-
- if(node->custom1 > 999) {
- printf("Error: too many outputs");
- break;
- }
- }
-
- str = malloc(len * sizeof(char));
- *str = 0;
-
- for(node= ntree->nodes.first; node; node= node->next)
- if(node->type == TEX_NODE_OUTPUT) {
- strcat(str, ((TexNodeOutput*)node->storage)->name);
- strcat(str, " %x");
-
- sprintf(ctrl, "%d", node->custom1);
- strcat(str, ctrl);
-
- if(--index)
- strcat(str, "|");
- else
- break;
- }
-
- return str;
-}
-
diff --git a/source/blender/python/intern/bpy_interface.c b/source/blender/python/intern/bpy_interface.c
index 1c15f311cd6..133f380120a 100644
--- a/source/blender/python/intern/bpy_interface.c
+++ b/source/blender/python/intern/bpy_interface.c
@@ -452,11 +452,11 @@ int BPY_run_python_script( bContext *C, const char *fn, struct Text *text, struc
fclose(fp);
- pystring= malloc(strlen(fn) + 32);
+ pystring= MEM_mallocN(strlen(fn) + 32, "pystring");
pystring[0]= '\0';
sprintf(pystring, "exec(open(r'%s').read())", fn);
py_result = PyRun_String( pystring, Py_file_input, py_dict, py_dict );
- free(pystring);
+ MEM_freeN(pystring);
#else
py_result = PyRun_File(fp, fn, Py_file_input, py_dict, py_dict);
fclose(fp);
diff --git a/source/blender/render/intern/raytrace/rayobject.cpp b/source/blender/render/intern/raytrace/rayobject.cpp
index 869405e0fbc..ac386e776b4 100644
--- a/source/blender/render/intern/raytrace/rayobject.cpp
+++ b/source/blender/render/intern/raytrace/rayobject.cpp
@@ -180,7 +180,7 @@ static inline int rayface_check_cullface(RayFace *face, Isect *is)
/* this function shall only modify Isect if it detects an hit */
static int intersect_rayface(RayObject *hit_obj, RayFace *face, Isect *is)
{
- float co1[3],co2[3],co3[3],co4[3];
+ float co1[3],co2[3],co3[3],co4[3]={0};
float x0,x1,x2,t00,t01,t02,t10,t11,t12,t20,t21,t22,r0,r1,r2;
float m0, m1, m2, divdet, det1;
float labda, u, v;
diff --git a/source/blender/render/intern/source/voxeldata.c b/source/blender/render/intern/source/voxeldata.c
index 1a220f6e9b1..f6da090f95b 100644
--- a/source/blender/render/intern/source/voxeldata.c
+++ b/source/blender/render/intern/source/voxeldata.c
@@ -57,29 +57,40 @@
#include "texture.h"
#include "voxeldata.h"
-void load_frame_blendervoxel(FILE *fp, float *F, int size, int frame, int offset)
+static int load_frame_blendervoxel(FILE *fp, float *F, int size, int frame, int offset)
{
- fseek(fp,frame*size*sizeof(float)+offset,0);
- fread(F,sizeof(float),size,fp);
+ if(fseek(fp,frame*size*sizeof(float)+offset,0) == -1)
+ return 0;
+ if(fread(F,sizeof(float),size,fp) != size)
+ return 0;
+
+ return 1;
}
-void load_frame_raw8(FILE *fp, float *F, int size, int frame)
+static int load_frame_raw8(FILE *fp, float *F, int size, int frame)
{
char *tmp;
int i;
tmp = (char *)MEM_mallocN(sizeof(char)*size, "temporary voxel file reading storage");
- fseek(fp,(frame-1)*size*sizeof(char),0);
- fread(tmp, sizeof(char), size, fp);
+ if(fseek(fp,(frame-1)*size*sizeof(char),0) == -1) {
+ MEM_freeN(tmp);
+ return 0;
+ }
+ if(fread(tmp, sizeof(char), size, fp) != size) {
+ MEM_freeN(tmp);
+ return 0;
+ }
for (i=0; i<size; i++) {
F[i] = (float)tmp[i] / 256.f;
}
MEM_freeN(tmp);
+ return 1;
}
-void load_frame_image_sequence(Render *re, VoxelData *vd, Tex *tex)
+static void load_frame_image_sequence(Render *re, VoxelData *vd, Tex *tex)
{
ImBuf *ibuf;
Image *ima = tex->ima;
@@ -133,26 +144,25 @@ void load_frame_image_sequence(Render *re, VoxelData *vd, Tex *tex)
}
}
-void write_voxeldata_header(struct VoxelDataHeader *h, FILE *fp)
-{
- fwrite(h,sizeof(struct VoxelDataHeader),1,fp);
-}
-
-void read_voxeldata_header(FILE *fp, struct VoxelData *vd)
+static int read_voxeldata_header(FILE *fp, struct VoxelData *vd)
{
VoxelDataHeader *h=(VoxelDataHeader *)MEM_mallocN(sizeof(VoxelDataHeader), "voxel data header");
rewind(fp);
- fread(h,sizeof(VoxelDataHeader),1,fp);
+ if(fread(h,sizeof(VoxelDataHeader),1,fp) != 1) {
+ MEM_freeN(h);
+ return 0;
+ }
vd->resol[0]=h->resolX;
vd->resol[1]=h->resolY;
vd->resol[2]=h->resolZ;
MEM_freeN(h);
+ return 1;
}
-void init_frame_smoke(Render *re, VoxelData *vd, Tex *tex)
+static void init_frame_smoke(Render *re, VoxelData *vd, Tex *tex)
{
Object *ob;
ModifierData *md;
@@ -224,7 +234,7 @@ void init_frame_smoke(Render *re, VoxelData *vd, Tex *tex)
}
}
-void cache_voxeldata(struct Render *re,Tex *tex)
+static void cache_voxeldata(struct Render *re,Tex *tex)
{
VoxelData *vd = tex->vd;
FILE *fp;
@@ -246,8 +256,12 @@ void cache_voxeldata(struct Render *re,Tex *tex)
fp = fopen(vd->source_path,"rb");
if (!fp) return;
- if (vd->file_format == TEX_VD_BLENDERVOXEL)
- read_voxeldata_header(fp, vd);
+ if (vd->file_format == TEX_VD_BLENDERVOXEL) {
+ if(!read_voxeldata_header(fp, vd)) {
+ fclose(fp);
+ return;
+ }
+ }
size = (vd->resol[0])*(vd->resol[1])*(vd->resol[2]);
vd->dataset = MEM_mapallocN(sizeof(float)*size, "voxel dataset");