Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(307)

Unified Diff: base/third_party/xdg_mime/xdgmime.c

Issue 10824186: Linux: update base/third_party/xdg_mime from upstream. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 8 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « base/third_party/xdg_mime/xdgmime.h ('k') | base/third_party/xdg_mime/xdgmimealias.c » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/third_party/xdg_mime/xdgmime.c
===================================================================
--- base/third_party/xdg_mime/xdgmime.c (revision 150109)
+++ base/third_party/xdg_mime/xdgmime.c (working copy)
@@ -26,7 +26,7 @@
*/
#ifdef HAVE_CONFIG_H
-#include "config.h"
+#include <config.h>
#endif
#include "xdgmime.h"
@@ -64,6 +64,8 @@
static int n_caches = 0;
const char xdg_mime_type_unknown[] = "application/octet-stream";
+const char xdg_mime_type_empty[] = "application/x-zerosize";
+const char xdg_mime_type_textplain[] = "text/plain";
enum
@@ -165,7 +167,7 @@
strcpy (file_name, directory); strcat (file_name, "/mime/globs2");
if (stat (file_name, &st) == 0)
{
- _xdg_mime_glob_read_from_file (global_hash, file_name);
+ _xdg_mime_glob_read_from_file (global_hash, file_name, TRUE);
xdg_dir_time_list_add (file_name, st.st_mtime);
}
else
@@ -175,7 +177,7 @@
strcpy (file_name, directory); strcat (file_name, "/mime/globs");
if (stat (file_name, &st) == 0)
{
- _xdg_mime_glob_read_from_file (global_hash, file_name);
+ _xdg_mime_glob_read_from_file (global_hash, file_name, FALSE);
xdg_dir_time_list_add (file_name, st.st_mtime);
}
else
@@ -467,17 +469,23 @@
{
const char *mime_type;
+ if (len == 0)
+ {
+ *result_prio = 100;
+ return XDG_MIME_TYPE_EMPTY;
+ }
+
xdg_mime_init ();
if (_caches)
- return _xdg_mime_cache_get_mime_type_for_data (data, len, result_prio);
+ mime_type = _xdg_mime_cache_get_mime_type_for_data (data, len, result_prio);
+ else
+ mime_type = _xdg_mime_magic_lookup_data (global_magic, data, len, result_prio, NULL, 0);
- mime_type = _xdg_mime_magic_lookup_data (global_magic, data, len, result_prio, NULL, 0);
-
if (mime_type)
return mime_type;
- return XDG_MIME_TYPE_UNKNOWN;
+ return _xdg_binary_or_text_fallback(data, len);
}
const char *
@@ -556,7 +564,7 @@
if (mime_type)
return mime_type;
- return XDG_MIME_TYPE_UNKNOWN;
+ return _xdg_binary_or_text_fallback(data, bytes_read);
}
const char *
« no previous file with comments | « base/third_party/xdg_mime/xdgmime.h ('k') | base/third_party/xdg_mime/xdgmimealias.c » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698