perl-Glib r1077 - trunk
- From: tsch svn gnome org
- To: svn-commits-list gnome org
- Subject: perl-Glib r1077 - trunk
- Date: Thu, 5 Feb 2009 14:39:12 +0000 (UTC)
Author: tsch
Date: Thu Feb 5 14:39:12 2009
New Revision: 1077
URL: http://svn.gnome.org/viewvc/perl-Glib?rev=1077&view=rev
Log:
In Glib::filename_from_uri and filename_to_uri, use the gchar converters for
the hostname. Patch by Kevin Ryde.
Modified:
trunk/ChangeLog
trunk/Glib.xs
Modified: trunk/Glib.xs
==============================================================================
--- trunk/Glib.xs (original)
+++ trunk/Glib.xs Thu Feb 5 14:39:12 2009
@@ -454,8 +454,14 @@
if (!filename)
gperl_croak_gerror (NULL, error);
PUSHs (sv_2mortal (newSVpv (filename, 0)));
- if (GIMME_V == G_ARRAY && hostname)
- XPUSHs (sv_2mortal (newSVpv (hostname, 0)));
+ if (GIMME_V == G_ARRAY && hostname) {
+ /* The g_filename_from_uri() docs say hostname is utf8,
+ * hence newSVGChar, though as of glib circa 2.16
+ * hostname_validate() only actually allows ascii
+ * alphanumerics, so utf8 doesn't actually come out.
+ */
+ XPUSHs (sv_2mortal (newSVGChar (hostname)));
+ }
g_free (filename);
if (hostname) g_free (hostname);
@@ -469,12 +475,16 @@
char * hostname = NULL;
GError * error = NULL;
CODE:
+ /* The g_filename_to_uri() docs say hostname is utf8, hence SvGChar,
+ * though as of glib circa 2.16 hostname_validate() only actually
+ * allows ascii alphanumerics, so you can't in fact pass in utf8.
+ */
if (items == 2) {
filename = SvPV_nolen (ST (0));
- hostname = gperl_sv_is_defined (ST (1)) ? SvPV_nolen (ST (1)) : NULL;
+ hostname = gperl_sv_is_defined (ST (1)) ? SvGChar (ST (1)) : NULL;
} else if (items == 3) {
filename = SvPV_nolen (ST (1));
- hostname = gperl_sv_is_defined (ST (2)) ? SvPV_nolen (ST (2)) : NULL;
+ hostname = gperl_sv_is_defined (ST (2)) ? SvGChar (ST (2)) : NULL;
} else {
croak ("Usage: Glib::filename_to_uri (filename, hostname)\n"
" -or- Glib->filename_to_uri (filename, hostname)\n"
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]