[PATCH] client context initialisation for Subversion 1.7
Philip Martin <[email protected]> Fri, 28 Jan 2011 20:08:54 +0000
| Newsgroups | gmane.comp.version-control.subversion.rapidsvn.devel |
|---|---|
| Message-ID | <[email protected]> |
svn_client_ctx_t should be initialised using svn_client_create_context
not memset. This allows the code to work when newer libraries are used,
either at build time or run time. You will definitely need something
like this if the code is going to work with the upcoming Subversion 1.7.
* src/svncpp/context.cpp
(Context::Data): Make ctx a pointer.
(Context::Data::Data): Use svn_client_create_context.
(Context::Data::setAuthCache,
Context::Data::setLogin,
Context::operator svn_client_ctx_t *,
Context::ctx): Adjust for pointer.
Index: src/svncpp/context.cpp
===================================================================
--- src/svncpp/context.cpp (revision 8194)
+++ src/svncpp/context.cpp (working copy)
@@ -65,7 +65,7 @@
bool logIsSet;
int promptCounter;
Pool pool;
- svn_client_ctx_t ctx;
+ svn_client_ctx_t * ctx;
std::string username;
std::string password;
std::string logMessage;
@@ -180,22 +180,22 @@
svn_auth_open(&ab, providers, pool);
// initialize ctx structure
- memset(&ctx, 0, sizeof(ctx));
+ svn_client_create_context(&ctx, pool);
// get the config based on the configDir passed in
- svn_config_get_config(&ctx.config, c_configDir, pool);
+ svn_config_get_config(&ctx->config, c_configDir, pool);
// tell the auth functions where the config is
svn_auth_set_parameter(ab, SVN_AUTH_PARAM_CONFIG_DIR,
c_configDir);
- ctx.auth_baton = ab;
- ctx.log_msg_func = onLogMsg;
- ctx.log_msg_baton = this;
- ctx.notify_func2 = onNotify2;
- ctx.notify_baton2 = this;
- ctx.cancel_func = onCancel;
- ctx.cancel_baton = this;
+ ctx->auth_baton = ab;
+ ctx->log_msg_func = onLogMsg;
+ ctx->log_msg_baton = this;
+ ctx->notify_func2 = onNotify2;
+ ctx->notify_baton2 = this;
+ ctx->cancel_func = onCancel;
+ ctx->cancel_baton = this;
}
void setAuthCache(bool value)
@@ -204,7 +204,7 @@
if (!value)
param = (void *)"1";
- svn_auth_set_parameter(ctx.auth_baton,
+ svn_auth_set_parameter(ctx->auth_baton,
SVN_AUTH_PARAM_NO_AUTH_CACHE,
param);
}
@@ -215,7 +215,7 @@
username = usr;
password = pwd;
- svn_auth_baton_t * ab = ctx.auth_baton;
+ svn_auth_baton_t * ab = ctx->auth_baton;
svn_auth_set_parameter(ab, SVN_AUTH_PARAM_DEFAULT_USERNAME,
username.c_str());
svn_auth_set_parameter(ab, SVN_AUTH_PARAM_DEFAULT_PASSWORD,
@@ -604,13 +604,13 @@
Context::operator svn_client_ctx_t * ()
{
- return &(m->ctx);
+ return m->ctx;
}
svn_client_ctx_t *
Context::ctx()
{
- return &(m->ctx);
+ return m->ctx;
}
void
--
Philip
------------------------------------------------------
http://rapidsvn.tigris.org/ds/viewMessage.do?dsForumId=668&dsMessageId=2701242
To unsubscribe from this discussion, e-mail: [[email protected]].