fix for use of un-initialized pointers in file_sfile_to_operator(...) & remove unused...
authorCampbell Barton <ideasman42@gmail.com>
Mon, 21 Mar 2011 03:22:33 +0000 (03:22 +0000)
committerCampbell Barton <ideasman42@gmail.com>
Mon, 21 Mar 2011 03:22:33 +0000 (03:22 +0000)
source/blender/editors/space_file/file_ops.c
source/blender/editors/space_file/filelist.c
source/blender/editors/space_file/filelist.h
source/blender/windowmanager/intern/wm_operators.c

index 9005a6c..7f8fe3e 100644 (file)
@@ -146,7 +146,7 @@ static FileSelection file_selection_get(bContext* C, const rcti* rect, short fil
        if (fill && (sel.last >= 0) && (sel.last < numfiles) ) {
                int f= sel.last;
                while (f >= 0) {
-                       if ( filelist_is_selected(sfile->files, f, SELECTED_FILE, CHECK_ALL) )
+                       if ( filelist_is_selected(sfile->files, f, CHECK_ALL) )
                                break;
                        f--;
                }
@@ -216,7 +216,7 @@ static FileSelect file_select(bContext* C, const rcti* rect, FileSelType select,
        if ( (sel.last >= 0) && ((select == FILE_SEL_ADD) || (select == FILE_SEL_TOGGLE)) )
        {
                /* Check last selection, if selected, act on the file or dir */
-               if (filelist_is_selected(sfile->files, sel.last, SELECTED_FILE, CHECK_ALL)) {
+               if (filelist_is_selected(sfile->files, sel.last, CHECK_ALL)) {
                        retval = file_select_do(C, sel.last);
                }
        }
@@ -369,7 +369,7 @@ static int file_select_all_exec(bContext *C, wmOperator *UNUSED(op))
 
        /* Is any file selected ? */
        for ( i=0; i < numfiles; ++i) {
-               if (filelist_is_selected(sfile->files, i, SELECTED_FILE, CHECK_ALL)) {
+               if (filelist_is_selected(sfile->files, i, CHECK_ALL)) {
                        is_selected = 1;
                        break;
                }
@@ -619,10 +619,11 @@ void file_sfile_to_operator(wmOperator *op, SpaceFile *sfile, char *filepath)
        {
                PointerRNA itemptr;
                int i, numfiles = filelist_numfiles(sfile->files);
-               struct direntry *file;
+
                if(RNA_struct_find_property(op->ptr, "files")) {
                        for (i=0; i<numfiles; i++) {
-                               if (filelist_is_selected(sfile->files, i, SELECTED_FILE, CHECK_FILES)) {
+                               if (filelist_is_selected(sfile->files, i, CHECK_FILES)) {
+                                       struct direntry *file= filelist_file(sfile->files, i);
                                        RNA_collection_add(op->ptr, "files", &itemptr);
                                        RNA_string_set(&itemptr, "name", file->relname);
                                }
@@ -631,7 +632,8 @@ void file_sfile_to_operator(wmOperator *op, SpaceFile *sfile, char *filepath)
                
                if(RNA_struct_find_property(op->ptr, "dirs")) {
                        for (i=0; i<numfiles; i++) {
-                               if (filelist_is_selected(sfile->files, i, SELECTED_FILE, CHECK_DIRS)) {
+                               if (filelist_is_selected(sfile->files, i, CHECK_DIRS)) {
+                                       struct direntry *file= filelist_file(sfile->files, i);
                                        RNA_collection_add(op->ptr, "dirs", &itemptr);
                                        RNA_string_set(&itemptr, "name", file->relname);
                                }
@@ -718,7 +720,7 @@ int file_exec(bContext *C, wmOperator *exec_op)
                        int i, active=0;
                        
                        for (i=0; i<filelist_numfiles(sfile->files); i++) {
-                               if(filelist_is_selected(sfile->files, i, SELECTED_FILE, CHECK_ALL)) {
+                               if(filelist_is_selected(sfile->files, i, CHECK_ALL)) {
                                        active=1;
                                        break;
                                }
@@ -883,7 +885,7 @@ static int file_smoothscroll_invoke(bContext *C, wmOperator *UNUSED(op), wmEvent
        /* check if we are editing a name */
        for (i=0; i < numfiles; ++i)
        {
-               if (filelist_is_selected(sfile->files, i, EDITING_FILE, CHECK_ALL) ) {
+               if (filelist_is_selected(sfile->files, i, CHECK_ALL) ) {
                        edit_idx=i;
                        break;
                }
index 1292cc6..da8226d 100644 (file)
@@ -948,7 +948,7 @@ void filelist_select(struct FileList* filelist, FileSelection* sel, FileSelType
        }
 }
 
-int    filelist_is_selected(struct FileList* filelist, int index, unsigned int flag, FileCheckType check)
+int    filelist_is_selected(struct FileList* filelist, int index, FileCheckType check)
 {
        struct direntry* file = filelist_file(filelist, index);
        if (!file) {
index c63e7f0..c5535b2 100644 (file)
@@ -77,7 +77,7 @@ void                          filelist_setdir(struct FileList* filelist, const char *dir);
 struct direntry *      filelist_file(struct FileList* filelist, int index);
 void                           filelist_select(struct FileList* filelist, FileSelection* sel, FileSelType select, unsigned int flag, FileCheckType check);
 void                           filelist_select_file(struct FileList* filelist, int index, FileSelType select, unsigned int flag, FileCheckType check);
-int                                    filelist_is_selected(struct FileList* filelist, int index, unsigned int flag, FileCheckType check);
+int                                    filelist_is_selected(struct FileList* filelist, int index, FileCheckType check);
 void                           filelist_hidedot(struct FileList* filelist, short hide);
 void                           filelist_setfilter(struct FileList* filelist, unsigned int filter);
 void                           filelist_setfilter_types(struct FileList* filelist, const char *filter_glob);
index a101564..74c2045 100644 (file)
@@ -2075,7 +2075,7 @@ void WM_paint_cursor_end(wmWindowManager *wm, void *handle)
    It stores 4 values (xmin, xmax, ymin, ymax) and event it ended with (event_type)
 */
 
-static int border_apply_rect(bContext *C, wmOperator *op)
+static int border_apply_rect(wmOperator *op)
 {
        wmGesture *gesture= op->customdata;
        rcti *rect= gesture->customdata;
@@ -2095,7 +2095,7 @@ static int border_apply_rect(bContext *C, wmOperator *op)
 
 static int border_apply(bContext *C, wmOperator *op, int gesture_mode)
 {
-       if (!border_apply_rect(C, op))
+       if (!border_apply_rect(op))
                return 0;
        
        /* XXX weak; border should be configured for this without reading event types */
@@ -2151,7 +2151,7 @@ int WM_border_select_modal(bContext *C, wmOperator *op, wmEvent *event)
                        rect->xmax= event->x - sx;
                        rect->ymax= event->y - sy;
                }
-               border_apply_rect(C, op);
+               border_apply_rect(op);
 
                wm_gesture_tag_redraw(C);
        }