- cleanups

SVN revision: 35309
This commit is contained in:
Dan Sinclair 2008-08-02 22:09:04 +00:00 committed by Dan Sinclair
parent 626a99a438
commit 5c0aaab8f1
2 changed files with 10 additions and 28 deletions

View File

@ -152,21 +152,15 @@ efreet_mime_type_get(const char *file)
if ((type = efreet_mime_special_check(file))) if ((type = efreet_mime_special_check(file)))
return type; return type;
/* /* Check magics with priority > 80 */
* Check magics with priority > 80
*/
if ((type = efreet_mime_magic_check_priority(file, 0, 80))) if ((type = efreet_mime_magic_check_priority(file, 0, 80)))
return type; return type;
/* /* Check globs */
* Check globs
*/
if ((type = efreet_mime_globs_type_get(file))) if ((type = efreet_mime_globs_type_get(file)))
return type; return type;
/* /* Check rest of magics */
* Check rest of magics
*/
if ((type = efreet_mime_magic_check_priority(file, 80, 0))) if ((type = efreet_mime_magic_check_priority(file, 80, 0)))
return type; return type;
@ -200,8 +194,7 @@ efreet_mime_type_icon_get(const char *mime, const char *theme, const char *size)
pp = p; pp = p;
while (*pp) while (*pp)
{ {
if (*pp == '/') if (*pp == '/') *pp = '-';
*pp = '-';
pp++; pp++;
} }
ecore_list_append(icons, p); ecore_list_append(icons, p);
@ -236,7 +229,6 @@ efreet_mime_type_icon_get(const char *mime, const char *theme, const char *size)
/* Search for icons using list */ /* Search for icons using list */
icon = efreet_icon_list_find(theme, icons, size); icon = efreet_icon_list_find(theme, icons, size);
ecore_list_destroy(icons); ecore_list_destroy(icons);
return icon; return icon;
@ -266,9 +258,7 @@ efreet_mime_globs_type_get(const char *file)
const char *s; const char *s;
char *ext, *mime; char *ext, *mime;
/* /* Check in the extension hash for the type */
* Check in the extension hash for the type
*/
ext = strchr(file, '.'); ext = strchr(file, '.');
if (ext) if (ext)
{ {
@ -284,9 +274,7 @@ efreet_mime_globs_type_get(const char *file)
} }
} }
/* /* Fallback to the other globs if not found */
* Fallback to the other globs if not found
*/
ecore_list_first_goto(globs); ecore_list_first_goto(globs);
while ((g = ecore_list_next(globs))) while ((g = ecore_list_next(globs)))
{ {
@ -602,14 +590,13 @@ efreet_mime_fallback_check(const char *file)
char buf[32]; char buf[32];
int i; int i;
if (!(f = fopen(file, "r"))) if (!(f = fopen(file, "r"))) return NULL;
return NULL;
i = fread(buf, 1, sizeof(buf), f); i = fread(buf, 1, sizeof(buf), f);
fclose(f); fclose(f);
if (i == 0) if (i == 0) return "application/octet-stream";
return "application/octet-stream";
/* /*
* Check for ASCII control characters in the first 32 bytes. * Check for ASCII control characters in the first 32 bytes.
* Line Feeds, carriage returns, and tabs are ignored as they are * Line Feeds, carriage returns, and tabs are ignored as they are
@ -1105,7 +1092,6 @@ efreet_mime_magic_check_priority(const char *file,
else if ((level > e->indent) && match) else if ((level > e->indent) && match)
{ {
fclose(f); fclose(f);
if (last_mime) return last_mime; if (last_mime) return last_mime;
} }

View File

@ -193,9 +193,7 @@ efreet_trash_ls(void)
files = ecore_file_ls(buf); files = ecore_file_ls(buf);
while (infofile = ecore_list_next(files)) while (infofile = ecore_list_next(files))
{
printf("FILE: %s\n", infofile); printf("FILE: %s\n", infofile);
}
return files; return files;
} }
@ -284,7 +282,6 @@ efreet_uri_escape(Efreet_Uri *uri)
memset(dest, 0, PATH_MAX * 3 + 4); memset(dest, 0, PATH_MAX * 3 + 4);
snprintf(dest, strlen(uri->protocol) + 4, "%s://", uri->protocol); snprintf(dest, strlen(uri->protocol) + 4, "%s://", uri->protocol);
/* Most app doesn't handle the hostname in the uri so it's put to NULL */ /* Most app doesn't handle the hostname in the uri so it's put to NULL */
for (i = strlen(uri->protocol) + 3, p = uri->path; *p != '\0'; p++, i++) for (i = strlen(uri->protocol) + 3, p = uri->path; *p != '\0'; p++, i++)
{ {
@ -311,6 +308,5 @@ efreet_uri_free(Efreet_Uri *uri)
IF_RELEASE(uri->protocol); IF_RELEASE(uri->protocol);
IF_RELEASE(uri->path); IF_RELEASE(uri->path);
IF_RELEASE(uri->hostname); IF_RELEASE(uri->hostname);
free(uri); FREE(uri);
uri = NULL;
} }