diff options
author | William Wilgus <wilgus.william@gmail.com> | 2022-11-19 22:39:14 -0500 |
---|---|---|
committer | William Wilgus <me.theuser@yahoo.com> | 2022-11-19 23:13:42 -0500 |
commit | e7e20fab1b2b90ea80e118959386017ed1d6f703 (patch) | |
tree | df435e8bc4a4d9069a365061454443ae9e33ded3 /apps/gui | |
parent | 8fe42c43c6c62a8f593ee337902f8919ed2152ad (diff) | |
download | rockbox-e7e20fab1b2b90ea80e118959386017ed1d6f703.tar.gz rockbox-e7e20fab1b2b90ea80e118959386017ed1d6f703.zip |
create function open_pathfmt() to allow printf formatting on open()
save some space by allowing printf formatting directly rather than
having a buffer and using sprintf
Change-Id: I049c8f898fb4a68a26ad0f0646250c242647ba12
Diffstat (limited to 'apps/gui')
-rw-r--r-- | apps/gui/icon.c | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/apps/gui/icon.c b/apps/gui/icon.c index e78aa6841c..2c09f88852 100644 --- a/apps/gui/icon.c +++ b/apps/gui/icon.c | |||
@@ -32,6 +32,7 @@ | |||
32 | #include "bmp.h" | 32 | #include "bmp.h" |
33 | #include "filetypes.h" | 33 | #include "filetypes.h" |
34 | #include "language.h" | 34 | #include "language.h" |
35 | #include "misc.h" | ||
35 | 36 | ||
36 | #include "bitmaps/default_icons.h" | 37 | #include "bitmaps/default_icons.h" |
37 | #if defined(HAVE_REMOTE_LCD) && (NB_SCREENS > 1) | 38 | #if defined(HAVE_REMOTE_LCD) && (NB_SCREENS > 1) |
@@ -181,10 +182,7 @@ static void load_icons(const char* filename, enum Iconset iconset, | |||
181 | ic->handle = 0; | 182 | ic->handle = 0; |
182 | if (filename[0] && filename[0] != '-') | 183 | if (filename[0] && filename[0] != '-') |
183 | { | 184 | { |
184 | char path[MAX_PATH]; | 185 | fd = open_pathfmt(O_RDONLY, ICON_DIR "/%s.bmp", filename); |
185 | |||
186 | snprintf(path, sizeof(path), ICON_DIR "/%s.bmp", filename); | ||
187 | fd = open(path, O_RDONLY); | ||
188 | if (fd < 0) | 186 | if (fd < 0) |
189 | return; | 187 | return; |
190 | buf_size = read_bmp_fd(fd, &ic->bmp, 0, | 188 | buf_size = read_bmp_fd(fd, &ic->bmp, 0, |