diff --git a/src/lib/data/TextLocation.cpp b/src/lib/data/TextLocation.cpp index 6ec731af..8cb36f50 100644 --- a/src/lib/data/TextLocation.cpp +++ b/src/lib/data/TextLocation.cpp @@ -4,15 +4,21 @@ #include "data/TextLocationLine.h" TextLocation::TextLocation( - const std::weak_ptr& textLocationLine, - const std::weak_ptr& element, - unsigned int column) -: m_textLocationLine(textLocationLine) -, m_element(element) -, m_column(column) + std::weak_ptr textLocationLine, + std::weak_ptr element, + unsigned int column +) + : m_element(element) + , m_textLocationLine(textLocationLine) + , m_column(column) { } TextLocation::~TextLocation() { } + +unsigned int TextLocation::getColumn() const +{ + return m_column; +} diff --git a/src/lib/data/TextLocation.h b/src/lib/data/TextLocation.h index 30cb3714..90332bd6 100644 --- a/src/lib/data/TextLocation.h +++ b/src/lib/data/TextLocation.h @@ -10,17 +10,19 @@ class TextLocation { public: TextLocation( - const std::weak_ptr& textLocationLine, - const std::weak_ptr& element, - unsigned int column); + std::weak_ptr textLocationLine, + std::weak_ptr element, + unsigned int column + ); ~TextLocation(); + unsigned int getColumn() const; + private: - const unsigned int m_column; - const std::weak_ptr m_textLocationLine; const std::weak_ptr m_element; + const std::weak_ptr m_textLocationLine; + const unsigned int m_column; }; - #endif // TEXT_LOCATION_H diff --git a/src/lib/data/TextLocationLine.cpp b/src/lib/data/TextLocationLine.cpp index 72acb6fe..dea02584 100644 --- a/src/lib/data/TextLocationLine.cpp +++ b/src/lib/data/TextLocationLine.cpp @@ -2,12 +2,17 @@ #include "data/TextLocationFile.h" -TextLocationLine::TextLocationLine(const std::weak_ptr& textLocationFile, unsigned int lineNumber) -: m_textLocationFile(textLocationFile) -, m_lineNumber(lineNumber) +TextLocationLine::TextLocationLine(std::weak_ptr textLocationFile, unsigned int lineNumber) + : m_textLocationFile(textLocationFile) + , m_lineNumber(lineNumber) { } TextLocationLine::~TextLocationLine() { } + +unsigned int TextLocationLine::getLineNumber() const +{ + return m_lineNumber; +} diff --git a/src/lib/data/TextLocationLine.h b/src/lib/data/TextLocationLine.h index ec241d7a..f0cda0cc 100644 --- a/src/lib/data/TextLocationLine.h +++ b/src/lib/data/TextLocationLine.h @@ -11,10 +11,12 @@ class TextLocationFile; class TextLocationLine { public: - TextLocationLine(const std::weak_ptr& textLocationFile, unsigned int lineNumber); + TextLocationLine(std::weak_ptr textLocationFile, unsigned int lineNumber); ~TextLocationLine(); + unsigned int getLineNumber() const; + private: const std::weak_ptr m_textLocationFile; const unsigned int m_lineNumber; diff --git a/src/lib/utility/ConfigManager.cpp b/src/lib/utility/ConfigManager.cpp index a94af238..4d87822d 100644 --- a/src/lib/utility/ConfigManager.cpp +++ b/src/lib/utility/ConfigManager.cpp @@ -39,7 +39,7 @@ bool ConfigManager::getValue(const std::string& key, float& value) const std::string valueString; if (getValue(key, valueString)) { - value = atof(valueString.c_str()); + value = static_cast(atof(valueString.c_str())); return true; } return false; @@ -82,7 +82,7 @@ void ConfigManager::setValue(const std::string& key, const float value) void ConfigManager::setValue(const std::string& key, const bool value) { - setValue(key, value ? "1" : "0"); + setValue(key, (value ? "1" : "0")); } diff --git a/src/lib/utility/logging/LogManager.cpp b/src/lib/utility/logging/LogManager.cpp index 045eb726..ad667035 100644 --- a/src/lib/utility/logging/LogManager.cpp +++ b/src/lib/utility/logging/LogManager.cpp @@ -43,7 +43,7 @@ void LogManager::removeLogger(std::shared_ptr logger) void LogManager::removeLoggersByType(const std::string& type) { std::lock_guard lockGuard(m_loggerMutex); - for (int i = 0; i < m_loggers.size(); i++) + for (unsigned int i = 0; i < m_loggers.size(); i++) { if (m_loggers[i]->getType() == type) { @@ -67,7 +67,7 @@ void LogManager::logInfo( ) { std::lock_guard lockGuardLogger(m_loggerMutex); - for (int i = 0; i < m_loggers.size(); i++) + for (unsigned int i = 0; i < m_loggers.size(); i++) { m_loggers[i]->logInfo(LogMessage(message, file, function, line, getTime())); } @@ -81,7 +81,7 @@ void LogManager::logWarning( ) { std::lock_guard lockGuardLogger(m_loggerMutex); - for (int i = 0; i < m_loggers.size(); i++) + for (unsigned int i = 0; i < m_loggers.size(); i++) { m_loggers[i]->logWarning(LogMessage(message, file, function, line, getTime())); } @@ -95,7 +95,7 @@ void LogManager::logError( ) { std::lock_guard lockGuardLogger(m_loggerMutex); - for (int i = 0; i < m_loggers.size(); i++) + for (unsigned int i = 0; i < m_loggers.size(); i++) { m_loggers[i]->logError(LogMessage(message, file, function, line, getTime())); } @@ -112,5 +112,7 @@ tm LogManager::getTime() { time_t time; std::time(&time); - return *std::localtime(&time); + tm result; + result = *localtime(&time); + return result; } diff --git a/src/lib/utility/math/Vector2.h b/src/lib/utility/math/Vector2.h index ad4fad36..1d90b038 100644 --- a/src/lib/utility/math/Vector2.h +++ b/src/lib/utility/math/Vector2.h @@ -74,7 +74,7 @@ Vector2::~Vector2() template float Vector2::getLengthSquared() const { - return (x * x) + (y * y); + return static_cast(x * x) + static_cast(y * y); } template diff --git a/src/test/Vector2TestSuite.h b/src/test/Vector2TestSuite.h index b72970b8..a8234dfd 100644 --- a/src/test/Vector2TestSuite.h +++ b/src/test/Vector2TestSuite.h @@ -132,12 +132,12 @@ public: TS_ASSERT_EQUALS(true, vec0.isEqual(vec1)); TS_ASSERT_EQUALS(false, vec0.isSame(vec1)); - Vec2i vec2(42.0f, 24.0f); - Vec2i vec3(69.0f, 96.0f); + Vec2i vec2(42, 24); + Vec2i vec3(69, 96); vec2 = vec3; - TS_ASSERT_EQUALS(69.0f, vec2.x); - TS_ASSERT_EQUALS(96.0f, vec2.y); + TS_ASSERT_EQUALS(69, vec2.x); + TS_ASSERT_EQUALS(96, vec2.y); TS_ASSERT_EQUALS(true, vec3.isEqual(vec2)); TS_ASSERT_EQUALS(false, vec3.isSame(vec2)); } @@ -197,7 +197,7 @@ public: TS_ASSERT_EQUALS(84.0f, vec0.y); Vec2i vec2(-2, 2); - Vec2i vec3 = vec2 * 42.5f; //the float is on purpose + Vec2i vec3 = vec2 * float(42.5f); TS_ASSERT_EQUALS(-84, vec3.x); TS_ASSERT_EQUALS(84, vec3.y);