replace sprintf with strcpy where no formatting is done and return value isn't used.
authorCampbell Barton <ideasman42@gmail.com>
Sun, 9 Oct 2011 06:03:38 +0000 (06:03 +0000)
committerCampbell Barton <ideasman42@gmail.com>
Sun, 9 Oct 2011 06:03:38 +0000 (06:03 +0000)
source/blender/blenkernel/intern/gpencil.c
source/blender/blenkernel/intern/library.c
source/blender/blenkernel/intern/nla.c
source/blender/blenlib/intern/winstuff.c
source/blender/editors/animation/anim_draw.c
source/blender/editors/animation/anim_ipo_utils.c
source/blender/editors/util/ed_util.c
source/blender/makesrna/intern/rna_fluidsim.c
source/blender/makesrna/intern/rna_modifier.c

index c2e94cc97db7cfd407ef49190345900f569feb00..d56c9a63a9138187d62fa079bd542f6398a9b753 100644 (file)
@@ -182,7 +182,7 @@ bGPDlayer *gpencil_layer_addnew (bGPdata *gpd)
        gpl->thickness = 3;
        
        /* auto-name */
-       sprintf(gpl->info, "GP_Layer");
+       strcpy(gpl->info, "GP_Layer");
        BLI_uniquename(&gpd->layers, gpl, "GP_Layer", '.', offsetof(bGPDlayer, info[0]), sizeof(gpl->info));
        
        /* make this one the active one */
index 677a292266688851f27a134289bb7c2aedb92bd6..1dc53811fc0adb8042bca4a64f4a9ad940291775 100644 (file)
@@ -941,9 +941,9 @@ static void get_flags_for_id(ID *id, char *buf)
                isnode= ((Tex *)id)->use_nodes;
        
        if (id->us<0)
-               sprintf(buf, "-1W ");
+               strcpy(buf, "-1W ");
        else if (!id->lib && !isfake && id->us && !isnode)
-               sprintf(buf, "     ");
+               strcpy(buf, "     ");
        else if(isnode)
                sprintf(buf, "%c%cN%c ", id->lib?'L':' ', isfake?'F':' ', (id->us==0)?'O':' ');
        else
index 6ce80342dd6de9aa31c4546e29e903e9e756e40e..9c5cf9f05fabb8cb49471e767f202a0b6447d281 100644 (file)
@@ -1284,16 +1284,16 @@ void BKE_nlastrip_validate_name (AnimData *adt, NlaStrip *strip)
        if (strip->name[0]==0) {
                switch (strip->type) {
                        case NLASTRIP_TYPE_CLIP: /* act-clip */
-                               sprintf(strip->name, "%s", (strip->act)?(strip->act->id.name+2):("<No Action>"));
+                               BLI_strncpy(strip->name, (strip->act)?(strip->act->id.name+2):("<No Action>"), sizeof(strip->name));
                                break;
                        case NLASTRIP_TYPE_TRANSITION: /* transition */
-                               sprintf(strip->name, "Transition");
+                               BLI_strncpy(strip->name, "Transition", sizeof(strip->name));
                                break;
                        case NLASTRIP_TYPE_META: /* meta */
-                               sprintf(strip->name, "Meta");
+                               BLI_strncpy(strip->name, "Meta", sizeof(strip->name));
                                break;
                        default:
-                               sprintf(strip->name, "NLA Strip");
+                               BLI_strncpy(strip->name, "NLA Strip", sizeof(strip->name));
                                break;
                }
        }
