diff options
author | Campbell Barton <ideasman42@gmail.com> | 2012-04-29 19:47:02 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2012-04-29 19:47:02 +0400 |
commit | e701f9b67010279db02ceb51f7d08078cb34170a (patch) | |
tree | 22134b33527f2d3a1b05f4265422bf5d98420bbc /source/blender/blenlib | |
parent | 038c12895f50a97607dd372cb0780c55eb38fe22 (diff) |
style cleanup: whitespace / commas
Diffstat (limited to 'source/blender/blenlib')
-rw-r--r-- | source/blender/blenlib/BLI_fileops_types.h | 2 | ||||
-rw-r--r-- | source/blender/blenlib/BLI_math_geom.h | 8 | ||||
-rw-r--r-- | source/blender/blenlib/BLI_math_vector.h | 2 | ||||
-rw-r--r-- | source/blender/blenlib/BLI_path_util.h | 2 | ||||
-rw-r--r-- | source/blender/blenlib/intern/BLI_kdopbvh.c | 24 | ||||
-rw-r--r-- | source/blender/blenlib/intern/BLI_kdtree.c | 24 | ||||
-rw-r--r-- | source/blender/blenlib/intern/fileops.c | 10 | ||||
-rw-r--r-- | source/blender/blenlib/intern/freetypefont.c | 10 | ||||
-rw-r--r-- | source/blender/blenlib/intern/jitter.c | 6 | ||||
-rw-r--r-- | source/blender/blenlib/intern/listbase.c | 2 | ||||
-rw-r--r-- | source/blender/blenlib/intern/math_matrix.c | 4 | ||||
-rw-r--r-- | source/blender/blenlib/intern/path_util.c | 16 | ||||
-rw-r--r-- | source/blender/blenlib/intern/storage.c | 40 | ||||
-rw-r--r-- | source/blender/blenlib/intern/string.c | 4 | ||||
-rw-r--r-- | source/blender/blenlib/intern/string_utf8.c | 32 | ||||
-rw-r--r-- | source/blender/blenlib/intern/winstuff.c | 42 |
16 files changed, 114 insertions, 114 deletions
diff --git a/source/blender/blenlib/BLI_fileops_types.h b/source/blender/blenlib/BLI_fileops_types.h index 8e4b5b3e411..d9f8549e8f5 100644 --- a/source/blender/blenlib/BLI_fileops_types.h +++ b/source/blender/blenlib/BLI_fileops_types.h @@ -70,7 +70,7 @@ struct direntry{ struct dirlink { - struct dirlink *next,*prev; + struct dirlink *next, *prev; char *name; }; diff --git a/source/blender/blenlib/BLI_math_geom.h b/source/blender/blenlib/BLI_math_geom.h index 9b5e3638609..85129d5b68d 100644 --- a/source/blender/blenlib/BLI_math_geom.h +++ b/source/blender/blenlib/BLI_math_geom.h @@ -244,14 +244,14 @@ void tangent_from_uv(float uv1[2], float uv2[2], float uv3[2], void vcloud_estimate_transform(int list_size, float (*pos)[3], float *weight, float (*rpos)[3], float *rweight, - float lloc[3],float rloc[3],float lrot[3][3],float lscale[3][3]); + float lloc[3], float rloc[3], float lrot[3][3], float lscale[3][3]); /****************************** Spherical Harmonics *************************/ /* Uses 2nd order SH => 9 coefficients, stored in this order: - * 0 = (0,0), - * 1 = (1,-1), 2 = (1,0), 3 = (1,1), - * 4 = (2,-2), 5 = (2,-1), 6 = (2,0), 7 = (2,1), 8 = (2,2) */ + * 0 = (0, 0), + * 1 = (1, -1), 2 = (1, 0), 3 = (1, 1), + * 4 = (2, -2), 5 = (2, -1), 6 = (2, 0), 7 = (2, 1), 8 = (2, 2) */ MINLINE void zero_sh(float r[9]); MINLINE void copy_sh_sh(float r[9], const float a[9]); diff --git a/source/blender/blenlib/BLI_math_vector.h b/source/blender/blenlib/BLI_math_vector.h index df5199e19e7..249f2265440 100644 --- a/source/blender/blenlib/BLI_math_vector.h +++ b/source/blender/blenlib/BLI_math_vector.h @@ -126,7 +126,7 @@ MINLINE void cross_v3_v3v3(float r[3], const float a[3], const float b[3]); MINLINE void add_newell_cross_v3_v3v3(float n[3], const float v_prev[3], const float v_curr[3]); -MINLINE void star_m3_v3(float rmat[3][3],float a[3]); +MINLINE void star_m3_v3(float rmat[3][3], float a[3]); /*********************************** Length **********************************/ diff --git a/source/blender/blenlib/BLI_path_util.h b/source/blender/blenlib/BLI_path_util.h index e02b48feda7..1d085a46a19 100644 --- a/source/blender/blenlib/BLI_path_util.h +++ b/source/blender/blenlib/BLI_path_util.h @@ -109,7 +109,7 @@ void BLI_newname(char * name, int add); int BLI_stringdec(const char *string, char *head, char *start, unsigned short *numlen); void BLI_stringenc(char *string, const char *head, const char *tail, unsigned short numlen, int pic); int BLI_split_name_num(char *left, int *nr, const char *name, const char delim); -void BLI_splitdirstring(char *di,char *fi); +void BLI_splitdirstring(char *di, char *fi); /* make sure path separators conform to system one */ void BLI_clean(char *path); diff --git a/source/blender/blenlib/intern/BLI_kdopbvh.c b/source/blender/blenlib/intern/BLI_kdopbvh.c index 3921c01d2cf..3e1561136cc 100644 --- a/source/blender/blenlib/intern/BLI_kdopbvh.c +++ b/source/blender/blenlib/intern/BLI_kdopbvh.c @@ -129,7 +129,7 @@ static float KDOP_AXES[13][3] = /* * Generic push and pop heap */ -#define PUSH_HEAP_BODY(HEAP_TYPE,PRIORITY,heap,heap_size) \ +#define PUSH_HEAP_BODY(HEAP_TYPE, PRIORITY, heap, heap_size) \ { \ HEAP_TYPE element = heap[heap_size-1]; \ int child = heap_size-1; \ @@ -146,7 +146,7 @@ static float KDOP_AXES[13][3] = heap[child] = element; \ } -#define POP_HEAP_BODY(HEAP_TYPE, PRIORITY,heap,heap_size) \ +#define POP_HEAP_BODY(HEAP_TYPE, PRIORITY, heap, heap_size) \ { \ HEAP_TYPE element = heap[heap_size-1]; \ int parent = 0; \ @@ -215,7 +215,7 @@ static int floor_lg(int a) */ static void bvh_insertionsort(BVHNode **a, int lo, int hi, int axis) { - int i,j; + int i, j; BVHNode *t; for (i=lo; i < hi; i++) { j=i; @@ -237,7 +237,7 @@ static int bvh_partition(BVHNode **a, int lo, int hi, BVHNode * x, int axis) while (x->bv[axis] < (a[j])->bv[axis]) j--; if (!(i < j)) return i; - SWAP( BVHNode* , a[i], a[j]); + SWAP(BVHNode *, a[i], a[j]); i++; } } @@ -269,12 +269,12 @@ static void bvh_heapsort(BVHNode **a, int lo, int hi, int axis) int n = hi-lo, i; for (i=n/2; i>=1; i=i-1) { - bvh_downheap(a, i,n,lo, axis); + bvh_downheap(a, i, n, lo, axis); } for (i=n; i>1; i=i-1) { - SWAP(BVHNode*, a[lo],a[lo+i-1]); - bvh_downheap(a, 1,i-1,lo, axis); + SWAP(BVHNode*, a[lo], a[lo+i-1]); + bvh_downheap(a, 1, i-1, lo, axis); } } #endif @@ -409,7 +409,7 @@ static void create_kdop_hull(BVHTree *tree, BVHNode *node, const float *co, int // depends on the fact that the BVH's for each face is already build static void refit_kdop_hull(BVHTree *tree, BVHNode *node, int start, int end) { - float newmin,newmax; + float newmin, newmax; int i, j; float *bv = node->bv; @@ -671,7 +671,7 @@ static int implicit_needed_branches(int tree_type, int leafs) * - 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] ] + * partition P is described as the elements in the range ( nth[P], nth[P+1] ] * * TODO: This can be optimized a bit by doing a specialized nth_element instead of K nth_elements */ @@ -1180,14 +1180,14 @@ typedef struct NodeDistance } NodeDistance; -#define NodeDistance_priority(a,b) ( (a).dist < (b).dist ) +#define NodeDistance_priority(a, b) ( (a).dist < (b).dist ) // TODO: use a priority queue to reduce the number of nodes looked on static void dfs_find_nearest_dfs(BVHNearestData *data, BVHNode *node) { if (node->totnode == 0) { if (data->callback) - data->callback(data->userdata , node->index, data->co, &data->nearest); + data->callback(data->userdata, node->index, data->co, &data->nearest); else { data->nearest.index = node->index; data->nearest.dist = calc_nearest_point(data->proj, node, data->nearest.co); @@ -1329,7 +1329,7 @@ int BLI_bvhtree_find_nearest(BVHTree *tree, const float co[3], BVHTreeNearest *n } if (nearest) { - memcpy( &data.nearest , nearest, sizeof(*nearest) ); + memcpy( &data.nearest, nearest, sizeof(*nearest) ); } else { data.nearest.index = -1; diff --git a/source/blender/blenlib/intern/BLI_kdtree.c b/source/blender/blenlib/intern/BLI_kdtree.c index ee06f32a934..a518d1445e3 100644 --- a/source/blender/blenlib/intern/BLI_kdtree.c +++ b/source/blender/blenlib/intern/BLI_kdtree.c @@ -167,7 +167,7 @@ int BLI_kdtree_find_nearest(KDTree *tree, float *co, float *nor, KDTreeNearest * root= tree->root; min_node= root; - min_dist= squared_distance(root->co,co,root->nor,nor); + min_dist= squared_distance(root->co, co, root->nor, nor); if (co[root->d] < root->co[root->d]) { if (root->right) @@ -191,7 +191,7 @@ int BLI_kdtree_find_nearest(KDTree *tree, float *co, float *nor, KDTreeNearest * cur_dist= -cur_dist*cur_dist; if (-cur_dist<min_dist) { - cur_dist=squared_distance(node->co,co,node->nor,nor); + cur_dist=squared_distance(node->co, co, node->nor, nor); if (cur_dist<min_dist) { min_dist=cur_dist; min_node=node; @@ -206,7 +206,7 @@ int BLI_kdtree_find_nearest(KDTree *tree, float *co, float *nor, KDTreeNearest * cur_dist= cur_dist*cur_dist; if (cur_dist<min_dist) { - cur_dist=squared_distance(node->co,co,node->nor,nor); + cur_dist=squared_distance(node->co, co, node->nor, nor); if (cur_dist<min_dist) { min_dist=cur_dist; min_node=node; @@ -219,7 +219,7 @@ int BLI_kdtree_find_nearest(KDTree *tree, float *co, float *nor, KDTreeNearest * } if (cur+3 > totstack) { KDTreeNode **temp=MEM_callocN((totstack+100)*sizeof(KDTreeNode*), "psys_treestack"); - memcpy(temp,stack,totstack*sizeof(KDTreeNode*)); + memcpy(temp, stack, totstack*sizeof(KDTreeNode*)); if (stack != defaultstack) MEM_freeN(stack); stack=temp; @@ -273,8 +273,8 @@ int BLI_kdtree_find_n_nearest(KDTree *tree, int n, float *co, float *nor, KDTree root= tree->root; - cur_dist= squared_distance(root->co,co,root->nor,nor); - add_nearest(nearest,&found,n,root->index,cur_dist,root->co); + cur_dist= squared_distance(root->co, co, root->nor, nor); + add_nearest(nearest, &found, n, root->index, cur_dist, root->co); if (co[root->d] < root->co[root->d]) { if (root->right) @@ -298,10 +298,10 @@ int BLI_kdtree_find_n_nearest(KDTree *tree, int n, float *co, float *nor, KDTree cur_dist= -cur_dist*cur_dist; if (found<n || -cur_dist<nearest[found-1].dist) { - cur_dist=squared_distance(node->co,co,node->nor,nor); + cur_dist=squared_distance(node->co, co, node->nor, nor); if (found<n || cur_dist<nearest[found-1].dist) - add_nearest(nearest,&found,n,node->index,cur_dist,node->co); + add_nearest(nearest, &found, n, node->index, cur_dist, node->co); if (node->left) stack[cur++]=node->left; @@ -313,9 +313,9 @@ int BLI_kdtree_find_n_nearest(KDTree *tree, int n, float *co, float *nor, KDTree cur_dist= cur_dist*cur_dist; if (found<n || cur_dist<nearest[found-1].dist) { - cur_dist=squared_distance(node->co,co,node->nor,nor); + cur_dist=squared_distance(node->co, co, node->nor, nor); if (found<n || cur_dist<nearest[found-1].dist) - add_nearest(nearest,&found,n,node->index,cur_dist,node->co); + add_nearest(nearest, &found, n, node->index, cur_dist, node->co); if (node->right) stack[cur++]=node->right; @@ -325,7 +325,7 @@ int BLI_kdtree_find_n_nearest(KDTree *tree, int n, float *co, float *nor, KDTree } if (cur+3 > totstack) { KDTreeNode **temp=MEM_callocN((totstack+100)*sizeof(KDTreeNode*), "psys_treestack"); - memcpy(temp,stack,totstack*sizeof(KDTreeNode*)); + memcpy(temp, stack, totstack * sizeof(KDTreeNode*)); if (stack != defaultstack) MEM_freeN(stack); stack=temp; @@ -432,7 +432,7 @@ int BLI_kdtree_range_search(KDTree *tree, float range, float *co, float *nor, KD if (cur+3 > totstack) { KDTreeNode **temp=MEM_callocN((totstack+100)*sizeof(KDTreeNode*), "psys_treestack"); - memcpy(temp,stack,totstack*sizeof(KDTreeNode*)); + memcpy(temp, stack, totstack*sizeof(KDTreeNode*)); if (stack != defaultstack) MEM_freeN(stack); stack=temp; diff --git a/source/blender/blenlib/intern/fileops.c b/source/blender/blenlib/intern/fileops.c index 8990f0f79d3..0a5e4d9fd48 100644 --- a/source/blender/blenlib/intern/fileops.c +++ b/source/blender/blenlib/intern/fileops.c @@ -82,7 +82,7 @@ int BLI_file_gzip(const char *from, const char *to) gzfile = BLI_gzopen(to, "wb1"); if (gzfile == NULL) return -1; - file = BLI_open(from, O_BINARY|O_RDONLY,0); + file = BLI_open(from, O_BINARY|O_RDONLY, 0); if (file < 0) return -2; @@ -223,17 +223,17 @@ void *BLI_gzopen(const char *filename, const char *mode) /* xxx Creates file before transcribing the path */ if (mode[0] == 'w') - fclose(ufopen(filename,"a")); + fclose(ufopen(filename, "a")); UTF16_ENCODE(filename); - GetShortPathNameW(filename_16,short_name_16, 256); + GetShortPathNameW(filename_16, short_name_16, 256); for (i = 0; i < 256; i++) { short_name[i] = (char)short_name_16[i]; } - gzfile = gzopen(short_name,mode); + gzfile = gzopen(short_name, mode); UTF16_UN_ENCODE(filename); } @@ -367,7 +367,7 @@ void BLI_dir_create_recursive(const char *dirname) if (dirname[0]) /* patch, this recursive loop tries to create a nameless directory */ if (umkdir(dirname)==-1) - printf("Unable to create directory %s\n",dirname); + printf("Unable to create directory %s\n", dirname); } int BLI_rename(const char *from, const char *to) diff --git a/source/blender/blenlib/intern/freetypefont.c b/source/blender/blenlib/intern/freetypefont.c index 8f2a2e6f8b5..a26c56a16f3 100644 --- a/source/blender/blenlib/intern/freetypefont.c +++ b/source/blender/blenlib/intern/freetypefont.c @@ -82,7 +82,7 @@ static void freetypechar_to_vchar(FT_Face face, FT_ULong charcode, VFontData *vf FT_Outline ftoutline; float scale, height; float dx, dy; - int j,k,l,m=0; + int j, k, l, m=0; // adjust font size height= ((double) face->bbox.yMax - (double) face->bbox.yMin); @@ -116,8 +116,8 @@ static void freetypechar_to_vchar(FT_Face face, FT_ULong charcode, VFontData *vf che->width= glyph->advance.x * scale; // Start converting the FT data - npoints = (int *)MEM_callocN((ftoutline.n_contours) * sizeof(int),"endpoints"); - onpoints = (int *)MEM_callocN((ftoutline.n_contours) * sizeof(int),"onpoints"); + npoints = (int *)MEM_callocN((ftoutline.n_contours) * sizeof(int), "endpoints"); + onpoints = (int *)MEM_callocN((ftoutline.n_contours) * sizeof(int), "onpoints"); // calculate total points of each contour for (j = 0; j < ftoutline.n_contours; j++) { @@ -271,7 +271,7 @@ static void freetypechar_to_vchar(FT_Face face, FT_ULong charcode, VFontData *vf // len_squared_v2v2, see if there's a distance between the three points // len_squared_v2v2 again, to check the angle between the handles // finally, check if one of them is a vector handle - if ((dist_to_line_v2(bezt->vec[0],bezt->vec[1],bezt->vec[2]) < 0.001f) && + if ((dist_to_line_v2(bezt->vec[0], bezt->vec[1], bezt->vec[2]) < 0.001f) && (len_squared_v2v2(bezt->vec[0], bezt->vec[1]) > 0.0001f*0.0001f) && (len_squared_v2v2(bezt->vec[1], bezt->vec[2]) > 0.0001f*0.0001f) && (len_squared_v2v2(bezt->vec[0], bezt->vec[2]) > 0.0002f*0.0001f) && @@ -620,7 +620,7 @@ font driver produces such outlines. Each glyph's original outline points are located on a grid of indivisible units. The points are stored -in the font file as 16-bit integer grid coordinates, with the grid origin's being at (0,0); they thus +in the font file as 16-bit integer grid coordinates, with the grid origin's being at (0, 0); they thus range from -16384 to 16383. Convert conic to bezier arcs: diff --git a/source/blender/blenlib/intern/jitter.c b/source/blender/blenlib/intern/jitter.c index fbdf698cc87..35651323ac4 100644 --- a/source/blender/blenlib/intern/jitter.c +++ b/source/blender/blenlib/intern/jitter.c @@ -43,7 +43,7 @@ void BLI_jitterate1(float *jit1, float *jit2, int num, float rad1) { - int i , j , k; + int i, j, k; float vecx, vecy, dvecx, dvecy, x, y, len; for (i = 2*num-2; i>=0 ; i-=2) { @@ -96,7 +96,7 @@ void BLI_jitterate1(float *jit1, float *jit2, int num, float rad1) jit2[i] = x; jit2[i+1] = y; } - memcpy(jit1,jit2,2 * num * sizeof(float)); + memcpy(jit1, jit2, 2 * num * sizeof(float)); } void BLI_jitterate2(float *jit1, float *jit2, int num, float rad2) @@ -135,7 +135,7 @@ void BLI_jitterate2(float *jit1, float *jit2, int num, float rad2) jit2[i] = x; jit2[i+1] = y; } - memcpy(jit1,jit2,2 * num * sizeof(float)); + memcpy(jit1, jit2, 2 * num * sizeof(float)); } diff --git a/source/blender/blenlib/intern/listbase.c b/source/blender/blenlib/intern/listbase.c index f7114822dfd..19cae7456c9 100644 --- a/source/blender/blenlib/intern/listbase.c +++ b/source/blender/blenlib/intern/listbase.c @@ -126,7 +126,7 @@ void BLI_freelinkN(ListBase *listbase, void *vlink) if (link == NULL) return; if (listbase == NULL) return; - BLI_remlink(listbase,link); + BLI_remlink(listbase, link); MEM_freeN(link); } diff --git a/source/blender/blenlib/intern/math_matrix.c b/source/blender/blenlib/intern/math_matrix.c index 76b986d7346..bb0b8897b15 100644 --- a/source/blender/blenlib/intern/math_matrix.c +++ b/source/blender/blenlib/intern/math_matrix.c @@ -1674,8 +1674,8 @@ void svd_m4(float U[4][4], float s[4], float V[4][4], float A_[4][4]) // Calculate the shift. float scale = maxf(maxf(maxf(maxf( - fabsf(s[p - 1]),fabsf(s[p - 2])),fabsf(e[p - 2])), - fabsf(s[k])),fabsf(e[k])); + fabsf(s[p - 1]), fabsf(s[p - 2])), fabsf(e[p - 2])), + fabsf(s[k])), fabsf(e[k])); float invscale = 1.0f / scale; float sp = s[p - 1] * invscale; float spm1 = s[p - 2] * invscale; diff --git a/source/blender/blenlib/intern/path_util.c b/source/blender/blenlib/intern/path_util.c index f52921cd19b..a6b851ca488 100644 --- a/source/blender/blenlib/intern/path_util.c +++ b/source/blender/blenlib/intern/path_util.c @@ -135,7 +135,7 @@ int BLI_stringdec(const char *string, char *head, char *tail, unsigned short *nu if (found) { if (tail) strcpy(tail, &string[nume+1]); if (head) { - strcpy(head,string); + strcpy(head, string); head[nums]=0; } if (numlen) *numlen = nume-nums+1; @@ -364,12 +364,12 @@ void BLI_cleanup_path(const char *relabase, char *dir) } } - while ( (start = strstr(dir,"\\.\\")) ) { + while ( (start = strstr(dir, "\\.\\")) ) { eind = start + strlen("\\.\\") - 1; memmove(start, eind, strlen(eind) + 1); } - while ( (start = strstr(dir,"\\\\" )) ) { + while ( (start = strstr(dir, "\\\\" )) ) { eind = start + strlen("\\\\") - 1; memmove(start, eind, strlen(eind) + 1); } @@ -402,12 +402,12 @@ void BLI_cleanup_path(const char *relabase, char *dir) } } - while ( (start = strstr(dir,"/./")) ) { + while ( (start = strstr(dir, "/./")) ) { eind = start + (3 - 1) /* strlen("/./") - 1 */; memmove(start, eind, strlen(eind) + 1); } - while ( (start = strstr(dir,"//" )) ) { + while ( (start = strstr(dir, "//" )) ) { eind = start + (2 - 1) /* strlen("//") - 1 */; memmove(start, eind, strlen(eind) + 1); } @@ -835,7 +835,7 @@ const char *BLI_getDefaultDocumentFolder(void) HRESULT hResult; /* Check for %HOME% env var */ - if (uput_getenv("HOME",documentfolder,MAXPATHLEN)) { + if (uput_getenv("HOME", documentfolder, MAXPATHLEN)) { if (BLI_is_dir(documentfolder)) return documentfolder; } @@ -1265,7 +1265,7 @@ void BLI_make_exist(char *dir) #ifdef WIN32 get_default_root(dir); #else - strcpy(dir,"/"); + strcpy(dir, "/"); #endif break; } @@ -1798,7 +1798,7 @@ static void bli_where_am_i(char *fullname, const size_t maxlen, const char *name #ifdef _WIN32 wchar_t * fullname_16 = MEM_mallocN(maxlen*sizeof(wchar_t), "ProgramPath"); if (GetModuleFileNameW(0, fullname_16, maxlen)) { - conv_utf_16_to_8(fullname_16,fullname, maxlen); + conv_utf_16_to_8(fullname_16, fullname, maxlen); if (!BLI_exists(fullname)) { printf("path can't be found: \"%.*s\"\n", maxlen, fullname); MessageBox(NULL, "path contains invalid characters or is too long (see console)", "Error", MB_OK); diff --git a/source/blender/blenlib/intern/storage.c b/source/blender/blenlib/intern/storage.c index 1c55d5b5a39..0245a9c90af 100644 --- a/source/blender/blenlib/intern/storage.c +++ b/source/blender/blenlib/intern/storage.c @@ -95,7 +95,7 @@ #include "BKE_utildefines.h" /* vars: */ -static int totnum,actnum; +static int totnum, actnum; static struct direntry *files; static struct ListBase dirbase_={NULL, NULL}; @@ -139,7 +139,7 @@ static int bli_compare(struct direntry *entry1, struct direntry *entry2) if ( strcmp(entry1->relname, "..")==0 ) return (-1); if ( strcmp(entry2->relname, "..")==0 ) return (1); - return (BLI_natstrcmp(entry1->relname,entry2->relname)); + return (BLI_natstrcmp(entry1->relname, entry2->relname)); } @@ -161,7 +161,7 @@ double BLI_dir_free_space(const char *dir) tmp[3]=0; } - GetDiskFreeSpace(tmp,§orspc, &bytesps, &freec, &clusters); + GetDiskFreeSpace(tmp, §orspc, &bytesps, &freec, &clusters); return (double) (freec*bytesps*sectorspc); #else @@ -171,19 +171,19 @@ double BLI_dir_free_space(const char *dir) #else struct statfs disk; #endif - char name[FILE_MAXDIR],*slash; + char name[FILE_MAXDIR], *slash; int len = strlen(dir); if (len >= FILE_MAXDIR) /* path too long */ return -1; - strcpy(name,dir); + strcpy(name, dir); if (len) { - slash = strrchr(name,'/'); + slash = strrchr(name, '/'); if (slash) slash[1] = 0; } - else strcpy(name,"/"); + else strcpy(name, "/"); #if defined (__FreeBSD__) || defined (linux) || defined (__OpenBSD__) || defined (__APPLE__) || defined(__GNU__) || defined(__GLIBC__) if (statfs(name, &disk)) return(-1); @@ -234,9 +234,9 @@ static void bli_builddir(const char *dirname, const char *relname) while ((fname = (struct dirent*) readdir(dir)) != NULL) { dlink = (struct dirlink *)malloc(sizeof(struct dirlink)); if (dlink) { - BLI_strncpy(buf + rellen ,fname->d_name, sizeof(buf) - rellen); + BLI_strncpy(buf + rellen, fname->d_name, sizeof(buf) - rellen); dlink->name = BLI_strdup(buf); - BLI_addhead(dirbase,dlink); + BLI_addhead(dirbase, dlink); newnum++; } } @@ -260,22 +260,22 @@ static void bli_builddir(const char *dirname, const char *relname) if (files) { dlink = (struct dirlink *) dirbase->first; while (dlink) { - memset(&files[actnum], 0 , sizeof(struct direntry)); + memset(&files[actnum], 0, sizeof(struct direntry)); files[actnum].relname = dlink->name; files[actnum].path = BLI_strdupcat(dirname, dlink->name); // use 64 bit file size, only needed for WIN32 and WIN64. // Excluding other than current MSVC compiler until able to test #ifdef WIN32 - {wchar_t * name_16 = alloc_utf16_from_8(dlink->name,0); + {wchar_t * name_16 = alloc_utf16_from_8(dlink->name, 0); #if (defined(WIN32) || defined(WIN64)) && (_MSC_VER>=1500) - _wstat64(name_16,&files[actnum].s); + _wstat64(name_16, &files[actnum].s); #elif defined(__MINGW32__) - _stati64(dlink->name,&files[actnum].s); + _stati64(dlink->name, &files[actnum].s); #endif free(name_16);}; #else - stat(dlink->name,&files[actnum].s); + stat(dlink->name, &files[actnum].s); #endif files[actnum].type=files[actnum].s.st_mode; files[actnum].flags = 0; @@ -290,16 +290,16 @@ static void bli_builddir(const char *dirname, const char *relname) } BLI_freelist(dirbase); - if (files) qsort(files, actnum, sizeof(struct direntry), (int (*)(const void *,const void*))bli_compare); + if (files) qsort(files, actnum, sizeof(struct direntry), (int (*)(const void *, const void*))bli_compare); } else { - printf("%s empty directory\n",dirname); + printf("%s empty directory\n", dirname); } closedir(dir); } else { - printf("%s non-existant directory\n",dirname); + printf("%s non-existant directory\n", dirname); } } @@ -349,7 +349,7 @@ static void bli_adddirstrings(void) #endif #ifdef WIN32 - strcpy(file->owner,"user"); + strcpy(file->owner, "user"); #else { struct passwd *pwuser; @@ -426,7 +426,7 @@ unsigned int BLI_dir_contents(const char *dirname, struct direntry **filelist) actnum = totnum = 0; files = NULL; - bli_builddir(dirname,""); + bli_builddir(dirname, ""); bli_adddirstrings(); if (files) { @@ -488,7 +488,7 @@ int BLI_exists(const char *name) if (res == -1) return(0); #else struct stat st; - if (stat(name,&st)) return(0); + if (stat(name, &st)) return(0); #endif return(st.st_mode); } diff --git a/source/blender/blenlib/intern/string.c b/source/blender/blenlib/intern/string.c index b2245226a3c..d880b895ced 100644 --- a/source/blender/blenlib/intern/string.c +++ b/source/blender/blenlib/intern/string.c @@ -391,10 +391,10 @@ void BLI_timestr(double _time, char *str) int hun= ( (int) (_time * 100.0)) % 100; if (hr) { - sprintf(str, "%.2d:%.2d:%.2d.%.2d",hr,min,sec,hun); + sprintf(str, "%.2d:%.2d:%.2d.%.2d", hr, min, sec, hun); } else { - sprintf(str, "%.2d:%.2d.%.2d",min,sec,hun); + sprintf(str, "%.2d:%.2d.%.2d", min, sec, hun); } str[11]=0; diff --git a/source/blender/blenlib/intern/string_utf8.c b/source/blender/blenlib/intern/string_utf8.c index 20c5c8082ce..77bebfaf2e8 100644 --- a/source/blender/blenlib/intern/string_utf8.c +++ b/source/blender/blenlib/intern/string_utf8.c @@ -46,14 +46,14 @@ * it's hard to know how many characters there are! */ static const char trailingBytesForUTF8[256] = { - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, - 2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,3,3,3,3,3,3,3,3,4,4,4,4,5,5,5,5 + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5 }; int BLI_utf8_invalid_byte(const char *str, int length) @@ -153,14 +153,14 @@ int BLI_utf8_invalid_strip(char *str, int length) * note: this looks to be at odd's with 'trailingBytesForUTF8', * need to find out what gives here! - campbell */ static const size_t utf8_skip_data[256] = { - 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, - 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, - 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, - 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, - 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, - 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, - 2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2, - 3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,4,4,4,4,4,4,4,4,5,5,5,5,6,6,1,1 + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4, 5, 5, 5, 5, 6, 6, 1, 1 }; #define BLI_STR_UTF8_CPY(dst, src, maxncpy) \ diff --git a/source/blender/blenlib/intern/winstuff.c b/source/blender/blenlib/intern/winstuff.c index f3cb0dd6f84..6c8754eeff3 100644 --- a/source/blender/blenlib/intern/winstuff.c +++ b/source/blender/blenlib/intern/winstuff.c @@ -58,12 +58,12 @@ int BLI_getInstallationDir(char * str) char dir[FILE_MAXDIR]; int a; /*change to utf support*/ - GetModuleFileName(NULL,str,FILE_MAX); + GetModuleFileName(NULL, str, FILE_MAX); BLI_split_dir_part(str, dir, sizeof(dir)); /* shouldn't be relative */ a = strlen(dir); if (dir[a-1] == '\\') dir[a-1]=0; - strcpy(str,dir); + strcpy(str, dir); return 1; } @@ -74,8 +74,8 @@ void RegisterBlendExtension_Fail(HKEY root) if (root) RegCloseKey(root); if (!G.background) - MessageBox(0,"Could not register file extension.","Blender error",MB_OK|MB_ICONERROR); - TerminateProcess(GetCurrentProcess(),1); + MessageBox(0, "Could not register file extension.", "Blender error", MB_OK|MB_ICONERROR); + TerminateProcess(GetCurrentProcess(), 1); } void RegisterBlendExtension(void) @@ -96,7 +96,7 @@ void RegisterBlendExtension(void) BOOL IsWOW64; printf("Registering file extension..."); - GetModuleFileName(0,BlPath,MAX_PATH); + GetModuleFileName(0, BlPath, MAX_PATH); // root is HKLM by default lresult = RegOpenKeyEx(HKEY_LOCAL_MACHINE, "Software\\Classes", 0, KEY_ALL_ACCESS, &root); @@ -111,7 +111,7 @@ void RegisterBlendExtension(void) lresult = RegCreateKeyEx(root, "blendfile", 0, NULL, REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS, NULL, &hkey, &dwd); if (lresult == ERROR_SUCCESS) { - strcpy(buffer,"Blender File"); + strcpy(buffer, "Blender File"); lresult = RegSetValueEx(hkey, NULL, 0, REG_SZ, (BYTE*)buffer, strlen(buffer) + 1); RegCloseKey(hkey); } @@ -131,7 +131,7 @@ void RegisterBlendExtension(void) lresult = RegCreateKeyEx(root, "blendfile\\DefaultIcon", 0, NULL, REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS, NULL, &hkey, &dwd); if (lresult == ERROR_SUCCESS) { - sprintf(buffer, "\"%s\",1", BlPath); + sprintf(buffer, "\"%s\", 1", BlPath); lresult = RegSetValueEx(hkey, NULL, 0, REG_SZ, (BYTE*)buffer, strlen(buffer) + 1); RegCloseKey(hkey); } @@ -149,26 +149,26 @@ void RegisterBlendExtension(void) RegisterBlendExtension_Fail(root); BLI_getInstallationDir(InstallDir); - GetSystemDirectory(SysDir,FILE_MAXDIR); + GetSystemDirectory(SysDir, FILE_MAXDIR); #ifdef WIN64 ThumbHandlerDLL = "BlendThumb64.dll"; #else - IsWow64Process(GetCurrentProcess(),&IsWOW64); + IsWow64Process(GetCurrentProcess(), &IsWOW64); if (IsWOW64 == TRUE) ThumbHandlerDLL = "BlendThumb64.dll"; else ThumbHandlerDLL = "BlendThumb.dll"; #endif - snprintf(RegCmd,MAX_PATH*2,"%s\\regsvr32 /s \"%s\\%s\"",SysDir,InstallDir,ThumbHandlerDLL); + snprintf(RegCmd, MAX_PATH*2, "%s\\regsvr32 /s \"%s\\%s\"", SysDir, InstallDir, ThumbHandlerDLL); system(RegCmd); RegCloseKey(root); - printf("success (%s)\n",usr_mode ? "user" : "system"); + printf("success (%s)\n", usr_mode ? "user" : "system"); if (!G.background) { - sprintf(MBox,"File extension registered for %s.",usr_mode ? "the current user. To register for all users, run as an administrator" : "all users"); - MessageBox(0,MBox,"Blender",MB_OK|MB_ICONINFORMATION); + sprintf(MBox, "File extension registered for %s.", usr_mode ? "the current user. To register for all users, run as an administrator" : "all users"); + MessageBox(0, MBox, "Blender", MB_OK|MB_ICONINFORMATION); } - TerminateProcess(GetCurrentProcess(),0); + TerminateProcess(GetCurrentProcess(), 0); } DIR *opendir (const char *path) @@ -179,7 +179,7 @@ DIR *opendir (const char *path) DIR *newd= MEM_mallocN(sizeof(DIR), "opendir"); newd->handle = INVALID_HANDLE_VALUE; - sprintf(newd->path, "%s\\*",path); + sprintf(newd->path, "%s\\*", path); newd->direntry.d_ino= 0; newd->direntry.d_off= 0; @@ -200,8 +200,8 @@ static char *BLI_alloc_utf_8_from_16(wchar_t *in16, size_t add) size_t bsize = count_utf_8_from_16(in16); char *out8 = NULL; if (!bsize) return NULL; - out8 = (char*)MEM_mallocN(sizeof(char) * (bsize + add),"UTF-8 String"); - conv_utf_16_to_8(in16,out8, bsize); + out8 = (char*)MEM_mallocN(sizeof(char) * (bsize + add), "UTF-8 String"); + conv_utf_16_to_8(in16, out8, bsize); return out8; } @@ -211,7 +211,7 @@ static wchar_t *UNUSED_FUNCTION(BLI_alloc_utf16_from_8)(char *in8, size_t add) wchar_t *out16 = NULL; if (!bsize) return NULL; out16 =(wchar_t*) MEM_mallocN(sizeof(wchar_t) * (bsize + add), "UTF-16 String"); - conv_utf_8_to_16(in8,out16, bsize); + conv_utf_8_to_16(in8, out16, bsize); return out16; } @@ -236,7 +236,7 @@ struct dirent *readdir(DIR *dp) return &dp->direntry; } else if (FindNextFileW (dp->handle, &(dp->data))) { - dp->direntry.d_name= BLI_alloc_utf_8_from_16(dp->data.cFileName,0); + dp->direntry.d_name= BLI_alloc_utf_8_from_16(dp->data.cFileName, 0); return &dp->direntry; } @@ -262,7 +262,7 @@ void get_default_root(char *root) /* the default drive to resolve a directory without a specified drive * should be the Windows installation drive, since this was what the OS * assumes. */ - if (GetWindowsDirectory(str,MAX_PATH+1)) { + if (GetWindowsDirectory(str, MAX_PATH+1)) { root[0] = str[0]; root[1] = ':'; root[2] = '\\'; @@ -271,7 +271,7 @@ void get_default_root(char *root) else { /* if GetWindowsDirectory fails, something has probably gone wrong, * we are trying the blender install dir though */ - if (GetModuleFileName(NULL,str,MAX_PATH+1)) { + if (GetModuleFileName(NULL, str, MAX_PATH+1)) { printf("Error! Could not get the Windows Directory - Defaulting to Blender installation Dir!"); root[0] = str[0]; root[1] = ':'; |