diff --git a/Framework/EventLog.cpp b/Framework/EventLog.cpp index c1eca97..30447c3 100644 --- a/Framework/EventLog.cpp +++ b/Framework/EventLog.cpp @@ -10,7 +10,7 @@ Transaction transaction(*this); EventLogItem item; QString timeStr = QDateTime::currentDateTime().toString("dd/MM/yyyy hh:mm:ss.zzz"); - item.m_dateTime = timeStr.toUtf8(); + item.m_dateTime = timeStr.toUtf8().data(); item.m_location = a_location; item.m_message = a_message; push_back(item); @@ -24,7 +24,7 @@ Transaction transaction(*this); EventLogItem item; QString timeStr = QDateTime::currentDateTime().toString("dd/MM/yyyy hh:mm:ss.zzz"); - item.m_dateTime = timeStr.toUtf8(); + item.m_dateTime = timeStr.toUtf8().data(); item.m_location = a_location; item.m_message = a_error; item.m_message = "Error: " + item.m_message; diff --git a/Framework/EventLog.cpp b/Framework/EventLog.cpp index c1eca97..30447c3 100644 --- a/Framework/EventLog.cpp +++ b/Framework/EventLog.cpp @@ -10,7 +10,7 @@ Transaction transaction(*this); EventLogItem item; QString timeStr = QDateTime::currentDateTime().toString("dd/MM/yyyy hh:mm:ss.zzz"); - item.m_dateTime = timeStr.toUtf8(); + item.m_dateTime = timeStr.toUtf8().data(); item.m_location = a_location; item.m_message = a_message; push_back(item); @@ -24,7 +24,7 @@ Transaction transaction(*this); EventLogItem item; QString timeStr = QDateTime::currentDateTime().toString("dd/MM/yyyy hh:mm:ss.zzz"); - item.m_dateTime = timeStr.toUtf8(); + item.m_dateTime = timeStr.toUtf8().data(); item.m_location = a_location; item.m_message = a_error; item.m_message = "Error: " + item.m_message; diff --git a/Framework/EventLog.h b/Framework/EventLog.h index 807751c..463d96f 100644 --- a/Framework/EventLog.h +++ b/Framework/EventLog.h @@ -23,7 +23,7 @@ class EventLog : public GenericTable { public: - EventLog() : GenericTable(true, "Time", QVariant::DateTime, "Location", QVariant::String, "Message", QVariant::String, 0) {} + EventLog() : GenericTable(true, "Time", QVariant::DateTime, "Location", QVariant::String, "Message", QVariant::String, nullptr) {} void LogMessage(const char* a_location, const char* a_message); void LogError(const char* a_location, const char* a_error); diff --git a/Framework/EventLog.cpp b/Framework/EventLog.cpp index c1eca97..30447c3 100644 --- a/Framework/EventLog.cpp +++ b/Framework/EventLog.cpp @@ -10,7 +10,7 @@ Transaction transaction(*this); EventLogItem item; QString timeStr = QDateTime::currentDateTime().toString("dd/MM/yyyy hh:mm:ss.zzz"); - item.m_dateTime = timeStr.toUtf8(); + item.m_dateTime = timeStr.toUtf8().data(); item.m_location = a_location; item.m_message = a_message; push_back(item); @@ -24,7 +24,7 @@ Transaction transaction(*this); EventLogItem item; QString timeStr = QDateTime::currentDateTime().toString("dd/MM/yyyy hh:mm:ss.zzz"); - item.m_dateTime = timeStr.toUtf8(); + item.m_dateTime = timeStr.toUtf8().data(); item.m_location = a_location; item.m_message = a_error; item.m_message = "Error: " + item.m_message; diff --git a/Framework/EventLog.h b/Framework/EventLog.h index 807751c..463d96f 100644 --- a/Framework/EventLog.h +++ b/Framework/EventLog.h @@ -23,7 +23,7 @@ class EventLog : public GenericTable { public: - EventLog() : GenericTable(true, "Time", QVariant::DateTime, "Location", QVariant::String, "Message", QVariant::String, 0) {} + EventLog() : GenericTable(true, "Time", QVariant::DateTime, "Location", QVariant::String, "Message", QVariant::String, nullptr) {} void LogMessage(const char* a_location, const char* a_message); void LogError(const char* a_location, const char* a_error); diff --git a/Framework/GenericTable.h b/Framework/GenericTable.h index 2b2cce7..0286143 100644 --- a/Framework/GenericTable.h +++ b/Framework/GenericTable.h @@ -58,7 +58,7 @@ while (str) { m_columnNames.push_back(std::string(str)); - m_columnTypes.push_back(va_arg(args, QVariant::Type)); + m_columnTypes.push_back((QVariant::Type)va_arg(args, int)); str = va_arg(args, const char*); } va_end(args); diff --git a/Framework/EventLog.cpp b/Framework/EventLog.cpp index c1eca97..30447c3 100644 --- a/Framework/EventLog.cpp +++ b/Framework/EventLog.cpp @@ -10,7 +10,7 @@ Transaction transaction(*this); EventLogItem item; QString timeStr = QDateTime::currentDateTime().toString("dd/MM/yyyy hh:mm:ss.zzz"); - item.m_dateTime = timeStr.toUtf8(); + item.m_dateTime = timeStr.toUtf8().data(); item.m_location = a_location; item.m_message = a_message; push_back(item); @@ -24,7 +24,7 @@ Transaction transaction(*this); EventLogItem item; QString timeStr = QDateTime::currentDateTime().toString("dd/MM/yyyy hh:mm:ss.zzz"); - item.m_dateTime = timeStr.toUtf8(); + item.m_dateTime = timeStr.toUtf8().data(); item.m_location = a_location; item.m_message = a_error; item.m_message = "Error: " + item.m_message; diff --git a/Framework/EventLog.h b/Framework/EventLog.h index 807751c..463d96f 100644 --- a/Framework/EventLog.h +++ b/Framework/EventLog.h @@ -23,7 +23,7 @@ class EventLog : public GenericTable { public: - EventLog() : GenericTable(true, "Time", QVariant::DateTime, "Location", QVariant::String, "Message", QVariant::String, 0) {} + EventLog() : GenericTable(true, "Time", QVariant::DateTime, "Location", QVariant::String, "Message", QVariant::String, nullptr) {} void LogMessage(const char* a_location, const char* a_message); void LogError(const char* a_location, const char* a_error); diff --git a/Framework/GenericTable.h b/Framework/GenericTable.h index 2b2cce7..0286143 100644 --- a/Framework/GenericTable.h +++ b/Framework/GenericTable.h @@ -58,7 +58,7 @@ while (str) { m_columnNames.push_back(std::string(str)); - m_columnTypes.push_back(va_arg(args, QVariant::Type)); + m_columnTypes.push_back((QVariant::Type)va_arg(args, int)); str = va_arg(args, const char*); } va_end(args); diff --git a/Framework/Tests.cpp b/Framework/Tests.cpp index 225fa42..046c82c 100644 --- a/Framework/Tests.cpp +++ b/Framework/Tests.cpp @@ -1,6 +1,13 @@ #include "Utilities.h" +#ifdef _MSC_VER +# define SNPRINTF _snprintf +#else +# define SNPRINTF snprintf +#endif + + void argCountTest() { int x0 = YQ_ARG_COUNT(); @@ -16,7 +23,7 @@ int x10 = YQ_ARG_COUNT(1, 2, 3, 4, 1, 1, 1, 1, 1, 1); int x11 = YQ_ARG_COUNT(1, 2, 3, 4, 1, 1, 1, 1, 1, 1, 1); char buf[1024]; - _snprintf(buf, 1024, "%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d\n", x0, x1, x2, x3, x4, x5, x6, x7, x8, x9, x10, x11); + SNPRINTF(buf, 1024, "%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d\n", x0, x1, x2, x3, x4, x5, x6, x7, x8, x9, x10, x11); yqConsolePrintString(buf); } diff --git a/Framework/EventLog.cpp b/Framework/EventLog.cpp index c1eca97..30447c3 100644 --- a/Framework/EventLog.cpp +++ b/Framework/EventLog.cpp @@ -10,7 +10,7 @@ Transaction transaction(*this); EventLogItem item; QString timeStr = QDateTime::currentDateTime().toString("dd/MM/yyyy hh:mm:ss.zzz"); - item.m_dateTime = timeStr.toUtf8(); + item.m_dateTime = timeStr.toUtf8().data(); item.m_location = a_location; item.m_message = a_message; push_back(item); @@ -24,7 +24,7 @@ Transaction transaction(*this); EventLogItem item; QString timeStr = QDateTime::currentDateTime().toString("dd/MM/yyyy hh:mm:ss.zzz"); - item.m_dateTime = timeStr.toUtf8(); + item.m_dateTime = timeStr.toUtf8().data(); item.m_location = a_location; item.m_message = a_error; item.m_message = "Error: " + item.m_message; diff --git a/Framework/EventLog.h b/Framework/EventLog.h index 807751c..463d96f 100644 --- a/Framework/EventLog.h +++ b/Framework/EventLog.h @@ -23,7 +23,7 @@ class EventLog : public GenericTable { public: - EventLog() : GenericTable(true, "Time", QVariant::DateTime, "Location", QVariant::String, "Message", QVariant::String, 0) {} + EventLog() : GenericTable(true, "Time", QVariant::DateTime, "Location", QVariant::String, "Message", QVariant::String, nullptr) {} void LogMessage(const char* a_location, const char* a_message); void LogError(const char* a_location, const char* a_error); diff --git a/Framework/GenericTable.h b/Framework/GenericTable.h index 2b2cce7..0286143 100644 --- a/Framework/GenericTable.h +++ b/Framework/GenericTable.h @@ -58,7 +58,7 @@ while (str) { m_columnNames.push_back(std::string(str)); - m_columnTypes.push_back(va_arg(args, QVariant::Type)); + m_columnTypes.push_back((QVariant::Type)va_arg(args, int)); str = va_arg(args, const char*); } va_end(args); diff --git a/Framework/Tests.cpp b/Framework/Tests.cpp index 225fa42..046c82c 100644 --- a/Framework/Tests.cpp +++ b/Framework/Tests.cpp @@ -1,6 +1,13 @@ #include "Utilities.h" +#ifdef _MSC_VER +# define SNPRINTF _snprintf +#else +# define SNPRINTF snprintf +#endif + + void argCountTest() { int x0 = YQ_ARG_COUNT(); @@ -16,7 +23,7 @@ int x10 = YQ_ARG_COUNT(1, 2, 3, 4, 1, 1, 1, 1, 1, 1); int x11 = YQ_ARG_COUNT(1, 2, 3, 4, 1, 1, 1, 1, 1, 1, 1); char buf[1024]; - _snprintf(buf, 1024, "%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d\n", x0, x1, x2, x3, x4, x5, x6, x7, x8, x9, x10, x11); + SNPRINTF(buf, 1024, "%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d\n", x0, x1, x2, x3, x4, x5, x6, x7, x8, x9, x10, x11); yqConsolePrintString(buf); } diff --git a/Framework/Utilities.h b/Framework/Utilities.h index c30c017..8db1c72 100644 --- a/Framework/Utilities.h +++ b/Framework/Utilities.h @@ -65,9 +65,9 @@ // In debug and release, on errors, the code always calls the installed or default error handling routine enum { YQ_VERBOSE_DEBUGGING = 0 }; #define YQ_API_VERBOSE(msg) ((YQ_VERBOSE_DEBUGGING) ? YQ_LOG_DEBUG(msg) : ((void)0)) -#define YQ_API_ERROR(result, ...) (yqHandleError(result, YQ_LOCATION(""), ##__VA_ARGS__), YQ_LOG_ERROR("Leave: " #result " (%i)", result), result) +#define YQ_API_ERROR(result, ...) (yqHandleError(result, YQ_LOCATION(""), __VA_ARGS__), YQ_LOG_ERROR("Leave: " #result " (%i)", result), result) #define YQ_API_ENTER() YQ_API_VERBOSE("Enter") -#define YQ_API_LEAVE(result, ...) return ((result == R_Okay) ? (YQ_API_VERBOSE("Leave"), result) : YQ_API_ERROR(result, "" ##__VA_ARGS__)) +#define YQ_API_LEAVE(result, ...) return ((result == R_Okay) ? (YQ_API_VERBOSE("Leave"), result) : YQ_API_ERROR(result, "" __VA_ARGS__)) // Macros to do common parameter and precondition checking for API function calls // This macro checks the pre-condition is met, if it doesn't then returns the error result and executes the provided cleanup code