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 6bfe370..0ccbf91 100644 (file)
@@ -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();
        } 
@@ -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 */
@@ -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);
@@ -1021,7 +1026,7 @@ static void tree_element_to_path(SpaceOops *soops, TreeElement *te, TreeStoreEle
                                        /* 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 */