diff options
author | Campbell Barton <ideasman42@gmail.com> | 2013-03-10 15:02:21 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2013-03-10 15:02:21 +0400 |
commit | f98fa5ec2d929962b763005496a19eb0e2d86ca4 (patch) | |
tree | be421e8baa6cb37225b13a17f2f338a1bd595e2e /source/blender/blenlib/intern | |
parent | bb6255b8290ae74e7ba57bb54a811852f7f3ae31 (diff) |
code cleanup: use '%.*d' with string formatting for variable length number.
Diffstat (limited to 'source/blender/blenlib/intern')
-rw-r--r-- | source/blender/blenlib/intern/path_util.c | 5 |
1 files changed, 1 insertions, 4 deletions
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); } /** |