Alien-SVN
view release on metacpan or search on metacpan
src/subversion/subversion/bindings/swig/perl/libsvn_swig_perl/swigutil_pl.c view on Meta::CPAN
return SVN_NO_ERROR;
}
svn_error_t *thunk_get_wc_prop(void *baton,
const char *relpath,
const char *name,
const svn_string_t **value,
apr_pool_t *pool)
{
SV *result;
char *data;
STRLEN len;
svn_swig_pl_callback_thunk(CALL_METHOD, (void *)"get_wc_prop",
&result, "OssS", baton, relpath, name,
pool, POOLINFO);
/* this is svn_string_t * typemap in */
if (!SvOK(result) || result == &PL_sv_undef) {
*value = NULL;
}
else if (SvPOK(result)) {
data = SvPV(result, len);
*value = svn_string_ncreate(data, len, pool);
}
else {
SvREFCNT_dec(result);
croak("not a string");
}
SvREFCNT_dec(result);
return SVN_NO_ERROR;
}
svn_error_t *svn_ra_make_callbacks(svn_ra_callbacks_t **cb,
void **c_baton,
SV *perl_callbacks,
apr_pool_t *pool)
{
SV *auth_baton;
*cb = apr_pcalloc(pool, sizeof(**cb));
(*cb)->open_tmp_file = thunk_open_tmp_file;
(*cb)->get_wc_prop = thunk_get_wc_prop;
(*cb)->set_wc_prop = NULL;
(*cb)->push_wc_prop = NULL;
(*cb)->invalidate_wc_props = NULL;
auth_baton = *hv_fetch((HV *)SvRV(perl_callbacks), "auth", 4, 0);
if (SWIG_ConvertPtr(auth_baton,
(void **)&(*cb)->auth_baton, _SWIG_TYPE("svn_auth_baton_t *"),0) < 0) {
croak("Unable to convert from SWIG Type");
}
*c_baton = perl_callbacks;
svn_swig_pl_hold_ref_in_pool(pool, perl_callbacks);
return SVN_NO_ERROR;
}
svn_error_t *svn_swig_pl_thunk_gnome_keyring_unlock_prompt(char **keyring_password,
const char *keyring_name,
void *baton,
apr_pool_t *pool)
{
SV *result;
STRLEN len;
/* The baton is the actual prompt function passed from perl, so we
* call that one and process the result. */
svn_swig_pl_callback_thunk(CALL_SV,
baton, &result,
"sS", keyring_name,
pool, POOLINFO);
if (!SvOK(result) || result == &PL_sv_undef) {
*keyring_password = NULL;
}
else if (SvPOK(result)) {
*keyring_password = apr_pstrdup(pool, SvPV(result, len));
}
else {
SvREFCNT_dec(result);
croak("not a string");
}
SvREFCNT_dec(result);
return SVN_NO_ERROR;
}
svn_error_t *svn_swig_pl_thunk_simple_prompt(svn_auth_cred_simple_t **cred,
void *baton,
const char *realm,
const char *username,
svn_boolean_t may_save,
apr_pool_t *pool)
{
/* Be nice and allocate the memory for the cred structure before passing it
* off to the perl space */
*cred = apr_pcalloc(pool, sizeof(**cred));
if (!*cred) {
croak("Could not allocate memory for cred structure");
}
svn_swig_pl_callback_thunk(CALL_SV,
baton, NULL,
"SssbS", *cred, _SWIG_TYPE("svn_auth_cred_simple_t *"),
realm, username, may_save, pool, POOLINFO);
return SVN_NO_ERROR;
}
svn_error_t *svn_swig_pl_thunk_username_prompt(svn_auth_cred_username_t **cred,
void *baton,
const char *realm,
svn_boolean_t may_save,
apr_pool_t *pool)
{
/* Be nice and allocate the memory for the cred structure before passing it
* off to the perl space */
*cred = apr_pcalloc(pool, sizeof(**cred));
if (!*cred) {
croak("Could not allocate memory for cred structure");
}
svn_swig_pl_callback_thunk(CALL_SV,
baton, NULL,
"SsbS", *cred, _SWIG_TYPE("svn_auth_cred_username_t *"),
realm, may_save, pool, POOLINFO);
return SVN_NO_ERROR;
}
svn_error_t *svn_swig_pl_thunk_ssl_server_trust_prompt(
svn_auth_cred_ssl_server_trust_t **cred,
void *baton,
const char *realm,
apr_uint32_t failures,
const svn_auth_ssl_server_cert_info_t *cert_info,
svn_boolean_t may_save,
apr_pool_t *pool)
{
/* Be nice and allocate the memory for the cred structure before passing it
* off to the perl space */
*cred = apr_pcalloc(pool, sizeof(**cred));
if (!*cred) {
croak("Could not allocate memory for cred structure");
}
svn_swig_pl_callback_thunk(CALL_SV,
baton, NULL,
"SsiSbS", *cred, _SWIG_TYPE("svn_auth_cred_ssl_server_trust_t *"),
realm, failures,
cert_info, _SWIG_TYPE("svn_auth_ssl_server_cert_info_t *"),
may_save, pool, POOLINFO);
/* Allow the perl callback to indicate failure by setting all vars to 0
* or by simply doing nothing. While still allowing them to indicate
* failure by setting the cred strucutre's pointer to 0 via $$cred = 0 */
if (*cred) {
if ((*cred)->may_save == 0 && (*cred)->accepted_failures == 0) {
*cred = NULL;
}
}
return SVN_NO_ERROR;
}
svn_error_t *svn_swig_pl_thunk_ssl_client_cert_prompt(
svn_auth_cred_ssl_client_cert_t **cred,
void *baton,
const char * realm,
svn_boolean_t may_save,
apr_pool_t *pool)
{
/* Be nice and allocate the memory for the cred structure before passing it
* off to the perl space */
*cred = apr_pcalloc(pool, sizeof(**cred));
if (!*cred) {
croak("Could not allocate memory for cred structure");
}
svn_swig_pl_callback_thunk(CALL_SV,
baton, NULL,
"SsbS", *cred, _SWIG_TYPE("svn_auth_cred_ssl_client_cert_t *"),
realm, may_save, pool, POOLINFO);
return SVN_NO_ERROR;
}
svn_error_t *svn_swig_pl_thunk_ssl_client_cert_pw_prompt(
svn_auth_cred_ssl_client_cert_pw_t **cred,
void *baton,
const char *realm,
svn_boolean_t may_save,
apr_pool_t *pool)
{
/* Be nice and allocate the memory for the cred structure before passing it
* off to the perl space */
*cred = apr_pcalloc(pool, sizeof(**cred));
if (!*cred) {
croak("Could not allocate memory for cred structure");
}
svn_swig_pl_callback_thunk(CALL_SV,
baton, NULL,
"SsbS", *cred, _SWIG_TYPE("svn_auth_cred_ssl_client_cert_pw_t *"),
realm, may_save, pool, POOLINFO);
return SVN_NO_ERROR;
}
/* Thunked version of svn_wc_notify_func_t callback type */
void svn_swig_pl_notify_func(void * baton,
const char *path,
svn_wc_notify_action_t action,
svn_node_kind_t kind,
const char *mime_type,
svn_wc_notify_state_t content_state,
svn_wc_notify_state_t prop_state,
svn_revnum_t revision)
{
if (!SvOK((SV *)baton)) {
return;
}
svn_swig_pl_callback_thunk(CALL_SV,
baton, NULL,
"siisiir", path, action, kind, mime_type,
content_state, prop_state, revision);
}
/* Thunked version of svn_client_get_commit_log3_t callback type. */
svn_error_t *svn_swig_pl_get_commit_log_func(const char **log_msg,
const char **tmp_file,
const apr_array_header_t *
commit_items,
void *baton,
apr_pool_t *pool)
{
SV *result;
svn_error_t *ret_val = SVN_NO_ERROR;
SV *log_msg_sv;
SV *tmp_file_sv;
SV *commit_items_sv;
if (!SvOK((SV *)baton)) {
*log_msg = apr_pstrdup(pool, "");
*tmp_file = NULL;
return SVN_NO_ERROR;
}
( run in 0.553 second using v1.01-cache-2.11-cpan-0b5f733616e )