mirror of
https://github.com/Rockbox/rockbox.git
synced 2025-10-13 18:17:39 -04:00
Undo hacks to meant to get around string formatting limitations
The new vuprintf makes unnecessary workarounds due to formatting limitations. I checked grep output for whatever appeared to fit but it's possible I missed some instances because they weren't so obvious. Also, this means sound settings can dynamically work with any number of decimals rather than the current assumption of one or two. Add an ipow() function to help and take advantage of dynamic field width and precision. Consolidate string formatting of sound settings. Change-Id: I46caf534859dfd1916cd440cd25e5206b192fcd8
This commit is contained in:
parent
5c9688961e
commit
aced667f48
13 changed files with 110 additions and 142 deletions
|
@ -107,7 +107,6 @@ char *create_numbered_filename(char *buffer, const char *path,
|
|||
int pathlen;
|
||||
int prefixlen = strlen(prefix);
|
||||
int suffixlen = strlen(suffix);
|
||||
char fmtstring[12];
|
||||
|
||||
if (buffer != path)
|
||||
strlcpy(buffer, path, MAX_PATH);
|
||||
|
@ -152,9 +151,8 @@ char *create_numbered_filename(char *buffer, const char *path,
|
|||
|
||||
max_num++;
|
||||
|
||||
snprintf(fmtstring, sizeof(fmtstring), "/%%s%%0%dd%%s", numberlen);
|
||||
snprintf(buffer + pathlen, MAX_PATH - pathlen, fmtstring, prefix,
|
||||
max_num, suffix);
|
||||
snprintf(buffer + pathlen, MAX_PATH - pathlen, "/%s%0*d%s", prefix,
|
||||
numberlen, max_num, suffix);
|
||||
|
||||
#ifdef IF_CNFN_NUM
|
||||
if (num)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue