You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@subversion.apache.org by Paul Burba <pa...@softlanding.com> on 2006/03/24 20:12:11 UTC

[PATCH] Follow-up to r18536 OS400/EBCDIC Port: Convert string args to EBCDIC for functions that require it.

Hi All,

Grrr...I just found this today while working on the 
svn_utf_cstring_*_utf8_ex() patch.

Revision 18536 was an OS400/EBCDIC related patch that handled a handful of 
functions on OS400 that still require EBCDIC encoded string arguments on 
V5R4.  Among these were readlink() and symlink().  Well somehow, with the 
plethora of working copies I have for various flavors of OS400 Subversion 
ports, I managed to not commit all of the required the required 
conversions for readlink() and symlink().  Throw rotten fruit at me if you 
wish...

Paul B.

[[[
OS400/EBCDIC Port: Convert string args to EBCDIC for functions that
require it.

This is a follow-up to r18536, one of several patches to allow
Subversion to run on IBM's OS400 V5R4.  Rev 18536 mistakenly didn't
include all the changes necessary to handle EBCDIC arguments to
symlink() and readlink().  This patch fixes that. 

* subversion/libsvn_subr/io.c
   (SVN_UTF_ETOU_XLATE_HANDLE): New xlate key for EBCDIC (CCSID 0) to
    UTF-8 (CCSID 1208) string conversions.
   (svn_io_create_unique_link): Convert *both* string args to
    symlink() to EBCDIC.
   (svn_io_read_link): Convert the buffer filled by readlink() from
    EBCDIC to UTF-8. 
]]]


_____________________________________________________________________________
Scanned for SoftLanding Systems, Inc. and SoftLanding Europe Plc by IBM Email Security Management Services powered by MessageLabs. 
_____________________________________________________________________________

Re: [PATCH] Follow-up to r18536 OS400/EBCDIC Port: Convert string args to EBCDIC for functions that require it.

Posted by Julian Foad <ju...@btopenworld.com>.
Paul Burba wrote:
> 
> [[[
> OS400/EBCDIC Port: Convert string args to EBCDIC for functions that
> require it.
[...]

+1.

- Julian

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org

Re: [PATCH] Follow-up to r18536 OS400/EBCDIC Port: Convert string args to EBCDIC for functions that require it.

Posted by Paul Burba <pa...@softlanding.com>.
Julian Foad <ju...@btopenworld.com> wrote on 03/24/2006 07:05:27 PM:

> Paul Burba wrote:
> > 
> > Index: subversion/libsvn_subr/io.c
> > ===================================================================
<snip>
> > @@ -554,8 +571,17 @@
> >    dest_apr.len = rv;
> > 
> >    /* ### Cast needed, one of these interfaces is wrong */
> > +#ifndef AS400_UTF8
> > +  /* ### Cast needed, one of these interfaces is wrong */
> 
> I assume you didn't mean to duplicate that comment.

Removed dups.
 
> >    SVN_ERR(svn_utf_string_to_utf8((const svn_string_t **)dest, 
&dest_apr,
> >                                   pool));
> > +#else
> > +  /* The buf filled by readlink() is ebcdic encoded
> > +   * despite V5R4's UTF support. */
> > +  SVN_ERR(svn_utf_cstring_to_utf8_ex(&buf_utf8, dest_apr.data,
> > +                                     (const char *)0, NULL, pool));
> 
> I think you meant to use that new constant you defined above, instead of 
NULL 
> here.  (Probably thinking about that other patch that might make the arg 

> redundant...)

That's what I did, fixed that.
 
> > +  *dest = svn_string_create(buf_utf8, pool);
> > +#endif
> > 
> >    return SVN_NO_ERROR;
> >  #else
> 
> - Julian

Thanks for taking a look,

Paul B.

[[[
OS400/EBCDIC Port: Convert string args to EBCDIC for functions that
require it.

This is a follow-up to r18536, one of several patches to allow
Subversion to run on IBM's OS400 V5R4.  Rev 18536 mistakenly didn't
include all the changes necessary to handle EBCDIC arguments to
symlink() and readlink().  This patch fixes that. 

* subversion/libsvn_subr/io.c
   (SVN_UTF_ETOU_XLATE_HANDLE): New xlate key for EBCDIC (CCSID 0) to
    UTF-8 (CCSID 1208) string conversions.
   (svn_io_create_unique_link): Convert *both* string args to
    symlink() to EBCDIC.
   (svn_io_read_link): Convert the buffer filled by readlink() from
    EBCDIC to UTF-8. 
]]]


_____________________________________________________________________________
Scanned for SoftLanding Systems, Inc. and SoftLanding Europe Plc by IBM Email Security Management Services powered by MessageLabs. 
_____________________________________________________________________________

Re: [PATCH] Follow-up to r18536 OS400/EBCDIC Port: Convert string args to EBCDIC for functions that require it.

Posted by Julian Foad <ju...@btopenworld.com>.
Paul Burba wrote:
> 
> Index: subversion/libsvn_subr/io.c
> ===================================================================
> --- subversion/libsvn_subr/io.c	(revision 19012)
> +++ subversion/libsvn_subr/io.c	(working copy)
> @@ -54,6 +54,7 @@
>  
>  #ifdef AS400
>  #define SVN_UTF_UTOE_XLATE_HANDLE "svn-utf-utoe-xlate-handle"
> +#define SVN_UTF_ETOU_XLATE_HANDLE "svn-utf-etou-xlate-handle"
>  #endif
>  
>  /*
> @@ -432,9 +433,22 @@
>    const char *unique_name_apr;
>    const char *dest_apr;
>    int rv;
> +#ifdef AS400_UTF8
> +  const char *dest_apr_ebcdic;
> +#endif
>  
>    SVN_ERR(svn_path_cstring_from_utf8(&dest_apr, dest, pool));
>  
> +#ifdef AS400_UTF8
> +  /* On OS400 with UTF support a native cstring is UTF-8, but
> +   * symlink() *really* needs EBCDIC paths. */
> +  SVN_ERR(svn_utf_cstring_from_utf8_ex(&dest_apr_ebcdic, dest_apr,
> +                                       (const char*)0,
> +                                       SVN_UTF_UTOE_XLATE_HANDLE,
> +                                       pool));
> +  dest_apr = dest_apr_ebcdic;
> +#endif
> +
>    for (i = 1; i <= 99999; i++)
>      {
>        apr_status_t apr_err;
> @@ -531,6 +545,9 @@
>    const char *path_apr;
>    char buf[1025];
>    int rv;
> +#ifdef AS400_UTF8
> +  const char *buf_utf8;
> +#endif
>    
>  #ifndef AS400_UTF8  
>    SVN_ERR(svn_path_cstring_from_utf8(&path_apr, path, pool));
> @@ -554,8 +571,17 @@
>    dest_apr.len = rv;
>  
>    /* ### Cast needed, one of these interfaces is wrong */
> +#ifndef AS400_UTF8
> +  /* ### Cast needed, one of these interfaces is wrong */

I assume you didn't mean to duplicate that comment.

>    SVN_ERR(svn_utf_string_to_utf8((const svn_string_t **)dest, &dest_apr,
>                                   pool));
> +#else
> +  /* The buf filled by readlink() is ebcdic encoded
> +   * despite V5R4's UTF support. */
> +  SVN_ERR(svn_utf_cstring_to_utf8_ex(&buf_utf8, dest_apr.data,
> +                                     (const char *)0, NULL, pool));

I think you meant to use that new constant you defined above, instead of NULL 
here.  (Probably thinking about that other patch that might make the arg 
redundant...)

> +  *dest = svn_string_create(buf_utf8, pool);
> +#endif
>    
>    return SVN_NO_ERROR;
>  #else

- Julian

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org