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

    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;
    }

    log_msg_sv = newRV_noinc(sv_newmortal());
    tmp_file_sv = newRV_noinc(sv_newmortal());
    commit_items_sv = svn_swig_pl_convert_array
      (commit_items, _SWIG_TYPE("svn_client_commit_item3_t *"));

    svn_swig_pl_callback_thunk(CALL_SV,
                               baton, &result,
                               "OOOS", log_msg_sv, tmp_file_sv,
                               commit_items_sv, pool, POOLINFO);

    if (!SvOK(SvRV(log_msg_sv))) {
        /* client returned undef to us */
        *log_msg = NULL;
    } else if (SvPOK(SvRV(log_msg_sv))) {



( run in 0.933 second using v1.01-cache-2.11-cpan-acf6aa7dc9e )