#include <pico/patch.h>\r
\r
static char static_buff[64];\r
-static char menu_error_msg[64] = { 0, };\r
+char menu_error_msg[64] = { 0, };\r
static int menu_error_time = 0;\r
\r
#ifndef UIQ3\r
lprintf("found skin.txt\n");\r
while (!feof(f))\r
{\r
- fgets(buff, sizeof(buff), f);\r
+ if (fgets(buff, sizeof(buff), f) == NULL)\r
+ break;\r
if (buff[0] == '#' || buff[0] == '/') continue; // comment\r
if (buff[0] == '\r' || buff[0] == '\n') continue; // empty line\r
if (strncmp(buff, "text_color=", 11) == 0)\r
\r
static int scandir_cmp(const void *p1, const void *p2)\r
{\r
- struct dirent **d1 = (struct dirent **)p1, **d2 = (struct dirent **)p2;\r
- if ((*d1)->d_type == (*d2)->d_type) return alphasort(d1, d2);\r
- if ((*d1)->d_type == DT_DIR) return -1; // put before\r
- if ((*d2)->d_type == DT_DIR) return 1;\r
+ const struct dirent **d1 = (const struct dirent **)p1;\r
+ const struct dirent **d2 = (const struct dirent **)p2;\r
+ if ((*d1)->d_type == (*d2)->d_type)\r
+ return alphasort(d1, d2);\r
+ if ((*d1)->d_type == DT_DIR)\r
+ return -1; // put before\r
+ if ((*d2)->d_type == DT_DIR)\r
+ return 1;\r
+\r
return alphasort(d1, d2);\r
}\r
\r
fname = p+1;\r
}\r
\r
- n = scandir(curr_path, &namelist, scandir_filter, scandir_cmp);\r
+ n = scandir(curr_path, &namelist, scandir_filter, (void *)scandir_cmp);\r
if (n < 0) {\r
+ char *t;\r
lprintf("menu_loop_romsel failed, dir: %s\n", curr_path);\r
\r
// try root\r
- getcwd(curr_path, len);\r
- n = scandir(curr_path, &namelist, scandir_filter, scandir_cmp);\r
+ t = getcwd(curr_path, len);\r
+ if (t == NULL)\r
+ plat_get_root_dir(curr_path, len);\r
+ n = scandir(curr_path, &namelist, scandir_filter, (void *)scandir_cmp);\r
if (n < 0) {\r
// oops, we failed\r
lprintf("menu_loop_romsel failed, dir: %s\n", curr_path);\r