diff options
Diffstat (limited to 'source/blender/blenlib/intern')
-rw-r--r-- | source/blender/blenlib/intern/BLI_ghash.c | 2 | ||||
-rw-r--r-- | source/blender/blenlib/intern/BLI_kdopbvh.c | 8 | ||||
-rw-r--r-- | source/blender/blenlib/intern/BLI_mempool.c | 187 | ||||
-rw-r--r-- | source/blender/blenlib/intern/DLRB_tree.c | 2 | ||||
-rw-r--r-- | source/blender/blenlib/intern/boxpack2d.c | 2 | ||||
-rw-r--r-- | source/blender/blenlib/intern/edgehash.c | 2 | ||||
-rw-r--r-- | source/blender/blenlib/intern/fileops.c | 2 | ||||
-rw-r--r-- | source/blender/blenlib/intern/math_geom.c | 2 | ||||
-rw-r--r-- | source/blender/blenlib/intern/math_matrix.c | 6 | ||||
-rw-r--r-- | source/blender/blenlib/intern/path_util.c | 18 | ||||
-rw-r--r-- | source/blender/blenlib/intern/string.c | 6 | ||||
-rw-r--r-- | source/blender/blenlib/intern/string_utf8.c | 6 | ||||
-rw-r--r-- | source/blender/blenlib/intern/voxel.c | 2 |
13 files changed, 146 insertions, 99 deletions
diff --git a/source/blender/blenlib/intern/BLI_ghash.c b/source/blender/blenlib/intern/BLI_ghash.c index 943b67cce8e..b05a1c00d0f 100644 --- a/source/blender/blenlib/intern/BLI_ghash.c +++ b/source/blender/blenlib/intern/BLI_ghash.c @@ -61,7 +61,7 @@ GHash *BLI_ghash_new(GHashHashFP hashfp, GHashCmpFP cmpfp, const char *info) GHash *gh= MEM_mallocN(sizeof(*gh), info); gh->hashfp= hashfp; gh->cmpfp= cmpfp; - gh->entrypool = BLI_mempool_create(sizeof(Entry), 64, 64, FALSE, FALSE); + gh->entrypool = BLI_mempool_create(sizeof(Entry), 64, 64, 0); gh->cursize= 0; gh->nentries= 0; diff --git a/source/blender/blenlib/intern/BLI_kdopbvh.c b/source/blender/blenlib/intern/BLI_kdopbvh.c index f01777bdce1..afc8a6a4aa6 100644 --- a/source/blender/blenlib/intern/BLI_kdopbvh.c +++ b/source/blender/blenlib/intern/BLI_kdopbvh.c @@ -656,14 +656,14 @@ static int implicit_leafs_index(BVHBuildHelper *data, int depth, int child_index * Its possible to find the position of the child or the parent with simple maths (multiplication and adittion). This type * of tree is for example used on heaps.. where node N has its childs at indexs N*2 and N*2+1. * - * Altought in this case the tree type is general.. and not know until runtime. + * Although in this case the tree type is general.. and not know until runtime. * tree_type stands for the maximum number of childs that a tree node can have. * All tree types >= 2 are supported. * * Advantages of the used trees include: * - No need to store child/parent relations (they are implicit); * - Any node child always has an index greater than the parent; - * - Brother nodes are sequencial in memory; + * - Brother nodes are sequential in memory; * * * Some math relations derived for general implicit trees: @@ -688,7 +688,7 @@ static int implicit_needed_branches(int tree_type, int leafs) * * It arranges the elements in the given partitions such that: * - any element in partition N is less or equal to any element in partition N+1. - * - if all elements are diferent all partition will get the same subset of elements + * - if all elements are different all partition will get the same subset of elements * as if the array was sorted. * * partition P is described as the elements in the range ( nth[P] , nth[P+1] ] @@ -721,7 +721,7 @@ static void split_leafs(BVHNode **leafs_array, int *nth, int partitions, int spl * to use multithread building. * * To archieve this is necessary to find how much leafs are accessible from a certain branch, BVHBuildHelper - * implicit_needed_branches and implicit_leafs_index are auxiliar functions to solve that "optimal-split". + * implicit_needed_branches and implicit_leafs_index are auxiliary functions to solve that "optimal-split". */ static void non_recursive_bvh_div_nodes(BVHTree *tree, BVHNode *branches_array, BVHNode **leafs_array, int num_leafs) { diff --git a/source/blender/blenlib/intern/BLI_mempool.c b/source/blender/blenlib/intern/BLI_mempool.c index aac36e5b79b..d5df882ba29 100644 --- a/source/blender/blenlib/intern/BLI_mempool.c +++ b/source/blender/blenlib/intern/BLI_mempool.c @@ -71,120 +71,159 @@ struct BLI_mempool { int esize; /* element size in bytes */ int csize; /* chunk size in bytes */ int pchunk; /* number of elements per chunk */ - short use_sysmalloc, allow_iter; + int flag; /* keeps aligned to 16 bits */ - BLI_freenode *free; /* free element list. Interleaved into chunk datas.*/ - int totalloc, totused; /* total number of elements allocated in total, - * and currently in use*/ + BLI_freenode *free; /* free element list. Interleaved into chunk datas. */ + int totalloc, totused; /* total number of elements allocated in total, + * and currently in use */ }; #define MEMPOOL_ELEM_SIZE_MIN (sizeof(void *) * 2) -BLI_mempool *BLI_mempool_create(int esize, int tote, int pchunk, - short use_sysmalloc, short allow_iter) +BLI_mempool *BLI_mempool_create(int esize, int totelem, int pchunk, int flag) { BLI_mempool *pool = NULL; BLI_freenode *lasttail = NULL, *curnode = NULL; int i,j, maxchunks; char *addr; - if (esize < MEMPOOL_ELEM_SIZE_MIN) + /* allocate the pool structure */ + if (flag & BLI_MEMPOOL_SYSMALLOC) { + pool = malloc(sizeof(BLI_mempool)); + } + else { + pool = MEM_mallocN(sizeof(BLI_mempool), "memory pool"); + } + + /* set the elem size */ + if (esize < MEMPOOL_ELEM_SIZE_MIN) { esize = MEMPOOL_ELEM_SIZE_MIN; + } + + if (flag & BLI_MEMPOOL_ALLOW_ITER) { + pool->esize = MAX2(esize, sizeof(BLI_freenode)); + } + else { + pool->esize = esize; + } - /*allocate the pool structure*/ - pool = use_sysmalloc ? malloc(sizeof(BLI_mempool)) : MEM_mallocN(sizeof(BLI_mempool), "memory pool"); - pool->esize = allow_iter ? MAX2(esize, sizeof(BLI_freenode)) : esize; - pool->use_sysmalloc = use_sysmalloc; + pool->flag = flag; pool->pchunk = pchunk; pool->csize = esize * pchunk; pool->chunks.first = pool->chunks.last = NULL; - pool->totused= 0; - pool->allow_iter= allow_iter; + pool->totused = 0; - maxchunks = tote / pchunk + 1; - if (maxchunks==0) maxchunks = 1; + maxchunks = totelem / pchunk + 1; + if (maxchunks == 0) { + maxchunks = 1; + } + + /* allocate the actual chunks */ + for (i = 0; i < maxchunks; i++) { + BLI_mempool_chunk *mpchunk; + + if (flag & BLI_MEMPOOL_SYSMALLOC) { + mpchunk = malloc(sizeof(BLI_mempool_chunk)); + mpchunk->data = malloc(pool->csize); + } + else { + mpchunk = MEM_mallocN(sizeof(BLI_mempool_chunk), "BLI_Mempool Chunk"); + mpchunk->data = MEM_mallocN(pool->csize, "BLI Mempool Chunk Data"); + } - /*allocate the actual chunks*/ - for (i=0; i < maxchunks; i++) { - BLI_mempool_chunk *mpchunk = use_sysmalloc ? malloc(sizeof(BLI_mempool_chunk)) : MEM_mallocN(sizeof(BLI_mempool_chunk), "BLI_Mempool Chunk"); mpchunk->next = mpchunk->prev = NULL; - mpchunk->data = use_sysmalloc ? malloc(pool->csize) : MEM_mallocN(pool->csize, "BLI Mempool Chunk Data"); BLI_addtail(&(pool->chunks), mpchunk); - if (i==0) { - pool->free = mpchunk->data; /*start of the list*/ - if (pool->allow_iter) + if (i == 0) { + pool->free = mpchunk->data; /* start of the list */ + if (pool->flag & BLI_MEMPOOL_ALLOW_ITER) { pool->free->freeword = FREEWORD; + } } - /*loop through the allocated data, building the pointer structures*/ - for (addr = mpchunk->data, j=0; j < pool->pchunk; j++) { - curnode = ((BLI_freenode*)addr); + /* loop through the allocated data, building the pointer structures */ + for (addr = mpchunk->data, j = 0; j < pool->pchunk; j++) { + curnode = ((BLI_freenode *)addr); addr += pool->esize; - curnode->next = (BLI_freenode*)addr; - if (pool->allow_iter) { - if (j != pool->pchunk-1) + curnode->next = (BLI_freenode *)addr; + if (pool->flag & BLI_MEMPOOL_ALLOW_ITER) { + if (j != pool->pchunk - 1) curnode->next->freeword = FREEWORD; curnode->freeword = FREEWORD; } } - /*final pointer in the previously allocated chunk is wrong.*/ + /* final pointer in the previously allocated chunk is wrong */ if (lasttail) { lasttail->next = mpchunk->data; - if (pool->allow_iter) + if (pool->flag & BLI_MEMPOOL_ALLOW_ITER) { lasttail->freeword = FREEWORD; + } } - /*set the end of this chunks memoryy to the new tail for next iteration*/ + /* set the end of this chunks memoryy to the new tail for next iteration */ lasttail = curnode; pool->totalloc += pool->pchunk; } - /*terminate the list*/ + /* terminate the list */ curnode->next = NULL; return pool; } void *BLI_mempool_alloc(BLI_mempool *pool) { - void *retval=NULL; + void *retval = NULL; pool->totused++; if (!(pool->free)) { - BLI_freenode *curnode=NULL; + BLI_freenode *curnode = NULL; char *addr; int j; - /*need to allocate a new chunk*/ - BLI_mempool_chunk *mpchunk = pool->use_sysmalloc ? malloc(sizeof(BLI_mempool_chunk)) : MEM_mallocN(sizeof(BLI_mempool_chunk), "BLI_Mempool Chunk"); + /* need to allocate a new chunk */ + BLI_mempool_chunk *mpchunk; + + if (pool->flag & BLI_MEMPOOL_SYSMALLOC) { + mpchunk = malloc(sizeof(BLI_mempool_chunk)); + mpchunk->data = malloc(pool->csize); + } + else { + 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; - mpchunk->data = pool->use_sysmalloc ? malloc(pool->csize) : MEM_mallocN(pool->csize, "BLI_Mempool Chunk Data"); BLI_addtail(&(pool->chunks), mpchunk); - pool->free = mpchunk->data; /*start of the list*/ - if (pool->allow_iter) + pool->free = mpchunk->data; /* start of the list */ + + if (pool->flag & BLI_MEMPOOL_ALLOW_ITER) { pool->free->freeword = FREEWORD; - for(addr = mpchunk->data, j=0; j < pool->pchunk; j++) { - curnode = ((BLI_freenode*)addr); + } + + for (addr = mpchunk->data, j = 0; j < pool->pchunk; j++) { + curnode = ((BLI_freenode *)addr); addr += pool->esize; - curnode->next = (BLI_freenode*)addr; + curnode->next = (BLI_freenode *)addr; - if (pool->allow_iter) { + if (pool->flag & BLI_MEMPOOL_ALLOW_ITER) { curnode->freeword = FREEWORD; - if (j != pool->pchunk-1) + if (j != pool->pchunk - 1) curnode->next->freeword = FREEWORD; } } - curnode->next = NULL; /*terminate the list*/ + curnode->next = NULL; /* terminate the list */ pool->totalloc += pool->pchunk; } retval = pool->free; - if (pool->allow_iter) + + if (pool->flag & BLI_MEMPOOL_ALLOW_ITER) { pool->free->freeword = 0x7FFFFFFF; + } pool->free = pool->free->next; //memset(retval, 0, pool->esize); @@ -193,7 +232,7 @@ void *BLI_mempool_alloc(BLI_mempool *pool) void *BLI_mempool_calloc(BLI_mempool *pool) { - void *retval= BLI_mempool_alloc(pool); + void *retval = BLI_mempool_alloc(pool); memset(retval, 0, pool->esize); return retval; } @@ -203,41 +242,49 @@ void BLI_mempool_free(BLI_mempool *pool, void *addr) { BLI_freenode *newhead = addr; - if (pool->allow_iter) + if (pool->flag & BLI_MEMPOOL_ALLOW_ITER) { newhead->freeword = FREEWORD; + } + newhead->next = pool->free; pool->free = newhead; pool->totused--; - /*nothing is in use; free all the chunks except the first*/ + /* nothing is in use; free all the chunks except the first */ if (pool->totused == 0) { - BLI_freenode *curnode=NULL; - char *tmpaddr=NULL; + BLI_freenode *curnode = NULL; + char *tmpaddr = NULL; int i; - BLI_mempool_chunk *mpchunk=NULL; - BLI_mempool_chunk *first= pool->chunks.first; + BLI_mempool_chunk *mpchunk = NULL; + BLI_mempool_chunk *first = pool->chunks.first; BLI_remlink(&pool->chunks, first); - for (mpchunk = pool->chunks.first; mpchunk; mpchunk = mpchunk->next) { - if (pool->use_sysmalloc) free(mpchunk->data); - else MEM_freeN(mpchunk->data); + if (pool->flag & BLI_MEMPOOL_SYSMALLOC) { + for (mpchunk = pool->chunks.first; mpchunk; mpchunk = mpchunk->next) { + free(mpchunk->data); + } + BLI_freelist(&(pool->chunks)); + } + else { + for (mpchunk = pool->chunks.first; mpchunk; mpchunk = mpchunk->next) { + MEM_freeN(mpchunk->data); + } + BLI_freelistN(&(pool->chunks)); } - pool->use_sysmalloc ? BLI_freelist(&(pool->chunks)) : BLI_freelistN(&(pool->chunks)); - BLI_addtail(&pool->chunks, first); pool->totalloc = pool->pchunk; - pool->free = first->data; /*start of the list*/ - for (tmpaddr = first->data, i=0; i < pool->pchunk; i++) { - curnode = ((BLI_freenode*)tmpaddr); + pool->free = first->data; /* start of the list */ + for (tmpaddr = first->data, i = 0; i < pool->pchunk; i++) { + curnode = ((BLI_freenode *)tmpaddr); tmpaddr += pool->esize; - curnode->next = (BLI_freenode*)tmpaddr; + curnode->next = (BLI_freenode *)tmpaddr; } - curnode->next = NULL; /*terminate the list*/ + curnode->next = NULL; /* terminate the list */ } } @@ -248,7 +295,7 @@ int BLI_mempool_count(BLI_mempool *pool) void *BLI_mempool_findelem(BLI_mempool *pool, int index) { - if (!pool->allow_iter) { + if (!(pool->flag & BLI_MEMPOOL_ALLOW_ITER)) { fprintf(stderr, "%s: Error! you can't iterate over this mempool!\n", __func__); return NULL; } @@ -257,7 +304,7 @@ 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)) { }; return elem; } @@ -266,7 +313,7 @@ void *BLI_mempool_findelem(BLI_mempool *pool, int index) void BLI_mempool_iternew(BLI_mempool *pool, BLI_mempool_iter *iter) { - if (!pool->allow_iter) { + if (!(pool->flag & BLI_MEMPOOL_ALLOW_ITER)) { fprintf(stderr, "%s: Error! you can't iterate over this mempool!\n", __func__); iter->curchunk = NULL; iter->curindex = 0; @@ -288,7 +335,7 @@ static void *bli_mempool_iternext(BLI_mempool_iter *iter) if (!iter->curchunk || !iter->pool->totused) return NULL; - ret = ((char*)iter->curchunk->data) + iter->pool->esize*iter->curindex; + ret = ((char *)iter->curchunk->data) + iter->pool->esize * iter->curindex; iter->curindex++; @@ -325,7 +372,7 @@ void *BLI_mempool_iterstep(BLI_mempool_iter *iter) do { if (LIKELY(iter->curchunk)) { - ret = (BLI_freenode *)(((char*)iter->curchunk->data) + iter->pool->esize*iter->curindex); + ret = (BLI_freenode *)(((char *)iter->curchunk->data) + iter->pool->esize * iter->curindex); } else { return NULL; @@ -344,9 +391,9 @@ void *BLI_mempool_iterstep(BLI_mempool_iter *iter) void BLI_mempool_destroy(BLI_mempool *pool) { - BLI_mempool_chunk *mpchunk=NULL; + BLI_mempool_chunk *mpchunk = NULL; - if (pool->use_sysmalloc) { + if (pool->flag & BLI_MEMPOOL_SYSMALLOC) { for (mpchunk = pool->chunks.first; mpchunk; mpchunk = mpchunk->next) { free(mpchunk->data); } diff --git a/source/blender/blenlib/intern/DLRB_tree.c b/source/blender/blenlib/intern/DLRB_tree.c index b7df06bbf24..0e90042a35f 100644 --- a/source/blender/blenlib/intern/DLRB_tree.c +++ b/source/blender/blenlib/intern/DLRB_tree.c @@ -36,7 +36,7 @@ /* *********************************************** */ /* Tree API */ -/* Create a new tree, and initialise as necessary */ +/* Create a new tree, and initialize as necessary */ DLRBT_Tree *BLI_dlrbTree_new (void) { /* just allocate for now */ diff --git a/source/blender/blenlib/intern/boxpack2d.c b/source/blender/blenlib/intern/boxpack2d.c index cf18fbd57cd..57174d0c0dd 100644 --- a/source/blender/blenlib/intern/boxpack2d.c +++ b/source/blender/blenlib/intern/boxpack2d.c @@ -295,7 +295,7 @@ void boxPack2D(boxPack *boxarray, const int len, float *tot_width, float *tot_he isect = 1; } else { /* do a full search for colliding box - * this is really slow, some spacialy divided + * this is really slow, some spatially divided * data-structure would be better */ for (box_test=boxarray; box_test != box; box_test++) { if BOXINTERSECT(box, box_test) { diff --git a/source/blender/blenlib/intern/edgehash.c b/source/blender/blenlib/intern/edgehash.c index df23f792aa3..531a4de361e 100644 --- a/source/blender/blenlib/intern/edgehash.c +++ b/source/blender/blenlib/intern/edgehash.c @@ -83,7 +83,7 @@ EdgeHash *BLI_edgehash_new(void) eh->nbuckets = _ehash_hashsizes[eh->cursize]; eh->buckets = MEM_callocN(eh->nbuckets * sizeof(*eh->buckets), "eh buckets 2"); - eh->epool = BLI_mempool_create(sizeof(EdgeEntry), 512, 512, TRUE, FALSE); + eh->epool = BLI_mempool_create(sizeof(EdgeEntry), 512, 512, BLI_MEMPOOL_SYSMALLOC); return eh; } diff --git a/source/blender/blenlib/intern/fileops.c b/source/blender/blenlib/intern/fileops.c index ad0478060f2..895ae03ab0f 100644 --- a/source/blender/blenlib/intern/fileops.c +++ b/source/blender/blenlib/intern/fileops.c @@ -323,7 +323,7 @@ int BLI_rename(const char *from, const char *to) /* * but the UNIX world is tied to the interface, and the system * timer, and... We implement a callback mechanism. The system will - * have to initialise the callback before the functions will work! + * have to initialize the callback before the functions will work! * */ static char str[12 + (MAXPATHLEN * 2)]; diff --git a/source/blender/blenlib/intern/math_geom.c b/source/blender/blenlib/intern/math_geom.c index f903072afb9..64b31df9c8e 100644 --- a/source/blender/blenlib/intern/math_geom.c +++ b/source/blender/blenlib/intern/math_geom.c @@ -850,7 +850,7 @@ int isect_line_plane_v3(float out[3], const float l1[3], const float l2[3], cons float l1_plane[3]; /* line point aligned with the plane */ float dist; /* 'plane_no' aligned distance to the 'plane_co' */ - /* for pradictable flipping since the plane is only used to + /* for predictable flipping since the plane is only used to * define a direction, ignore its flipping and aligned with 'l_vec' */ if(dot < 0.0f) { dot= -dot; diff --git a/source/blender/blenlib/intern/math_matrix.c b/source/blender/blenlib/intern/math_matrix.c index f1dc65bd066..e07025ccf56 100644 --- a/source/blender/blenlib/intern/math_matrix.c +++ b/source/blender/blenlib/intern/math_matrix.c @@ -1196,7 +1196,7 @@ void loc_eul_size_to_mat4(float mat[4][4], const float loc[3], const float eul[3 { float rmat[3][3], smat[3][3], tmat[3][3]; - /* initialise new matrix */ + /* initialize new matrix */ unit_m4(mat); /* make rotation + scaling part */ @@ -1219,7 +1219,7 @@ void loc_eulO_size_to_mat4(float mat[4][4], const float loc[3], const float eul[ { float rmat[3][3], smat[3][3], tmat[3][3]; - /* initialise new matrix */ + /* initialize new matrix */ unit_m4(mat); /* make rotation + scaling part */ @@ -1243,7 +1243,7 @@ void loc_quat_size_to_mat4(float mat[4][4], const float loc[3], const float quat { float rmat[3][3], smat[3][3], tmat[3][3]; - /* initialise new matrix */ + /* initialize new matrix */ unit_m4(mat); /* make rotation + scaling part */ diff --git a/source/blender/blenlib/intern/path_util.c b/source/blender/blenlib/intern/path_util.c index 18f7767c303..ec8e1cf6b82 100644 --- a/source/blender/blenlib/intern/path_util.c +++ b/source/blender/blenlib/intern/path_util.c @@ -378,8 +378,8 @@ void BLI_cleanup_path(const char *relabase, char *dir) } /* support for odd paths: eg /../home/me --> /home/me - * this is a valid path in blender but we cant handle this the useual way below - * simply strip this prefix then evaluate the path as useual. pythons os.path.normpath() does this */ + * this is a valid path in blender but we cant handle this the usual way below + * simply strip this prefix then evaluate the path as usual. pythons os.path.normpath() does this */ while((strncmp(dir, "/../", 4)==0)) { memmove( dir, dir + 4, strlen(dir + 4) + 1 ); } @@ -694,7 +694,7 @@ int BLI_path_abs(char *path, const char *basepath) BLI_char_switch(base, '\\', '/'); /* Paths starting with // will get the blend file as their base, - * this isnt standard in any os but is uesed in blender all over the place */ + * this isnt standard in any os but is used in blender all over the place */ if (wasrelative) { char *lslash= BLI_last_slash(base); if (lslash) { @@ -1571,7 +1571,7 @@ char *BLI_path_basename(char *path) This logic will help ensure that all image paths are relative and that a user gets his images in one place. It'll also provide - consistent behaviour across exporters. + consistent behavior across exporters. */ int BKE_rebase_path(char *abs, size_t abs_len, char *rel, size_t rel_len, const char *base_dir, const char *src_dir, const char *dest_dir) { @@ -1748,9 +1748,9 @@ static int add_win32_extension(char *name) * the name to its 8.3 version to prevent problems with * spaces and stuff. Final result is returned in fullname. * -* @param fullname The full path and full name of the executable +* \param fullname The full path and full name of the executable * (must be FILE_MAX minimum) -* @param name The name of the executable (usually argv[0]) to be checked +* \param name The name of the executable (usually argv[0]) to be checked */ static void bli_where_am_i(char *fullname, const size_t maxlen, const char *name) { @@ -1854,9 +1854,9 @@ const char *BLI_program_dir(void) * * Also make sure the temp dir has a trailing slash * -* @param fullname The full path to the temp directory -* @param maxlen The size of the fullname buffer -* @param userdir Directory specified in user preferences +* \param fullname The full path to the temp directory +* \param maxlen The size of the fullname buffer +* \param userdir Directory specified in user preferences */ static void BLI_where_is_temp(char *fullname, const size_t maxlen, char *userdir) { diff --git a/source/blender/blenlib/intern/string.c b/source/blender/blenlib/intern/string.c index 3a66425a5de..e2c86d70872 100644 --- a/source/blender/blenlib/intern/string.c +++ b/source/blender/blenlib/intern/string.c @@ -184,8 +184,8 @@ char *BLI_getQuotedStr (const char *str, const char *prefix) return BLI_strdupn(startMatch, (size_t)(endMatch-startMatch)); } -/* Replaces all occurances of oldText with newText in str, returning a new string that doesn't - * contain the 'replaced' occurances. +/* Replaces all occurrences of oldText with newText in str, returning a new string that doesn't + * contain the 'replaced' occurrences. */ // A rather wasteful string-replacement utility, though this shall do for now... // Feel free to replace this with an even safe + nicer alternative @@ -231,7 +231,7 @@ char *BLI_replacestr(char *str, const char *oldText, const char *newText) str += lenOld; } - /* finish off and return a new string that has had all occurances of */ + /* finish off and return a new string that has had all occurrences of */ if (ds) { char *newStr; diff --git a/source/blender/blenlib/intern/string_utf8.c b/source/blender/blenlib/intern/string_utf8.c index cf865b5686d..c958648836b 100644 --- a/source/blender/blenlib/intern/string_utf8.c +++ b/source/blender/blenlib/intern/string_utf8.c @@ -369,7 +369,7 @@ unsigned int BLI_str_utf8_as_unicode(const char *p) return result; } -/* varient that increments the length */ +/* variant that increments the length */ unsigned int BLI_str_utf8_as_unicode_and_size(const char *p, size_t *index) { int i, mask = 0, len; @@ -384,7 +384,7 @@ unsigned int BLI_str_utf8_as_unicode_and_size(const char *p, size_t *index) return result; } -/* another varient that steps over the index, +/* another variant that steps over the index, * note, currently this also falls back to latin1 for text drawing. */ unsigned int BLI_str_utf8_as_unicode_step(const char *p, size_t *index) { @@ -433,7 +433,7 @@ unsigned int BLI_str_utf8_as_unicode_step(const char *p, size_t *index) /** * BLI_str_utf8_from_unicode: * @c a Unicode character code - * @param outbuf output buffer, must have at least 6 bytes of space. + * \param outbuf output buffer, must have at least 6 bytes of space. * If %NULL, the length will be computed and returned * and nothing will be written to outbuf. * diff --git a/source/blender/blenlib/intern/voxel.c b/source/blender/blenlib/intern/voxel.c index f6c8c634c8d..dd56988fd90 100644 --- a/source/blender/blenlib/intern/voxel.c +++ b/source/blender/blenlib/intern/voxel.c @@ -43,7 +43,7 @@ BM_INLINE float D(float *data, const int res[3], int x, int y, int z) return data[ V_I(x, y, z, res) ]; } -/* *** nearest neighbour *** */ +/* *** nearest neighbor *** */ /* input coordinates must be in bounding box 0.0 - 1.0 */ float voxel_sample_nearest(float *data, const int res[3], const float co[3]) { |