PATH_MAX is the standard

SVN revision: 24839
This commit is contained in:
sebastid 2006-08-17 17:09:23 +00:00 committed by sebastid
parent 2b48ecaa61
commit 6101f10142
5 changed files with 28 additions and 28 deletions

View File

@ -48,7 +48,7 @@ ecore_desktop_ini_get(const char *file)
if (result)
{
FILE *f;
char buffer[MAX_PATH];
char buffer[PATH_MAX];
Ecore_Hash *current = NULL;
f = fopen(file, "r");
@ -444,7 +444,7 @@ ecore_desktop_home_get()
{
char *d;
int length;
char home[MAX_PATH];
char home[PATH_MAX];
/* Get Home Dir, check for trailing '/', strip it */
snprintf(home, sizeof(home), "%s", getenv("HOME"));

View File

@ -35,7 +35,7 @@ static const char *ext[] = { ".png", ".svgz", ".svg", ".xpm", "", NULL };
char *
ecore_desktop_icon_find(char *icon, char *icon_size, char *icon_theme)
{
char icn[MAX_PATH], path[MAX_PATH];
char icn[PATH_MAX], path[PATH_MAX];
char *dir, *home;
if (icon == NULL)
@ -67,7 +67,7 @@ ecore_desktop_icon_find(char *icon, char *icon_size, char *icon_theme)
dir = ecore_file_get_dir(icn);
if (!strcmp(dir, icn) == 0)
{
snprintf(path, MAX_PATH, "%s", icn);
snprintf(path, PATH_MAX, "%s", icn);
/* Check Supplied Dir For Icon */
if (ecore_file_exists(path))
return strdup(icn);
@ -117,7 +117,7 @@ _ecore_desktop_icon_find0(char *icon, char *icon_size, char *icon_theme)
* the .theme files.
*/
char icn[MAX_PATH], path[MAX_PATH];
char icn[PATH_MAX], path[PATH_MAX];
char *theme_path, *found;
if ((icon == NULL) || (icon[0] == '\0'))
@ -129,7 +129,7 @@ _ecore_desktop_icon_find0(char *icon, char *icon_size, char *icon_theme)
#endif
/* Get the theme description file. */
snprintf(icn, MAX_PATH, "%s/index.theme", icon_theme);
snprintf(icn, PATH_MAX, "%s/index.theme", icon_theme);
#ifdef DEBUG
printf("SEARCHING FOR %s\n", icn);
#endif
@ -289,7 +289,7 @@ _ecore_desktop_icon_find0(char *icon, char *icon_size, char *icon_theme)
/* Look for icon with all extensions. */
for (j = 0; ext[j] != NULL; j++)
{
snprintf(path, MAX_PATH,
snprintf(path, PATH_MAX,
"%s/%s/%s%s",
icon_theme, directory,
icon, ext[j]);
@ -346,7 +346,7 @@ _ecore_desktop_icon_find0(char *icon, char *icon_size, char *icon_theme)
/* Fall back strategy #4, Just search in the base of the icon directories. */
for (i = 0; ext[i] != NULL; i++)
{
snprintf(path, MAX_PATH, "%s%s", icon, ext[i]);
snprintf(path, PATH_MAX, "%s%s", icon, ext[i]);
#ifdef DEBUG
printf("FDO icon = %s\n", path);
#endif

View File

@ -258,7 +258,7 @@ _ecore_desktop_menu_unxml(const void *data, Ecore_Desktop_Tree * tree,
int i;
char *flags = " ", *name = "", *directory =
"", *menu_path = "";
char temp[MAX_PATH];
char temp[PATH_MAX];
flags = (char *)menu->elements[0].element;
flags += 7;
@ -473,7 +473,7 @@ _ecore_desktop_menu_unxml(const void *data, Ecore_Desktop_Tree * tree,
element)[0] != '<'))
{
char
temp[MAX_PATH];
temp[PATH_MAX];
sprintf(temp, "%s %s",
(char *)sub->
@ -573,7 +573,7 @@ _ecore_desktop_menu_check_directory(const void *data, char *path)
{
if (strcmp(p, ".directory") == 0)
{
char merge_file[MAX_PATH];
char merge_file[PATH_MAX];
sprintf(merge_file, "<Directory %s", path);
ecore_desktop_tree_extend(merge, merge_file);
@ -595,7 +595,7 @@ _ecore_desktop_menu_check_menu(const void *data, char *path)
{
if (strcmp(p, ".menu") == 0)
{
char merge_file[MAX_PATH];
char merge_file[PATH_MAX];
sprintf(merge_file, "<MergeFile type=\"path\" %s", path);
ecore_desktop_tree_extend(merge, merge_file);
@ -645,7 +645,7 @@ _ecore_desktop_menu_legacy_menu_dir(const void *data, char *path)
menu = _ecore_desktop_menu_create_menu();
if (menu)
{
char temp[MAX_PATH];
char temp[PATH_MAX];
sprintf(temp, "<MENU < L> <%s> <>", &path[start]);
menu->elements[0].element = strdup(temp);
@ -685,7 +685,7 @@ _ecore_desktop_menu_legacy_menu(const void *data, char *path)
{
struct _ecore_desktop_menu_legacy_data *legacy_data;
char *menu_path, *file;
char temp[MAX_PATH];
char temp[PATH_MAX];
int i, count = 0, menu_count = 0;
legacy_data = (struct _ecore_desktop_menu_legacy_data *)data;
@ -789,7 +789,7 @@ _ecore_desktop_menu_unxml_rules(Ecore_Desktop_Tree * rules,
char sub_type)
{
int i;
char temp[MAX_PATH];
char temp[PATH_MAX];
for (i = 0; i < tree->size; i++)
{
@ -888,7 +888,7 @@ _ecore_desktop_menu_unxml_moves(Ecore_Desktop_Tree * menu,
}
if ((old) && (new))
{
char temp[MAX_PATH * 2];
char temp[PATH_MAX * 2];
sprintf(temp, "<MOVE <%s> <%s>", old, new);
ecore_desktop_tree_extend(menu, temp);
@ -904,7 +904,7 @@ static void
_ecore_desktop_menu_add_dirs(Ecore_Desktop_Tree * tree, Ecore_List * paths,
char *pre, char *post, char *extra, int element)
{
char t[MAX_PATH], *this_path;
char t[PATH_MAX], *this_path;
/* reverse the order of the dirs. */
ecore_list_goto_first(paths);
@ -926,7 +926,7 @@ _ecore_desktop_menu_expand_apps(struct _ecore_desktop_menu_unxml_data
if (pool)
{
struct _ecore_desktop_menu_expand_apps_data our_data;
char dir[MAX_PATH];
char dir[PATH_MAX];
our_data.pool = pool;
sprintf(dir, "%s", app_dir);
@ -1003,7 +1003,7 @@ _ecore_desktop_menu_merge(const void *data, Ecore_Desktop_Tree * tree,
}
else if (strncmp(string, "<MergeDir ", 10) == 0)
{
char merge_path[MAX_PATH];
char merge_path[PATH_MAX];
if (string[10] == '/')
sprintf(merge_path, "%s", &string[10]);
@ -1016,7 +1016,7 @@ _ecore_desktop_menu_merge(const void *data, Ecore_Desktop_Tree * tree,
}
else if (strncmp(string, "<LegacyDir ", 11) == 0)
{
char merge_path[MAX_PATH];
char merge_path[PATH_MAX];
struct _ecore_desktop_menu_legacy_data legacy_data;
string += 11;
@ -1058,7 +1058,7 @@ _ecore_desktop_menu_merge(const void *data, Ecore_Desktop_Tree * tree,
}
else if (strncmp(string, "<MergeFile ", 11) == 0)
{
char merge_path[MAX_PATH];
char merge_path[PATH_MAX];
int path_type = 1;
/* FIXME: need to weed out duplicate <MergeFile's, use the last one. */
@ -1272,7 +1272,7 @@ _ecore_desktop_menu_generate(const void *data, Ecore_Desktop_Tree * tree,
}
else if (strncmp(string, "<DirectoryDir ", 14) == 0)
{
char merge_path[MAX_PATH];
char merge_path[PATH_MAX];
Ecore_Desktop_Tree *merge;
if (string[14] == '/')

View File

@ -110,7 +110,7 @@ ecore_desktop_paths_init()
if (config_list)
{
char *this_config;
char path[MAX_PATH];
char path[PATH_MAX];
ecore_list_goto_first(config_list);
while ((this_config = ecore_list_next(config_list)) != NULL)
@ -142,7 +142,7 @@ ecore_desktop_paths_init()
}
if (!ecore_desktop_paths_kde_legacy)
{
char temp[MAX_PATH], *path;
char temp[PATH_MAX], *path;
Ecore_List *temp_list;
#ifdef KDE_SUPPORT
@ -262,7 +262,7 @@ ecore_desktop_paths_file_find(Ecore_List * paths, char *file, int sub,
const void *data)
{
char *path = NULL, *this_path;
char temp[MAX_PATH];
char temp[PATH_MAX];
struct stat path_stat;
if (paths)
@ -325,7 +325,7 @@ _ecore_desktop_paths_get(char *before, char *env_home, char *env,
paths = ecore_list_new();
if (paths)
{
char path[MAX_PATH];
char path[PATH_MAX];
Ecore_List *env_list;
ecore_list_set_free_cb(paths, free);
@ -647,7 +647,7 @@ _ecore_desktop_paths_cb_exe_exit(void *data, int type, void *event)
Ecore_Exe_Event_Data *read;
struct _config_exe_data *ced;
char *value;
char path[MAX_PATH];
char path[PATH_MAX];
ev = event;
if (!ev->exe)

View File

@ -6,9 +6,9 @@
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <limits.h>
#include <Ecore_File.h>
#define MAX_PATH 4096
#define E_FN_DEL(_fn, _h) if (_h) { _fn(_h); _h = NULL; }
#define E_REALLOC(p, s, n) p = (s *)realloc(p, sizeof(s) * n)
#define E_NEW(s, n) (s *)calloc(n, sizeof(s))