[glibmm] Bug 581811 - Gio::content_type_guess() miss the version with a NULL filename
- From: Jonathon Jongsma <jjongsma src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glibmm] Bug 581811 - Gio::content_type_guess() miss the version with a NULL filename
- Date: Wed, 21 Apr 2010 01:57:13 +0000 (UTC)
commit ae50a4100287b5f657cfcb36bea8d8b20740e52f
Author: Jonathon Jongsma <jonathon quotidian org>
Date: Wed Jan 6 00:02:07 2010 -0600
Bug 581811 - Gio::content_type_guess() miss the version with a NULL filename
Pass NULL to the C function when the filename is an empty string. The
alternative of providing an overloaded function without the filename parameter
would have resulted in 6 overloads of this function, which is just too much, so
I chose this path instead.
gio/giomm/contenttype.cc | 9 ++++++---
1 files changed, 6 insertions(+), 3 deletions(-)
---
diff --git a/gio/giomm/contenttype.cc b/gio/giomm/contenttype.cc
index 760d085..c0c3a49 100644
--- a/gio/giomm/contenttype.cc
+++ b/gio/giomm/contenttype.cc
@@ -69,7 +69,8 @@ Glib::ustring content_type_guess(const std::string& filename,
const std::basic_string<guchar>& data, bool& result_uncertain)
{
gboolean c_result_uncertain = FALSE;
- gchar* cresult = g_content_type_guess(filename.c_str(), data.c_str(),
+ const gchar *c_filename = filename.empty () ? NULL : filename.c_str ();
+ gchar* cresult = g_content_type_guess(c_filename, data.c_str(),
data.size(), &c_result_uncertain);
result_uncertain = c_result_uncertain;
return Glib::convert_return_gchar_ptr_to_ustring(cresult);
@@ -79,7 +80,8 @@ Glib::ustring content_type_guess(const std::string& filename,
const guchar* data, gsize data_size, bool& result_uncertain)
{
gboolean c_result_uncertain = FALSE;
- gchar* cresult = g_content_type_guess(filename.c_str(), data,
+ const gchar *c_filename = filename.empty () ? NULL : filename.c_str ();
+ gchar* cresult = g_content_type_guess(c_filename, data,
data_size, &c_result_uncertain);
result_uncertain = c_result_uncertain;
return Glib::convert_return_gchar_ptr_to_ustring(cresult);
@@ -89,7 +91,8 @@ Glib::ustring content_type_guess(const std::string& filename,
const std::string& data, bool& result_uncertain)
{
gboolean c_result_uncertain = FALSE;
- gchar* cresult = g_content_type_guess(filename.c_str(), (const guchar*)data.c_str(),
+ const gchar *c_filename = filename.empty () ? NULL : filename.c_str ();
+ gchar* cresult = g_content_type_guess(c_filename, (const guchar*)data.c_str(),
data.size(), &c_result_uncertain);
result_uncertain = c_result_uncertain;
return Glib::convert_return_gchar_ptr_to_ustring(cresult);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]