Commit Graph

63 Commits

Author SHA1 Message Date
Ryan Lortie
ddf82a2576 [PATCH] Fix trivial non literal format uses
Based on a patch from Henrique Dante de Almeida <hdante@gmail.com>.

https://bugzilla.gnome.org/show_bug.cgi?id=691608
2013-12-08 14:22:51 -05:00
Philip Withnall
49ea52e6a6 gio: Replace g_clear_object() with if()…g_object_unref()
As per https://bugzilla.gnome.org/show_bug.cgi?id=113075#c39.
2013-11-28 20:41:49 +00:00
Philip Withnall
8b9e8dc53b gcontenttype: Fix a potential NULL pointer dereference
If the initial part of the header (‘MIME-TreeMagic’) is valid, but the
following line does not start with ‘[’ (i.e. is not a valid section
line), insert_matchlet() will be called with a NULL match pointer, and
will crash with a NULL pointer dereference.

Fix this by bailing out if a valid section line isn’t encountered before
the first insert_matchlet() call (i.e. between the header line and the
first data line).

Note that this has not been tested against a real treemagic file; the
fix is purely theoretical.

Found by scan-build.

https://bugzilla.gnome.org/show_bug.cgi?id=113075
2013-11-27 10:01:29 +00:00
Philip Withnall
44af12aba1 gcontenttype: Fix a potential g_object_unref(NULL) call
This can happen if the g_file_query_info() call fails, returning NULL.

Found with scan-build.

https://bugzilla.gnome.org/show_bug.cgi?id=113075
2013-11-27 10:01:29 +00:00
John Ralls
ab5aa2aa3a Fix the -Werror=format-nonliteral fixes for older GCCs
They don't allow that pragma inside functions.
2013-09-29 11:33:30 -07:00
John Ralls
09d83640a8 More -Werror=format-nonliteral fixes
This fixes the build with CLang.

https://bugzilla.gnome.org/show_bug.cgi?id=702516
2013-09-29 11:03:16 -04:00
William Jon McCann
b0e6a38d95 Remove legacy icon name support
https://bugzilla.gnome.org/show_bug.cgi?id=684327
2013-08-17 21:53:33 -04:00
Akira TAGOH
7261294ec1 gcontenttype: Duplicate the string inside Mutex lock for thread-safety
https://bugzilla.gnome.org/show_bug.cgi?id=692360
2013-01-25 13:39:53 +09:00
Alexander Larsson
936254c386 Don't look for icons called "(null)" if no xdg mime icon 2012-11-30 09:39:52 +01:00
William Jon McCann
cc3238a9c9 Add api to get the generic icon name for a mime type
https://bugzilla.gnome.org/show_bug.cgi?id=683744
2012-09-13 12:50:02 -04:00
William Jon McCann
40b4fae42e Add ability to get symbolic icon for content type
https://bugzilla.gnome.org/show_bug.cgi?id=682101
2012-08-30 11:04:43 -04:00
Matthias Clasen
32192ee9e4 Split gcontenttype.c
Instead of a giant #if G_OS_WIN32 #else #endif around the entire
file, just split it into gcontenttype.c and gcontenttype-win32.c.
2012-07-03 21:13:32 -04:00
Marc-André Lureau
af3b1674cd win32: fix build after bug 674452 2012-07-03 21:01:31 -04:00
Martin Pitt
139c1ce988 gio/tests/contenttype: Call g_content_type_guess() with valid data len
g_content_type_guess() requires specifying a valid data length. Fixes a
segfault when running the test.

Also add an explicit check for this and return XDG_MIME_TYPE_UNKNOWN when
data_size is specified as -1, to avoid crashing.

https://bugzilla.gnome.org/show_bug.cgi?id=674452
2012-06-27 16:00:27 +02:00
Philip Withnall
e98f17e5cf Bug 666700 — Add some missing (allow-none) annotations
Add some missing (allow-none) annotations to GContentType, GIcon and
GHashTable methods.

Closes: bgo#666700
2012-01-11 20:48:29 +00:00
Javier Jardón
928d2cea61 gio/*: Use g_list_free_full() convenience function 2012-01-03 16:53:47 +01:00
Matthias Clasen
9a6529442c Fix doc syntax 2011-06-04 19:05:51 -04:00
Matthias Clasen
a588974561 Expand content type docs slighly 2011-05-31 19:27:04 -04:00
Pavel Holejsovsky
79fd5ff80d Add missing GI annotation to g_content_type_guess_for_tree 2010-12-29 16:02:04 +01:00
Johan Dahlin
30132c44c1 Add a lot of missing annotations 2010-09-24 18:24:41 -03:00
Johan Dahlin
835f9cb310 [introspection] Move over annotations
Move all the annotations over from gobject-introspection.

They will not be used directly by the introspection scanner for now,
instead they will be extracted by a script and updated manually
until introspection is properly integrated into the glib build
2010-09-24 15:52:38 -03:00
Ryan Lortie
5b946e0504 gio/: fully remove gioalias hacks 2010-07-07 19:53:22 -04:00
Matthias Clasen
c53c701e53 Cleanups 2010-07-05 00:56:12 -04:00
Alexander Larsson
b37da7134b Set result_uncertain in win32 g_content_type_guess implementation
Fixes bug #609143
2010-02-15 10:13:10 +01:00
Matthias Clasen
6cee86a3ef Fix an off-by-one error
Reported by Steve Grubb.
2010-01-05 18:16:37 -05:00
Ryan Lortie
48e2a57043 Bug 598712 - can't detect text file with backspace
looks_like_text(): Allow '\b' to appear in text files.
2009-11-23 13:47:16 -05:00
Alexander Larsson
9fdf70ba5f Don't ever sniff desktop files when the filename is known. In other words,
2009-02-20  Alexander Larsson  <alexl@redhat.com>

        * gcontenttype.c:
        (g_content_type_guess):
	Don't ever sniff desktop files when the filename is known.
	In other words, only allow desktop files with the .desktop extension
	and when the filename isn't known.
	This is a security precaution since desktop files can execute
	arbitrary code when launched and we don't want to allow them to
	try and hide as another type. There is no legit reason to not
	have the .desktop extension anyway.



svn path=/trunk/; revision=7892
2009-02-20 07:46:57 +00:00
Cosimo Cecchi
8dc9c875ff Bug 561352 – Leak of icon description
2008-11-21  Cosimo Cecchi  <cosimoc@gnome.org>

	Bug 561352 – Leak of icon description

	* gcontenttype.c: (g_content_type_get_icon): don't leak the XDG mimetype
	generic icon string.

svn path=/trunk/; revision=7660
2008-11-20 23:58:39 +00:00
Christian Persch
cef6abff8e Bug 557087 – mem leak in g_content_types_get_registered
svn path=/trunk/; revision=7616
2008-10-20 16:49:16 +00:00
Matthias Clasen
a8c88cae76 Bug 555711 – Wrong fallback order of mimetype icons
* gcontenttype.c: Don't prefer generic icons over
        default mimetype icons.

        * xdgmime/xdgmimecache.c (xdg_mime_cache_get_icon):
        * xdgmime/xdgmime.c (xdg_mime_get_icon): Don't fall back
        to generic icons.
        Patch by Krysztof Kosiński


svn path=/trunk/; revision=7587
2008-10-10 05:07:56 +00:00
Michael Natterer
2623f6fc0f can't assign the return value of g_strdupv() to an array. Fill the array
2008-09-16  Michael Natterer  <mitch@imendio.com>

	* gcontenttype.c (g_content_type_guess): can't assign the return
	value of g_strdupv() to an array. Fill the array manually with
	const strings instead (it is never freed anyway). Fixes the
	build. Also fixed indentation.


svn path=/trunk/; revision=7501
2008-09-16 11:36:52 +00:00
Matthias Clasen
f634171ec5 Bug 551681 – g_content_type_guess() too naive with filenames
* gcontenttype.c (g_content_type_guess): Check whether there's a '/'
        at the end of the filename, and declare it a directory.
        Patch by Bastien Nocera


svn path=/trunk/; revision=7491
2008-09-15 16:06:05 +00:00
Matthias Clasen
48867a895c Remove debug spew
svn path=/trunk/; revision=7206
2008-07-19 01:15:12 +00:00
Matthias Clasen
38d4e3fd48 Add g_content_type_guess_for_tree
svn path=/trunk/; revision=7199
2008-07-18 15:33:22 +00:00
Colin Walters
eb4ce9620a Use UNLOCK to unlock, not LOCK.
2008-07-02  Colin Walters  <walters@redhat.com>

	* gio/gcontenttype.c: Use UNLOCK to unlock, not LOCK.


svn path=/trunk/; revision=7146
2008-07-02 19:06:08 +00:00
Cody Russell
a6a4779108 Fixed some more includes
svn path=/trunk/; revision=7131
2008-07-02 01:54:16 +00:00
Matthias Clasen
9b89825af0 Unalias. Patch by Markus Bergman
* gcontentype.c (g_content_type_from_mime_type): Unalias.
        Patch by Markus Bergman


svn path=/trunk/; revision=7109
2008-06-30 04:59:40 +00:00
Johan Dahlin
761424465a Include "config.h" instead of <config.h> Command used: find -name
2008-06-21  Johan Dahlin  <jdahlin@async.com.br>

    * *.[ch]: Include "config.h" instead of <config.h>
    Command used:
    find -name \*.[ch]|xargs perl -p -i -e 's/^#include <config.h>/#include "config.h"/g'
    Rubberstamped by Mitch


svn path=/trunk/; revision=7092
2008-06-22 15:10:51 +00:00
Tor Lillqvist
cc8adfaeb8 Bug 538362 - Get Win32 icons back in the file chooser
2008-06-16  Tor Lillqvist  <tml@novell.com>

	Bug 538362 - Get Win32 icons back in the file chooser

	* gcontenttype.c (g_content_type_get_icon): Look up the icon
	corresponding to a file extension in the Registry. Patch by Hans
	Breuer.
	(get_registry_classes_key): Handle also REG_EXPAND_SZ type values.
	
2008-06-16  Tor Lillqvist  <tml@novell.com>

	Patches by Hans Breuer:

	* glocalfile.c (is_xp_or_later): Handle compiling against older
	SDK headers with missing VerifyVersionInfo().  Conditioned on
	_MSC_VER, but should probably use some better test.
	* glocalfile.c (g_local_file_query_filesystem_info): Don't test
	uninitialised statfs_result variable on Win32.



svn path=/trunk/; revision=7049
2008-06-16 13:23:14 +00:00
Michael Natterer
b15a223a8a fix SEGV by not using uninitialized memory as array index.
2008-06-10  Michael Natterer  <mitch@imendio.com>

	* gcontenttype.c (g_content_type_get_icon): fix SEGV by not using
	uninitialized memory as array index.


svn path=/trunk/; revision=6981
2008-06-10 10:51:29 +00:00
Tor Lillqvist
8b5ad297da Add TODO comments.
2008-06-10  Tor Lillqvist  <tml@novell.com>

	* gcontenttype.c (g_content_type_get_icon) [Win32]:
	Add TODO comments.


svn path=/trunk/; revision=6980
2008-06-10 10:35:20 +00:00
Tor Lillqvist
c7b21acd7b Add TODO comment.
2008-06-10  Tor Lillqvist  <tml@novell.com>

	* gcontenttype.c (g_content_type_can_be_executable) [Win32]: Add
	TODO comment.


svn path=/trunk/; revision=6979
2008-06-10 10:34:02 +00:00
Matthias Clasen
c82988e262 Use icons from the shared mime database, if available.
svn path=/trunk/; revision=6976
2008-06-09 17:33:43 +00:00
Matthias Clasen
4f21fe18cb New function to create a content type from a mime type. (#527175, Milan
2008-05-17  Matthias Clasen  <mclasen@redhat.com>

        * gcontenttype.h:
        * gcontenttype.c: (g_content_type_from_mime_type):
        New function to create a content type from a mime type. (#527175,
        Milan Crha)


svn path=/trunk/; revision=6906
2008-05-18 02:50:48 +00:00
Alexander Larsson
82046b6c97 Fix type warnings
2008-02-27  Alexander Larsson  <alexl@redhat.com>

        * gcontenttype.c:
	Fix type warnings
	
        * gunixvolume.c:
        (g_unix_volume_mount):
	Add missing GMountMountFlags argument


svn path=/trunk/; revision=6599
2008-02-27 11:23:35 +00:00
Alexander Larsson
5f6ccf9a3f Look at old-style gnome mime icon names too, as many have not moved to the
2008-02-22  Alexander Larsson  <alexl@redhat.com>

	* gcontenttype.c (g_content_type_get_icon):
	Look at old-style gnome mime icon names too, as many
	have not moved to the new style.


svn path=/trunk/; revision=6557
2008-02-22 14:56:50 +00:00
Matthias Clasen
f3144c7efe Doc fixes
svn path=/trunk/; revision=6554
2008-02-21 18:20:17 +00:00
David Zeuthen
bfda430eff Implement this function by moving bits from glocalfileinfo.c
2008-02-21  David Zeuthen  <davidz@redhat.com>

	* glocalfileinfo.c: (_g_local_file_info_get):
	* gcontenttype.c:
	(g_content_type_get_icon): Implement this function by
	moving bits from glocalfileinfo.c
	(g_content_type_get_description): Unalias before getting
	description (#517687)

	* gfile.c: (g_file_class_init),
	(g_file_query_filesystem_info_async),
	(g_file_query_filesystem_info_finish),
	(query_filesystem_info_data_free),
	(query_filesystem_info_async_thread),
	(g_file_real_query_filesystem_info_async),
	(g_file_real_query_filesystem_info_finish):
	* gfile.h: Implement async version of
	g_file_query_filesystem_info()

	* gfileinfo.h: Add new attributes for filesystem::use-preview

	* gio.symbols: Update

	* gthemedicon.c: (g_themed_icon_append_name):
	* gthemedicon.h: Add new new convenience function.

	* gunionvolumemonitor.c: (g_union_volume_monitor_dispose),
	(get_mounts), (get_volumes), (get_connected_drives),
	(get_volume_for_uuid), (get_mount_for_uuid),
	(g_union_volume_monitor_init), (populate_union_monitor),
	(g_volume_monitor_get), (_g_mount_get_for_mount_path),
	(g_volume_monitor_adopt_orphan_mount):
	* gvolumemonitor.c:
	* gvolumemonitor.h: Use recursive locks so it's safe for volume
	monitor implementations to call into the main volume monitor. Also
	separate object initialization and volume monitor initialization
	such that non-native volume monitors can properly adopt their
	mounts away.


svn path=/trunk/; revision=6550
2008-02-21 12:35:05 +00:00
Michael Natterer
573a73f391 assign the return value of xdg_mime_list_mime_parents() to a variable of
2008-02-01  Michael Natterer  <mitch@imendio.com>

	* gcontenttype.c (_g_unix_content_type_get_parents): assign the
	return value of xdg_mime_list_mime_parents() to a variable of the
	correct type.


svn path=/trunk/; revision=6441
2008-02-01 13:17:04 +00:00
Alexander Larsson
1efe9d9cd1 Don't treat whitespace as control chars.
2008-01-29  Alexander Larsson  <alexl@redhat.com>

	* gcontenttype.c (looks_like_text):
	Don't treat whitespace as control chars.


svn path=/trunk/; revision=6414
2008-01-29 14:19:46 +00:00