From 3b782473633145a8ab48da42bd8d81fab3f68093 Mon Sep 17 00:00:00 2001 From: Emiel Bruijntjes Date: Tue, 15 Apr 2014 12:29:22 +0200 Subject: [PATCH] error callbacks get a const char *, no longer a std::string --- include/channelimpl.h | 4 ++-- include/deferred.h | 19 +------------------ src/channelcloseframe.h | 2 +- 3 files changed, 4 insertions(+), 21 deletions(-) diff --git a/include/channelimpl.h b/include/channelimpl.h index 91d666c..ba0d9e4 100644 --- a/include/channelimpl.h +++ b/include/channelimpl.h @@ -485,7 +485,7 @@ public: * Report an error message on a channel * @param message */ - void reportError(const std::string &message) + void reportError(const char *message) { // change state _state = state_closed; @@ -496,7 +496,7 @@ public: // @todo should this be a std::string parameter? // inform handler - if (_errorCallback) _errorCallback(message.c_str()); + if (_errorCallback) _errorCallback(message); // leap out if channel is already destructed, or when there are no further callbacks if (!monitor.valid() || !_oldestCallback) return; diff --git a/include/deferred.h b/include/deferred.h index f2e849c..897c36a 100644 --- a/include/deferred.h +++ b/include/deferred.h @@ -117,28 +117,11 @@ protected: * @param error Description of the error that occured * @return Deferred Next deferred result */ - Deferred *reportError(const std::string& error) - { - // from this moment on the object should be listed as failed - _failed = true; - - // execute callbacks if registered - if (_errorCallback) _errorCallback(error.c_str()); - if (_finalizeCallback) _finalizeCallback(); - - // return the next deferred result - return _next; - } - - /** - * Indicate failure - * @param error description of the error that occured - */ Deferred *reportError(const char *error) { // from this moment on the object should be listed as failed _failed = true; - + // execute callbacks if registered if (_errorCallback) _errorCallback(error); if (_finalizeCallback) _finalizeCallback(); diff --git a/src/channelcloseframe.h b/src/channelcloseframe.h index 6db745f..0d9c1d6 100644 --- a/src/channelcloseframe.h +++ b/src/channelcloseframe.h @@ -156,7 +156,7 @@ public: if (!channel) return false; // report to the handler - channel->reportError(text()); + channel->reportError(_text.value().c_str()); // done return true;