[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: svn commit: rev 5980 - trunk/subversion/bindings/swig

From: Greg Stein <gstein_at_lyra.org>
Date: 2003-05-19 23:49:47 CEST

On Mon, May 19, 2003 at 10:50:53AM -0500, cmpilato@tigris.org wrote:
> Author: cmpilato
> Date: Mon May 19 10:50:52 2003
> New Revision: 5980
>
> Modified:
> trunk/subversion/bindings/swig/swigutil_py.c
> Log:
> * subversion/bindings/swig/swigutil_py.c
> (svn_swig_py_make_file): Not making this any less hackish, but
> hopefully this will work on Windows now.

Great. Me likes.

>...
> +++ trunk/subversion/bindings/swig/swigutil_py.c Mon May 19 10:50:52 2003
>>..
> else if (PyFile_Check (py_file))
> {
> - file = PyFile_AsFile (py_file);
> - fd = fileno (file);
> + /* input is a file object -- convert to apr_file_t */
> + file = PyFile_AsFile(py_file);
> +#ifdef WIN32
> + osfile = (apr_os_file_t *)_get_osfhandle(_fileno(file));
> +#else
> + osfile = (apr_os_file_t *)fileno(file);
> +#endif
> + status = apr_os_file_put (&apr_file, osfile, O_CREAT | O_WRONLY, pool);
> + if (status)
> + return NULL;

You could narrow the 'file' and 'osfile' variables down to this scope.

> - else if (PyInt_Check (py_file))
> - {
> - fd = PyInt_AsLong (py_file);
> - }

This is good. I was unsure about the need for this (since a Python program
can always use os.fdopen() (or whatever it is) to get a File object), but
never had enough anti-fd willpower to toss it. But it sounds like two
anti-fd people is enough :-)

Cheers,
-g

-- 
Greg Stein, http://www.lyra.org/
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Mon May 19 23:47:40 2003

This is an archived mail posted to the Subversion Dev mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.