Philip Martin <philip@codematters.co.uk> writes:
> My first patch did exactly that
Like this:
Use UTF-8 to represent symlinks in text-base and repository.
* subversion/include/svn_io.h
(svn_io_create_unique_link, svn_io_read_link): Remove comment
about dest encoding.
* subversion/libsvn_subr/io.c
(svn_io_read_link): Convert dest path to UTF-8, increase buffer
to allow for null termination.
(svn_io_create_unique_link): Convert dest from UTF-8, remove
comment about dest encoding.
Index: subversion/include/svn_io.h
===================================================================
--- subversion/include/svn_io.h (revision 11358)
+++ subversion/include/svn_io.h (working copy)
@@ -135,8 +135,6 @@
*
* Like svn_io_open_unique_file, except that instead of creating a
* file, a symlink is generated that references the path @a dest.
- *
- * Note: @a dest is not in UTF-8, it is in the native encoding.
*/
svn_error_t *svn_io_create_unique_link (const char **unique_name_p,
const char *path,
@@ -150,8 +148,6 @@
*
* Set @a dest to the path that the symlink at @a path references.
* Allocate the string from @a pool.
- *
- * Note: @a dest is not in UTF-8, it is in the native encoding.
*/
svn_error_t *svn_io_read_link (svn_string_t **dest,
const char *path,
Index: subversion/libsvn_subr/io.c
===================================================================
--- subversion/libsvn_subr/io.c (revision 11358)
+++ subversion/libsvn_subr/io.c (working copy)
@@ -262,7 +262,7 @@
svn_error_t *
svn_io_create_unique_link (const char **unique_name_p,
const char *path,
- const char *dest, /* native, not UTF-8 */
+ const char *dest,
const char *suffix,
apr_pool_t *pool)
{
@@ -270,8 +270,11 @@
unsigned int i;
const char *unique_name;
const char *unique_name_apr;
+ const char *dest_apr;
int rv;
+ SVN_ERR (svn_path_cstring_from_utf8 (&dest_apr, dest, pool));
+
for (i = 1; i <= 99999; i++)
{
apr_status_t apr_err;
@@ -300,7 +303,7 @@
pool));
do {
- rv = symlink (dest, unique_name_apr);
+ rv = symlink (dest_apr, unique_name_apr);
} while (rv == -1 && APR_STATUS_IS_EINTR (apr_get_os_error ()));
apr_err = apr_get_os_error();
@@ -354,8 +357,9 @@
apr_pool_t *pool)
{
#ifdef HAVE_READLINK
+ svn_string_t dest_apr;
const char *path_apr;
- char buf[1024];
+ char buf[1025];
int rv;
SVN_ERR (svn_path_cstring_from_utf8 (&path_apr, path, pool));
@@ -367,8 +371,13 @@
return svn_error_wrap_apr
(apr_get_os_error (), _("Can't read contents of link"));
- /* Note: returning non-UTF-8 here */
- *dest = svn_string_ncreate (buf, rv, pool);
+ buf[rv] = '\0';
+ dest_apr.data = buf;
+ dest_apr.len = rv;
+
+ /* ### Cast needed, one of these interfaces is wrong */
+ SVN_ERR (svn_utf_string_to_utf8 ((const svn_string_t **)dest, &dest_apr,
+ pool));
return SVN_NO_ERROR;
#else
--
Philip Martin
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Wed Oct 13 19:10:14 2004