diff options
author | Campbell Barton <ideasman42@gmail.com> | 2014-04-01 04:34:00 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2014-04-01 08:22:28 +0400 |
commit | 617557b08ea94e2b65a1697ddf0b79651204d92b (patch) | |
tree | 50b24bab075b42fa20456140c9a9681cfb01325b /source/blender/blenlib/intern | |
parent | 2c00ecc738c04dc5dc22d4a6b81a1e937526ba6d (diff) |
Code cleanup: remove TRUE/FALSE & WITH_BOOL_COMPAT define
Diffstat (limited to 'source/blender/blenlib/intern')
-rw-r--r-- | source/blender/blenlib/intern/BLI_args.c | 4 | ||||
-rw-r--r-- | source/blender/blenlib/intern/BLI_kdopbvh.c | 2 | ||||
-rw-r--r-- | source/blender/blenlib/intern/fileops.c | 2 | ||||
-rw-r--r-- | source/blender/blenlib/intern/freetypefont.c | 2 | ||||
-rw-r--r-- | source/blender/blenlib/intern/math_matrix.c | 26 | ||||
-rw-r--r-- | source/blender/blenlib/intern/string_cursor_utf8.c | 8 | ||||
-rw-r--r-- | source/blender/blenlib/intern/uvproject.c | 8 | ||||
-rw-r--r-- | source/blender/blenlib/intern/voronoi.c | 34 | ||||
-rw-r--r-- | source/blender/blenlib/intern/winstuff.c | 6 |
9 files changed, 47 insertions, 45 deletions
diff --git a/source/blender/blenlib/intern/BLI_args.c b/source/blender/blenlib/intern/BLI_args.c index fb35b55a935..8bd35f651b7 100644 --- a/source/blender/blenlib/intern/BLI_args.c +++ b/source/blender/blenlib/intern/BLI_args.c @@ -49,7 +49,7 @@ typedef struct bArgDoc { const char *short_arg; const char *long_arg; const char *documentation; - int done; + bool done; } bArgDoc; typedef struct bAKey { @@ -243,7 +243,7 @@ void BLI_argsPrintArgDoc(struct bArgs *ba, const char *arg) internalDocPrint(d); - d->done = TRUE; + d->done = true; } } diff --git a/source/blender/blenlib/intern/BLI_kdopbvh.c b/source/blender/blenlib/intern/BLI_kdopbvh.c index 0effdf081a9..6fdfac2e1cb 100644 --- a/source/blender/blenlib/intern/BLI_kdopbvh.c +++ b/source/blender/blenlib/intern/BLI_kdopbvh.c @@ -1275,7 +1275,7 @@ static void bfs_find_nearest(BVHNearestData *data, BVHNode *node) else { /* adjust heap size */ if ((heap_size >= max_heap_size) && - ADJUST_MEMORY(default_heap, (void **)&heap, heap_size + 1, &max_heap_size, sizeof(heap[0])) == FALSE) + ADJUST_MEMORY(default_heap, (void **)&heap, heap_size + 1, &max_heap_size, sizeof(heap[0])) == false) { printf("WARNING: bvh_find_nearest got out of memory\n"); diff --git a/source/blender/blenlib/intern/fileops.c b/source/blender/blenlib/intern/fileops.c index 4702b384211..988979b5d0a 100644 --- a/source/blender/blenlib/intern/fileops.c +++ b/source/blender/blenlib/intern/fileops.c @@ -360,7 +360,7 @@ int BLI_copy(const char *file, const char *to) UTF16_ENCODE(file); UTF16_ENCODE(str); - err = !CopyFileW(file_16, str_16, FALSE); + err = !CopyFileW(file_16, str_16, false); UTF16_UN_ENCODE(str); UTF16_UN_ENCODE(file); diff --git a/source/blender/blenlib/intern/freetypefont.c b/source/blender/blenlib/intern/freetypefont.c index 4680cfc1add..79f009e8aa3 100644 --- a/source/blender/blenlib/intern/freetypefont.c +++ b/source/blender/blenlib/intern/freetypefont.c @@ -301,7 +301,7 @@ static VChar *objchr_to_ftvfontdata(VFont *vfont, FT_ULong charcode) } } else { - err = TRUE; + err = true; return NULL; } diff --git a/source/blender/blenlib/intern/math_matrix.c b/source/blender/blenlib/intern/math_matrix.c index cfcbd0bce72..4cbe1a76f58 100644 --- a/source/blender/blenlib/intern/math_matrix.c +++ b/source/blender/blenlib/intern/math_matrix.c @@ -601,10 +601,10 @@ float determinant_m3_array(float m[3][3]) m[2][0] * (m[0][1] * m[1][2] - m[0][2] * m[1][1])); } -int invert_m3_ex(float m[3][3], const float epsilon) +bool invert_m3_ex(float m[3][3], const float epsilon) { float tmp[3][3]; - int success; + bool success; success = invert_m3_m3_ex(tmp, m, epsilon); copy_m3_m3(m, tmp); @@ -612,10 +612,11 @@ int invert_m3_ex(float m[3][3], const float epsilon) return success; } -int invert_m3_m3_ex(float m1[3][3], float m2[3][3], const float epsilon) +bool invert_m3_m3_ex(float m1[3][3], float m2[3][3], const float epsilon) { float det; - int a, b, success; + int a, b; + bool success; BLI_assert(epsilon >= 0.0f); @@ -638,10 +639,10 @@ int invert_m3_m3_ex(float m1[3][3], float m2[3][3], const float epsilon) return success; } -int invert_m3(float m[3][3]) +bool invert_m3(float m[3][3]) { float tmp[3][3]; - int success; + bool success; success = invert_m3_m3(tmp, m); copy_m3_m3(m, tmp); @@ -649,10 +650,11 @@ int invert_m3(float m[3][3]) return success; } -int invert_m3_m3(float m1[3][3], float m2[3][3]) +bool invert_m3_m3(float m1[3][3], float m2[3][3]) { float det; - int a, b, success; + int a, b; + bool success; /* calc adjoint */ adjoint_m3_m3(m1, m2); @@ -674,10 +676,10 @@ int invert_m3_m3(float m1[3][3], float m2[3][3]) return success; } -int invert_m4(float m[4][4]) +bool invert_m4(float m[4][4]) { float tmp[4][4]; - int success; + bool success; success = invert_m4_m4(tmp, m); copy_m4_m4(m, tmp); @@ -688,13 +690,13 @@ int invert_m4(float m[4][4]) /* * invertmat - * computes the inverse of mat and puts it in inverse. Returns - * TRUE on success (i.e. can always find a pivot) and FALSE on failure. + * true on success (i.e. can always find a pivot) and false on failure. * Uses Gaussian Elimination with partial (maximal column) pivoting. * * Mark Segal - 1992 */ -int invert_m4_m4(float inverse[4][4], float mat[4][4]) +bool invert_m4_m4(float inverse[4][4], float mat[4][4]) { int i, j, k; double temp; diff --git a/source/blender/blenlib/intern/string_cursor_utf8.c b/source/blender/blenlib/intern/string_cursor_utf8.c index 57913af3703..09b7ecb2277 100644 --- a/source/blender/blenlib/intern/string_cursor_utf8.c +++ b/source/blender/blenlib/intern/string_cursor_utf8.c @@ -126,10 +126,10 @@ bool BLI_str_cursor_step_next_utf8(const char *str, size_t maxlen, int *pos) if ((*pos) > (int)maxlen) { (*pos) = (int)maxlen; } - return TRUE; + return true; } - return FALSE; + return false; } bool BLI_str_cursor_step_prev_utf8(const char *str, size_t UNUSED(maxlen), int *pos) @@ -139,11 +139,11 @@ bool BLI_str_cursor_step_prev_utf8(const char *str, size_t UNUSED(maxlen), int * const char *str_prev = BLI_str_find_prev_char_utf8(str, str_pos); if (str_prev) { (*pos) -= (str_pos - str_prev); - return TRUE; + return true; } } - return FALSE; + return false; } void BLI_str_cursor_step_utf8(const char *str, size_t maxlen, diff --git a/source/blender/blenlib/intern/uvproject.c b/source/blender/blenlib/intern/uvproject.c index 730ab01bfd2..cf6a6366e9a 100644 --- a/source/blender/blenlib/intern/uvproject.c +++ b/source/blender/blenlib/intern/uvproject.c @@ -58,7 +58,7 @@ void BLI_uvproject_from_camera(float target[2], float source[3], ProjCameraInfo if (uci->do_pano) { float angle = atan2f(pv4[0], -pv4[2]) / ((float)M_PI * 2.0f); /* angle around the camera */ - if (uci->do_persp == FALSE) { + if (uci->do_persp == false) { target[0] = angle; /* no correct method here, just map to 0-1 */ target[1] = pv4[1] / uci->camsize; } @@ -74,7 +74,7 @@ void BLI_uvproject_from_camera(float target[2], float source[3], ProjCameraInfo if (pv4[2] == 0.0f) pv4[2] = 0.00001f; /* don't allow div by 0 */ - if (uci->do_persp == FALSE) { + if (uci->do_persp == false) { target[0] = (pv4[0] / uci->camsize); target[1] = (pv4[1] / uci->camsize); } @@ -152,10 +152,10 @@ ProjCameraInfo *BLI_uvproject_camera_info(Object *ob, float(*rotmat)[4], float w /* normal projection */ if (rotmat) { copy_m4_m4(uci.rotmat, rotmat); - uci.do_rotmat = TRUE; + uci.do_rotmat = true; } else { - uci.do_rotmat = FALSE; + uci.do_rotmat = false; } /* also make aspect ratio adjustment factors */ diff --git a/source/blender/blenlib/intern/voronoi.c b/source/blender/blenlib/intern/voronoi.c index 731536ff0df..e0cbe278ffb 100644 --- a/source/blender/blenlib/intern/voronoi.c +++ b/source/blender/blenlib/intern/voronoi.c @@ -58,9 +58,9 @@ typedef struct VoronoiEvent { typedef struct VoronoiParabola { struct VoronoiParabola *left, *right, *parent; VoronoiEvent *event; - int is_leaf; - float site[2]; VoronoiEdge *edge; + float site[2]; + bool is_leaf; } VoronoiParabola; typedef struct VoronoiProcess { @@ -118,7 +118,7 @@ static VoronoiParabola *voronoiParabola_new(void) { VoronoiParabola *parabola = MEM_callocN(sizeof(VoronoiParabola), "voronoi parabola"); - parabola->is_leaf = FALSE; + parabola->is_leaf = false; parabola->event = NULL; parabola->edge = NULL; parabola->parent = NULL; @@ -131,7 +131,7 @@ static VoronoiParabola *voronoiParabola_newSite(float site[2]) VoronoiParabola *parabola = MEM_callocN(sizeof(VoronoiParabola), "voronoi parabola site"); copy_v2_v2(parabola->site, site); - parabola->is_leaf = TRUE; + parabola->is_leaf = true; parabola->event = NULL; parabola->edge = NULL; parabola->parent = NULL; @@ -364,7 +364,7 @@ static void voronoi_addParabola(VoronoiProcess *process, float site[2]) float *fp = root->site; float s[2]; - root->is_leaf = FALSE; + root->is_leaf = false; voronoiParabola_setLeft(root, voronoiParabola_newSite(fp)); voronoiParabola_setRight(root, voronoiParabola_newSite(site)); @@ -399,7 +399,7 @@ static void voronoi_addParabola(VoronoiProcess *process, float site[2]) BLI_addtail(&process->edges, el); par->edge = er; - par->is_leaf = FALSE; + par->is_leaf = false; p0 = voronoiParabola_newSite(par->site); p1 = voronoiParabola_newSite(site); @@ -566,29 +566,29 @@ static int voronoi_getNextSideCoord(ListBase *edges, float coord[2], int dim, in int other_dim = dim ? 0 : 1; while (edge) { - int ok = FALSE; + bool ok = false; float co[2], cur_distance; if (fabsf(edge->start[other_dim] - coord[other_dim]) < VORONOI_EPS && len_squared_v2v2(coord, edge->start) > VORONOI_EPS) { copy_v2_v2(co, edge->start); - ok = TRUE; + ok = true; } if (fabsf(edge->end[other_dim] - coord[other_dim]) < VORONOI_EPS && len_squared_v2v2(coord, edge->end) > VORONOI_EPS) { copy_v2_v2(co, edge->end); - ok = TRUE; + ok = true; } if (ok) { if (dir > 0 && coord[dim] > co[dim]) { - ok = FALSE; + ok = false; } else if (dir < 0 && coord[dim] < co[dim]) { - ok = FALSE; + ok = false; } } @@ -693,7 +693,7 @@ void BLI_voronoi_compute(const VoronoiSite *sites, int sites_total, int width, i BLI_movelisttolist(edges, &process.edges); } -static int testVoronoiEdge(const float site[2], const float point[2], const VoronoiEdge *edge) +static bool testVoronoiEdge(const float site[2], const float point[2], const VoronoiEdge *edge) { float p[2]; @@ -701,11 +701,11 @@ static int testVoronoiEdge(const float site[2], const float point[2], const Voro if (len_squared_v2v2(p, edge->start) > VORONOI_EPS && len_squared_v2v2(p, edge->end) > VORONOI_EPS) { - return FALSE; + return false; } } - return TRUE; + return true; } static int voronoi_addTriangulationPoint(const float coord[2], const float color[3], @@ -787,16 +787,16 @@ void BLI_voronoi_triangulate(const VoronoiSite *sites, int sites_total, ListBase edge = boundary_edges.first; while (edge) { VoronoiEdge *test_edge = boundary_edges.first; - int ok_start = TRUE, ok_end = TRUE; + bool ok_start = true, ok_end = true; while (test_edge) { if (ok_start && !testVoronoiEdge(sites[i].co, edge->start, test_edge)) { - ok_start = FALSE; + ok_start = false; break; } if (ok_end && !testVoronoiEdge(sites[i].co, edge->end, test_edge)) { - ok_end = FALSE; + ok_end = false; break; } diff --git a/source/blender/blenlib/intern/winstuff.c b/source/blender/blenlib/intern/winstuff.c index 7db33ff79be..65ded37eb7b 100644 --- a/source/blender/blenlib/intern/winstuff.c +++ b/source/blender/blenlib/intern/winstuff.c @@ -82,7 +82,7 @@ void RegisterBlendExtension(void) LONG lresult; HKEY hkey = 0; HKEY root = 0; - BOOL usr_mode = FALSE; + BOOL usr_mode = false; DWORD dwd = 0; char buffer[256]; @@ -103,7 +103,7 @@ void RegisterBlendExtension(void) lresult = RegOpenKeyEx(HKEY_LOCAL_MACHINE, "Software\\Classes", 0, KEY_ALL_ACCESS, &root); if (lresult != ERROR_SUCCESS) { /* try HKCU on failure */ - usr_mode = TRUE; + usr_mode = true; lresult = RegOpenKeyEx(HKEY_CURRENT_USER, "Software\\Classes", 0, KEY_ALL_ACCESS, &root); if (lresult != ERROR_SUCCESS) RegisterBlendExtension_Fail(0); @@ -157,7 +157,7 @@ void RegisterBlendExtension(void) ThumbHandlerDLL = "BlendThumb.dll"; #else IsWow64Process(GetCurrentProcess(), &IsWOW64); - if (IsWOW64 == TRUE) + if (IsWOW64 == true) ThumbHandlerDLL = "BlendThumb64.dll"; else ThumbHandlerDLL = "BlendThumb.dll"; |