From: Enlightenment C. <no...@cv...> - 2006-08-17 17:09:24
|
Enlightenment CVS committal Author : sebastid Project : e17 Module : libs/ecore Dir : e17/libs/ecore/src/lib/ecore_desktop Modified Files: ecore_desktop.c ecore_desktop_icon.c ecore_desktop_menu.c ecore_desktop_paths.c ecore_desktop_private.h Log Message: PATH_MAX is the standard =================================================================== RCS file: /cvs/e/e17/libs/ecore/src/lib/ecore_desktop/ecore_desktop.c,v retrieving revision 1.8 retrieving revision 1.9 diff -u -3 -r1.8 -r1.9 --- ecore_desktop.c 16 Aug 2006 18:18:01 -0000 1.8 +++ ecore_desktop.c 17 Aug 2006 17:09:23 -0000 1.9 @@ -48,7 +48,7 @@ if (result) { FILE *f; - char buffer[MAX_PATH]; + char buffer[PATH_MAX]; Ecore_Hash *current = NULL; f = fopen(file, "r"); @@ -444,7 +444,7 @@ { 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")); =================================================================== RCS file: /cvs/e/e17/libs/ecore/src/lib/ecore_desktop/ecore_desktop_icon.c,v retrieving revision 1.6 retrieving revision 1.7 diff -u -3 -r1.6 -r1.7 --- ecore_desktop_icon.c 16 Aug 2006 08:50:39 -0000 1.6 +++ ecore_desktop_icon.c 17 Aug 2006 17:09:23 -0000 1.7 @@ -35,7 +35,7 @@ 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 @@ 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 @@ * 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 @@ #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 @@ /* 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 @@ /* 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 =================================================================== RCS file: /cvs/e/e17/libs/ecore/src/lib/ecore_desktop/ecore_desktop_menu.c,v retrieving revision 1.6 retrieving revision 1.7 diff -u -3 -r1.6 -r1.7 --- ecore_desktop_menu.c 14 Aug 2006 21:42:53 -0000 1.6 +++ ecore_desktop_menu.c 17 Aug 2006 17:09:23 -0000 1.7 @@ -258,7 +258,7 @@ 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 @@ element)[0] != '<')) { char - temp[MAX_PATH]; + temp[PATH_MAX]; sprintf(temp, "%s %s", (char *)sub-> @@ -573,7 +573,7 @@ { 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 @@ { 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 @@ 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 @@ { 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 @@ char sub_type) { int i; - char temp[MAX_PATH]; + char temp[PATH_MAX]; for (i = 0; i < tree->size; i++) { @@ -888,7 +888,7 @@ } 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 @@ _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 @@ 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 @@ } 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 @@ } 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 @@ } 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 @@ } else if (strncmp(string, "<DirectoryDir ", 14) == 0) { - char merge_path[MAX_PATH]; + char merge_path[PATH_MAX]; Ecore_Desktop_Tree *merge; if (string[14] == '/') =================================================================== RCS file: /cvs/e/e17/libs/ecore/src/lib/ecore_desktop/ecore_desktop_paths.c,v retrieving revision 1.6 retrieving revision 1.7 diff -u -3 -r1.6 -r1.7 --- ecore_desktop_paths.c 14 Aug 2006 21:42:53 -0000 1.6 +++ ecore_desktop_paths.c 17 Aug 2006 17:09:23 -0000 1.7 @@ -110,7 +110,7 @@ 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 @@ } 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 @@ 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 @@ 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_Exe_Event_Data *read; struct _config_exe_data *ced; char *value; - char path[MAX_PATH]; + char path[PATH_MAX]; ev = event; if (!ev->exe) =================================================================== RCS file: /cvs/e/e17/libs/ecore/src/lib/ecore_desktop/ecore_desktop_private.h,v retrieving revision 1.3 retrieving revision 1.4 diff -u -3 -r1.3 -r1.4 --- ecore_desktop_private.h 16 Aug 2006 18:57:58 -0000 1.3 +++ ecore_desktop_private.h 17 Aug 2006 17:09:23 -0000 1.4 @@ -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)) |