minor edits
authorCampbell Barton <ideasman42@gmail.com>
Wed, 5 Oct 2011 12:20:38 +0000 (12:20 +0000)
committerCampbell Barton <ideasman42@gmail.com>
Wed, 5 Oct 2011 12:20:38 +0000 (12:20 +0000)
- use TRUE/FALSE rather than 1/0
- WM_operator_properties_create_ptr rather than WM_operator_properties_create since the pointers available.
- remove redundant strlen()

source/blender/editors/interface/interface.c
source/blender/editors/interface/interface_layout.c
source/blender/editors/space_file/filesel.c
source/blender/editors/space_file/space_file.c

index 5ebdf78..a816c16 100644 (file)
@@ -2519,7 +2519,7 @@ static uiBut *ui_def_but(uiBlock *block, int type, int retval, const char *str,
        but->pos= -1;   /* cursor invisible */
 
        if(ELEM4(but->type, NUM, NUMABS, NUMSLI, HSVSLI)) {     /* add a space to name */
-               slen= strlen(but->str);
+               /* slen remains unchanged from previous assignment, ensure this stays true */
                if(slen>0 && slen<UI_MAX_NAME_STR-2) {
                        if(but->str[slen-1]!=' ') {
                                but->str[slen]= ' ';
index 2f10ebf..ba612fc 100644 (file)
@@ -768,7 +768,7 @@ void uiItemsFullEnumO(uiLayout *layout, const char *opname, const char *propname
                                if(properties) {
                                        PointerRNA tptr;
 
-                                       WM_operator_properties_create(&tptr, opname);
+                                       WM_operator_properties_create_ptr(&tptr, ot);
                                        if(tptr.data) {
                                                IDP_FreeProperty(tptr.data);
                                                MEM_freeN(tptr.data);
index 645f54a..e357188 100644 (file)
@@ -248,7 +248,7 @@ short ED_fileselect_set_params(SpaceFile *sfile)
 
        /* switching thumbnails needs to recalc layout [#28809] */
        if (sfile->layout) {
-               sfile->layout->dirty= 1;
+               sfile->layout->dirty= TRUE;
        }
 
        return 1;
@@ -471,12 +471,13 @@ void ED_fileselect_init_layout(struct SpaceFile *sfile, struct ARegion *ar)
        int maxlen = 0;
        int numfiles;
        int textheight;
+
        if (sfile->layout == NULL) {
                sfile->layout = MEM_callocN(sizeof(struct FileLayout), "file_layout");
-               sfile->layout->dirty = 1;
-       } 
-
-       if (!sfile->layout->dirty) return;
+               sfile->layout->dirty = TRUE;
+       } else if (sfile->layout->dirty == FALSE) {
+               return;
+       }
 
        numfiles = filelist_numfiles(sfile->files);
        textheight = (int)file_font_pointsize();
@@ -543,7 +544,7 @@ void ED_fileselect_init_layout(struct SpaceFile *sfile, struct ARegion *ar)
                layout->width = sfile->layout->columns * (layout->tile_w + 2*layout->tile_border_x) + layout->tile_border_x*2;
                layout->flag = FILE_LAYOUT_HOR;
        }
-       layout->dirty= 0;
+       layout->dirty= FALSE;
 }
 
 FileLayout* ED_fileselect_get_layout(struct SpaceFile *sfile, struct ARegion *ar)
index f4adc47..7a70ed9 100644 (file)
@@ -154,7 +154,7 @@ static void file_init(struct wmWindowManager *UNUSED(wm), ScrArea *sa)
        SpaceFile *sfile= (SpaceFile*)sa->spacedata.first;
        //printf("file_init\n");
 
-       if(sfile->layout) sfile->layout->dirty= 1;
+       if(sfile->layout) sfile->layout->dirty= TRUE;
 }
 
 
@@ -242,7 +242,7 @@ static void file_refresh(const bContext *C, ScrArea *UNUSED(sa))
                BLI_strncpy(sfile->params->renameedit, sfile->params->renamefile, sizeof(sfile->params->renameedit));
                params->renamefile[0] = '\0';
        }
-       if (sfile->layout) sfile->layout->dirty= 1;
+       if (sfile->layout) sfile->layout->dirty= TRUE;
 
 }