From f98fa5ec2d929962b763005496a19eb0e2d86ca4 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Sun, 10 Mar 2013 11:02:21 +0000 Subject: code cleanup: use '%.*d' with string formatting for variable length number. --- source/blender/blenlib/intern/path_util.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) (limited to 'source/blender/blenlib/intern/path_util.c') diff --git a/source/blender/blenlib/intern/path_util.c b/source/blender/blenlib/intern/path_util.c index 7237f7d4ecf..c3bc35a906b 100644 --- a/source/blender/blenlib/intern/path_util.c +++ b/source/blender/blenlib/intern/path_util.c @@ -147,10 +147,7 @@ int BLI_stringdec(const char *string, char *head, char *tail, unsigned short *nu */ void BLI_stringenc(char *string, const char *head, const char *tail, unsigned short numlen, int pic) { - char fmtstr[16] = ""; - if (pic < 0) pic = 0; - sprintf(fmtstr, "%%s%%.%dd%%s", numlen); - sprintf(string, fmtstr, head, pic, tail); + sprintf(string, "%s%.*d%s", head, numlen, MAX2(0, pic), tail); } /** -- cgit v1.2.3