From 20e887db90ab219b7034ccbb1788aa2a362675dd Mon Sep 17 00:00:00 2001 From: Hector Martin Date: Sat, 29 Jul 2017 19:32:45 +0900 Subject: [PATCH] use PATH_MAX instead of MAXPATHLEN --- channel/channelapp/source/appentry.c | 2 +- channel/channelapp/source/loader.c | 4 ++-- channel/channelapp/source/loader.h | 3 ++- channel/channelapp/source/main.c | 2 +- channel/channelapp/source/manage.c | 10 +++++----- 5 files changed, 11 insertions(+), 10 deletions(-) diff --git a/channel/channelapp/source/appentry.c b/channel/channelapp/source/appentry.c index d488ff4..374957f 100644 --- a/channel/channelapp/source/appentry.c +++ b/channel/channelapp/source/appentry.c @@ -166,7 +166,7 @@ void app_entry_set_sort(app_sort sort) { static app_entry *app_entry_load_single (const char *dirname) { app_entry *entry; app_entry_type type; - char tmp[MAXPATHLEN + 32]; + char tmp[PATH_MAX + 32]; struct stat st; type = AET_BOOT_ELF; diff --git a/channel/channelapp/source/loader.c b/channel/channelapp/source/loader.c index 7323285..4ca4044 100644 --- a/channel/channelapp/source/loader.c +++ b/channel/channelapp/source/loader.c @@ -703,8 +703,8 @@ static void * ld_load_func (void *arg) { // public loading function void loader_load(loader_result *result, view *sub_view, app_entry *entry) { - char caption[MAXPATHLEN + 32]; - char filename[MAXPATHLEN]; + char caption[PATH_MAX + 32]; + char filename[PATH_MAX]; ld_load_arg ta; s32 res; diff --git a/channel/channelapp/source/loader.h b/channel/channelapp/source/loader.h index 3b8158f..52226ba 100644 --- a/channel/channelapp/source/loader.h +++ b/channel/channelapp/source/loader.h @@ -2,6 +2,7 @@ #define _LOADER_H_ #include +#include #include @@ -25,7 +26,7 @@ typedef struct { char args[ARGS_MAX_LEN]; u32 args_len; - char dirname[MAXPATHLEN]; + char dirname[PATH_MAX]; u32 bytes; } loader_result; diff --git a/channel/channelapp/source/main.c b/channel/channelapp/source/main.c index 29a3bdd..4fa3bf6 100644 --- a/channel/channelapp/source/main.c +++ b/channel/channelapp/source/main.c @@ -295,7 +295,7 @@ void main_real(void) { u64 frame; bool exit_about; - char charbuf[MAXPATHLEN]; + char charbuf[PATH_MAX]; load_text(); diff --git a/channel/channelapp/source/manage.c b/channel/channelapp/source/manage.c index 53644e8..58dc412 100644 --- a/channel/channelapp/source/manage.c +++ b/channel/channelapp/source/manage.c @@ -35,7 +35,7 @@ s32 dir_exists(char *dirname) { } static s32 mkdir_hier(char *dirname) { - char dir[MAXPATHLEN]; + char dir[PATH_MAX]; size_t i; s32 res; @@ -84,7 +84,7 @@ static s32 rmdir_hier_iter(const char *dirname) { return -1; } - char newpath[MAXPATHLEN]; + char newpath[PATH_MAX]; while ((de = readdir(d))) { if (!strcmp(de->d_name, ".") || !strcmp(de->d_name, "..")) @@ -118,7 +118,7 @@ exit: } static s32 rmdir_hier(const char *dirname) { - char buf[MAXPATHLEN]; + char buf[PATH_MAX]; sprintf(buf, "%s/%s", app_path, dirname); @@ -348,7 +348,7 @@ static bool manage_extract_zip(u8 *data, u32 data_len, unz_file_info fi; char filename[256]; - char sd_filename[MAXPATHLEN]; + char sd_filename[PATH_MAX]; char *p; int fd; @@ -481,7 +481,7 @@ bool manage_run(view *sub_view, const char *dirname, u8 *data, u32 data_len, u32 bytes) { s32 res; u32 progress = 0; - char caption[MAXPATHLEN]; + char caption[PATH_MAX]; view *v;