index bf816a91fb3fda9611d292ac527c113b5a21e2df..3b14abb0beee5181beebc0ef03d103f12fffbed3 100644 (file)
@@ -109,7 +109,7 @@ void RegisterBlendExtension(void) {
        lresult = RegCreateKeyEx(root, "blendfile", 0,
                NULL, REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS, NULL, &hkey, &dwd);
        if (lresult == ERROR_SUCCESS) {
-               sprintf(buffer,"%s","Blender File");
+               strcpy(buffer,"Blender File");
                lresult = RegSetValueEx(hkey, NULL, 0, REG_SZ, (BYTE*)buffer, strlen(buffer) + 1);
                RegCloseKey(hkey);
        }
index d2b1fcc4abdab68271291831a069a7e46ae2ea94..2774bd2cda483bd6a2082c59e86b6366def7126f 100644 (file)
@@ -71,12 +71,12 @@ void ANIM_timecode_string_from_frame (char *str, Scene *scene, int power, short
        if (timecodes) {
                int hours=0, minutes=0, seconds=0, frames=0;
                float raw_seconds= cfra;
-               char neg[2]= "";
+               char neg[2]= {'\0'};
                
                /* get cframes */
                if (cfra < 0) {
                        /* correction for negative cfraues */
-                       sprintf(neg, "-");
+                       neg[0]= '-';
                        cfra = -cfra;
                }
                if (cfra >= 3600) {
index 9c43671cdf4c4734ecbd208fdbd12442901079c4..383e0bac796d0817b9328265fa0440ec3e1e34d8 100644 (file)
@@ -63,9 +63,9 @@ int getname_anim_fcurve(char *name, ID *id, FCurve *fcu)
                return icon;
        else if ELEM3(NULL, id, fcu, fcu->rna_path) {
                if (fcu == NULL)
-                       sprintf(name, "<invalid>");
+                       strcpy(name, "<invalid>");
                else if (fcu->rna_path == NULL)
-                       sprintf(name, "<no path>");
+                       strcpy(name, "<no path>");
                else /* id == NULL */
                        BLI_snprintf(name, 256, "%s[%d]", fcu->rna_path, fcu->array_index);
        }
index 3dd7514429ed56e54410c2cb2dd8feb4ed10de1f..d46f4b0ed30a21843425ed9b0bc659638ca2ca9a 100644 (file)
@@ -171,7 +171,7 @@ void unpack_menu(bContext *C, const char *opname, const char *id_name, const cha
        pup= uiPupMenuBegin(C, "Unpack file", ICON_NONE);
        layout= uiPupMenuLayout(pup);
 
-       sprintf(line, "Remove Pack");
+       strcpy(line, "Remove Pack");
        props_ptr= uiItemFullO(layout, opname, line, ICON_NONE, NULL, WM_OP_EXEC_DEFAULT, UI_ITEM_O_RETURN_PROPS);
        RNA_enum_set(&props_ptr, "method", PF_REMOVE);
        RNA_string_set(&props_ptr, "id", id_name);
index 82911ebb3be97368ddc285533f8808458eddfe3b..ba90aca47a35ee37b7e3742cea2709affe6c84ff 100644 (file)
@@ -141,12 +141,12 @@ static void rna_FluidSettings_update_type(Main *bmain, Scene *scene, PointerRNA
                        psys->part= part;
                        psys->pointcache= BKE_ptcache_add(&psys->ptcaches);
                        psys->flag |= PSYS_ENABLED;
-                       sprintf(psys->name, "FluidParticles");
+                       BLI_strncpy(psys->name, "FluidParticles", sizeof(psys->name));
                        BLI_addtail(&ob->particlesystem,psys);
 
                        /* add modifier */
                        psmd= (ParticleSystemModifierData*)modifier_new(eModifierType_ParticleSystem);
-                       sprintf(psmd->modifier.name, "FluidParticleSystem" );
+                       BLI_strncpy(psmd->modifier.name, "FluidParticleSystem", sizeof(psmd->modifier.name));
                        psmd->psys= psys;
                        BLI_addtail(&ob->modifiers, psmd);
                        modifier_unique_name(&ob->modifiers, (ModifierData *)psmd);
index 5259ee1f6d18d2054978f353fe0562a44bfca8e9..f7d1b5d20cf9b3304561988fe4a9402da650ff5e 100644 (file)
@@ -275,7 +275,7 @@ static void rna_Smoke_set_type(Main *bmain, Scene *scene, PointerRNA *ptr)
                                        part->end = 250.0f;
                                        part->ren_as = PART_DRAW_NOT;
                                        part->draw_as = PART_DRAW_DOT;
-                                       sprintf(psys->name, "SmokeParticles");
+                                       BLI_strncpy(psys->name, "SmokeParticles", sizeof(psys->name));
                                        psys->recalc |= (PSYS_RECALC_RESET|PSYS_RECALC_PHYS);
                                        DAG_id_tag_update(ptr->id.data, OB_RECALC_DATA);
                                }