use BLI_strncpy and BLI_snprintf when the size of the string is known.
[blender.git] / source / blender / editors / space_outliner / outliner_edit.c
index 6172273..0ccbf91 100644 (file)
@@ -213,7 +213,7 @@ void OUTLINER_OT_item_openclose(wmOperatorType *ot)
        
        ot->poll= ED_operator_outliner_active;
        
-       RNA_def_boolean(ot->srna, "all", 1, "All", "Close or open all items.");
+       RNA_def_boolean(ot->srna, "all", 1, "All", "Close or open all items");
 }
 
 /* Rename --------------------------------------------------- */
@@ -221,12 +221,17 @@ void OUTLINER_OT_item_openclose(wmOperatorType *ot)
 static void do_item_rename(ARegion *ar, TreeElement *te, TreeStoreElem *tselem, ReportList *reports)
 {
        /* can't rename rna datablocks entries */
-       if(ELEM3(tselem->type, TSE_RNA_STRUCT, TSE_RNA_PROPERTY, TSE_RNA_ARRAY_ELEM))
-                       ;
-       else if(ELEM10(tselem->type, TSE_ANIM_DATA, TSE_NLA, TSE_DEFGROUP_BASE, TSE_CONSTRAINT_BASE, TSE_MODIFIER_BASE, TSE_SCRIPT_BASE, TSE_POSE_BASE, TSE_POSEGRP_BASE, TSE_R_LAYER_BASE, TSE_R_PASS)) 
+       if(ELEM3(tselem->type, TSE_RNA_STRUCT, TSE_RNA_PROPERTY, TSE_RNA_ARRAY_ELEM)) {
+                       /* do nothing */;
+       }
+       else if(ELEM10(tselem->type, TSE_ANIM_DATA, TSE_NLA, TSE_DEFGROUP_BASE, TSE_CONSTRAINT_BASE, TSE_MODIFIER_BASE,
+                                    TSE_SCRIPT_BASE, TSE_POSE_BASE, TSE_POSEGRP_BASE, TSE_R_LAYER_BASE, TSE_R_PASS))
+       {
                        BKE_report(reports, RPT_WARNING, "Cannot edit builtin name");
-       else if(ELEM3(tselem->type, TSE_SEQUENCE, TSE_SEQ_STRIP, TSE_SEQUENCE_DUP))
+       }
+       else if(ELEM3(tselem->type, TSE_SEQUENCE, TSE_SEQ_STRIP, TSE_SEQUENCE_DUP)) {
                BKE_report(reports, RPT_WARNING, "Cannot edit sequence name");
+       }
        else if(tselem->id->lib) {
                // XXX                                          error_libdata();
        } 
@@ -669,7 +674,7 @@ void OUTLINER_OT_scroll_page(wmOperatorType *ot)
        ot->poll= ED_operator_outliner_active;
        
        /* properties */
-       RNA_def_boolean(ot->srna, "up", 0, "Up", "Scroll up one page.");
+       RNA_def_boolean(ot->srna, "up", 0, "Up", "Scroll up one page");
 }
 
 /* Search ------------------------------------------------------- */
@@ -744,7 +749,7 @@ static void outliner_find_panel(Scene *UNUSED(scene), ARegion *ar, SpaceOops *so
        TreeElement *last_find;
        TreeStoreElem *tselem;
        int ytop, xdelta, prevFound=0;
-       char name[32];
+       char name[sizeof(soops->search_string)];
        
        /* get last found tree-element based on stored search_tse */
        last_find= outliner_find_tse(soops, &soops->search_tse);
@@ -798,7 +803,7 @@ static void outliner_find_panel(Scene *UNUSED(scene), ARegion *ar, SpaceOops *so
                        /* store selection */
                        soops->search_tse= *tselem;
                        
-                       BLI_strncpy(soops->search_string, name, 33);
+                       BLI_strncpy(soops->search_string, name, sizeof(soops->search_string));
                        soops->search_flags= flags;
                        
                        /* redraw */
@@ -869,7 +874,7 @@ void OUTLINER_OT_show_one_level(wmOperatorType *ot)
        /* no undo or registry, UI option */
        
        /* properties */
-       RNA_def_boolean(ot->srna, "open", 1, "Open", "Expand all entries one level deep.");
+       RNA_def_boolean(ot->srna, "open", 1, "Open", "Expand all entries one level deep");
 }
 
 /* Show Hierarchy ----------------------------------------------- */
@@ -947,7 +952,7 @@ void OUTLINER_OT_show_hierarchy(wmOperatorType *ot)
 /* ANIMATO OPERATIONS */
 /* KeyingSet and Driver Creation - Helper functions */
 
-/* specialised poll callback for these operators to work in Datablocks view only */
+/* specialized poll callback for these operators to work in Datablocks view only */
 static int ed_operator_outliner_datablocks_active(bContext *C)
 {
        ScrArea *sa= CTX_wm_area(C);
@@ -969,7 +974,7 @@ static void tree_element_to_path(SpaceOops *soops, TreeElement *te, TreeStoreEle
        ListBase hierarchy = {NULL, NULL};
        LinkData *ld;
        TreeElement *tem, *temnext, *temsub;
-       TreeStoreElem *tse, *tsenext;
+       TreeStoreElem *tse /* , *tsenext */ /* UNUSED */;
        PointerRNA *ptr, *nextptr;
        PropertyRNA *prop;
        char *newpath=NULL;
@@ -1018,10 +1023,10 @@ static void tree_element_to_path(SpaceOops *soops, TreeElement *te, TreeStoreEle
                                        char buf[128], *name;
                                        
                                        temnext= (TreeElement*)(ld->next->data);
-                                       tsenext= TREESTORE(temnext);
+                                       /* tsenext= TREESTORE(temnext); */ /* UNUSED */
                                        
                                        nextptr= &temnext->rnaptr;
-                                       name= RNA_struct_name_get_alloc(nextptr, buf, sizeof(buf));
+                                       name= RNA_struct_name_get_alloc(nextptr, buf, sizeof(buf), NULL);
                                        
                                        if(name) {
                                                /* if possible, use name as a key in the path */