Enlightenment CVS committal
Author : englebass
Project : e17
Module : libs/efreet
Dir : e17/libs/efreet/src/lib
Modified Files:
efreet_icon.c
Log Message:
Reduce the needed amount of ecore_strlcpy.
===================================================================
RCS file: /cvs/e/e17/libs/efreet/src/lib/efreet_icon.c,v
retrieving revision 1.30
retrieving revision 1.31
diff -u -3 -r1.30 -r1.31
--- efreet_icon.c 4 Nov 2007 09:32:35 -0000 1.30
+++ efreet_icon.c 29 Jul 2008 18:52:27 -0000 1.31
@@ -697,7 +697,6 @@
* @param theme: The theme to use
* @param dir: The theme directory to look in
* @param icon_name: The icon name to look for
- * @param size: The icon size to look for
* @return Returns the icon cloest matching the given information or NULL if
* none found
* @brief Tries to find the file closest matching the given icon
@@ -845,28 +844,28 @@
{
char *icon = NULL;
char path[PATH_MAX], *ext;
+ const char *icon_path[] = { dir, "/", icon_name, NULL };
+ size_t size;
if (!dir || !icon_name) return NULL;
+ size = efreet_array_cat(path, sizeof(path), icon_path);
ecore_list_first_goto(efreet_icon_extensions);
while ((ext = ecore_list_next(efreet_icon_extensions)))
{
- const char *icon_path[] = { dir, "/", icon_name, ext, NULL };
- efreet_array_cat(path, sizeof(path), icon_path);
+ ecore_strlcpy(path + size, ext, sizeof(path) - size);
if (ecore_file_exists(path))
{
icon = strdup(path);
if (icon) break;
}
+ *(path + size) = '\0';
}
/* This is to catch non-conforming .desktop files */
#ifdef SLOPPY_SPEC
if (!icon)
{
- const char *icon_path[] = { dir, "/", icon_name, NULL };
- efreet_array_cat(path, sizeof(path), icon_path);
-
if (ecore_file_exists(path))
{
icon = strdup(path);
@@ -896,13 +895,15 @@
{
char *icon = NULL;
char file_path[PATH_MAX];
- const char *ext, *path_strs[] = { path, "/", dir->name, "/", icon_name,
NULL, NULL };
+ const char *ext, *path_strs[] = { path, "/", dir->name, "/", icon_name,
NULL };
+ size_t len;
+
+ len = efreet_array_cat(file_path, sizeof(file_path), path_strs);
ecore_list_first_goto(efreet_icon_extensions);
while ((ext = ecore_list_next(efreet_icon_extensions)))
{
- path_strs[5] = ext;
- efreet_array_cat(file_path, sizeof(file_path), path_strs);
+ ecore_strlcpy(file_path + len, ext, sizeof(file_path) - len);
if (ecore_file_exists(file_path))
{
-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
enlightenment-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs