You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@subversion.apache.org by David James <ja...@gmail.com> on 2005/08/29 18:48:27 UTC

[PATCH] Fix non-portable use of filehandles in Perl bindings (was: [PATCH] Fix warnings in the Windows build of the Perl bindings)

On 8/29/05, Branko Čibej <br...@xbc.nu> wrote:
> David James wrote:
> 
> >Index: subversion/bindings/swig/perl/libsvn_swig_perl/swigutil_pl.c
> >===================================================================
> >--- subversion/bindings/swig/perl/libsvn_swig_perl/swigutil_pl.c       (revision 15951)
> >+++ subversion/bindings/swig/perl/libsvn_swig_perl/swigutil_pl.c       (working copy)
> >@@ -1370,7 +1370,8 @@
> >                     pool);
> >     } else if (SvROK(file) && SvTYPE(SvRV(file)) == SVt_PVGV) {
> >         apr_status_t status;
> >-        apr_os_file_t osfile = PerlIO_fileno(IoIFP(sv_2io(file)));
> >+        apr_os_file_t osfile = (apr_os_file_t)
> >+          PerlIO_fileno(IoIFP(sv_2io(file)));
> >
> >
> This won't work and can't work on Windows. PerlIO_fileno returns an int
> file descriptor. apr_os_file_t is a HANDLE, a completely different,
> totally incompatible beast.
Good catch! I've upgraded the Perl bindings to use _get_os_fhandle on
Win32. I believe this construct is more portable -- the python
bindings use this technique. A new patch is attached.

portable_filehandles_patch.txt:
[[[

Fix non-portable use of filehandles in the Perl bindings.

* swig/perl/libsvn_swig_perl/swigutil_pl.c
  (svn_swig_pl_make_file): On Win32, use _get_os_fhandle to convert
  Perl file numbers into Windows file handles.

]]]

missing_svn_time_header_patch.txt:
[[[

* swig/include/svn_global.swg:
 Include svn_time.h, so that the return type of svn_parse_date will
 be defined.

]]]



Cheers,

David




-- 
David James -- http://www.cs.toronto.edu/~james

Re: [PATCH] Fix non-portable use of filehandles in Perl bindings

Posted by Branko Čibej <br...@xbc.nu>.
David James wrote:

>On 8/29/05, David James <ja...@gmail.com> wrote:
>  
>
>>Good catch! I've upgraded the Perl bindings to use _get_os_fhandle on
>>Win32. I believe this construct is more portable -- the python
>>bindings use this technique. A new patch is attached.
>>
>>portable_filehandles_patch.txt:
>>[[[
>>
>>Fix non-portable use of filehandles in the Perl bindings.
>>
>>* swig/perl/libsvn_swig_perl/swigutil_pl.c
>>  (svn_swig_pl_make_file): On Win32, use _get_os_fhandle to convert
>>  Perl file numbers into Windows file handles.
>>
>>]]]
>>
>>missing_svn_time_header_patch.txt:
>>[[[
>>
>>* swig/include/svn_global.swg:
>> Include svn_time.h, so that the return type of svn_parse_date will
>> be defined.
>>
>>]]]
>>    
>>
>
>Oops -- my original pprtable filehandles patch was missing an #ifdef.
>See attached file, portable_filehandles_patch_v2.txt, for an updated
>version.
>  
>
Thanks. Committed in r15975. Now we've only two fixable warnings left in 
the Perl and Python bindings builds -- the ones about "not enough actual 
parameters for macro 'SWIG_GetModule'".

-- Brane


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

Re: [PATCH] Fix non-portable use of filehandles in Perl bindings (was: [PATCH] Fix warnings in the Windows build of the Perl bindings)

Posted by David James <ja...@gmail.com>.
On 8/29/05, David James <ja...@gmail.com> wrote:
> Good catch! I've upgraded the Perl bindings to use _get_os_fhandle on
> Win32. I believe this construct is more portable -- the python
> bindings use this technique. A new patch is attached.
> 
> portable_filehandles_patch.txt:
> [[[
> 
> Fix non-portable use of filehandles in the Perl bindings.
> 
> * swig/perl/libsvn_swig_perl/swigutil_pl.c
>   (svn_swig_pl_make_file): On Win32, use _get_os_fhandle to convert
>   Perl file numbers into Windows file handles.
> 
> ]]]
> 
> missing_svn_time_header_patch.txt:
> [[[
> 
> * swig/include/svn_global.swg:
>  Include svn_time.h, so that the return type of svn_parse_date will
>  be defined.
> 
> ]]]

Oops -- my original pprtable filehandles patch was missing an #ifdef.
See attached file, portable_filehandles_patch_v2.txt, for an updated
version.

Cheers,

David


-- 
David James -- http://www.cs.toronto.edu/~james