style cleanup
authorCampbell Barton <ideasman42@gmail.com>
Sun, 11 Mar 2012 23:47:41 +0000 (23:47 +0000)
committerCampbell Barton <ideasman42@gmail.com>
Sun, 11 Mar 2012 23:47:41 +0000 (23:47 +0000)
source/blender/blenlib/intern/BLI_ghash.c
source/blender/blenlib/intern/BLI_heap.c
source/blender/blenlib/intern/BLI_memarena.c
source/blender/blenlib/intern/BLI_mempool.c
source/blender/blenlib/intern/bpath.c
source/blender/blenlib/intern/string_cursor_utf8.c
source/blender/blenlib/intern/uvproject.c
source/blender/editors/sculpt_paint/paint_vertex.c

index b05a1c0..49da6f9 100644 (file)
 #include <string.h>
 #include <stdlib.h>
 
-
 #include "MEM_guardedalloc.h"
 
-
-
 // #include "BLI_blenlib.h"
 
 #include "BLI_utildefines.h"
@@ -47,7 +44,7 @@
 #include "BLO_sys_types.h" // for intptr_t support
 /***/
 
-unsigned int hashsizes[]= {
+unsigned int hashsizes[] = {
        5, 11, 17, 37, 67, 131, 257, 521, 1031, 2053, 4099, 8209, 
        16411, 32771, 65537, 131101, 262147, 524309, 1048583, 2097169, 
        4194319, 8388617, 16777259, 33554467, 67108879, 134217757, 
@@ -58,18 +55,18 @@ unsigned int hashsizes[]= {
 
 GHash *BLI_ghash_new(GHashHashFP hashfp, GHashCmpFP cmpfp, const char *info)
 {
-       GHash *gh= MEM_mallocN(sizeof(*gh), info);
-       gh->hashfp= hashfp;
-       gh->cmpfp= cmpfp;
+       GHash *gh = MEM_mallocN(sizeof(*gh), info);
+       gh->hashfp = hashfp;
+       gh->cmpfp = cmpfp;
        gh->entrypool = BLI_mempool_create(sizeof(Entry), 64, 64, 0);
 
-       gh->cursize= 0;
-       gh->nentries= 0;
-       gh->nbuckets= hashsizes[gh->cursize];
-       
-       gh->buckets= MEM_mallocN(gh->nbuckets*sizeof(*gh->buckets), "buckets");
-       memset(gh->buckets, 0, gh->nbuckets*sizeof(*gh->buckets));
-       
+       gh->cursize = 0;
+       gh->nentries = 0;
+       gh->nbuckets = hashsizes[gh->cursize];
+
+       gh->buckets = MEM_mallocN(gh->nbuckets * sizeof(*gh->buckets), "buckets");
+       memset(gh->buckets, 0, gh->nbuckets * sizeof(*gh->buckets));
+
        return gh;
 }
 
@@ -80,31 +77,31 @@ int BLI_ghash_size(GHash *gh)
 
 void BLI_ghash_insert(GHash *gh, void *key, void *val)
 {
-       unsigned int hash= gh->hashfp(key)%gh->nbuckets;
-       Entry *e= (Entry*) BLI_mempool_alloc(gh->entrypool);
+       unsigned int hash = gh->hashfp(key) % gh->nbuckets;
+       Entry *e = (Entry*)BLI_mempool_alloc(gh->entrypool);
 
-       e->key= key;
-       e->val= val;
-       e->next= gh->buckets[hash];
-       gh->buckets[hash]= e;
+       e->key = key;
+       e->val = val;
+       e->next = gh->buckets[hash];
+       gh->buckets[hash] = e;
 
-       if (++gh->nentries>(float)gh->nbuckets/2) {
-               Entry **old= gh->buckets;
-               int i, nold= gh->nbuckets;
+       if (++gh->nentries > (float)gh->nbuckets / 2) {
+               Entry **old = gh->buckets;
+               int i, nold = gh->nbuckets;
 
-               gh->nbuckets= hashsizes[++gh->cursize];
-               gh->buckets= (Entry**)MEM_mallocN(gh->nbuckets*sizeof(*gh->buckets), "buckets");
-               memset(gh->buckets, 0, gh->nbuckets*sizeof(*gh->buckets));
+               gh->nbuckets = hashsizes[++gh->cursize];
+               gh->buckets = (Entry**)MEM_mallocN(gh->nbuckets * sizeof(*gh->buckets), "buckets");
+               memset(gh->buckets, 0, gh->nbuckets * sizeof(*gh->buckets));
 
-               for (i=0; i<nold; i++) {
-                       for (e= old[i]; e;) {
-                               Entry *n= e->next;
+               for (i = 0; i < nold; i++) {
+                       for (e = old[i]; e;) {
+                               Entry *n = e->next;
 
-                               hash= gh->hashfp(e->key)%gh->nbuckets;
-                               e->next= gh->buckets[hash];
-                               gh->buckets[hash]= e;
+                               hash = gh->hashfp(e->key) % gh->nbuckets;
+                               e->next = gh->buckets[hash];
+                               gh->buckets[hash] = e;
 
-                               e= n;
+                               e = n;
                        }
                }
 
@@ -114,33 +111,35 @@ void BLI_ghash_insert(GHash *gh, void *key, void *val)
 
 void *BLI_ghash_lookup(GHash *gh, const void *key)
 {
-       if(gh) {
-               unsigned int hash= gh->hashfp(key)%gh->nbuckets;
+       if (gh) {
+               unsigned int hash = gh->hashfp(key) % gh->nbuckets;
                Entry *e;
 
-               for (e= gh->buckets[hash]; e; e= e->next)
-                       if (gh->cmpfp(key, e->key)==0)
+               for (e = gh->buckets[hash]; e; e = e->next)
+                       if (gh->cmpfp(key, e->key) == 0)
                                return e->val;
        }
        return NULL;
 }
 
-int BLI_ghash_remove (GHash *gh, void *key, GHashKeyFreeFP keyfreefp, GHashValFreeFP valfreefp)
+int BLI_ghash_remove(GHash *gh, void *key, GHashKeyFreeFP keyfreefp, GHashValFreeFP valfreefp)
 {
-       unsigned int hash= gh->hashfp(key)%gh->nbuckets;
+       unsigned int hash = gh->hashfp(key) % gh->nbuckets;
        Entry *e;
        Entry *p = NULL;
 
-       for (e= gh->buckets[hash]; e; e= e->next) {
-               if (gh->cmpfp(key, e->key)==0) {
-                       Entry *n= e->next;
+       for (e = gh->buckets[hash]; e; e = e->next) {
+               if (gh->cmpfp(key, e->key) == 0) {
+                       Entry *n = e->next;
 
-                       if (keyfreefp) keyfreefp(e->key);
-                       if (valfreefp) valfreefp(e->val);
+                       if (keyfreefp)
+                               keyfreefp(e->key);
+                       if (valfreefp)
+                               valfreefp(e->val);
                        BLI_mempool_free(gh->entrypool, e);
 
                        /* correct but 'e' isnt used before return */
-                       /* e= n; */ /*UNUSED*/
+                       /* e= n; *//*UNUSED*/
                        if (p)
                                p->next = n;
                        else
@@ -157,11 +156,11 @@ int BLI_ghash_remove (GHash *gh, void *key, GHashKeyFreeFP keyfreefp, GHashValFr
 
 int BLI_ghash_haskey(GHash *gh, void *key)
 {
-       unsigned int hash= gh->hashfp(key)%gh->nbuckets;
+       unsigned int hash = gh->hashfp(key) % gh->nbuckets;
        Entry *e;
 
-       for (e= gh->buckets[hash]; e; e= e->next)
-               if (gh->cmpfp(key, e->key)==0)
+       for (e = gh->buckets[hash]; e; e = e->next)
+               if (gh->cmpfp(key, e->key) == 0)
                        return 1;
 
        return 0;
@@ -170,22 +169,22 @@ int BLI_ghash_haskey(GHash *gh, void *key)
 void BLI_ghash_free(GHash *gh, GHashKeyFreeFP keyfreefp, GHashValFreeFP valfreefp)
 {
        int i;
-       
+
        if (keyfreefp || valfreefp) {
-               for (i=0; i<gh->nbuckets; i++) {
+               for (i = 0; i < gh->nbuckets; i++) {
                        Entry *e;
-                       
-                       for (e= gh->buckets[i]; e; ) {
-                               Entry *n= e->next;
-                               
+
+                       for (e = gh->buckets[i]; e;) {
+                               Entry *n = e->next;
+
                                if (keyfreefp) keyfreefp(e->key);
                                if (valfreefp) valfreefp(e->val);
 
-                               e= n;
+                               e = n;
                        }
                }
        }
-       
+
        MEM_freeN(gh->buckets);
        BLI_mempool_destroy(gh->entrypool);
        gh->buckets = NULL;
@@ -198,28 +197,28 @@ void BLI_ghash_free(GHash *gh, GHashKeyFreeFP keyfreefp, GHashValFreeFP valfreef
 
 GHashIterator *BLI_ghashIterator_new(GHash *gh)
 {
-       GHashIterator *ghi= MEM_mallocN(sizeof(*ghi), "ghash iterator");
-       ghi->gh= gh;
-       ghi->curEntry= NULL;
-       ghi->curBucket= -1;
+       GHashIterator *ghi = MEM_mallocN(sizeof(*ghi), "ghash iterator");
+       ghi->gh = gh;
+       ghi->curEntry = NULL;
+       ghi->curBucket = -1;
        while (!ghi->curEntry) {
                ghi->curBucket++;
-               if (ghi->curBucket==ghi->gh->nbuckets)
+               if (ghi->curBucket == ghi->gh->nbuckets)
                        break;
-               ghi->curEntry= ghi->gh->buckets[ghi->curBucket];
+               ghi->curEntry = ghi->gh->buckets[ghi->curBucket];
        }
        return ghi;
 }
 void BLI_ghashIterator_init(GHashIterator *ghi, GHash *gh)
 {
-       ghi->gh= gh;
-       ghi->curEntry= NULL;
-       ghi->curBucket= -1;
+       ghi->gh = gh;
+       ghi->curEntry = NULL;
+       ghi->curBucket = -1;
        while (!ghi->curEntry) {
                ghi->curBucket++;
-               if (ghi->curBucket==ghi->gh->nbuckets)
+               if (ghi->curBucket == ghi->gh->nbuckets)
                        break;
-               ghi->curEntry= ghi->gh->buckets[ghi->curBucket];
+               ghi->curEntry = ghi->gh->buckets[ghi->curBucket];
        }
 }
 void BLI_ghashIterator_free(GHashIterator *ghi)
@@ -229,22 +228,22 @@ void BLI_ghashIterator_free(GHashIterator *ghi)
 
 void *BLI_ghashIterator_getKey(GHashIterator *ghi)
 {
-       return ghi->curEntry?ghi->curEntry->key:NULL;
+       return ghi->curEntry ? ghi->curEntry->key : NULL;
 }
 void *BLI_ghashIterator_getValue(GHashIterator *ghi)
 {
-       return ghi->curEntry?ghi->curEntry->val:NULL;
+       return ghi->curEntry ? ghi->curEntry->val : NULL;
 }
 
 void BLI_ghashIterator_step(GHashIterator *ghi)
 {
        if (ghi->curEntry) {
-               ghi->curEntry= ghi->curEntry->next;
+               ghi->curEntry = ghi->curEntry->next;
                while (!ghi->curEntry) {
                        ghi->curBucket++;
-                       if (ghi->curBucket==ghi->gh->nbuckets)
+                       if (ghi->curBucket == ghi->gh->nbuckets)
                                break;
-                       ghi->curEntry= ghi->gh->buckets[ghi->curBucket];
+                       ghi->curEntry = ghi->gh->buckets[ghi->curBucket];
                }
        }
 }
@@ -261,10 +260,10 @@ unsigned int BLI_ghashutil_ptrhash(const void *key)
 }
 int BLI_ghashutil_ptrcmp(const void *a, const void *b)
 {
-       if (a==b)
+       if (a == b)
                return 0;
        else
-               return (a<b)?-1:1;
+               return (a < b) ? -1 : 1;
 }
 
 unsigned int BLI_ghashutil_inthash(const void *ptr)
@@ -283,21 +282,22 @@ unsigned int BLI_ghashutil_inthash(const void *ptr)
 
 int BLI_ghashutil_intcmp(const void *a, const void *b)
 {
-       if (a==b)
+       if (a == b)
                return 0;
        else
-               return (a<b)?-1:1;
+               return (a < b) ? -1 : 1;
 }
 
 unsigned int BLI_ghashutil_strhash(const void *ptr)
 {
-       const char *s= ptr;
-       unsigned int i= 0;
+       const char *s = ptr;
+       unsigned int i = 0;
        unsigned char c;
-       
-       while ( (c= *s++) )
-               i= i*37 + c;
-               
+
+       while ((c = *s++)) {
+               i = i * 37 + c;
+       }
+
        return i;
 }
 int BLI_ghashutil_strcmp(const void *a, const void *b)
@@ -326,7 +326,7 @@ int BLI_ghashutil_paircmp(const void *a, const void *b)
        const GHashPair *B = b;
 
        int cmp = BLI_ghashutil_ptrcmp(A->first, B->first);
-       if(cmp == 0)
+       if (cmp == 0)
                return BLI_ghashutil_intcmp(SET_INT_IN_POINTER(A->second), SET_INT_IN_POINTER(B->second));
        return cmp;
 }
index 62a38e7..01a38cf 100644 (file)
@@ -30,7 +30,6 @@
  *  \ingroup bli
  */
 
-
 #include <string.h>
 
 #include "MEM_guardedalloc.h"
@@ -55,26 +54,26 @@ struct Heap {
 };
 
 #define SWAP(type, a, b) \
-       { type sw_ap; sw_ap=(a); (a)=(b); (b)=sw_ap; }
-#define HEAP_PARENT(i) ((i-1)>>1)
-#define HEAP_LEFT(i)   ((i<<1)+1)
-#define HEAP_RIGHT(i)  ((i<<1)+2)
+       { type sw_ap; sw_ap = (a); (a) = (b); (b) = sw_ap; }
+#define HEAP_PARENT(i) ((i - 1) >> 1)
+#define HEAP_LEFT(i)   ((i << 1) + 1)
+#define HEAP_RIGHT(i)  ((i << 1) + 2)
 #define HEAP_COMPARE(a, b) (a->value < b->value)
 #define HEAP_EQUALS(a, b) (a->value == b->value)
 #define HEAP_SWAP(heap, i, j) \
 {                                                                             \
        SWAP(int, heap->tree[i]->index, heap->tree[j]->index);                    \
-       SWAP(HeapNode*, heap->tree[i], heap->tree[j]);                            \
+       SWAP(HeapNode *, heap->tree[i], heap->tree[j]);                           \
 }
 
 /***/
 
 Heap *BLI_heap_new(void)
 {
-       Heap *heap = (Heap*)MEM_callocN(sizeof(Heap), "BLIHeap");
+       Heap *heap = (Heap *)MEM_callocN(sizeof(Heap), __func__);
        heap->bufsize = 1;
-       heap->tree = (HeapNode**)MEM_mallocN(sizeof(HeapNode*), "BLIHeapTree");
-       heap->arena = BLI_memarena_new(1<<16, "heap arena");
+       heap->tree = (HeapNode **)MEM_mallocN(sizeof(HeapNode *), "BLIHeapTree");
+       heap->arena = BLI_memarena_new(1 << 16, "heap arena");
 
        return heap;
 }
@@ -86,7 +85,7 @@ void BLI_heap_free(Heap *heap, HeapFreeFP ptrfreefp)
        if (ptrfreefp)
                for (i = 0; i < heap->size; i++)
                        ptrfreefp(heap->tree[i]->ptr);
-       
+
        MEM_freeN(heap->tree);
        BLI_memarena_free(heap->arena);
        MEM_freeN(heap);
@@ -99,11 +98,11 @@ static void BLI_heap_down(Heap *heap, int i)
                int l = HEAP_LEFT(i);
                int r = HEAP_RIGHT(i);
 
-               smallest = ((l < size) && HEAP_COMPARE(heap->tree[l], heap->tree[i]))? l: i;
+               smallest = ((l < size) && HEAP_COMPARE(heap->tree[l], heap->tree[i])) ? l : i;
 
                if ((r < size) && HEAP_COMPARE(heap->tree[r], heap->tree[smallest]))
                        smallest = r;
-               
+
                if (smallest == i)
                        break;
 
@@ -130,11 +129,11 @@ HeapNode *BLI_heap_insert(Heap *heap, float value, void *ptr)
        HeapNode *node;
 
        if ((heap->size + 1) > heap->bufsize) {
-               int newsize = heap->bufsize*2;
+               int newsize = heap->bufsize * 2;
                HeapNode **newtree;
 
-               newtree = (HeapNode**)MEM_mallocN(newsize*sizeof(*newtree), "BLIHeapTree");
-               memcpy(newtree, heap->tree, sizeof(HeapNode*)*heap->size);
+               newtree = (HeapNode **)MEM_mallocN(newsize * sizeof(*newtree), __func__);
+               memcpy(newtree, heap->tree, sizeof(HeapNode *) * heap->size);
                MEM_freeN(heap->tree);
 
                heap->tree = newtree;
@@ -143,10 +142,10 @@ HeapNode *BLI_heap_insert(Heap *heap, float value, void *ptr)
 
        if (heap->freenodes) {
                node = heap->freenodes;
-               heap->freenodes = (HeapNode*)(((HeapNode*)heap->freenodes)->ptr);
+               heap->freenodes = (HeapNode *)(((HeapNode *)heap->freenodes)->ptr);
        }
        else
-               node = (HeapNode*)BLI_memarena_alloc(heap->arena, sizeof *node);
+               node = (HeapNode *)BLI_memarena_alloc(heap->arena, sizeof *node);
 
        node->value = value;
        node->ptr = ptr;
@@ -156,7 +155,7 @@ HeapNode *BLI_heap_insert(Heap *heap, float value, void *ptr)
 
        heap->size++;
 
-       BLI_heap_up(heap, heap->size-1);
+       BLI_heap_up(heap, heap->size - 1);
 
        return node;
 }
index 72f312b..95a007d 100644 (file)
@@ -30,8 +30,6 @@
  *  \ingroup bli
  */
 
-
-
 #include "MEM_guardedalloc.h"
 
 #include "BLI_memarena.h"
@@ -41,31 +39,31 @@ struct MemArena {
        unsigned char *curbuf;
        int bufsize, cursize;
        const char *name;
-       
-       int use_calloc; 
+
+       int use_calloc;
        int align;
-       
+
        LinkNode *bufs;
 };
 
 MemArena *BLI_memarena_new(int bufsize, const char *name)
 {
-       MemArena *ma= MEM_callocN(sizeof(*ma), "memarena");
-       ma->bufsize= bufsize;
+       MemArena *ma = MEM_callocN(sizeof(*ma), "memarena");
+       ma->bufsize = bufsize;
        ma->align = 8;
-       ma->name= name;
-       
+       ma->name = name;
+
        return ma;
 }
 
 void BLI_memarena_use_calloc(MemArena *ma)
 {
-       ma->use_calloc= 1;
+       ma->use_calloc = 1;
 }
 
 void BLI_memarena_use_malloc(MemArena *ma)
 {
-       ma->use_calloc= 0;
+       ma->use_calloc = 0;
 }
 
 void BLI_memarena_use_align(struct MemArena *ma, int align)
@@ -76,46 +74,47 @@ void BLI_memarena_use_align(struct MemArena *ma, int align)
 
 void BLI_memarena_free(MemArena *ma)
 {
-       BLI_linklist_free(ma->bufs, (void(*)(void*)) MEM_freeN);
+       BLI_linklist_free(ma->bufs, (void(*)(void *))MEM_freeN);
        MEM_freeN(ma);
 }
 
-       /* amt must be power of two */
-#define PADUP(num, amt)        ((num+(amt-1))&~(amt-1))
+/* amt must be power of two */
+#define PADUP(num, amt)        ((num + (amt - 1)) &~ (amt-1))
 
 void *BLI_memarena_alloc(MemArena *ma, int size)
 {
        void *ptr;
 
-               /* ensure proper alignment by rounding
-                * size up to multiple of 8 */  
-       size= PADUP(size, ma->align);
-       
-       if (size>ma->cursize) {
+       /* ensure proper alignment by rounding
+        * size up to multiple of 8 */
+       size = PADUP(size, ma->align);
+
+       if (size > ma->cursize) {
                unsigned char *tmp;
-               
-               if(size > ma->bufsize - (ma->align - 1)) {
+
+               if (size > ma->bufsize - (ma->align - 1)) {
                        ma->cursize = PADUP(size+1, ma->align);
                }
-               else ma->cursize = ma->bufsize;
+               else
+                       ma->cursize = ma->bufsize;
 
-               if(ma->use_calloc)
-                       ma->curbuf= MEM_callocN(ma->cursize, ma->name);
+               if (ma->use_calloc)
+                       ma->curbuf = MEM_callocN(ma->cursize, ma->name);
                else
-                       ma->curbuf= MEM_mallocN(ma->cursize, ma->name);
-               
+                       ma->curbuf = MEM_mallocN(ma->cursize, ma->name);
+
                BLI_linklist_prepend(&ma->bufs, ma->curbuf);
 
                /* align alloc'ed memory (needed if align > 8) */
                tmp = (unsigned char*)PADUP( (intptr_t) ma->curbuf, ma->align);
                ma->cursize -= (tmp - ma->curbuf);
-               ma->curbuf = tmp;               
+               ma->curbuf = tmp;
        }
-       
-       ptr= ma->curbuf;
-       ma->curbuf+= size;
-       ma->cursize-= size;
-       
+
+       ptr = ma->curbuf;
+       ma->curbuf += size;
+       ma->cursize -= size;
+
        return ptr;
 }
 
index d5df882..b8a18b5 100644 (file)
@@ -74,7 +74,7 @@ struct BLI_mempool {
        int flag;
        /* keeps aligned to 16 bits */
 
-       BLI_freenode *free;        /* free element list. Interleaved into chunk datas. */
+       BLI_freenode *free;    /* free element list. Interleaved into chunk datas. */
        int totalloc, totused; /* total number of elements allocated in total,
                                * and currently in use */
 };
@@ -83,9 +83,9 @@ struct BLI_mempool {
 
 BLI_mempool *BLI_mempool_create(int esize, int totelem, int pchunk, int flag)
 {
-       BLI_mempool  *pool = NULL;
+       BLI_mempool *pool = NULL;
        BLI_freenode *lasttail = NULL, *curnode = NULL;
-       int i,j, maxchunks;
+       int i, j, maxchunks;
        char *addr;
 
        /* allocate the pool structure */
@@ -113,7 +113,7 @@ BLI_mempool *BLI_mempool_create(int esize, int totelem, int pchunk, int flag)
        pool->csize = esize * pchunk;
        pool->chunks.first = pool->chunks.last = NULL;
        pool->totused = 0;
-       
+
        maxchunks = totelem / pchunk + 1;
        if (maxchunks == 0) {
                maxchunks = 1;
@@ -124,17 +124,17 @@ BLI_mempool *BLI_mempool_create(int esize, int totelem, int pchunk, int flag)
                BLI_mempool_chunk *mpchunk;
 
                if (flag & BLI_MEMPOOL_SYSMALLOC) {
-                       mpchunk       = malloc(sizeof(BLI_mempool_chunk));
+                       mpchunk = malloc(sizeof(BLI_mempool_chunk));
                        mpchunk->data = malloc(pool->csize);
                }
                else {
-                       mpchunk       = MEM_mallocN(sizeof(BLI_mempool_chunk), "BLI_Mempool Chunk");
+                       mpchunk = MEM_mallocN(sizeof(BLI_mempool_chunk), "BLI_Mempool Chunk");
                        mpchunk->data = MEM_mallocN(pool->csize, "BLI Mempool Chunk Data");
                }
 
                mpchunk->next = mpchunk->prev = NULL;
                BLI_addtail(&(pool->chunks), mpchunk);
-               
+
                if (i == 0) {
                        pool->free = mpchunk->data; /* start of the list */
                        if (pool->flag & BLI_MEMPOOL_ALLOW_ITER) {
@@ -304,7 +304,9 @@ void *BLI_mempool_findelem(BLI_mempool *pool, int index)
                BLI_mempool_iter iter;
                void *elem;
                BLI_mempool_iternew(pool, &iter);
-               for (elem = BLI_mempool_iterstep(&iter); index-- != 0; elem = BLI_mempool_iterstep(&iter)) { };
+               for (elem = BLI_mempool_iterstep(&iter); index-- != 0; elem = BLI_mempool_iterstep(&iter)) {
+                       /* do nothing */
+               };
                return elem;
        }
 
@@ -317,10 +319,10 @@ void BLI_mempool_iternew(BLI_mempool *pool, BLI_mempool_iter *iter)
                fprintf(stderr, "%s: Error! you can't iterate over this mempool!\n", __func__);
                iter->curchunk = NULL;
                iter->curindex = 0;
-               
+
                return;
        }
-       
+
        iter->pool = pool;
        iter->curchunk = pool->chunks.first;
        iter->curindex = 0;
@@ -332,29 +334,29 @@ void BLI_mempool_iternew(BLI_mempool *pool, BLI_mempool_iter *iter)
 static void *bli_mempool_iternext(BLI_mempool_iter *iter)
 {
        void *ret = NULL;
-       
+
        if (!iter->curchunk || !iter->pool->totused) return NULL;
-       
+
        ret = ((char *)iter->curchunk->data) + iter->pool->esize * iter->curindex;
-       
+
        iter->curindex++;
-       
+
        if (iter->curindex >= iter->pool->pchunk) {
                iter->curchunk = iter->curchunk->next;
                iter->curindex = 0;
        }
-       
+
        return ret;
 }
 
 void *BLI_mempool_iterstep(BLI_mempool_iter *iter)
 {
        BLI_freenode *ret;
-       
+
        do {
                ret = bli_mempool_iternext(iter);
-       } while (ret && ret->freeword == FREEWORD);
-       
+       }while (ret && ret->freeword == FREEWORD);
+
        return ret;
 }
 
@@ -383,7 +385,7 @@ void *BLI_mempool_iterstep(BLI_mempool_iter *iter)
                        iter->curchunk = iter->curchunk->next;
                }
        } while (ret->freeword == FREEWORD);
-       
+
        return ret;
 }
 
index 6436afe..bedae13 100644 (file)
 
 /* path/file handeling stuff */
 #ifndef WIN32
-  #include <dirent.h>
-  #include <unistd.h>
+#  include <dirent.h>
+#  include <unistd.h>
 #else
-  #include <io.h>
-  #include "BLI_winstuff.h"
+#  include <io.h>
+#  include "BLI_winstuff.h"
 #endif
 
 #include "MEM_guardedalloc.h"
@@ -82,7 +82,7 @@
 
 static int checkMissingFiles_visit_cb(void *userdata, char *UNUSED(path_dst), const char *path_src)
 {
-       ReportList *reports= (ReportList *)userdata;
+       ReportList *reports = (ReportList *)userdata;
 
        if (!BLI_exists(path_src)) {
                BKE_reportf(reports, RPT_WARNING, "Path Not Found \"%s\"", path_src);
@@ -97,8 +97,7 @@ void checkMissingFiles(Main *bmain, ReportList *reports)
        bpath_traverse_main(bmain, checkMissingFiles_visit_cb, BPATH_TRAVERSE_ABS, reports);
 }
 
-typedef struct BPathRemap_Data
-{
+typedef struct BPathRemap_Data {
        const char *basedir;
        ReportList *reports;
 
@@ -109,17 +108,17 @@ typedef struct BPathRemap_Data
 
 static int makeFilesRelative_visit_cb(void *userdata, char *path_dst, const char *path_src)
 {
-       BPathRemap_Data *data= (BPathRemap_Data *)userdata;
+       BPathRemap_Data *data = (BPathRemap_Data *)userdata;
 
        data->count_tot++;
 
-       if(strncmp(path_src, "//", 2)==0) {
+       if (strncmp(path_src, "//", 2) == 0) {
                return FALSE; /* already relative */
        }
        else {
                strcpy(path_dst, path_src);
                BLI_path_rel(path_dst, data->basedir);
-               if (strncmp(path_dst, "//", 2)==0) {
+               if (strncmp(path_dst, "//", 2) == 0) {
                        data->count_changed++;
                }
                else {
@@ -132,15 +131,15 @@ static int makeFilesRelative_visit_cb(void *userdata, char *path_dst, const char
 
 void makeFilesRelative(Main *bmain, const char *basedir, ReportList *reports)
 {
-       BPathRemap_Data data= {NULL};
+       BPathRemap_Data data = {NULL};
 
-       if(basedir[0] == '\0') {
+       if (basedir[0] == '\0') {
                printf("%s: basedir='', this is a bug\n", __func__);
                return;
        }
 
-       data.basedir= basedir;
-       data.reports= reports;
+       data.basedir = basedir;
+       data.reports = reports;
 
        bpath_traverse_main(bmain, makeFilesRelative_visit_cb, 0, (void *)&data);
 
@@ -151,17 +150,17 @@ void makeFilesRelative(Main *bmain, const char *basedir, ReportList *reports)
 
 static int makeFilesAbsolute_visit_cb(void *userdata, char *path_dst, const char *path_src)
 {
-       BPathRemap_Data *data= (BPathRemap_Data *)userdata;
+       BPathRemap_Data *data = (BPathRemap_Data *)userdata;
 
        data->count_tot++;
 
-       if(strncmp(path_src, "//", 2)!=0) {
+       if (strncmp(path_src, "//", 2) != 0) {
                return FALSE; /* already absolute */
        }
        else {
                strcpy(path_dst, path_src);
                BLI_path_abs(path_dst, data->basedir);
-               if (strncmp(path_dst, "//", 2)!=0) {
+               if (strncmp(path_dst, "//", 2) != 0) {
                        data->count_changed++;
                }
                else {
@@ -175,15 +174,15 @@ static int makeFilesAbsolute_visit_cb(void *userdata, char *path_dst, const char
 /* similar to makeFilesRelative - keep in sync! */
 void makeFilesAbsolute(Main *bmain, const char *basedir, ReportList *reports)
 {
-       BPathRemap_Data data= {NULL};
+       BPathRemap_Data data = {NULL};
 
-       if(basedir[0] == '\0') {
+       if (basedir[0] == '\0') {
                printf("%s: basedir='', this is a bug\n", __func__);
                return;
        }
 
-       data.basedir= basedir;
-       data.reports= reports;
+       data.basedir = basedir;
+       data.reports = reports;
 
        bpath_traverse_main(bmain, makeFilesAbsolute_visit_cb, 0, (void *)&data);
 
@@ -192,7 +191,6 @@ void makeFilesAbsolute(Main *bmain, const char *basedir, ReportList *reports)
                    data.count_tot, data.count_changed, data.count_failed);
 }
 
-
 /* find this file recursively, use the biggest file so thumbnails dont get used by mistake
  * - dir: subdir to search
  * - filename: set this filename
@@ -217,17 +215,17 @@ static int findFileRecursive(char *filename_new,
 
        filename_new[0] = '\0';
 
-       dir= opendir(dirname);
+       dir = opendir(dirname);
 
-       if (dir==NULL)
+       if (dir == NULL)
                return found;
 
        if (*filesize == -1)
-               *filesize= 0; /* dir opened fine */
+               *filesize = 0; /* dir opened fine */
 
-       while ((de= readdir(dir)) != NULL) {
+       while ((de = readdir(dir)) != NULL) {
 
-               if (strcmp(".", de->d_name)==0 || strcmp("..", de->d_name)==0)
+               if (strcmp(".", de->d_name) == 0 || strcmp("..", de->d_name) == 0)
                        continue;
 
                BLI_join_dirfile(path, sizeof(path), dirname, de->d_name);
@@ -236,11 +234,11 @@ static int findFileRecursive(char *filename_new,
                        continue; /* cant stat, dont bother with this file, could print debug info here */
 
                if (S_ISREG(status.st_mode)) { /* is file */
-                       if (strncmp(filename, de->d_name, FILE_MAX)==0) { /* name matches */
+                       if (strncmp(filename, de->d_name, FILE_MAX) == 0) { /* name matches */
                                /* open the file to read its size */
-                               size= status.st_size;
+                               size = status.st_size;
                                if ((size > 0) && (size > *filesize)) { /* find the biggest file */
-                                       *filesize= size;
+                                       *filesize = size;
                                        BLI_strncpy(filename_new, path, FILE_MAX);
                                        found = TRUE;
                                }
@@ -258,8 +256,7 @@ static int findFileRecursive(char *filename_new,
        return found;
 }
 
-typedef struct BPathFind_Data
-{
+typedef struct BPathFind_Data {
        const char *basedir;
        char searchdir[FILE_MAX];
        ReportList *reports;
@@ -267,11 +264,11 @@ typedef struct BPathFind_Data
 
 static int findMissingFiles_visit_cb(void *userdata, char *path_dst, const char *path_src)
 {
-       BPathFind_Data *data= (BPathFind_Data *)userdata;
+       BPathFind_Data *data = (BPathFind_Data *)userdata;
        char filename_new[FILE_MAX];
 
-       int filesize= -1;
-       int recur_depth= 0;
+       int filesize = -1;
+       int recur_depth = 0;
        int found;
 
        found = findFileRecursive(filename_new,
@@ -298,9 +295,9 @@ static int findMissingFiles_visit_cb(void *userdata, char *path_dst, const char
 
 void findMissingFiles(Main *bmain, const char *searchpath, ReportList *reports)
 {
-       struct BPathFind_Data data= {NULL};
+       struct BPathFind_Data data = {NULL};
 
-       data.reports= reports;
+       data.reports = reports;
        BLI_split_dir_part(searchpath, data.searchdir, sizeof(data.searchdir));
 
        bpath_traverse_main(bmain, findMissingFiles_visit_cb, 0, (void *)&data);
@@ -316,10 +313,10 @@ static int rewrite_path_fixed(char *path, BPathVisitor visit_cb, const char *abs
        if (absbase) {
                BLI_strncpy(path_src_buf, path, sizeof(path_src_buf));
                BLI_path_abs(path_src_buf, absbase);
-               path_src= path_src_buf;
+               path_src = path_src_buf;
        }
        else {
-               path_src= path;
+               path_src = path;
        }
 
        if (visit_cb(userdata, path_dst, path_src)) {
@@ -364,15 +361,15 @@ static int rewrite_path_alloc(char **path, BPathVisitor visit_cb, const char *ab
        if (absbase) {
                BLI_strncpy(path_src_buf, *path, sizeof(path_src_buf));
                BLI_path_abs(path_src_buf, absbase);
-               path_src= path_src_buf;
+               path_src = path_src_buf;
        }
        else {
-               path_src= *path;
+               path_src = *path;
        }
 
        if (visit_cb(userdata, path_dst, path_src)) {
                MEM_freeN((*path));
-               (*path)= BLI_strdup(path_dst);
+               (*path) = BLI_strdup(path_dst);
                return TRUE;
        }
        else {
@@ -384,7 +381,7 @@ static int rewrite_path_alloc(char **path, BPathVisitor visit_cb, const char *ab
 void bpath_traverse_id(Main *bmain, ID *id, BPathVisitor visit_cb, const int flag, void *bpath_user_data)
 {
        Image *ima;
-       const char *absbase= (flag & BPATH_TRAVERSE_ABS) ? ID_BLEND_PATH(bmain, id) : NULL;
+       const char *absbase = (flag & BPATH_TRAVERSE_ABS) ? ID_BLEND_PATH(bmain, id) : NULL;
 
        if ((flag & BPATH_TRAVERSE_SKIP_LIBRARY) && id->lib) {
                return;
@@ -428,7 +425,6 @@ void bpath_traverse_id(Main *bmain, ID *id, BPathVisitor visit_cb, const int fla
                        ModifierData *md;
                        ParticleSystem *psys;
 
-
                        /* do via modifiers instead */
 #if 0
                        if (ob->fluidsimSettings) {
@@ -581,7 +577,7 @@ void bpath_traverse_id(Main *bmain, ID *id, BPathVisitor visit_cb, const int fla
 void bpath_traverse_id_list(Main *bmain, ListBase *lb, BPathVisitor visit_cb, const int flag, void *bpath_user_data)
 {
        ID *id;
-       for(id= lb->first; id; id= id->next) {
+       for (id = lb->first; id; id = id->next) {
                bpath_traverse_id(bmain, id, visit_cb, flag, bpath_user_data);
        }
 }
@@ -589,8 +585,10 @@ void bpath_traverse_id_list(Main *bmain, ListBase *lb, BPathVisitor visit_cb, co
 void bpath_traverse_main(Main *bmain, BPathVisitor visit_cb, const int flag, void *bpath_user_data)
 {
        ListBase *lbarray[MAX_LIBARRAY];
-       int a= set_listbasepointers(bmain, lbarray);
-       while(a--) bpath_traverse_id_list(bmain, lbarray[a], visit_cb, flag, bpath_user_data);
+       int a = set_listbasepointers(bmain, lbarray);
+       while (a--) {
+               bpath_traverse_id_list(bmain, lbarray[a], visit_cb, flag, bpath_user_data);
+       }
 }
 
 /* Rewrites a relative path to be relative to the main file - unless the path is
@@ -599,8 +597,8 @@ int bpath_relocate_visitor(void *pathbase_v, char *path_dst, const char *path_sr
 {
        /* be sure there is low chance of the path being too short */
        char filepath[(FILE_MAXDIR * 2) + FILE_MAXFILE];
-       const char *base_new= ((char **)pathbase_v)[0];
-       const char *base_old= ((char **)pathbase_v)[1];
+       const char *base_new = ((char **)pathbase_v)[0];
+       const char *base_old = ((char **)pathbase_v)[1];
 
        if (strncmp(base_old, "//", 2) == 0) {
                printf("%s: error, old base path '%s' is not absolute.\n",
index 56998cf..baf52d9 100644 (file)
@@ -101,7 +101,7 @@ static strCursorDelimType test_special_char(const char ch)
                case ':':
                case ';':
                case '?':
-               /* case '_': */ /* special case, for python */
+                       /* case '_': *//* special case, for python */
                        return STRCUR_DELIM_OTHER;
 
                default:
@@ -112,12 +112,14 @@ static strCursorDelimType test_special_char(const char ch)
 
 int BLI_str_cursor_step_next_utf8(const char *str, size_t maxlen, int *pos)
 {
-       const char *str_end= str + (maxlen + 1);
-       const char *str_pos= str + (*pos);
-       const char *str_next= BLI_str_find_next_char_utf8(str_pos, str_end);
+       const char *str_end = str + (maxlen + 1);
+       const char *str_pos = str + (*pos);
+       const char *str_next = BLI_str_find_next_char_utf8(str_pos, str_end);
        if (str_next) {
                (*pos) += (str_next - str_pos);
-               if((*pos) > maxlen) (*pos)= maxlen;
+               if ((*pos) > maxlen) {
+                       (*pos) = maxlen;
+               }
                return TRUE;
        }
 
@@ -126,9 +128,9 @@ int BLI_str_cursor_step_next_utf8(const char *str, size_t maxlen, int *pos)
 
 int BLI_str_cursor_step_prev_utf8(const char *str, size_t UNUSED(maxlen), int *pos)
 {
-       if((*pos) > 0) {
-               const char *str_pos= str + (*pos);
-               const char *str_prev= BLI_str_find_prev_char_utf8(str, str_pos);
+       if ((*pos) > 0) {
+               const char *str_pos = str + (*pos);
+               const char *str_prev = BLI_str_find_prev_char_utf8(str, str_pos);
                if (str_prev) {
                        (*pos) -= (str_pos - str_prev);
                        return TRUE;
@@ -142,19 +144,20 @@ void BLI_str_cursor_step_utf8(const char *str, size_t maxlen,
                               int *pos, strCursorJumpDirection direction,
                               strCursorJumpType jump)
 {
-       const short pos_prev= *pos;
+       const short pos_prev = *pos;
 
        if (direction == STRCUR_DIR_NEXT) {
                BLI_str_cursor_step_next_utf8(str, maxlen, pos);
 
                if (jump != STRCUR_JUMP_NONE) {
-                       const strCursorDelimType is_special= (*pos) < maxlen ? test_special_char(str[(*pos)]) : STRCUR_DELIM_NONE;
+                       const strCursorDelimType is_special = (*pos) < maxlen ? test_special_char(str[(*pos)]) : STRCUR_DELIM_NONE;
                        /* jump between special characters (/,\,_,-, etc.),
                         * look at function test_special_char() for complete
                         * list of special character, ctr -> */
                        while ((*pos) < maxlen) {
                                if (BLI_str_cursor_step_next_utf8(str, maxlen, pos)) {
-                                       if ((jump != STRCUR_JUMP_ALL) && (is_special != test_special_char(str[(*pos)]))) break;
+                                       if ((jump != STRCUR_JUMP_ALL) && (is_special != test_special_char(str[(*pos)])))
+                                               break;
                                }
                                else {
                                        break; /* unlikely but just in case */
@@ -165,14 +168,15 @@ void BLI_str_cursor_step_utf8(const char *str, size_t maxlen,
        else if (direction == STRCUR_DIR_PREV) {
                BLI_str_cursor_step_prev_utf8(str, maxlen, pos);
 
-               if(jump != STRCUR_JUMP_NONE) {
-                       const strCursorDelimType is_special= (*pos) > 1 ? test_special_char(str[(*pos) - 1]) : STRCUR_DELIM_NONE;
+               if (jump != STRCUR_JUMP_NONE) {
+                       const strCursorDelimType is_special = (*pos) > 1 ? test_special_char(str[(*pos) - 1]) : STRCUR_DELIM_NONE;
                        /* jump between special characters (/,\,_,-, etc.),
                         * look at function test_special_char() for complete
                         * list of special character, ctr -> */
                        while ((*pos) > 0) {
                                if (BLI_str_cursor_step_prev_utf8(str, maxlen, pos)) {
-                                       if ((jump != STRCUR_JUMP_ALL) && (is_special != test_special_char(str[(*pos)]))) break;
+                                       if ((jump != STRCUR_JUMP_ALL) && (is_special != test_special_char(str[(*pos)])))
+                                               break;
                                }
                                else {
                                        break;
index 8b00d8e..89621cd 100644 (file)
@@ -22,7 +22,6 @@
  *  \ingroup bli
  */
 
-
 #include <math.h>
 
 #include "MEM_guardedalloc.h"
@@ -48,45 +47,46 @@ void project_from_camera(float target[2], float source[3], UvCameraInfo *uci)
        float pv4[4];
 
        copy_v3_v3(pv4, source);
-       pv4[3]= 1.0;
+       pv4[3] = 1.0;
 
        /* rotmat is the object matrix in this case */
-       if(uci->do_rotmat)
+       if (uci->do_rotmat)
                mul_m4_v4(uci->rotmat, pv4);
 
        /* caminv is the inverse camera matrix */
        mul_m4_v4(uci->caminv, pv4);
 
-       if(uci->do_pano) {
-               float angle= atan2f(pv4[0], -pv4[2]) / ((float)M_PI * 2.0f); /* angle around the camera */
-               if (uci->do_persp==0) {
-                       target[0]= angle; /* no correct method here, just map to  0-1 */
-                       target[1]= pv4[1] / uci->camsize;
+       if (uci->do_pano) {
+               float angle = atan2f(pv4[0], -pv4[2]) / ((float)M_PI * 2.0f); /* angle around the camera */
+               if (uci->do_persp == 0) {
+                       target[0] = angle; /* no correct method here, just map to  0-1 */
+                       target[1] = pv4[1] / uci->camsize;
                }
                else {
                        float vec2d[2]; /* 2D position from the camera */
-                       vec2d[0]= pv4[0];
-                       vec2d[1]= pv4[2];
-                       target[0]= angle * ((float)M_PI / uci->camangle);
-                       target[1]= pv4[1] / (len_v2(vec2d) * (uci->camsize * 2.0f));
+                       vec2d[0] = pv4[0];
+                       vec2d[1] = pv4[2];
+                       target[0] = angle * ((float)M_PI / uci->camangle);
+                       target[1] = pv4[1] / (len_v2(vec2d) * (uci->camsize * 2.0f));
                }
        }
        else {
-               if (pv4[2]==0.0f) pv4[2]= 0.00001f; /* don't allow div by 0 */
+               if (pv4[2] == 0.0f)
+                       pv4[2] = 0.00001f; /* don't allow div by 0 */
 
-               if (uci->do_persp==0) {
-                       target[0]= (pv4[0]/uci->camsize);
-                       target[1]= (pv4[1]/uci->camsize);
+               if (uci->do_persp == 0) {
+                       target[0] = (pv4[0] / uci->camsize);
+                       target[1] = (pv4[1] / uci->camsize);
                }
                else {
-                       target[0]= (-pv4[0]*((1.0f/uci->camsize)/pv4[2])) / 2.0f;
-                       target[1]= (-pv4[1]*((1.0f/uci->camsize)/pv4[2])) / 2.0f;
+                       target[0] = (-pv4[0] * ((1.0f / uci->camsize) / pv4[2])) / 2.0f;
+                       target[1] = (-pv4[1] * ((1.0f / uci->camsize) / pv4[2])) / 2.0f;
                }
        }
 
        target[0] *= uci->xasp;
        target[1] *= uci->yasp;
-       
+
        /* adds camera shift + 0.5 */
        target[0] += uci->shiftx;
        target[1] += uci->shifty;
@@ -95,54 +95,54 @@ void project_from_camera(float target[2], float source[3], UvCameraInfo *uci)
 /* could rv3d->persmat */
 void project_from_view(float target[2], float source[3], float persmat[4][4], float rotmat[4][4], float winx, float winy)
 {
-       float pv[3], pv4[4], x= 0.0, y= 0.0;
+       float pv[3], pv4[4], x = 0.0, y = 0.0;
 
        mul_v3_m4v3(pv, rotmat, source);
 
        copy_v3_v3(pv4, source);
-       pv4[3]= 1.0;
+       pv4[3] = 1.0;
 
        /* rotmat is the object matrix in this case */
-       mul_m4_v4(rotmat, pv4); 
+       mul_m4_v4(rotmat, pv4);
 
        /* almost project_short */
        mul_m4_v4(persmat, pv4);
-       if(fabsf(pv4[3]) > 0.00001f) { /* avoid division by zero */
-               target[0] = winx/2.0f + (winx/2.0f) * pv4[0] / pv4[3];
-               target[1] = winy/2.0f + (winy/2.0f) * pv4[1] / pv4[3];
+       if (fabsf(pv4[3]) > 0.00001f) { /* avoid division by zero */
+               target[0] = winx / 2.0f + (winx / 2.0f) * pv4[0] / pv4[3];
+               target[1] = winy / 2.0f + (winy / 2.0f) * pv4[1] / pv4[3];
        }
        else {
                /* scaling is lost but give a valid result */
-               target[0] = winx/2.0f + (winx/2.0f) * pv4[0];
-               target[1] = winy/2.0f + (winy/2.0f) * pv4[1];
+               target[0] = winx / 2.0f + (winx / 2.0f) * pv4[0];
+               target[1] = winy / 2.0f + (winy / 2.0f) * pv4[1];
        }
 
-       /* v3d->persmat seems to do this funky scaling */ 
-       if(winx > winy) {
-               y= (winx - winy)/2.0f;
+       /* v3d->persmat seems to do this funky scaling */
+       if (winx > winy) {
+               y = (winx - winy) / 2.0f;
                winy = winx;
        }
        else {
-               x= (winy - winx)/2.0f;
+               x = (winy - winx) / 2.0f;
                winx = winy;
        }
 
-       target[0]= (x + target[0]) / winx;
-       target[1]= (y + target[1]) / winy;
+       target[0] = (x + target[0]) / winx;
+       target[1] = (y + target[1]) / winy;
 }
 
 /* 'rotmat' can be obedit->obmat when uv project is used.
- * 'winx' and 'winy' can be from scene->r.xsch/ysch */ 
-UvCameraInfo *project_camera_info(Object *ob, float (*rotmat)[4], float winx, float winy)
+ * 'winx' and 'winy' can be from scene->r.xsch/ysch */
+UvCameraInfo *project_camera_info(Object *ob, float(*rotmat)[4], float winx, float winy)
 {
        UvCameraInfo uci;
-       Camera *camera= ob->data;
+       Camera *camera = ob->data;
 
        uci.do_pano = (camera->flag & CAM_PANORAMA);
-       uci.do_persp = (camera->type==CAM_PERSP);
+       uci.do_persp = (camera->type == CAM_PERSP);
 
-       uci.camangle= focallength_to_fov(camera->lens, camera->sensor_x) / 2.0f;
-       uci.camsize= uci.do_persp ? tanf(uci.camangle) : camera->ortho_scale;
+       uci.camangle = focallength_to_fov(camera->lens, camera->sensor_x) / 2.0f;
+       uci.camsize = uci.do_persp ? tanf(uci.camangle) : camera->ortho_scale;
 
        /* account for scaled cameras */
        copy_m4_m4(uci.caminv, ob->obmat);
@@ -152,30 +152,30 @@ UvCameraInfo *project_camera_info(Object *ob, float (*rotmat)[4], float winx, fl
                UvCameraInfo *uci_pt;
 
                /* normal projection */
-               if(rotmat) {
+               if (rotmat) {
                        copy_m4_m4(uci.rotmat, rotmat);
-                       uci.do_rotmat= 1;
+                       uci.do_rotmat = 1;
                }
                else {
-                       uci.do_rotmat= 0;
+                       uci.do_rotmat = 0;
                }
 
                /* also make aspect ratio adjustment factors */
                if (winx > winy) {
-                       uci.xasp= 1.0f;
-                       uci.yasp= winx / winy;
+                       uci.xasp = 1.0f;
+                       uci.yasp = winx / winy;
                }
                else {
-                       uci.xasp= winy / winx;
-                       uci.yasp= 1.0f;
+                       uci.xasp = winy / winx;
+                       uci.yasp = 1.0f;
                }
-               
+
                /* include 0.5f here to move the UVs into the center */
                uci.shiftx = 0.5f - (camera->shiftx * uci.xasp);
                uci.shifty = 0.5f - (camera->shifty * uci.yasp);
-               
-               uci_pt= MEM_mallocN(sizeof(UvCameraInfo), "UvCameraInfo");
-               *uci_pt= uci;
+
+               uci_pt = MEM_mallocN(sizeof(UvCameraInfo), "UvCameraInfo");
+               *uci_pt = uci;
                return uci_pt;
        }
 
@@ -193,7 +193,6 @@ void project_from_view_ortho(float target[2], float source[3], float rotmat[4][4
        target[1] = pv[2];
 }
 
-
 void project_camera_info_scale(UvCameraInfo *uci, float scale_x, float scale_y)
 {
        uci->xasp *= scale_x;
index dcd89a5..11f4ec5 100644 (file)
@@ -477,7 +477,6 @@ void vpaint_fill(Object *ob, unsigned int paintcol)
        selected= (me->editflag & ME_EDIT_PAINT_MASK);
 
        mp = me->mpoly;
-       lcol = me->mloopcol;
        for (i=0; i<me->totpoly; i++, mp++) {
                if (!(!selected || mp->flag & ME_FACE_SEL))
                        continue;
@@ -3062,4 +3061,3 @@ void PAINT_OT_weight_from_bones(wmOperatorType *ot)
        /* properties */
        ot->prop= RNA_def_enum(ot->srna, "type", type_items, 0, "Type", "Method to use for assigning weights");
 }
-