From 617557b08ea94e2b65a1697ddf0b79651204d92b Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Tue, 1 Apr 2014 11:34:00 +1100 Subject: Code cleanup: remove TRUE/FALSE & WITH_BOOL_COMPAT define --- source/blender/blenloader/intern/readfile.c | 48 ++++++++++++----------- source/blender/blenloader/intern/versioning_250.c | 6 +-- source/blender/blenloader/intern/versioning_260.c | 8 ++-- source/blender/blenloader/intern/writefile.c | 17 ++++---- 4 files changed, 42 insertions(+), 37 deletions(-) (limited to 'source/blender/blenloader') diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c index 4ab3afcaa0c..13827f833e0 100644 --- a/source/blender/blenloader/intern/readfile.c +++ b/source/blender/blenloader/intern/readfile.c @@ -2534,7 +2534,7 @@ static void lib_verify_nodetree(Main *main, int UNUSED(open)) * the ntree interface sockets, which need to be redirected to new interface nodes. */ for (link = ntree->links.first; link; link = next_link) { - int free_link = FALSE; + bool free_link = false; next_link = link->next; if (link->fromnode == NULL) { @@ -2549,8 +2549,9 @@ static void lib_verify_nodetree(Main *main, int UNUSED(open)) input_locy += link->tonode->locy; } } - else - free_link = TRUE; + else { + free_link = true; + } } if (link->tonode == NULL) { @@ -2565,8 +2566,9 @@ static void lib_verify_nodetree(Main *main, int UNUSED(open)) output_locy += link->fromnode->locy; } } - else - free_link = TRUE; + else { + free_link = true; + } } if (free_link) @@ -2626,7 +2628,7 @@ static void direct_link_nodetree(FileData *fd, bNodeTree *ntree) bNodeLink *link; ntree->init = 0; /* to set callbacks and force setting types */ - ntree->is_updating = FALSE; + ntree->is_updating = false; ntree->typeinfo= NULL; ntree->interface_type = NULL; @@ -5361,7 +5363,7 @@ static void direct_link_scene(FileData *fd, Scene *sce) seq->strip = newdataadr(fd, seq->strip); if (seq->strip && seq->strip->done==0) { - seq->strip->done = TRUE; + seq->strip->done = true; if (ELEM4(seq->type, SEQ_TYPE_IMAGE, SEQ_TYPE_MOVIE, SEQ_TYPE_SOUND_RAM, SEQ_TYPE_SOUND_HD)) { seq->strip->stripdata = newdataadr(fd, seq->strip->stripdata); @@ -5493,7 +5495,7 @@ static void direct_link_scene(FileData *fd, Scene *sce) rbw->effector_weights = BKE_add_effector_weights(NULL); /* link cache */ - direct_link_pointcache_list(fd, &rbw->ptcaches, &rbw->pointcache, FALSE); + direct_link_pointcache_list(fd, &rbw->ptcaches, &rbw->pointcache, false); /* make sure simulation starts from the beginning after loading file */ if (rbw->pointcache) { rbw->ltime = (float)rbw->pointcache->startframe; @@ -7654,7 +7656,7 @@ BlendFileData *blo_read_file_internal(FileData *fd, const char *filepath) lib_link_all(fd, bfd->main); //do_versions_after_linking(fd, NULL, bfd->main); // XXX: not here (or even in this function at all)! this causes crashes on many files - Aligorith (July 04, 2010) - lib_verify_nodetree(bfd->main, TRUE); + lib_verify_nodetree(bfd->main, true); fix_relpaths_library(fd->relabase, bfd->main); /* make all relative paths, relative to the open blend file */ link_global(fd, bfd); /* as last */ @@ -8598,10 +8600,11 @@ void BLO_expand_main(void *fdhandle, Main *mainvar) ListBase *lbarray[MAX_LIBARRAY]; FileData *fd = fdhandle; ID *id; - int a, do_it = TRUE; + int a; + bool do_it = true; while (do_it) { - do_it = FALSE; + do_it = false; a = set_listbasepointers(mainvar, lbarray); while (a--) { @@ -8683,7 +8686,7 @@ void BLO_expand_main(void *fdhandle, Main *mainvar) break; } - do_it = TRUE; + do_it = true; id->flag -= LIB_NEED_EXPAND; } @@ -8723,27 +8726,27 @@ static void give_base_to_objects(Main *mainvar, Scene *sce, Library *lib, const * * (ob->id.flag & LIB_PRE_EXISTING)==0 means that this is a newly appended object - Campbell */ if (is_group_append==0 || (ob->id.flag & LIB_PRE_EXISTING)==0) { - int do_it = FALSE; + bool do_it = false; if (ob->id.us == 0) { - do_it = TRUE; + do_it = true; } else if (idcode==ID_GR) { - if (ob->id.us==1 && is_link==FALSE && ob->id.lib==lib) { + if (ob->id.us == 1 && is_link == false && ob->id.lib == lib) { if ((ob->flag & OB_FROMGROUP) && object_in_any_scene(mainvar, ob)==0) { - do_it = TRUE; + do_it = true; } } } else { /* when appending, make sure any indirectly loaded objects * get a base else they cant be accessed at all [#27437] */ - if (ob->id.us==1 && is_link==FALSE && ob->id.lib==lib) { + if (ob->id.us==1 && is_link == false && ob->id.lib == lib) { /* we may be appending from a scene where we already * have a linked object which is not in any scene [#27616] */ if ((ob->id.flag & LIB_PRE_EXISTING)==0) { if (object_in_any_scene(mainvar, ob)==0) { - do_it = TRUE; + do_it = true; } } } @@ -9012,7 +9015,7 @@ static void library_append_end(const bContext *C, Main *mainl, FileData **fd, in mainl = NULL; /* blo_join_main free's mainl, cant use anymore */ lib_link_all(*fd, mainvar); - lib_verify_nodetree(mainvar, FALSE); + lib_verify_nodetree(mainvar, false); fix_relpaths_library(G.main->name, mainvar); /* make all relative paths, relative to the open blend file */ if (C) { @@ -9087,13 +9090,14 @@ static void read_libraries(FileData *basefd, ListBase *mainlist) Main *mainl = mainlist->first; Main *mainptr; ListBase *lbarray[MAX_LIBARRAY]; - int a, do_it = TRUE; + int a; + bool do_it = true; /* expander now is callback function */ BLO_main_expander(expand_doit_library); while (do_it) { - do_it = FALSE; + do_it = false; /* test 1: read libdata */ mainptr= mainl->next; @@ -9180,7 +9184,7 @@ static void read_libraries(FileData *basefd, ListBase *mainlist) } } if (fd) { - do_it = TRUE; + do_it = true; a = set_listbasepointers(mainptr, lbarray); while (a--) { ID *id = lbarray[a]->first; diff --git a/source/blender/blenloader/intern/versioning_250.c b/source/blender/blenloader/intern/versioning_250.c index c276bd0876c..17600d1fcd1 100644 --- a/source/blender/blenloader/intern/versioning_250.c +++ b/source/blender/blenloader/intern/versioning_250.c @@ -1141,7 +1141,7 @@ void blo_do_versions_250(FileData *fd, Library *lib, Main *main) World *wo; Tex *tex; ParticleSettings *part; - int do_gravity = FALSE; + bool do_gravity = false; for (sce = main->scene.first; sce; sce = sce->id.next) if (sce->unit.scale_length == 0.0f) @@ -1197,7 +1197,7 @@ void blo_do_versions_250(FileData *fd, Library *lib, Main *main) sce->physics_settings.gravity[0] = sce->physics_settings.gravity[1] = 0.0f; sce->physics_settings.gravity[2] = -9.81f; sce->physics_settings.flag = PHYS_GLOBAL_GRAVITY; - do_gravity = TRUE; + do_gravity = true; } } @@ -2561,7 +2561,7 @@ void blo_do_versions_250(FileData *fd, Library *lib, Main *main) tex->pd->falloff_curve->preset = CURVE_PRESET_LINE; tex->pd->falloff_curve->cm->flag &= ~CUMA_EXTEND_EXTRAPOLATE; curvemap_reset(tex->pd->falloff_curve->cm, &tex->pd->falloff_curve->clipr, tex->pd->falloff_curve->preset, CURVEMAP_SLOPE_POSITIVE); - curvemapping_changed(tex->pd->falloff_curve, FALSE); + curvemapping_changed(tex->pd->falloff_curve, false); } } } diff --git a/source/blender/blenloader/intern/versioning_260.c b/source/blender/blenloader/intern/versioning_260.c index 43da85c2715..cf74ef068eb 100644 --- a/source/blender/blenloader/intern/versioning_260.c +++ b/source/blender/blenloader/intern/versioning_260.c @@ -1198,7 +1198,7 @@ void blo_do_versions_260(FileData *fd, Library *UNUSED(lib), Main *main) if (sl->spacetype == SPACE_CLIP) { SpaceClip *sclip = (SpaceClip *)sl; ARegion *ar; - int hide = FALSE; + bool hide = false; for (ar = sa->regionbase.first; ar; ar = ar->next) { if (ar->regiontype == RGN_TYPE_PREVIEW) { @@ -1207,7 +1207,7 @@ void blo_do_versions_260(FileData *fd, Library *UNUSED(lib), Main *main) ar->v2d.flag &= ~V2D_IS_INITIALISED; ar->alignment = RGN_ALIGN_NONE; - hide = TRUE; + hide = true; } } } @@ -1530,7 +1530,7 @@ void blo_do_versions_260(FileData *fd, Library *UNUSED(lib), Main *main) if (main->versionfile < 263 || (main->versionfile == 263 && main->subversionfile < 19)) { Scene *scene; Image *ima; - int colormanagement_disabled = FALSE; + bool colormanagement_disabled = false; /* make scenes which are not using color management have got None as display device, * so they wouldn't perform linear-to-sRGB conversion on display @@ -1544,7 +1544,7 @@ void blo_do_versions_260(FileData *fd, Library *UNUSED(lib), Main *main) } - colormanagement_disabled = TRUE; + colormanagement_disabled = true; } } diff --git a/source/blender/blenloader/intern/writefile.c b/source/blender/blenloader/intern/writefile.c index f724458c2ba..ffd1d6d1be1 100644 --- a/source/blender/blenloader/intern/writefile.c +++ b/source/blender/blenloader/intern/writefile.c @@ -2229,7 +2229,7 @@ static void write_scenes(WriteData *wd, ListBase *scebase) SEQ_BEGIN (ed, seq) { - if (seq->strip) seq->strip->done = FALSE; + if (seq->strip) seq->strip->done = false; writestruct(wd, DATA, "Sequence", 1, seq); } SEQ_END @@ -2275,7 +2275,7 @@ static void write_scenes(WriteData *wd, ListBase *scebase) else if (seq->type==SEQ_TYPE_MOVIE || seq->type==SEQ_TYPE_SOUND_RAM || seq->type == SEQ_TYPE_SOUND_HD) writestruct(wd, DATA, "StripElem", 1, strip->stripdata); - strip->done = TRUE; + strip->done = true; } write_sequence_modifiers(wd, &seq->modifiers); @@ -2625,7 +2625,8 @@ static void write_libraries(WriteData *wd, Main *main) { ListBase *lbarray[MAX_LIBARRAY]; ID *id; - int a, tot, foundone; + int a, tot; + bool found_one; for (; main; main= main->next) { @@ -2633,24 +2634,24 @@ static void write_libraries(WriteData *wd, Main *main) /* test: is lib being used */ if (main->curlib && main->curlib->packedfile) - foundone = TRUE; + found_one = true; else { - foundone = FALSE; + found_one = false; while (tot--) { for (id= lbarray[tot]->first; id; id= id->next) { if (id->us>0 && (id->flag & LIB_EXTERN)) { - foundone = TRUE; + found_one = true; break; } } - if (foundone) break; + if (found_one) break; } } /* to be able to restore quit.blend and temp saves, the packed blend has to be in undo buffers... */ /* XXX needs rethink, just like save UI in undo files now - would be nice to append things only for the] * quit.blend and temp saves */ - if (foundone) { + if (found_one) { writestruct(wd, ID_LI, "Library", 1, main->curlib); if (main->curlib->packedfile) { -- cgit v1.2.3