summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/inspircd.h4
-rw-r--r--include/inspstring.h2
-rw-r--r--include/modules/sql.h11
3 files changed, 8 insertions, 9 deletions
diff --git a/include/inspircd.h b/include/inspircd.h
index 40c368106..bdbcdb20d 100644
--- a/include/inspircd.h
+++ b/include/inspircd.h
@@ -407,8 +407,8 @@ class CoreExport InspIRCd
* @param ... A variable number of format arguments.
* @return The formatted string
*/
- static const char* Format(const char* formatString, ...) CUSTOM_PRINTF(1, 2);
- static const char* Format(va_list &vaList, const char* formatString) CUSTOM_PRINTF(2, 0);
+ static std::string Format(const char* formatString, ...) CUSTOM_PRINTF(1, 2);
+ static std::string Format(va_list& vaList, const char* formatString) CUSTOM_PRINTF(2, 0);
/** Determines whether a nickname is valid. */
TR1NS::function<bool(const std::string&)> IsNick;
diff --git a/include/inspstring.h b/include/inspstring.h
index ccc77da66..2501b76ce 100644
--- a/include/inspstring.h
+++ b/include/inspstring.h
@@ -29,7 +29,7 @@
do { \
va_list _vaList; \
va_start(_vaList, last); \
- ret = InspIRCd::Format(_vaList, format); \
+ ret.assign(InspIRCd::Format(_vaList, format)); \
va_end(_vaList); \
} while (false);
diff --git a/include/modules/sql.h b/include/modules/sql.h
index dd33fc676..01adbb42e 100644
--- a/include/modules/sql.h
+++ b/include/modules/sql.h
@@ -132,7 +132,7 @@ class SQL::Error
{
private:
/** The custom error message if one has been specified. */
- const char* message;
+ const std::string message;
public:
/** The code which represents this error. */
@@ -142,8 +142,7 @@ class SQL::Error
* @param c A code which represents this error.
*/
Error(ErrorCode c)
- : message(NULL)
- , code(c)
+ : code(c)
{
}
@@ -151,7 +150,7 @@ class SQL::Error
* @param c A code which represents this error.
* @param m A custom error message.
*/
- Error(ErrorCode c, const char* m)
+ Error(ErrorCode c, const std::string m)
: message(m)
, code(c)
{
@@ -160,8 +159,8 @@ class SQL::Error
/** Retrieves the error message. */
const char* ToString() const
{
- if (message)
- return message;
+ if (!message.empty())
+ return message.c_str();
switch (code)
{