SyncSource: add source name to all exception handling

Not all exceptions thrown while executing a source operation contain
the source name. SyncSource::throwError() does that, but SE_THROW() as
used in helper code does not. It is better to add the source name as
logging prefix. The other advantage is that all lines will have the
prefix, not just the first one.

The SyncSource operations need access to the SyncSource class which
contains them to access the display name of the SyncSource instance.
A positive a side effect of telling the wrappers about the instance at
construction time is that the caller no longer has to pass the source
reference.

This change allows removing the SyncSource::throwError() special
cases, which completes the transition towards having correct source
code location information for all exceptions.
This commit is contained in:
Patrick Ohly 2014-04-03 12:09:04 +02:00
parent c95bc08e61
commit 02088c22e0
4 changed files with 194 additions and 103 deletions

View File

@ -1400,7 +1400,7 @@ bool Cmdline::run() {
source->throwError(SE_HERE, "reading items not supported");
}
err = ops.m_startDataRead(*source, "", "");
err = ops.m_startDataRead("", "");
CHECK_ERROR("reading items");
source->setReadAheadOrder(SyncSourceBase::READ_ALL_ITEMS);
processLUIDs(source, boost::bind(ShowLUID, logging, _1));
@ -1410,7 +1410,7 @@ bool Cmdline::run() {
}
list<string> luids;
bool deleteAll = std::find(m_luids.begin(), m_luids.end(), "*") != m_luids.end();
err = ops.m_startDataRead(*source, "", "");
err = ops.m_startDataRead("", "");
CHECK_ERROR("reading items");
if (deleteAll) {
readLUIDs(source, luids);
@ -1418,21 +1418,21 @@ bool Cmdline::run() {
luids = m_luids;
}
if (ops.m_endDataRead) {
err = ops.m_endDataRead(*source);
err = ops.m_endDataRead();
CHECK_ERROR("stop reading items");
}
if (ops.m_startDataWrite) {
err = ops.m_startDataWrite(*source);
err = ops.m_startDataWrite();
CHECK_ERROR("writing items");
}
BOOST_FOREACH(const string &luid, luids) {
sysync::ItemIDType id;
id.item = (char *)luid.c_str();
err = ops.m_deleteItem(*source, &id);
err = ops.m_deleteItem(&id);
CHECK_ERROR("deleting item");
}
char *token;
err = ops.m_endDataWrite(*source, true, &token);
err = ops.m_endDataWrite(true, &token);
if (token) {
free(token);
}
@ -1443,14 +1443,14 @@ bool Cmdline::run() {
source->throwError(SE_HERE, "reading/writing items directly not supported");
}
if (m_import || m_update) {
err = ops.m_startDataRead(*source, "", "");
err = ops.m_startDataRead("", "");
CHECK_ERROR("reading items");
if (ops.m_endDataRead) {
err = ops.m_endDataRead(*source);
err = ops.m_endDataRead();
CHECK_ERROR("stop reading items");
}
if (ops.m_startDataWrite) {
err = ops.m_startDataWrite(*source);
err = ops.m_startDataWrite();
CHECK_ERROR("writing items");
}
@ -1536,13 +1536,13 @@ bool Cmdline::run() {
}
}
char *token = NULL;
err = ops.m_endDataWrite(*source, true, &token);
err = ops.m_endDataWrite(true, &token);
if (token) {
free(token);
}
CHECK_ERROR("stop writing items");
} else if (m_export) {
err = ops.m_startDataRead(*source, "", "");
err = ops.m_startDataRead("", "");
CHECK_ERROR("reading items");
ostream *out = NULL;
@ -1720,13 +1720,13 @@ void Cmdline::processLUIDs(SyncSource *source, const boost::function<void (const
const SyncSource::Operations &ops = source->getOperations();
sysync::ItemIDType id;
sysync::sInt32 status;
sysync::TSyError err = ops.m_readNextItem(*source, &id, &status, true);
sysync::TSyError err = ops.m_readNextItem(&id, &status, true);
CHECK_ERROR("next item");
while (status != sysync::ReadNextItem_EOF) {
process(id.item);
StrDispose(id.item);
StrDispose(id.parent);
err = ops.m_readNextItem(*source, &id, &status, false);
err = ops.m_readNextItem(&id, &status, false);
CHECK_ERROR("next item");
}
}

View File

@ -191,6 +191,26 @@ string SyncSourceBase::getNativeDatatypeName()
return info.m_native;
}
SyncSourceBase::Operations::Operations(SyncSourceName &source) :
m_startDataRead(source),
m_endDataRead(source),
m_startDataWrite(source),
m_finalizeLocalID(source),
m_endDataWrite(source),
m_readNextItem(source),
m_readItemAsKey(source),
m_insertItemAsKey(source),
m_updateItemAsKey(source),
m_deleteItem(source),
m_loadAdminData(source),
m_saveAdminData(source),
m_insertMapItem(source),
m_updateMapItem(source),
m_deleteMapItem(source),
m_deleteBlob(source)
{
}
static void BumpCounter(int32_t &counter)
{
counter++;
@ -198,6 +218,7 @@ static void BumpCounter(int32_t &counter)
SyncSource::SyncSource(const SyncSourceParams &params) :
SyncSourceConfig(params.m_name, params.m_nodes),
m_operations(*this),
m_numDeleted(0),
m_added(0),
m_updated(0),

View File

@ -674,32 +674,6 @@ enum OperationExecution {
OPERATION_EMPTY /**< operation not implemented */
};
/**
* Implements the "call all slots, error if any failed" semantic of
* the pre- and post-signals described below.
*/
class OperationSlotInvoker {
public:
typedef sysync::TSyError result_type;
template<typename InputIterator>
result_type operator() (InputIterator first, InputIterator last) const
{
result_type res = sysync::LOCERR_OK;
while (first != last) {
try {
*first;
} catch (...) {
SyncMLStatus status = Exception::handle();
if (res == sysync::LOCERR_OK) {
res = static_cast<result_type>(status);
}
}
++first;
}
return res;
}
};
/**
* Helper class for looking up a pending operation by a Synthesis parameter.
* KeyH (add, replace) and item ID (delete) are supported.
@ -742,6 +716,62 @@ template <class F> class ContinueOperation : public boost::function<F>
{}
};
/**
* Interface expected by SyncSourceBase helper class.
* Needed to break a cyclic dependency.
*/
class SyncSourceName
{
public:
/**
* the name of the sync source (for example, "addressbook"),
* unique in the context of its own configuration
**/
virtual std::string getName() const { return "uninitialized SyncSourceBase"; }
/**
* the name of the sync source as it should be displayed to users
* in debug messages; typically the same as getName(), but may
* also include a context ("@foobar/addressbook") to disambiguate
* the name when "addressbook" is used multiple times in a sync (as
* with local sync)
*/
virtual std::string getDisplayName() const { return "uninitialized SyncSourceBase"; }
};
/**
* Implements the "call all slots, error if any failed" semantic of
* the pre- and post-signals described below.
*/
class OperationSlotInvoker {
SyncSourceName &m_source;
public:
OperationSlotInvoker(SyncSourceName &source) :
m_source(source)
{}
typedef sysync::TSyError result_type;
template<typename InputIterator>
result_type operator() (InputIterator first, InputIterator last) const
{
result_type res = sysync::LOCERR_OK;
while (first != last) {
try {
*first;
} catch (...) {
SyncMLStatus status = Exception::handle(m_source.getDisplayName());
if (res == sysync::LOCERR_OK) {
res = static_cast<result_type>(status);
}
}
++first;
}
return res;
}
};
/**
* Helper class, needs to be specialized based on number of parameters
* and return type.
@ -787,11 +817,11 @@ template<class F> class OperationWrapperSwitch<F, 0, sysync::TSyError>
* invokes signals and implementation of operation,
* combines all return codes into one
*/
sysync::TSyError operator () (SyncSource &source) const throw ()
sysync::TSyError operator () () const throw ()
{
sysync::TSyError res;
OperationExecution exec;
res = m_pre(source);
res = m_pre(dynamic_cast<SyncSource &>(m_source));
if (res != sysync::LOCERR_OK) {
exec = OPERATION_SKIPPED;
} else {
@ -800,7 +830,7 @@ template<class F> class OperationWrapperSwitch<F, 0, sysync::TSyError>
res = m_operation();
exec = OPERATION_FINISHED;
} catch (...) {
res = Exception::handle(/* source */);
res = Exception::handle(m_source.getDisplayName());
exec = OPERATION_EXCEPTION;
}
} else {
@ -808,7 +838,7 @@ template<class F> class OperationWrapperSwitch<F, 0, sysync::TSyError>
exec = OPERATION_EMPTY;
}
}
sysync::TSyError newres = m_post(source, exec, res);
sysync::TSyError newres = m_post(dynamic_cast<SyncSource &>(m_source), exec, res);
if (newres != sysync::LOCERR_OK) {
res = newres;
}
@ -824,10 +854,19 @@ template<class F> class OperationWrapperSwitch<F, 0, sysync::TSyError>
PreSignal &getPreSignal() const { return const_cast<PreSignal &>(m_pre); }
PostSignal &getPostSignal() const { return const_cast<PostSignal &>(m_post); }
OperationWrapperSwitch(SyncSourceName &source) :
m_source(source),
m_pre(OperationSlotInvoker(source)),
m_post(OperationSlotInvoker(source))
{
}
protected:
OperationType m_operation;
private:
SyncSourceName &m_source;
PreSignal m_pre;
PostSignal m_post;
};
@ -844,12 +883,11 @@ template<class F> class OperationWrapperSwitch<F, 1, sysync::TSyError>
arg1_type a1),
OperationSlotInvoker> PostSignal;
sysync::TSyError operator () (SyncSource &source,
arg1_type a1) const throw ()
sysync::TSyError operator () (arg1_type a1) const throw ()
{
sysync::TSyError res;
OperationExecution exec;
res = m_pre(source, a1);
res = m_pre(dynamic_cast<SyncSource &>(m_source), a1);
if (res != sysync::LOCERR_OK) {
exec = OPERATION_SKIPPED;
} else {
@ -858,7 +896,7 @@ template<class F> class OperationWrapperSwitch<F, 1, sysync::TSyError>
res = m_operation(a1);
exec = OPERATION_FINISHED;
} catch (...) {
res = Exception::handle(/* source */);
res = Exception::handle(m_source.getDisplayName());
exec = OPERATION_EXCEPTION;
}
} else {
@ -866,7 +904,7 @@ template<class F> class OperationWrapperSwitch<F, 1, sysync::TSyError>
exec = OPERATION_EMPTY;
}
}
sysync::TSyError newres = m_post(source, exec, res, a1);
sysync::TSyError newres = m_post(dynamic_cast<SyncSource &>(m_source), exec, res, a1);
if (newres != sysync::LOCERR_OK) {
res = newres;
}
@ -876,10 +914,18 @@ template<class F> class OperationWrapperSwitch<F, 1, sysync::TSyError>
PreSignal &getPreSignal() const { return const_cast<PreSignal &>(m_pre); }
PostSignal &getPostSignal() const { return const_cast<PostSignal &>(m_post); }
OperationWrapperSwitch(SyncSourceName &source) :
m_source(source),
m_pre(OperationSlotInvoker(source)),
m_post(OperationSlotInvoker(source))
{
}
protected:
OperationType m_operation;
private:
SyncSourceName &m_source;
PreSignal m_pre;
PostSignal m_post;
};
@ -899,8 +945,7 @@ template<class F, class V> class OperationWrapperSwitch<F, 1, V>
typedef ContinueOperation<sysync::TSyError (arg1_type)> Continue;
typedef std::map<typename Converter::key_type, Continue> Pending;
sysync::TSyError operator () (SyncSource &source,
arg1_type a1) const throw ()
sysync::TSyError operator () (arg1_type a1) const throw ()
{
sysync::TSyError res;
OperationExecution exec;
@ -909,7 +954,7 @@ template<class F, class V> class OperationWrapperSwitch<F, 1, V>
typename Pending::iterator it = const_cast<Pending &>(m_pending).find(Converter::toKey(a1));
bool continuing = it != m_pending.end();
res = continuing ? sysync::LOCERR_OK : m_pre(source, a1);
res = continuing ? sysync::LOCERR_OK : m_pre(dynamic_cast<SyncSource &>(m_source), a1);
if (res != sysync::LOCERR_OK) {
exec = OPERATION_SKIPPED;
} else {
@ -931,7 +976,7 @@ template<class F, class V> class OperationWrapperSwitch<F, 1, V>
}
exec = OPERATION_FINISHED;
} catch (...) {
res = Exception::handle(/* source */);
res = Exception::handle(m_source.getDisplayName());
exec = OPERATION_EXCEPTION;
}
} else {
@ -940,7 +985,7 @@ template<class F, class V> class OperationWrapperSwitch<F, 1, V>
}
}
if (res != sysync::LOCERR_AGAIN) {
sysync::TSyError newres = m_post(source, exec, res, a1);
sysync::TSyError newres = m_post(dynamic_cast<SyncSource &>(m_source), exec, res, a1);
if (newres != sysync::LOCERR_OK) {
res = newres;
}
@ -951,10 +996,18 @@ template<class F, class V> class OperationWrapperSwitch<F, 1, V>
PreSignal &getPreSignal() const { return const_cast<PreSignal &>(m_pre); }
PostSignal &getPostSignal() const { return const_cast<PostSignal &>(m_post); }
OperationWrapperSwitch(SyncSourceName &source) :
m_source(source),
m_pre(OperationSlotInvoker(source)),
m_post(OperationSlotInvoker(source))
{
}
protected:
OperationType m_operation;
private:
SyncSourceName &m_source;
PreSignal m_pre;
PostSignal m_post;
Pending m_pending;
@ -973,12 +1026,11 @@ template<class F> class OperationWrapperSwitch<F, 2, sysync::TSyError>
arg1_type a1, arg2_type a2),
OperationSlotInvoker> PostSignal;
sysync::TSyError operator () (SyncSource &source,
arg1_type a1, arg2_type a2) const throw ()
sysync::TSyError operator () (arg1_type a1, arg2_type a2) const throw ()
{
sysync::TSyError res;
OperationExecution exec;
res = m_pre(source, a1, a2);
res = m_pre(dynamic_cast<SyncSource &>(m_source), a1, a2);
if (res != sysync::LOCERR_OK) {
exec = OPERATION_SKIPPED;
} else {
@ -987,7 +1039,7 @@ template<class F> class OperationWrapperSwitch<F, 2, sysync::TSyError>
res = m_operation(a1, a2);
exec = OPERATION_FINISHED;
} catch (...) {
res = Exception::handle(/* source */);
res = Exception::handle(m_source.getDisplayName());
exec = OPERATION_EXCEPTION;
}
} else {
@ -995,7 +1047,7 @@ template<class F> class OperationWrapperSwitch<F, 2, sysync::TSyError>
exec = OPERATION_EMPTY;
}
}
sysync::TSyError newres = m_post(source, exec, res, a1, a2);
sysync::TSyError newres = m_post(dynamic_cast<SyncSource &>(m_source), exec, res, a1, a2);
if (newres != sysync::LOCERR_OK) {
res = newres;
}
@ -1005,10 +1057,18 @@ template<class F> class OperationWrapperSwitch<F, 2, sysync::TSyError>
PreSignal &getPreSignal() const { return const_cast<PreSignal &>(m_pre); }
PostSignal &getPostSignal() const { return const_cast<PostSignal &>(m_post); }
OperationWrapperSwitch(SyncSourceName &source) :
m_source(source),
m_pre(OperationSlotInvoker(source)),
m_post(OperationSlotInvoker(source))
{
}
protected:
OperationType m_operation;
private:
SyncSourceName &m_source;
PreSignal m_pre;
PostSignal m_post;
};
@ -1029,8 +1089,7 @@ template<class F, class V> class OperationWrapperSwitch<F, 2, V>
typedef ContinueOperation<sysync::TSyError (arg1_type, arg2_type)> Continue;
typedef std::map<typename Converter::key_type, Continue> Pending;
sysync::TSyError operator () (SyncSource &source,
arg1_type a1, arg2_type a2) const throw ()
sysync::TSyError operator () (arg1_type a1, arg2_type a2) const throw ()
{
sysync::TSyError res;
OperationExecution exec;
@ -1039,7 +1098,7 @@ template<class F, class V> class OperationWrapperSwitch<F, 2, V>
typename Pending::iterator it = const_cast<Pending &>(m_pending).find(Converter::toKey(a1));
bool continuing = it != m_pending.end();
res = continuing ? sysync::LOCERR_OK : m_pre(source, a1, a2);
res = continuing ? sysync::LOCERR_OK : m_pre(dynamic_cast<SyncSource &>(m_source), a1, a2);
if (res != sysync::LOCERR_OK) {
exec = OPERATION_SKIPPED;
} else {
@ -1061,7 +1120,7 @@ template<class F, class V> class OperationWrapperSwitch<F, 2, V>
}
exec = OPERATION_FINISHED;
} catch (...) {
res = Exception::handle(/* source */);
res = Exception::handle(m_source.getDisplayName());
exec = OPERATION_EXCEPTION;
}
} else {
@ -1070,7 +1129,7 @@ template<class F, class V> class OperationWrapperSwitch<F, 2, V>
}
}
if (res != sysync::LOCERR_AGAIN) {
sysync::TSyError newres = m_post(source, exec, res, a1, a2);
sysync::TSyError newres = m_post(dynamic_cast<SyncSource &>(m_source), exec, res, a1, a2);
if (newres != sysync::LOCERR_OK) {
res = newres;
}
@ -1081,10 +1140,18 @@ template<class F, class V> class OperationWrapperSwitch<F, 2, V>
PreSignal &getPreSignal() const { return const_cast<PreSignal &>(m_pre); }
PostSignal &getPostSignal() const { return const_cast<PostSignal &>(m_post); }
OperationWrapperSwitch(SyncSourceName &source) :
m_source(source),
m_pre(OperationSlotInvoker(source)),
m_post(OperationSlotInvoker(source))
{
}
protected:
OperationType m_operation;
private:
SyncSourceName &m_source;
PreSignal m_pre;
PostSignal m_post;
Pending m_pending;
@ -1104,12 +1171,11 @@ template<class F> class OperationWrapperSwitch<F, 3, sysync::TSyError>
arg1_type a1, arg2_type a2, arg3_type a3),
OperationSlotInvoker> PostSignal;
sysync::TSyError operator () (SyncSource &source,
arg1_type a1, arg2_type a2, arg3_type a3) const throw ()
sysync::TSyError operator () (arg1_type a1, arg2_type a2, arg3_type a3) const throw ()
{
sysync::TSyError res;
OperationExecution exec;
res = m_pre(source, a1, a2, a3);
res = m_pre(dynamic_cast<SyncSource &>(m_source), a1, a2, a3);
if (res != sysync::LOCERR_OK) {
exec = OPERATION_SKIPPED;
} else {
@ -1118,7 +1184,7 @@ template<class F> class OperationWrapperSwitch<F, 3, sysync::TSyError>
res = m_operation(a1, a2, a3);
exec = OPERATION_FINISHED;
} catch (...) {
res = Exception::handle(/* source */);
res = Exception::handle(m_source.getDisplayName());
exec = OPERATION_EXCEPTION;
}
} else {
@ -1126,7 +1192,7 @@ template<class F> class OperationWrapperSwitch<F, 3, sysync::TSyError>
exec = OPERATION_EMPTY;
}
}
sysync::TSyError newres = m_post(source, exec, res, a1, a2, a3);
sysync::TSyError newres = m_post(dynamic_cast<SyncSource &>(m_source), exec, res, a1, a2, a3);
if (newres != sysync::LOCERR_OK) {
res = newres;
}
@ -1136,10 +1202,18 @@ template<class F> class OperationWrapperSwitch<F, 3, sysync::TSyError>
PreSignal &getPreSignal() const { return const_cast<PreSignal &>(m_pre); }
PostSignal &getPostSignal() const { return const_cast<PostSignal &>(m_post); }
OperationWrapperSwitch(SyncSourceName &source) :
m_source(source),
m_pre(OperationSlotInvoker(source)),
m_post(OperationSlotInvoker(source))
{
}
protected:
OperationType m_operation;
private:
SyncSourceName &m_source;
PreSignal m_pre;
PostSignal m_post;
@ -1162,8 +1236,7 @@ template<class F, class V> class OperationWrapperSwitch<F, 3, V>
typedef ContinueOperation<sysync::TSyError (arg1_type, arg2_type, arg3_type)> Continue;
typedef std::map<typename Converter::key_type, Continue> Pending;
sysync::TSyError operator () (SyncSource &source,
arg1_type a1, arg2_type a2, arg3_type a3) const throw ()
sysync::TSyError operator () (arg1_type a1, arg2_type a2, arg3_type a3) const throw ()
{
sysync::TSyError res;
OperationExecution exec;
@ -1172,7 +1245,7 @@ template<class F, class V> class OperationWrapperSwitch<F, 3, V>
typename Pending::iterator it = const_cast<Pending &>(m_pending).find(Converter::toKey(a1));
bool continuing = it != m_pending.end();
res = continuing ? sysync::LOCERR_OK : m_pre(source, a1, a2, a3);
res = continuing ? sysync::LOCERR_OK : m_pre(dynamic_cast<SyncSource &>(m_source), a1, a2, a3);
if (res != sysync::LOCERR_OK) {
exec = OPERATION_SKIPPED;
} else {
@ -1194,7 +1267,7 @@ template<class F, class V> class OperationWrapperSwitch<F, 3, V>
}
exec = OPERATION_FINISHED;
} catch (...) {
res = Exception::handle(/* source */);
res = Exception::handle(m_source.getDisplayName());
exec = OPERATION_EXCEPTION;
}
} else {
@ -1203,7 +1276,7 @@ template<class F, class V> class OperationWrapperSwitch<F, 3, V>
}
}
if (res != sysync::LOCERR_AGAIN) {
sysync::TSyError newres = m_post(source, exec, res, a1, a2, a3);
sysync::TSyError newres = m_post(dynamic_cast<SyncSource &>(m_source), exec, res, a1, a2, a3);
if (newres != sysync::LOCERR_OK) {
res = newres;
}
@ -1214,10 +1287,18 @@ template<class F, class V> class OperationWrapperSwitch<F, 3, V>
PreSignal &getPreSignal() const { return const_cast<PreSignal &>(m_pre); }
PostSignal &getPostSignal() const { return const_cast<PostSignal &>(m_post); }
OperationWrapperSwitch(SyncSourceName &source) :
m_source(source),
m_pre(OperationSlotInvoker(source)),
m_post(OperationSlotInvoker(source))
{
}
protected:
OperationType m_operation;
private:
SyncSourceName &m_source;
PreSignal m_pre;
PostSignal m_post;
Pending m_pending;
@ -1254,6 +1335,8 @@ public OperationWrapperSwitch<F, boost::function<F>::arity, typename boost::func
{
typedef OperationWrapperSwitch<F, boost::function<F>::arity, typename boost::function<F>::result_type> inherited;
public:
OperationWrapper(SyncSourceName &source): inherited(source) {}
/** operation implemented? */
operator bool () const { return inherited::m_operation; }
@ -1276,25 +1359,10 @@ public OperationWrapperSwitch<F, boost::function<F>::arity, typename boost::func
* this base via different intermediate classes, therefore the
* need to keep it abstract.
*/
class SyncSourceBase {
class SyncSourceBase : public SyncSourceName {
public:
virtual ~SyncSourceBase() {}
/**
* the name of the sync source (for example, "addressbook"),
* unique in the context of its own configuration
**/
virtual std::string getName() const { return "uninitialized SyncSourceBase"; }
/**
* the name of the sync source as it should be displayed to users
* in debug messages; typically the same as getName(), but may
* also include a context ("@foobar/addressbook") to disambiguate
* the name when "addressbook" is used multiple times in a sync (as
* with local sync)
*/
virtual std::string getDisplayName() const { return "uninitialized SyncSourceBase"; }
/**
* Convenience function, to be called inside a catch() block of
* (or for) the sync source.
@ -1416,6 +1484,8 @@ class SyncSourceBase {
* post-signals managed by OperationWrapper.
*/
struct Operations {
Operations(SyncSourceName &source);
/**
* The caller determines where item data is stored (m_dirname)
* and where meta information about them (m_node). The callee

View File

@ -448,7 +448,7 @@ TSyError SyncEvolution_LoadAdminData( CContext aContext, cAppCharP aLocDB,
if (!source) {
return LOCERR_WRONGUSAGE;
}
TSyError res = source->getOperations().m_loadAdminData(*source, aLocDB, aRemDB, adminData);
TSyError res = source->getOperations().m_loadAdminData(aLocDB, aRemDB, adminData);
SE_LOG_DEBUG(source->getDisplayName(), "LoadAdminData '%s' '%s', '%s' res=%d",
aLocDB, aRemDB, *adminData ? *adminData : "", res);
return res;
@ -463,7 +463,7 @@ TSyError SyncEvolution_SaveAdminData( CContext aContext, cAppCharP adminData )
if (!source) {
return LOCERR_WRONGUSAGE;
}
TSyError res = source->getOperations().m_saveAdminData(*source, adminData);
TSyError res = source->getOperations().m_saveAdminData(adminData);
SE_LOG_DEBUG(source->getDisplayName(), "SaveAdminData '%s' res=%d", adminData, res);
return res;
} /* SaveAdminData */
@ -511,7 +511,7 @@ TSyError SyncEvolution_InsertMapItem( CContext aContext, cMapID mID )
if (!source) {
return LOCERR_WRONGUSAGE;
}
TSyError res = source->getOperations().m_insertMapItem(*source, mID);
TSyError res = source->getOperations().m_insertMapItem(mID);
SE_LOG_DEBUG(source->getDisplayName(), "InsertMapItem '%s' + %x = '%s' + %x res=%d",
NullPtrCheck(mID->localID), mID->ident,
NullPtrCheck(mID->remoteID), mID->flags,
@ -528,7 +528,7 @@ TSyError SyncEvolution_UpdateMapItem( CContext aContext, cMapID mID )
if (!source) {
return LOCERR_WRONGUSAGE;
}
TSyError res = source->getOperations().m_updateMapItem(*source, mID);
TSyError res = source->getOperations().m_updateMapItem(mID);
SE_LOG_DEBUG(source->getDisplayName(), "UpdateMapItem '%s' + %x = '%s' + %x, res=%d",
mID->localID, mID->ident,
mID->remoteID, mID->flags,
@ -546,7 +546,7 @@ TSyError SyncEvolution_DeleteMapItem( CContext aContext, cMapID mID )
if (!source) {
return LOCERR_WRONGUSAGE;
}
TSyError res = source->getOperations().m_deleteMapItem(*source, mID);
TSyError res = source->getOperations().m_deleteMapItem(mID);
SE_LOG_DEBUG(source->getDisplayName(), "DeleteMapItem '%s' + %x = '%s' + %x res=%d",
mID->localID, mID->ident,
mID->remoteID, mID->flags,
@ -621,7 +621,7 @@ TSyError SyncEvolution_StartDataRead( CContext aContext, cAppCharP lastToken,
if (!source) {
return LOCERR_WRONGUSAGE;
}
TSyError res = source->getOperations().m_startDataRead(*source, lastToken, resumeToken);
TSyError res = source->getOperations().m_startDataRead(lastToken, resumeToken);
SE_LOG_DEBUG(source->getDisplayName(), "StartDataRead last='%s' resume='%s' res=%d",
lastToken, resumeToken, res);
return res;
@ -639,7 +639,7 @@ TSyError SyncEvolution_ReadNextItemAsKey( CContext aContext, ItemID aID, KeyH aI
}
*aStatus = 0;
memset(aID, 0, sizeof(*aID));
TSyError res = source->getOperations().m_readNextItem(*source, aID, aStatus, aFirst);
TSyError res = source->getOperations().m_readNextItem(aID, aStatus, aFirst);
SE_LOG_DEBUG(source->getDisplayName(), "ReadNextItemAsKey aStatus=%d aID=(%s,%s) res=%d",
*aStatus, aID->item, aID->parent, res);
return res;
@ -652,7 +652,7 @@ TSyError SyncEvolution_ReadItemAsKey( CContext aContext, cItemID aID, KeyH aItem
if (!source) {
return LOCERR_WRONGUSAGE;
}
TSyError res = source->getOperations().m_readItemAsKey(*source, aID, aItemKey);
TSyError res = source->getOperations().m_readItemAsKey(aID, aItemKey);
SE_LOG_DEBUG(source->getDisplayName(), "ReadItemAsKey aID=(%s,%s) res=%d",
aID->item, aID->parent, res);
return res;
@ -709,7 +709,7 @@ TSyError SyncEvolution_EndDataRead( CContext aContext )
if (!source) {
return LOCERR_WRONGUSAGE;
}
TSyError res = source->getOperations().m_endDataRead(*source);
TSyError res = source->getOperations().m_endDataRead();
SE_LOG_DEBUG(source->getDisplayName(), "EndDataRead res=%d", res);
return res;
}
@ -737,7 +737,7 @@ TSyError SyncEvolution_InsertItemAsKey( CContext aContext, KeyH aItemKey, ItemID
if (!source) {
return LOCERR_WRONGUSAGE;
}
TSyError res = source->getOperations().m_insertItemAsKey(*source, aItemKey, newID);
TSyError res = source->getOperations().m_insertItemAsKey(aItemKey, newID);
SE_LOG_DEBUG(source->getDisplayName(), "InsertItemAsKey res=%d\n", res);
return res;
}
@ -751,7 +751,7 @@ TSyError SyncEvolution_UpdateItemAsKey( CContext aContext, KeyH aItemKey, cItemI
if (!source) {
return LOCERR_WRONGUSAGE;
}
TSyError res = source->getOperations().m_updateItemAsKey(*source, aItemKey, aID, updID);
TSyError res = source->getOperations().m_updateItemAsKey(aItemKey, aID, updID);
SE_LOG_DEBUG(source->getDisplayName(), "aID=(%s,%s) res=%d",
aID->item,aID->parent, res);
return res;
@ -780,7 +780,7 @@ TSyError SyncEvolution_DeleteItem( CContext aContext, cItemID aID )
if (!source) {
return LOCERR_WRONGUSAGE;
}
TSyError res = source->getOperations().m_deleteItem(*source, aID);
TSyError res = source->getOperations().m_deleteItem(aID);
SE_LOG_DEBUG(source->getDisplayName(), "DeleteItem aID=(%s,%s) res=%d",
aID->item, aID->parent, res);
return res;
@ -846,7 +846,7 @@ TSyError SyncEvolution_DeleteBlob( CContext aContext, cItemID aID, cAppCharP aBl
return LOCERR_WRONGUSAGE;
}
TSyError res = source->getOperations().m_deleteBlob(*source, aID, aBlobID);
TSyError res = source->getOperations().m_deleteBlob(aID, aBlobID);
SE_LOG_DEBUG(source->getDisplayName(), "DeleteBlob aID=(%s,%s) aBlobID=(%s) res=%d",
aID->item,aID->parent, aBlobID, res);
return res;
@ -859,7 +859,7 @@ TSyError SyncEvolution_EndDataWrite( CContext aContext, bool success, appCharP *
if (!source) {
return LOCERR_WRONGUSAGE;
}
TSyError res = source->getOperations().m_endDataWrite(*source, success, newToken);
TSyError res = source->getOperations().m_endDataWrite(success, newToken);
SE_LOG_DEBUG(source->getDisplayName(), "EndDataWrite %s '%s' res=%d",
success ? "COMMIT":"ROLLBACK", *newToken, res);
return res;