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:
authorBrecht Van Lommel <brechtvanlommel@pandora.be>2010-02-08 16:55:31 +0300
committerBrecht Van Lommel <brechtvanlommel@pandora.be>2010-02-08 16:55:31 +0300
commitec7df03c867d28316708e9b91bec5cef0aee832e (patch)
tree3f560939b745032e235d9ac789c4117d669d6462 /source/blender/blenkernel/intern
parent4c318539b2f6abdf8f2a02376b6fcb8d30a4b12e (diff)
Warning fixes, one actual bug found in sequencer sound wave drawing. Also
changed some malloc to MEM_mallocN while trying to track down a memory leak.
Diffstat (limited to 'source/blender/blenkernel/intern')
-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
7 files changed, 40 insertions, 20 deletions
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);