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:
authorMatt Ebb <matt@mke3.net>2009-08-19 15:18:52 +0400
committerMatt Ebb <matt@mke3.net>2009-08-19 15:18:52 +0400
commit132277f0989b0b7d99d883d22a2bade6534ae44c (patch)
tree6d26c46f62749470130375061381353fd54c2364 /source/blender/blenlib
parent8480ea2b0abacae00c90d37e7d99fa5e0c89eebe (diff)
parente611c4756fa17c57855123dc2b5c2c2408b0d790 (diff)
svn merge -r 22450:22627 https://svn.blender.org/svnroot/bf-blender/branches/blender2.5/blender
Diffstat (limited to 'source/blender/blenlib')
-rw-r--r--source/blender/blenlib/CMakeLists.txt3
-rw-r--r--source/blender/blenlib/intern/BLI_kdopbvh.c2
-rw-r--r--source/blender/blenlib/intern/BLI_kdtree.c2
-rw-r--r--source/blender/blenlib/intern/boxpack2d.c59
-rw-r--r--source/blender/blenlib/intern/listbase.c4
-rw-r--r--source/blender/blenlib/intern/storage.c8
6 files changed, 37 insertions, 41 deletions
diff --git a/source/blender/blenlib/CMakeLists.txt b/source/blender/blenlib/CMakeLists.txt
index 334c8e6906b..a0bf2367b98 100644
--- a/source/blender/blenlib/CMakeLists.txt
+++ b/source/blender/blenlib/CMakeLists.txt
@@ -28,8 +28,7 @@ FILE(GLOB SRC intern/*.c)
SET(INC
. ../makesdna ../blenkernel ../../../intern/guardedalloc ../include
- ${FREETYPE_INC}
- ${SDL_INC}
+ ${FREETYPE_INCLUDE_DIRS}
${ZLIB_INC}
)
diff --git a/source/blender/blenlib/intern/BLI_kdopbvh.c b/source/blender/blenlib/intern/BLI_kdopbvh.c
index 08e8a5871cd..61d9cce1a58 100644
--- a/source/blender/blenlib/intern/BLI_kdopbvh.c
+++ b/source/blender/blenlib/intern/BLI_kdopbvh.c
@@ -1531,7 +1531,7 @@ float BLI_bvhtree_bb_raycast(float *bv, float *light_start, float *light_end, fl
{
BVHRayCastData data;
float dist = 0.0;
-
+
data.hit.dist = FLT_MAX;
// get light direction
diff --git a/source/blender/blenlib/intern/BLI_kdtree.c b/source/blender/blenlib/intern/BLI_kdtree.c
index 79a46da4c66..1f3a861ba6a 100644
--- a/source/blender/blenlib/intern/BLI_kdtree.c
+++ b/source/blender/blenlib/intern/BLI_kdtree.c
@@ -374,7 +374,7 @@ int BLI_kdtree_range_search(KDTree *tree, float range, float *co, float *nor, KD
KDTreeNode **stack, *defaultstack[100];
KDTreeNearest *foundstack=NULL;
float range2 = range*range, dist2;
- int i, totstack, cur=0, found=0, totfoundstack=0;
+ int totstack, cur=0, found=0, totfoundstack=0;
if(!tree || !tree->root)
return 0;
diff --git a/source/blender/blenlib/intern/boxpack2d.c b/source/blender/blenlib/intern/boxpack2d.c
index db7bae8a91d..7d5e1eec53e 100644
--- a/source/blender/blenlib/intern/boxpack2d.c
+++ b/source/blender/blenlib/intern/boxpack2d.c
@@ -16,28 +16,22 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): Campbell barton
+ * Contributor(s): Campbell Barton
*
* ***** END GPL LICENSE BLOCK *****
*/
-#include <stdlib.h>
+#include <stdlib.h> /* for qsort */
-#include "BKE_utildefines.h"
#include "MEM_guardedalloc.h"
#include "BLI_boxpack2d.h"
-/* BoxPacker ported from Python by Campbell Barton
+/* BoxPacker for backing 2D rectangles into a square
*
* The defined Below are for internal use only */
/* free vert flags */
-#define eul 0.0000001
+#define eul 0.0000001f
#define BLF 1
#define TRF 2
#define TLF 4
@@ -79,6 +73,9 @@
BOXRIGHT(b1)-eul<=BOXLEFT(b2) ||\
BOXTOP(b1)-eul<=BOXBOTTOM(b2) ))
+#define MIN2(x,y) ( (x)<(y) ? (x) : (y) )
+#define MAX2(x,y) ( (x)>(y) ? (x) : (y) )
+
/* #define BOXDEBUG(b)\
* printf("\tBox Debug i %i, w:%.3f h:%.3f x:%.3f y:%.3f\n",\
* b->index, b->w, b->h, b->x, b->y) */
@@ -141,11 +138,11 @@ void boxPack2D(boxPack *boxarray, int len, float *tot_width, float *tot_height)
int box_index, verts_pack_len, i, j, k, isect;
int quad_flags[4]= {BLF,TRF,TLF,BRF}; /* use for looping */
boxPack *box, *box_test; /*current box and another for intersection tests*/
- int *vertex_pack_indicies; /*an array of indicies used for sorting verts*/
+ int *vertex_pack_indicies; /*an array of indices used for sorting verts*/
if (!len) {
- *tot_width = 0.0;
- *tot_height = 0.0;
+ *tot_width = 0.0f;
+ *tot_height = 0.0f;
return;
}
@@ -153,8 +150,8 @@ void boxPack2D(boxPack *boxarray, int len, float *tot_width, float *tot_height)
qsort(boxarray, len, sizeof(boxPack), box_areasort);
/* add verts to the boxes, these are only used internally */
- vert = vertarray = MEM_mallocN( len*4*sizeof(boxVert), "boxPack verts");
- vertex_pack_indicies = MEM_mallocN( len*3*sizeof(int), "boxPack indicies");
+ vert = vertarray = MEM_mallocN( len*4*sizeof(boxVert), "boxPack Verts");
+ vertex_pack_indicies = MEM_mallocN( len*3*sizeof(int), "boxPack Indices");
for (box=boxarray, box_index=0, i=0; box_index < len; box_index++, box++) {
@@ -194,11 +191,11 @@ void boxPack2D(boxPack *boxarray, int len, float *tot_width, float *tot_height)
/* Pack the First box!
- * then enter the main boxpacking loop */
+ * then enter the main box-packing loop */
box = boxarray; /* get the first box */
/* First time, no boxes packed */
- box->v[BL]->free = 0; /* Cant use any if these */
+ box->v[BL]->free = 0; /* Can't use any if these */
box->v[BR]->free &= ~(BLF|BRF);
box->v[TL]->free &= ~(BLF|TLF);
@@ -206,9 +203,9 @@ void boxPack2D(boxPack *boxarray, int len, float *tot_width, float *tot_height)
*tot_height = box->h;
/* This sets all the vertex locations */
- SET_BOXLEFT(box, 0.0);
- SET_BOXBOTTOM(box, 0.0);
- box->x = box->y = 0.0;
+ SET_BOXLEFT(box, 0.0f);
+ SET_BOXBOTTOM(box, 0.0f);
+ box->x = box->y = 0.0f;
for (i=0; i<3; i++)
vertex_pack_indicies[i] = box->v[i+1]->index;
@@ -219,7 +216,7 @@ void boxPack2D(boxPack *boxarray, int len, float *tot_width, float *tot_height)
/* Main boxpacking loop */
for (box_index=1; box_index < len; box_index++, box++) {
- /* Sort the verts, these constants are used in sorting */
+ /* These static floatds are used for sorting */
box_width = box->w;
box_height = box->h;
@@ -234,7 +231,7 @@ void boxPack2D(boxPack *boxarray, int len, float *tot_width, float *tot_height)
/* printf("\ttesting vert %i %i %i %f %f\n", i,
* vert->free, verts_pack_len, vert->x, vert->y); */
- /* This vert has a free quaderent
+ /* This vert has a free quadrant
* Test if we can place the box here
* vert->free & quad_flags[j] - Checks
* */
@@ -266,7 +263,7 @@ void boxPack2D(boxPack *boxarray, int len, float *tot_width, float *tot_height)
isect = 0;
if (/* Constrain boxes to positive X/Y values */
- BOXLEFT(box)<0.0 || BOXBOTTOM(box) < 0.0 ||
+ BOXLEFT(box)<0.0f || BOXBOTTOM(box) < 0.0f ||
/* check for last intersected */
( vert->isect_cache[j] &&
BOXINTERSECT(box, vert->isect_cache[j]) )
@@ -274,13 +271,13 @@ void boxPack2D(boxPack *boxarray, int len, float *tot_width, float *tot_height)
/* Here we check that the last intersected
* box will intersect with this one using
* isect_cache that can store a pointer to a
- * box for each quaderent
+ * box for each quadrant
* big speedup */
isect = 1;
} else {
- /* do a full saech for colliding box
- * this is realy slow, some spacialy divided
- * datastructure would be better */
+ /* do a full search for colliding box
+ * this is really slow, some spacialy divided
+ * data-structure would be better */
for (box_test=boxarray; box_test != box; box_test++) {
if BOXINTERSECT(box, box_test) {
/* Store the last intersecting here as cache
@@ -321,7 +318,7 @@ void boxPack2D(boxPack *boxarray, int len, float *tot_width, float *tot_height)
}
/* Mask free flags for verts that are
- * on the bottom or side so we dont get
+ * on the bottom or side so we don't get
* boxes outside the given rectangle ares
*
* We can do an else/if here because only the first
@@ -392,7 +389,7 @@ void boxPack2D(boxPack *boxarray, int len, float *tot_width, float *tot_height)
verts_pack_len++;
}
}
- /* The Box verts are only used interially
+ /* The Box verts are only used internally
* Update the box x and y since thats what external
* functions will see */
box->x = BOXLEFT(box);
@@ -403,8 +400,8 @@ void boxPack2D(boxPack *boxarray, int len, float *tot_width, float *tot_height)
}
}
- /* free all the verts, not realy needed because they shouldebt be
- * touched anymore but accessing the pointers woud crash blender */
+ /* free all the verts, not really needed because they shouldn't be
+ * touched anymore but accessing the pointers would crash blender */
for (box_index=0; box_index < len; box_index++) {
box = boxarray+box_index;
box->v[0] = box->v[1] = box->v[2] = box->v[3] = NULL;
diff --git a/source/blender/blenlib/intern/listbase.c b/source/blender/blenlib/intern/listbase.c
index 1064c8ac1bf..3194593374f 100644
--- a/source/blender/blenlib/intern/listbase.c
+++ b/source/blender/blenlib/intern/listbase.c
@@ -347,11 +347,11 @@ void BLI_duplicatelist(ListBase *list1, ListBase *list2) /* copy from 2 to 1 */
{
struct Link *link1, *link2;
+ /* in this order, to ensure it works if list1 == list2 */
+ link2= list2->first;
list1->first= list1->last= 0;
- link2= list2->first;
while(link2) {
-
link1= MEM_dupallocN(link2);
BLI_addtail(list1, link1);
diff --git a/source/blender/blenlib/intern/storage.c b/source/blender/blenlib/intern/storage.c
index 0a416e624cb..e6e37c58805 100644
--- a/source/blender/blenlib/intern/storage.c
+++ b/source/blender/blenlib/intern/storage.c
@@ -47,13 +47,13 @@
#include <time.h>
#include <sys/stat.h>
-#if defined (__sun__) || defined (__sun) || defined (__sgi)
+#if defined (__sun__) || defined (__sun) || defined (__sgi) || defined (__NetBSD__)
#include <sys/statvfs.h> /* Other modern unix os's should probably use this also */
#elif !defined(__FreeBSD__) && !defined(linux) && (defined(__sparc) || defined(__sparc__))
#include <sys/statfs.h>
#endif
-#if defined (__FreeBSD__) || defined (__OpenBSD__) || defined (__NetBSD__)
+#if defined (__FreeBSD__) || defined (__OpenBSD__)
#include <sys/param.h>
#include <sys/mount.h>
#endif
@@ -173,7 +173,7 @@ double BLI_diskfree(char *dir)
return (double) (freec*bytesps*sectorspc);
#else
-#if defined (__sun__) || defined (__sun) || defined (__sgi)
+#if defined (__sun__) || defined (__sun) || defined (__sgi) || defined (__NetBSD__)
struct statvfs disk;
#else
struct statfs disk;
@@ -195,7 +195,7 @@ double BLI_diskfree(char *dir)
if (statfs(name, &disk)) return(-1);
#endif
-#if defined (__sun__) || defined (__sun) || defined (__sgi)
+#if defined (__sun__) || defined (__sun) || defined (__sgi) || defined (__NetBSD__)
if (statvfs(name, &disk)) return(-1);
#elif !defined(__FreeBSD__) && !defined(linux) && (defined(__sparc) || defined(__sparc__))
/* WARNING - This may not be supported by geeneric unix os's - Campbell */