diff options
author | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2010-02-08 16:55:31 +0300 |
---|---|---|
committer | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2010-02-08 16:55:31 +0300 |
commit | ec7df03c867d28316708e9b91bec5cef0aee832e (patch) | |
tree | 3f560939b745032e235d9ac789c4117d669d6462 /source/blender/blenlib | |
parent | 4c318539b2f6abdf8f2a02376b6fcb8d30a4b12e (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/blenlib')
-rw-r--r-- | source/blender/blenlib/intern/BLI_kdopbvh.c | 8 | ||||
-rw-r--r-- | source/blender/blenlib/intern/noise.c | 10 | ||||
-rw-r--r-- | source/blender/blenlib/intern/path_util.c | 4 | ||||
-rw-r--r-- | source/blender/blenlib/intern/storage.c | 4 |
4 files changed, 15 insertions, 11 deletions
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); |