mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-02-23 02:32:11 +01:00
Added a note about the changes below.
2004-06-07 Federico Mena Quintero <federico@ximian.com> * README.in: Added a note about the changes below. Merge from HEAD: Fixes #140532. * glib/gconvert.c (is_asciialphanum): Renamed from is_escalphanum(); ensures that this is an ASCII character. (is_asciiescalpha): Renamed from is_escalpha(). (hostname_validate): Use the two functions above. (g_filename_to_uri): Don't convert the filename to UTF-8. (g_filename_from_uri): Don't convert the filename from UTF-8.
This commit is contained in:
parent
3f1e8d546d
commit
06235517b0
15
ChangeLog
15
ChangeLog
@ -1,3 +1,18 @@
|
||||
2004-06-07 Federico Mena Quintero <federico@ximian.com>
|
||||
|
||||
* README.in: Added a note about the changes below.
|
||||
|
||||
Merge from HEAD:
|
||||
|
||||
Fixes #140532.
|
||||
|
||||
* glib/gconvert.c (is_asciialphanum): Renamed from
|
||||
is_escalphanum(); ensures that this is an ASCII character.
|
||||
(is_asciiescalpha): Renamed from is_escalpha().
|
||||
(hostname_validate): Use the two functions above.
|
||||
(g_filename_to_uri): Don't convert the filename to UTF-8.
|
||||
(g_filename_from_uri): Don't convert the filename from UTF-8.
|
||||
|
||||
Mon Jun 7 22:25:24 2004 Matthias Clasen <maclas@gmx.de>
|
||||
|
||||
* tests/run-markup-tests.sh: Default to silence, but support
|
||||
|
@ -1,3 +1,18 @@
|
||||
2004-06-07 Federico Mena Quintero <federico@ximian.com>
|
||||
|
||||
* README.in: Added a note about the changes below.
|
||||
|
||||
Merge from HEAD:
|
||||
|
||||
Fixes #140532.
|
||||
|
||||
* glib/gconvert.c (is_asciialphanum): Renamed from
|
||||
is_escalphanum(); ensures that this is an ASCII character.
|
||||
(is_asciiescalpha): Renamed from is_escalpha().
|
||||
(hostname_validate): Use the two functions above.
|
||||
(g_filename_to_uri): Don't convert the filename to UTF-8.
|
||||
(g_filename_from_uri): Don't convert the filename from UTF-8.
|
||||
|
||||
Mon Jun 7 22:25:24 2004 Matthias Clasen <maclas@gmx.de>
|
||||
|
||||
* tests/run-markup-tests.sh: Default to silence, but support
|
||||
|
@ -1,3 +1,18 @@
|
||||
2004-06-07 Federico Mena Quintero <federico@ximian.com>
|
||||
|
||||
* README.in: Added a note about the changes below.
|
||||
|
||||
Merge from HEAD:
|
||||
|
||||
Fixes #140532.
|
||||
|
||||
* glib/gconvert.c (is_asciialphanum): Renamed from
|
||||
is_escalphanum(); ensures that this is an ASCII character.
|
||||
(is_asciiescalpha): Renamed from is_escalpha().
|
||||
(hostname_validate): Use the two functions above.
|
||||
(g_filename_to_uri): Don't convert the filename to UTF-8.
|
||||
(g_filename_from_uri): Don't convert the filename from UTF-8.
|
||||
|
||||
Mon Jun 7 22:25:24 2004 Matthias Clasen <maclas@gmx.de>
|
||||
|
||||
* tests/run-markup-tests.sh: Default to silence, but support
|
||||
|
@ -1,3 +1,18 @@
|
||||
2004-06-07 Federico Mena Quintero <federico@ximian.com>
|
||||
|
||||
* README.in: Added a note about the changes below.
|
||||
|
||||
Merge from HEAD:
|
||||
|
||||
Fixes #140532.
|
||||
|
||||
* glib/gconvert.c (is_asciialphanum): Renamed from
|
||||
is_escalphanum(); ensures that this is an ASCII character.
|
||||
(is_asciiescalpha): Renamed from is_escalpha().
|
||||
(hostname_validate): Use the two functions above.
|
||||
(g_filename_to_uri): Don't convert the filename to UTF-8.
|
||||
(g_filename_from_uri): Don't convert the filename from UTF-8.
|
||||
|
||||
Mon Jun 7 22:25:24 2004 Matthias Clasen <maclas@gmx.de>
|
||||
|
||||
* tests/run-markup-tests.sh: Default to silence, but support
|
||||
|
@ -1,3 +1,18 @@
|
||||
2004-06-07 Federico Mena Quintero <federico@ximian.com>
|
||||
|
||||
* README.in: Added a note about the changes below.
|
||||
|
||||
Merge from HEAD:
|
||||
|
||||
Fixes #140532.
|
||||
|
||||
* glib/gconvert.c (is_asciialphanum): Renamed from
|
||||
is_escalphanum(); ensures that this is an ASCII character.
|
||||
(is_asciiescalpha): Renamed from is_escalpha().
|
||||
(hostname_validate): Use the two functions above.
|
||||
(g_filename_to_uri): Don't convert the filename to UTF-8.
|
||||
(g_filename_from_uri): Don't convert the filename from UTF-8.
|
||||
|
||||
Mon Jun 7 22:25:24 2004 Matthias Clasen <maclas@gmx.de>
|
||||
|
||||
* tests/run-markup-tests.sh: Default to silence, but support
|
||||
|
10
README.in
10
README.in
@ -27,6 +27,16 @@ See the file 'INSTALL'
|
||||
Notes about GLib-2.4.0
|
||||
======================
|
||||
|
||||
* g_filename_to_uri() used to operate like this:
|
||||
|
||||
1. convert the filename from G_FILENAME_ENCODING to UTF-8
|
||||
2. encode the UTF-8 into hexadecimal escapes for URIs
|
||||
|
||||
This was incorrect, and now the filename is simply escaped for
|
||||
conversion into URIs. g_filename_from_uri() is fixed in the same
|
||||
fashion. Programs which store the converted URIs or filenames may
|
||||
need manual conversion.
|
||||
|
||||
* GObject now enforces CONSTRUCT_ONLY properties; due to an oversight
|
||||
in previous versions, it was possible to set CONSTRUCT_ONLY properties
|
||||
after construct time.
|
||||
|
@ -1411,15 +1411,15 @@ g_unescape_uri_string (const char *escaped,
|
||||
}
|
||||
|
||||
static gboolean
|
||||
is_escalphanum (gunichar c)
|
||||
is_asciialphanum (gunichar c)
|
||||
{
|
||||
return c > 0x7F || g_ascii_isalnum (c);
|
||||
return c <= 0x7F && g_ascii_isalnum (c);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
is_escalpha (gunichar c)
|
||||
is_asciialpha (gunichar c)
|
||||
{
|
||||
return c > 0x7F || g_ascii_isalpha (c);
|
||||
return c <= 0x7F && g_ascii_isalpha (c);
|
||||
}
|
||||
|
||||
/* allows an empty string */
|
||||
@ -1437,7 +1437,7 @@ hostname_validate (const char *hostname)
|
||||
/* read in a label */
|
||||
c = g_utf8_get_char (p);
|
||||
p = g_utf8_next_char (p);
|
||||
if (!is_escalphanum (c))
|
||||
if (!is_asciialphanum (c))
|
||||
return FALSE;
|
||||
first_char = c;
|
||||
do
|
||||
@ -1446,13 +1446,13 @@ hostname_validate (const char *hostname)
|
||||
c = g_utf8_get_char (p);
|
||||
p = g_utf8_next_char (p);
|
||||
}
|
||||
while (is_escalphanum (c) || c == '-');
|
||||
while (is_asciialphanum (c) || c == '-');
|
||||
if (last_char == '-')
|
||||
return FALSE;
|
||||
|
||||
/* if that was the last label, check that it was a toplabel */
|
||||
if (c == '\0' || (c == '.' && *p == '\0'))
|
||||
return is_escalpha (first_char);
|
||||
return is_asciialpha (first_char);
|
||||
}
|
||||
while (c == '.');
|
||||
return FALSE;
|
||||
@ -1460,14 +1460,14 @@ hostname_validate (const char *hostname)
|
||||
|
||||
/**
|
||||
* g_filename_from_uri:
|
||||
* @uri: a uri describing a filename (escaped, encoded in UTF-8).
|
||||
* @uri: a uri describing a filename (escaped, encoded in ASCII).
|
||||
* @hostname: Location to store hostname for the URI, or %NULL.
|
||||
* If there is no hostname in the URI, %NULL will be
|
||||
* stored in this location.
|
||||
* @error: location to store the error occuring, or %NULL to ignore
|
||||
* errors. Any of the errors in #GConvertError may occur.
|
||||
*
|
||||
* Converts an escaped UTF-8 encoded URI to a local filename in the
|
||||
* Converts an escaped ASCII-encoded URI to a local filename in the
|
||||
* encoding used for filenames.
|
||||
*
|
||||
* Return value: a newly-allocated string holding the resulting
|
||||
@ -1587,10 +1587,10 @@ g_filename_from_uri (const gchar *uri,
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
result = g_filename_from_utf8 (filename + offs, -1, NULL, NULL, error);
|
||||
|
||||
result = g_strdup (filename + offs);
|
||||
g_free (filename);
|
||||
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
@ -1602,7 +1602,7 @@ g_filename_from_uri (const gchar *uri,
|
||||
* @error: location to store the error occuring, or %NULL to ignore
|
||||
* errors. Any of the errors in #GConvertError may occur.
|
||||
*
|
||||
* Converts an absolute filename to an escaped UTF-8 encoded URI.
|
||||
* Converts an absolute filename to an escaped ASCII-encoded URI.
|
||||
*
|
||||
* Return value: a newly-allocated string holding the resulting
|
||||
* URI, or %NULL on an error.
|
||||
@ -1613,7 +1613,6 @@ g_filename_to_uri (const gchar *filename,
|
||||
GError **error)
|
||||
{
|
||||
char *escaped_uri;
|
||||
char *utf8_filename;
|
||||
|
||||
g_return_val_if_fail (filename != NULL, NULL);
|
||||
|
||||
@ -1634,20 +1633,13 @@ g_filename_to_uri (const gchar *filename,
|
||||
return NULL;
|
||||
}
|
||||
|
||||
utf8_filename = g_filename_to_utf8 (filename, -1, NULL, NULL, error);
|
||||
if (utf8_filename == NULL)
|
||||
return NULL;
|
||||
|
||||
#ifdef G_OS_WIN32
|
||||
/* Don't use localhost unnecessarily */
|
||||
if (hostname && g_ascii_strcasecmp (hostname, "localhost") == 0)
|
||||
hostname = NULL;
|
||||
#endif
|
||||
|
||||
escaped_uri = g_escape_file_uri (hostname,
|
||||
utf8_filename);
|
||||
g_free (utf8_filename);
|
||||
|
||||
escaped_uri = g_escape_file_uri (hostname, filename);
|
||||
|
||||
return escaped_uri;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user