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

Re: [PATCH] Missing Binding for svn_checksum_t

From: Shivani Poddar <shivani.poddar92_at_gmail.com>
Date: Fri, 7 Dec 2012 15:37:06 +0530

On Fri, Dec 7, 2012 at 2:32 PM, Daniel Shahaf <danielsh_at_elego.de> wrote:

> > Index: svn_checksum_t.swg
> > ===================================================================
> > --- svn_checksum_t.swg (revision 0)
> > +++ svn_checksum_t.swg (revision 0)
> > @@ -0,0 +1,47 @@
> > +%module checksum/**
> > + * TYPE: svn_checksum_t.; functions typemapped svn_checksum_t ;
> svn_checksum_kind_t, svn_checksum_create and avn_checksum_clear
> > + * The input for the function svn_checksum_clear is of the Type
> svn_check_sum_t so by the typemap rules it maps to the typemap("in")
> defined here.
> > + */
> > +
> > +#ifdef SWIGPYTHON
> > +%typemap(in) svn_checksum_t * {
> > + /* check if the input is not a const unsigned char* digest */
> > + if(!PyBytes_Check($input)){
>
> If the input is a 'bytes' instance, where do you stow the 'kind' member?
>
I simple redirect it to the else statement in that case.

> > + PyErr_SetString(PyExc_TypeError, "Not a valid Bit string");
> > + /* return fail if it isnt*/
> > + SWIG_fail;
> > + }
> > + /*else , pass is as the required argument for the
> svn_checksum_Clear function*/
> > + $1 = svn_checksum_clear(PyBytes_FromString($input));

i beieve having returned the "kind" parameter here would have been a better
thing to do,
the "out" typemap should account for the returning of svn_error * ,

This line:
>
> - Passes a 'bytes' object to a constructor of 'bytes' object;
>
> - Passes a counted-length string to an API that expects a C string;
>
> - Passes a PyObject * to a Subversion API function taking an
> svn_checksum_t *;
>
> - Uses an svn_error_t * as the result of the typemap
>

yes i get your point, prolly covered this lag in subsequent functions ,
will have to retypemap this bit later..

Basically, you managed to condense four type mismatches into two
> function calls and one assignment. And each one of those is a potential
> segfault.
>
> I won't blame you for not noticing that your patch generated new
> compiler warnings --- the bindings build generates mountains of stderr
> spam --- but did you compile and run the code?
>
> About compiling the code, yes as far as my knowledge about building swg
goes (which i am sure is very premature); i did compile it and the
compiling atlease did not give me any errors that i wouldve gotten
concerened with then.
About running in the code i wanted to turn in svn_checksum_create and
svn_checksum_kind_t which i prioritized to this one.

> > +}
> > +#endif
>
> Cheers
>
> Daniel
>
Regards

Shivani
Received on 2012-12-07 11:07:42 CET

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.