summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTeruaki Kawashima <teru@rockbox.org>2010-05-17 12:49:51 +0000
committerTeruaki Kawashima <teru@rockbox.org>2010-05-17 12:49:51 +0000
commit20041b96c80a6eb60fb0f667846970387c2a16bd (patch)
tree45d861166ded8fcc3529bc3fa56be1e1c9e7c935
parent1a25eddaa74e99f65d20e6cfdd4e95a0fdaa2093 (diff)
downloadrockbox-20041b96c80a6eb60fb0f667846970387c2a16bd.tar.gz
rockbox-20041b96c80a6eb60fb0f667846970387c2a16bd.zip
rockboy: fix format strings in snprintf. use int for slot_id and use %d tag for it in format strings.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@26104 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r--apps/plugins/rockboy/menu.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/apps/plugins/rockboy/menu.c b/apps/plugins/rockboy/menu.c
index e081a81d18..b1a7389a18 100644
--- a/apps/plugins/rockboy/menu.c
+++ b/apps/plugins/rockboy/menu.c
@@ -150,7 +150,7 @@ static void munge_name(char *buf, const size_t bufsiz) {
150 * Note: uses rom.name. Is there a safer way of doing this? Like a ROM 150 * Note: uses rom.name. Is there a safer way of doing this? Like a ROM
151 * checksum or something like that? 151 * checksum or something like that?
152 */ 152 */
153static void build_slot_path(char *buf, size_t bufsiz, size_t slot_id) { 153static void build_slot_path(char *buf, size_t bufsiz, int slot_id) {
154 char name_buf[17]; 154 char name_buf[17];
155 155
156 /* munge state file name */ 156 /* munge state file name */
@@ -158,7 +158,7 @@ static void build_slot_path(char *buf, size_t bufsiz, size_t slot_id) {
158 munge_name(name_buf, strlen(name_buf)); 158 munge_name(name_buf, strlen(name_buf));
159 159
160 /* glom the whole mess together */ 160 /* glom the whole mess together */
161 snprintf(buf, bufsiz, "%s/%s-%zud.rbs", STATE_DIR, name_buf, slot_id + 1); 161 snprintf(buf, bufsiz, "%s/%s-%d.rbs", STATE_DIR, name_buf, slot_id + 1);
162} 162}
163 163
164/* 164/*
@@ -218,7 +218,7 @@ static bool do_file(char *path, char *desc, bool is_load) {
218 * 218 *
219 * Returns true on success and false on failure. 219 * Returns true on success and false on failure.
220 */ 220 */
221static bool do_slot(size_t slot_id, bool is_load) { 221static bool do_slot(int slot_id, bool is_load) {
222 char path_buf[256], desc_buf[20]; 222 char path_buf[256], desc_buf[20];
223 223
224 /* build slot filename, clear desc buf */ 224 /* build slot filename, clear desc buf */
@@ -239,7 +239,7 @@ static bool do_slot(size_t slot_id, bool is_load) {
239/* 239/*
240 * get information on the given slot 240 * get information on the given slot
241 */ 241 */
242static void slot_info(char *info_buf, size_t info_bufsiz, size_t slot_id) { 242static void slot_info(char *info_buf, size_t info_bufsiz, int slot_id) {
243 char buf[256]; 243 char buf[256];
244 int fd; 244 int fd;
245 245
@@ -253,17 +253,17 @@ static void slot_info(char *info_buf, size_t info_bufsiz, size_t slot_id) {
253 if (read(fd, buf, 20) > 0) 253 if (read(fd, buf, 20) > 0)
254 { 254 {
255 buf[20] = '\0'; 255 buf[20] = '\0';
256 snprintf(info_buf, info_bufsiz, "%zud. %s", slot_id + 1, buf); 256 snprintf(info_buf, info_bufsiz, "%d. %s", slot_id + 1, buf);
257 } 257 }
258 else 258 else
259 snprintf(info_buf, info_bufsiz, "%zud. ERROR", slot_id + 1); 259 snprintf(info_buf, info_bufsiz, "%d. ERROR", slot_id + 1);
260 260
261 close(fd); 261 close(fd);
262 } 262 }
263 else 263 else
264 { 264 {
265 /* if we couldn't open the file, then the slot is empty */ 265 /* if we couldn't open the file, then the slot is empty */
266 snprintf(info_buf, info_bufsiz, "%zu. %s", slot_id + 1, "<Empty>"); 266 snprintf(info_buf, info_bufsiz, "%d. %s", slot_id + 1, "<Empty>");
267 } 267 }
268} 268}
269 269