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

[PATCH] all swig bindings: Fix invalid assumptions that don't hold true on 64-bit platforms.

From: Ben Reser <ben_at_reser.org>
Date: 2003-12-26 00:32:51 CET

These apply to all SWIG based bindings. It'd be really helpful if some
the other bindings people would look at these and make sure they don't
break anything in their bindings. Especially the Python ones since I
made a specific change to them. From looking at the generated code I
almost think that typemap isn't necessary for 64-bit platforms with
Python.

[[[
Fixes cases where we assume a 32-bit platform.

* subversion/bindings/swig/svn_types.i
    svn_boolean_t is the size of an int, not a long.
    apr_time_t is always 64-bits long. This means it
    is a long long on 32-bit and a long on 64-bit.
]]]

Index: subversion/bindings/swig/svn_types.i
===================================================================
--- subversion/bindings/swig/svn_types.i (revision 8081)
+++ subversion/bindings/swig/svn_types.i (working copy)
@@ -146,7 +146,8 @@
 /* -----------------------------------------------------------------------
    'svn_revnum_t *' and 'svn_boolean_t *' will always be an OUTPUT parameter
 */
-%apply long *OUTPUT { svn_revnum_t *, svn_boolean_t * };
+%apply long *OUTPUT { svn_revnum_t * };
+%apply int *OUTPUT { svn_boolean_t * };
 
 /* -----------------------------------------------------------------------
    Define an OUTPUT typemap for 'svn_filesize_t *'. For now, we'll
Index: subversion/bindings/swig/apr.i
===================================================================
--- subversion/bindings/swig/apr.i (revision 8081)
+++ subversion/bindings/swig/apr.i (working copy)
@@ -72,15 +72,26 @@
    to handle that.
 */
 
-%apply long long { apr_time_t };
+#if APR_INT64_T_FMT == "lld"
 
+ %apply long long { apr_time_t };
+
+ %typemap(python,argout,fragment="t_output_helper") apr_time_t *
+ "$result = t_output_helper($result, PyLong_FromLongLong(*$1));";
+
+#elif APR_INT64_T_FMT = "ld"
+
+ %apply long { apr_time_t };
+
+ %typemap(python,argout,fragment="t_output_helper") apr_time_t *
+ "$result = t_output_helper($result, PyLong_FromLong(*$1));";
+
+#endif
+
 /* 'apr_time_t *' will always be an OUTPUT parameter */
 %typemap(in,numinputs=0) apr_time_t * (apr_time_t temp)
     "$1 = &temp;";
 
-%typemap(python,argout,fragment="t_output_helper") apr_time_t *
- "$result = t_output_helper($result, PyLong_FromLongLong(*$1));";
-
 %typemap(java,argout) apr_time_t * {
         /* FIXME: What goes here? */
 }

-- 
Ben Reser <ben@reser.org>
http://ben.reser.org
"Conscience is the inner voice which warns us somebody may be looking."
- H.L. Mencken
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Fri Dec 26 00:33:27 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.