Remove warnings

This commit is contained in:
Alexander Bock
2017-04-06 23:19:23 -04:00
parent 78b0d77101
commit 9f3bbe324d
49 changed files with 244 additions and 112 deletions
+10 -1
View File
@@ -163,10 +163,19 @@ std::shared_ptr<DownloadManager::FileFuture> DownloadManager::downloadFile(
std::shared_ptr<FileFuture> future = std::make_shared<FileFuture>(file.filename());
errno = 0;
#ifdef WIN32
FILE* fp;
errno_t error = fopen_s(&fp, file.path().c_str(), "wb");
ghoul_assert(
error == 0,
"Could not open/create file:" + file.path() + ". Errno: " + std::to_string(errno)
);
#else
FILE* fp = fopen(file.path().c_str(), "wb"); // write binary
#endif // WIN32
ghoul_assert(
fp != nullptr,
"Could not open/create file:\n" + file.path() + " \nerrno: " + std::to_string(errno)
"Could not open/create file:" + file.path() + ". Errno: " + std::to_string(errno)
);
//LDEBUG("Start downloading file: '" << url << "' into file '" << file.path() << "'");
@@ -258,7 +258,6 @@ int saveCameraStateToFile(lua_State* L) {
int resetCameraDirection(lua_State* L) {
using ghoul::lua::luaTypeToString;
const std::string _loggerCat = "lua.resetCameraDirection";
int nArguments = lua_gettop(L);
if (nArguments != 0) {
+2 -2
View File
@@ -323,7 +323,7 @@ bool LuaConsole::keyboardCallback(Key key, KeyModifier modifier, KeyAction actio
std::transform(
command.begin(), command.end(),
std::back_inserter(commandLowerCase),
::tolower
[](char v) { return static_cast<char>(tolower(v)); }
);
std::string initialValueLowerCase;
@@ -331,7 +331,7 @@ bool LuaConsole::keyboardCallback(Key key, KeyModifier modifier, KeyAction actio
_autoCompleteInfo.initialValue.begin(),
_autoCompleteInfo.initialValue.end(),
std::back_inserter(initialValueLowerCase),
::tolower
[](char v) { return static_cast<char>(tolower(v)); }
);
bool correctCommand =
+22 -5
View File
@@ -621,11 +621,23 @@ void ParallelConnection::sendFunc(){
reinterpret_cast<const char*>(&messageSizeOut),
reinterpret_cast<const char*>(&messageSizeOut) + sizeof(uint32_t));
result = send(_clientSocket, header.data(), header.size(), 0);
result = send(_clientSocket, message.content.data(), message.content.size(), 0);
result = send(
_clientSocket,
header.data(),
static_cast<int>(header.size()),
0
);
result = send(
_clientSocket,
message.content.data(),
static_cast<int>(message.content.size()),
0
);
if (result == SOCKET_ERROR) {
LERROR("Failed to send message.\nError: " << _ERRNO << " detected in connection, disconnecting.");
LERROR("Failed to send message.\nError: " <<
_ERRNO << " detected in connection, disconnecting."
);
signalDisconnect();
}
@@ -826,7 +838,12 @@ void ParallelConnection::listenCommunication() {
// receive the payload
messageBuffer.resize(messageSize);
nBytesRead = receiveData(_clientSocket, messageBuffer, messageSize, 0);
nBytesRead = receiveData(
_clientSocket,
messageBuffer,
static_cast<int>(messageSize),
0
);
if (nBytesRead <= 0) {
if (!_disconnect) {
@@ -964,7 +981,7 @@ void ParallelConnection::setNConnections(size_t nConnections) {
}
int ParallelConnection::nConnections() {
return _nConnections;
return static_cast<int>(_nConnections);
}
bool ParallelConnection::isHost() {
+3
View File
@@ -54,6 +54,9 @@ REGISTER_TEMPLATEPROPERTY_SOURCE(BoolProperty, bool, false,
if (success) {
return v;
}
else {
throw ghoul::RuntimeError("Conversion error for string: " + value);
}
},
[](std::string& outValue, bool inValue) -> bool {
outValue = inValue ? "true" : "false";
+3
View File
@@ -60,6 +60,9 @@ namespace properties {
if (success) { \
return v; \
} \
else { \
throw ghoul::RuntimeError("Conversion error for string: " + value); \
} \
}
#define DEFAULT_TO_STRING_LAMBDA(TYPE) \
+3
View File
@@ -60,6 +60,9 @@ namespace properties {
if (success) { \
return v; \
} \
else { \
throw ghoul::RuntimeError("Conversion error for string: " + value); \
} \
}
#define DEFAULT_TO_STRING_LAMBDA(TYPE) \
+3
View File
@@ -60,6 +60,9 @@ namespace properties {
if (success) { \
return v; \
} \
else { \
throw ghoul::RuntimeError("Conversion error for string: " + value); \
} \
}
#define DEFAULT_TO_STRING_LAMBDA(TYPE) \
+3
View File
@@ -60,6 +60,9 @@ namespace properties {
if (success) { \
return v; \
} \
else { \
throw ghoul::RuntimeError("Conversion error for string: " + value); \
} \
}
#define DEFAULT_TO_STRING_LAMBDA(TYPE) \
@@ -60,6 +60,9 @@ namespace properties {
if (success) { \
return v; \
} \
else { \
throw ghoul::RuntimeError("Conversion error for string: " + value); \
} \
}
#define DEFAULT_TO_STRING_LAMBDA(TYPE) \
@@ -60,6 +60,9 @@ namespace properties {
if (success) { \
return v; \
} \
else { \
throw ghoul::RuntimeError("Conversion error for string: " + value); \
} \
}
#define DEFAULT_TO_STRING_LAMBDA(TYPE) \
+3
View File
@@ -60,6 +60,9 @@ namespace properties {
if (success) { \
return v; \
} \
else { \
throw ghoul::RuntimeError("Conversion error for string: " + value); \
} \
}
#define DEFAULT_TO_STRING_LAMBDA(TYPE) \
+3
View File
@@ -60,6 +60,9 @@ namespace properties {
if (success) { \
return v; \
} \
else { \
throw ghoul::RuntimeError("Conversion error for string: " + value); \
} \
}
#define DEFAULT_TO_STRING_LAMBDA(TYPE) \
@@ -60,6 +60,9 @@ namespace properties {
if (success) { \
return v; \
} \
else { \
throw ghoul::RuntimeError("Conversion error for string: " + value); \
} \
}
#define DEFAULT_TO_STRING_LAMBDA(TYPE) \
+9 -3
View File
@@ -37,10 +37,12 @@ namespace properties {
#define DEFAULT_FROM_LUA_LAMBDA(TYPE, DEFAULT_VALUE) \
[](lua_State* state, bool& success) -> TYPE { \
success = (lua_isnumber(state, -1) == 1); \
if (success) \
if (success) { \
return static_cast<TYPE>(lua_tonumber(state, -1)); \
else \
} \
else { \
return DEFAULT_VALUE; \
} \
}
#define DEFAULT_TO_LUA_LAMBDA(TYPE) \
@@ -55,8 +57,12 @@ namespace properties {
TYPE v; \
s >> v; \
success = !s.fail(); \
if (success) \
if (success) { \
return v; \
} \
else { \
throw ghoul::RuntimeError("Conversion error for string: " + value); \
} \
}
#define DEFAULT_TO_STRING_LAMBDA(TYPE) \
+9 -3
View File
@@ -37,10 +37,12 @@ namespace properties {
#define DEFAULT_FROM_LUA_LAMBDA(TYPE, DEFAULT_VALUE) \
[](lua_State* state, bool& success) -> TYPE { \
success = (lua_isnumber(state, -1) == 1); \
if (success) \
if (success) { \
return static_cast<TYPE>(lua_tonumber(state, -1)); \
else \
} \
else { \
return DEFAULT_VALUE; \
} \
}
#define DEFAULT_TO_LUA_LAMBDA(TYPE) \
@@ -55,8 +57,12 @@ namespace properties {
TYPE v; \
s >> v; \
success = !s.fail(); \
if (success) \
if (success) { \
return v; \
} \
else { \
throw ghoul::RuntimeError("Conversion error for string: " + value); \
} \
}
#define DEFAULT_TO_STRING_LAMBDA(TYPE) \
@@ -60,6 +60,9 @@ namespace properties {
if (success) { \
return v; \
} \
else { \
throw ghoul::RuntimeError("Conversion error for string: " + value); \
} \
}
#define DEFAULT_TO_STRING_LAMBDA(TYPE) \
+3
View File
@@ -60,6 +60,9 @@ namespace properties {
if (success) { \
return v; \
} \
else { \
throw ghoul::RuntimeError("Conversion error for string: " + value); \
} \
}
#define DEFAULT_TO_STRING_LAMBDA(TYPE) \
+3
View File
@@ -60,6 +60,9 @@ namespace properties {
if (success) { \
return v; \
} \
else { \
throw ghoul::RuntimeError("Conversion error for string: " + value); \
} \
}
#define DEFAULT_TO_STRING_LAMBDA(TYPE) \
+6 -4
View File
@@ -40,8 +40,8 @@ namespace properties {
__TYPE__ result; \
lua_pushnil(state); \
for (glm::length_t i = 0; i < ghoul::glm_components<__TYPE__>::value; ++i) { \
int success = lua_next(state, -2); \
if (success != 1) { \
int hasNext = lua_next(state, -2); \
if (hasNext != 1) { \
success = false; \
return __TYPE__(0); \
} \
@@ -85,8 +85,9 @@ namespace properties {
success = false; \
return result; \
} \
else \
else { \
result[i] = v; \
} \
} \
success = true; \
return result; \
@@ -95,8 +96,9 @@ namespace properties {
#define DEFAULT_TO_STRING_LAMBDA(__TYPE__) \
[](std::string& outValue, __TYPE__ inValue) -> bool { \
outValue = "{"; \
for (glm::length_t i = 0; i < ghoul::glm_components<__TYPE__>::value; ++i) \
for (glm::length_t i = 0; i < ghoul::glm_components<__TYPE__>::value; ++i) { \
outValue += std::to_string(inValue[i]) + ","; \
} \
outValue.pop_back(); \
outValue += "}"; \
return true; \
+6 -4
View File
@@ -40,8 +40,8 @@ namespace properties {
__TYPE__ result; \
lua_pushnil(state); \
for (glm::length_t i = 0; i < ghoul::glm_components<__TYPE__>::value; ++i) { \
int success = lua_next(state, -2); \
if (success != 1) { \
int hasNext = lua_next(state, -2); \
if (hasNext != 1) { \
success = false; \
return __TYPE__(0); \
} \
@@ -85,8 +85,9 @@ namespace properties {
success = false; \
return result; \
} \
else \
else { \
result[i] = v; \
} \
} \
success = true; \
return result; \
@@ -95,8 +96,9 @@ namespace properties {
#define DEFAULT_TO_STRING_LAMBDA(__TYPE__) \
[](std::string& outValue, __TYPE__ inValue) -> bool { \
outValue = "{"; \
for (glm::length_t i = 0; i < ghoul::glm_components<__TYPE__>::value; ++i) \
for (glm::length_t i = 0; i < ghoul::glm_components<__TYPE__>::value; ++i) { \
outValue += std::to_string(inValue[i]) + ","; \
} \
outValue.pop_back(); \
outValue += "}"; \
return true; \
+6 -4
View File
@@ -40,8 +40,8 @@ namespace properties {
__TYPE__ result; \
lua_pushnil(state); \
for (glm::length_t i = 0; i < ghoul::glm_components<__TYPE__>::value; ++i) { \
int success = lua_next(state, -2); \
if (success != 1) { \
int hasNext = lua_next(state, -2); \
if (hasNext != 1) { \
success = false; \
return __TYPE__(0); \
} \
@@ -85,8 +85,9 @@ namespace properties {
success = false; \
return result; \
} \
else \
else { \
result[i] = v; \
} \
} \
success = true; \
return result; \
@@ -95,8 +96,9 @@ namespace properties {
#define DEFAULT_TO_STRING_LAMBDA(__TYPE__) \
[](std::string& outValue, __TYPE__ inValue) -> bool { \
outValue = "{"; \
for (glm::length_t i = 0; i < ghoul::glm_components<__TYPE__>::value; ++i) \
for (glm::length_t i = 0; i < ghoul::glm_components<__TYPE__>::value; ++i) { \
outValue += std::to_string(inValue[i]) + ","; \
} \
outValue.pop_back(); \
outValue += "}"; \
return true; \
+6 -4
View File
@@ -40,8 +40,8 @@ namespace properties {
__TYPE__ result; \
lua_pushnil(state); \
for (glm::length_t i = 0; i < ghoul::glm_components<__TYPE__>::value; ++i) { \
int success = lua_next(state, -2); \
if (success != 1) { \
int hasNext = lua_next(state, -2); \
if (hasNext != 1) { \
success = false; \
return __TYPE__(0); \
} \
@@ -85,8 +85,9 @@ namespace properties {
success = false; \
return result; \
} \
else \
else { \
result[i] = v; \
} \
} \
success = true; \
return result; \
@@ -95,8 +96,9 @@ namespace properties {
#define DEFAULT_TO_STRING_LAMBDA(__TYPE__) \
[](std::string& outValue, __TYPE__ inValue) -> bool { \
outValue = "{"; \
for (glm::length_t i = 0; i < ghoul::glm_components<__TYPE__>::value; ++i) \
for (glm::length_t i = 0; i < ghoul::glm_components<__TYPE__>::value; ++i) { \
outValue += std::to_string(inValue[i]) + ","; \
} \
outValue.pop_back(); \
outValue += "}"; \
return true; \
+6 -4
View File
@@ -40,8 +40,8 @@ namespace properties {
__TYPE__ result; \
lua_pushnil(state); \
for (glm::length_t i = 0; i < ghoul::glm_components<__TYPE__>::value; ++i) { \
int success = lua_next(state, -2); \
if (success != 1) { \
int hasNext = lua_next(state, -2); \
if (hasNext != 1) { \
success = false; \
return __TYPE__(0); \
} \
@@ -85,8 +85,9 @@ namespace properties {
success = false; \
return result; \
} \
else \
else { \
result[i] = v; \
} \
} \
success = true; \
return result; \
@@ -95,8 +96,9 @@ namespace properties {
#define DEFAULT_TO_STRING_LAMBDA(__TYPE__) \
[](std::string& outValue, __TYPE__ inValue) -> bool { \
outValue = "{"; \
for (glm::length_t i = 0; i < ghoul::glm_components<__TYPE__>::value; ++i) \
for (glm::length_t i = 0; i < ghoul::glm_components<__TYPE__>::value; ++i) { \
outValue += std::to_string(inValue[i]) + ","; \
} \
outValue.pop_back(); \
outValue += "}"; \
return true; \
+6 -4
View File
@@ -40,8 +40,8 @@ namespace properties {
__TYPE__ result; \
lua_pushnil(state); \
for (glm::length_t i = 0; i < ghoul::glm_components<__TYPE__>::value; ++i) { \
int success = lua_next(state, -2); \
if (success != 1) { \
int hasNext = lua_next(state, -2); \
if (hasNext != 1) { \
success = false; \
return __TYPE__(0); \
} \
@@ -85,8 +85,9 @@ namespace properties {
success = false; \
return result; \
} \
else \
else { \
result[i] = v; \
} \
} \
success = true; \
return result; \
@@ -95,8 +96,9 @@ namespace properties {
#define DEFAULT_TO_STRING_LAMBDA(__TYPE__) \
[](std::string& outValue, __TYPE__ inValue) -> bool { \
outValue = "{"; \
for (glm::length_t i = 0; i < ghoul::glm_components<__TYPE__>::value; ++i) \
for (glm::length_t i = 0; i < ghoul::glm_components<__TYPE__>::value; ++i) { \
outValue += std::to_string(inValue[i]) + ","; \
} \
outValue.pop_back(); \
outValue += "}"; \
return true; \
+6 -4
View File
@@ -40,8 +40,8 @@ namespace properties {
__TYPE__ result; \
lua_pushnil(state); \
for (glm::length_t i = 0; i < ghoul::glm_components<__TYPE__>::value; ++i) { \
int success = lua_next(state, -2); \
if (success != 1) { \
int hasNext = lua_next(state, -2); \
if (hasNext != 1) { \
success = false; \
return __TYPE__(0); \
} \
@@ -85,8 +85,9 @@ namespace properties {
success = false; \
return result; \
} \
else \
else { \
result[i] = v; \
} \
} \
success = true; \
return result; \
@@ -95,8 +96,9 @@ namespace properties {
#define DEFAULT_TO_STRING_LAMBDA(__TYPE__) \
[](std::string& outValue, __TYPE__ inValue) -> bool { \
outValue = "{"; \
for (glm::length_t i = 0; i < ghoul::glm_components<__TYPE__>::value; ++i) \
for (glm::length_t i = 0; i < ghoul::glm_components<__TYPE__>::value; ++i) { \
outValue += std::to_string(inValue[i]) + ","; \
} \
outValue.pop_back(); \
outValue += "}"; \
return true; \
+6 -4
View File
@@ -40,8 +40,8 @@ namespace properties {
__TYPE__ result; \
lua_pushnil(state); \
for (glm::length_t i = 0; i < ghoul::glm_components<__TYPE__>::value; ++i) { \
int success = lua_next(state, -2); \
if (success != 1) { \
int hasNext = lua_next(state, -2); \
if (hasNext != 1) { \
success = false; \
return __TYPE__(0); \
} \
@@ -85,8 +85,9 @@ namespace properties {
success = false; \
return result; \
} \
else \
else { \
result[i] = v; \
} \
} \
success = true; \
return result; \
@@ -95,8 +96,9 @@ namespace properties {
#define DEFAULT_TO_STRING_LAMBDA(__TYPE__) \
[](std::string& outValue, __TYPE__ inValue) -> bool { \
outValue = "{"; \
for (glm::length_t i = 0; i < ghoul::glm_components<__TYPE__>::value; ++i) \
for (glm::length_t i = 0; i < ghoul::glm_components<__TYPE__>::value; ++i) { \
outValue += std::to_string(inValue[i]) + ","; \
} \
outValue.pop_back(); \
outValue += "}"; \
return true; \
+6 -4
View File
@@ -40,8 +40,8 @@ namespace properties {
__TYPE__ result; \
lua_pushnil(state); \
for (glm::length_t i = 0; i < ghoul::glm_components<__TYPE__>::value; ++i) { \
int success = lua_next(state, -2); \
if (success != 1) { \
int hasNext = lua_next(state, -2); \
if (hasNext != 1) { \
success = false; \
return __TYPE__(0); \
} \
@@ -85,8 +85,9 @@ namespace properties {
success = false; \
return result; \
} \
else \
else { \
result[i] = v; \
} \
} \
success = true; \
return result; \
@@ -95,8 +96,9 @@ namespace properties {
#define DEFAULT_TO_STRING_LAMBDA(__TYPE__) \
[](std::string& outValue, __TYPE__ inValue) -> bool { \
outValue = "{"; \
for (glm::length_t i = 0; i < ghoul::glm_components<__TYPE__>::value; ++i) \
for (glm::length_t i = 0; i < ghoul::glm_components<__TYPE__>::value; ++i) { \
outValue += std::to_string(inValue[i]) + ","; \
} \
outValue.pop_back(); \
outValue += "}"; \
return true; \
+6 -4
View File
@@ -40,8 +40,8 @@ namespace properties {
__TYPE__ result; \
lua_pushnil(state); \
for (glm::length_t i = 0; i < ghoul::glm_components<__TYPE__>::value; ++i) { \
int success = lua_next(state, -2); \
if (success != 1) { \
int hasNext = lua_next(state, -2); \
if (hasNext != 1) { \
success = false; \
return __TYPE__(0); \
} \
@@ -85,8 +85,9 @@ namespace properties {
success = false; \
return result; \
} \
else \
else { \
result[i] = v; \
} \
} \
success = true; \
return result; \
@@ -95,8 +96,9 @@ namespace properties {
#define DEFAULT_TO_STRING_LAMBDA(__TYPE__) \
[](std::string& outValue, __TYPE__ inValue) -> bool { \
outValue = "{"; \
for (glm::length_t i = 0; i < ghoul::glm_components<__TYPE__>::value; ++i) \
for (glm::length_t i = 0; i < ghoul::glm_components<__TYPE__>::value; ++i) { \
outValue += std::to_string(inValue[i]) + ","; \
} \
outValue.pop_back(); \
outValue += "}"; \
return true; \
+6 -4
View File
@@ -40,8 +40,8 @@ namespace properties {
__TYPE__ result; \
lua_pushnil(state); \
for (glm::length_t i = 0; i < ghoul::glm_components<__TYPE__>::value; ++i) { \
int success = lua_next(state, -2); \
if (success != 1) { \
int hasNext = lua_next(state, -2); \
if (hasNext != 1) { \
success = false; \
return __TYPE__(0); \
} \
@@ -85,8 +85,9 @@ namespace properties {
success = false; \
return result; \
} \
else \
else { \
result[i] = v; \
} \
} \
success = true; \
return result; \
@@ -95,8 +96,9 @@ namespace properties {
#define DEFAULT_TO_STRING_LAMBDA(__TYPE__) \
[](std::string& outValue, __TYPE__ inValue) -> bool { \
outValue = "{"; \
for (glm::length_t i = 0; i < ghoul::glm_components<__TYPE__>::value; ++i) \
for (glm::length_t i = 0; i < ghoul::glm_components<__TYPE__>::value; ++i) { \
outValue += std::to_string(inValue[i]) + ","; \
} \
outValue.pop_back(); \
outValue += "}"; \
return true; \
+6 -4
View File
@@ -40,8 +40,8 @@ namespace properties {
__TYPE__ result; \
lua_pushnil(state); \
for (glm::length_t i = 0; i < ghoul::glm_components<__TYPE__>::value; ++i) { \
int success = lua_next(state, -2); \
if (success != 1) { \
int hasNext = lua_next(state, -2); \
if (hasNext != 1) { \
success = false; \
return __TYPE__(0); \
} \
@@ -85,8 +85,9 @@ namespace properties {
success = false; \
return result; \
} \
else \
else { \
result[i] = v; \
} \
} \
success = true; \
return result; \
@@ -95,8 +96,9 @@ namespace properties {
#define DEFAULT_TO_STRING_LAMBDA(__TYPE__) \
[](std::string& outValue, __TYPE__ inValue) -> bool { \
outValue = "{"; \
for (glm::length_t i = 0; i < ghoul::glm_components<__TYPE__>::value; ++i) \
for (glm::length_t i = 0; i < ghoul::glm_components<__TYPE__>::value; ++i) { \
outValue += std::to_string(inValue[i]) + ","; \
} \
outValue.pop_back(); \
outValue += "}"; \
return true; \
+6 -4
View File
@@ -40,8 +40,8 @@ namespace properties {
__TYPE__ result; \
lua_pushnil(state); \
for (glm::length_t i = 0; i < ghoul::glm_components<__TYPE__>::value; ++i) { \
int success = lua_next(state, -2); \
if (success != 1) { \
int hasNext = lua_next(state, -2); \
if (hasNext != 1) { \
success = false; \
return __TYPE__(0); \
} \
@@ -85,8 +85,9 @@ namespace properties {
success = false; \
return result; \
} \
else \
else { \
result[i] = v; \
} \
} \
success = true; \
return result; \
@@ -95,8 +96,9 @@ namespace properties {
#define DEFAULT_TO_STRING_LAMBDA(__TYPE__) \
[](std::string& outValue, __TYPE__ inValue) -> bool { \
outValue = "{"; \
for (glm::length_t i = 0; i < ghoul::glm_components<__TYPE__>::value; ++i) \
for (glm::length_t i = 0; i < ghoul::glm_components<__TYPE__>::value; ++i) { \
outValue += std::to_string(inValue[i]) + ","; \
} \
outValue.pop_back(); \
outValue += "}"; \
return true; \
+6 -4
View File
@@ -40,8 +40,8 @@ namespace properties {
__TYPE__ result; \
lua_pushnil(state); \
for (glm::length_t i = 0; i < ghoul::glm_components<__TYPE__>::value; ++i) { \
int success = lua_next(state, -2); \
if (success != 1) { \
int hasNext = lua_next(state, -2); \
if (hasNext != 1) { \
success = false; \
return __TYPE__(0); \
} \
@@ -85,8 +85,9 @@ namespace properties {
success = false; \
return result; \
} \
else \
else { \
result[i] = v; \
} \
} \
success = true; \
return result; \
@@ -95,8 +96,9 @@ namespace properties {
#define DEFAULT_TO_STRING_LAMBDA(__TYPE__) \
[](std::string& outValue, __TYPE__ inValue) -> bool { \
outValue = "{"; \
for (glm::length_t i = 0; i < ghoul::glm_components<__TYPE__>::value; ++i) \
for (glm::length_t i = 0; i < ghoul::glm_components<__TYPE__>::value; ++i) { \
outValue += std::to_string(inValue[i]) + ","; \
} \
outValue.pop_back(); \
outValue += "}"; \
return true; \
+6 -4
View File
@@ -40,8 +40,8 @@ namespace properties {
__TYPE__ result; \
lua_pushnil(state); \
for (glm::length_t i = 0; i < ghoul::glm_components<__TYPE__>::value; ++i) { \
int success = lua_next(state, -2); \
if (success != 1) { \
int hasNext = lua_next(state, -2); \
if (hasNext != 1) { \
success = false; \
return __TYPE__(0); \
} \
@@ -85,8 +85,9 @@ namespace properties {
success = false; \
return result; \
} \
else \
else { \
result[i] = v; \
} \
} \
success = true; \
return result; \
@@ -95,8 +96,9 @@ namespace properties {
#define DEFAULT_TO_STRING_LAMBDA(__TYPE__) \
[](std::string& outValue, __TYPE__ inValue) -> bool { \
outValue = "{"; \
for (glm::length_t i = 0; i < ghoul::glm_components<__TYPE__>::value; ++i) \
for (glm::length_t i = 0; i < ghoul::glm_components<__TYPE__>::value; ++i) { \
outValue += std::to_string(inValue[i]) + ","; \
} \
outValue.pop_back(); \
outValue += "}"; \
return true; \
+3 -2
View File
@@ -99,7 +99,8 @@ properties::Property* property(const std::string& uri) {
std::vector<properties::Property*> allProperties() {
std::vector<properties::Property*> properties;
auto p = OsEng.globalPropertyOwner().propertiesRecursive();
std::vector<properties::Property*> p =
OsEng.globalPropertyOwner().propertiesRecursive();
properties.insert(
properties.end(),
@@ -111,7 +112,7 @@ std::vector<properties::Property*> allProperties() {
std::vector<SceneGraphNode*> nodes = graph->allSceneGraphNodes();
for (SceneGraphNode* n : nodes) {
auto p = n->propertiesRecursive();
std::vector<properties::Property*> props = n->propertiesRecursive();
properties.insert(
properties.end(),
p.begin(),
+3 -3
View File
@@ -298,14 +298,14 @@ void ABufferRenderer::render(float blackoutFactor, bool doPerformanceMeasurement
float gamma = 1.0;
glm::vec3 cameraPos = data.camera.position().vec3();
float maxComponent = std::max(std::max(std::abs(cameraPos.x), std::abs(cameraPos.y)), std::abs(cameraPos.z));
float logDistance = std::log(glm::length(cameraPos / maxComponent) * maxComponent) / std::log(10);
float logDistance = std::log(glm::length(cameraPos / maxComponent) * maxComponent) / std::log(10.f);
float minLogDist = 15;
float maxLogDist = 20;
float t = (logDistance - minLogDist) / (maxLogDist - minLogDist);
t = glm::clamp(t, 0.0f, 1.0f);
gamma = 1.0 * (1 - t) + 2.2 * t;
gamma = 1.f * (1.f - t) + 2.2f * t;
_resolveProgram->setUniform("gamma", gamma);
@@ -503,7 +503,7 @@ void ABufferRenderer::updateRaycastData() {
for (auto &raycaster : raycasters) {
if (nextId > MaxRaycasters) {
int nIgnored = MaxRaycasters - raycasters.size();
int nIgnored = MaxRaycasters - static_cast<int>(raycasters.size());
LWARNING("ABufferRenderer does not support more than 32 raycasters. Ignoring " << nIgnored << " raycasters");
break;
}
+5 -5
View File
@@ -853,7 +853,7 @@ void RenderEngine::renderInformation() {
const std::string& hostName = OsEng.parallelConnection().hostName();
std::string connectionInfo = "";
int nClients = nConnections;
int nClients = static_cast<int>(nConnections);
if (status == ParallelConnection::Status::Host) {
nClients--;
if (nClients == 1) {
@@ -963,7 +963,7 @@ void RenderEngine::renderInformation() {
if (isCurrentPhase || showAllPhases) {
// phases are sorted increasingly by start time, and will be popped
// last-in-first-out from the stack, so add them in reversed order.
int indexLastPhase = phase->phases().size() - 1;
int indexLastPhase = static_cast<int>(phase->phases().size()) - 1;
for (int i = indexLastPhase; 0 <= i; --i) {
S.push({ &phase->phases()[i], depth + 1 });
}
@@ -985,11 +985,11 @@ void RenderEngine::renderInformation() {
glm::dvec3 p =
SpiceManager::ref().targetPosition("PLUTO", "NEW HORIZONS", "GALACTIC", {}, currentTime, lt);
psc nhPos = PowerScaledCoordinate::CreatePowerScaledCoordinate(p.x, p.y, p.z);
float a, b, c;
float a, b;
glm::dvec3 radii;
SpiceManager::ref().getValue("PLUTO", "RADII", radii);
a = radii.x;
b = radii.y;
a = static_cast<float>(radii.x);
b = static_cast<float>(radii.y);
float radius = (a + b) / 2.f;
float distToSurf = glm::length(nhPos.vec3()) - radius;
+4 -4
View File
@@ -110,9 +110,9 @@ ScreenSpaceRenderable::ScreenSpaceRenderable(const ghoul::Dictionary& dictionary
, _sphericalPosition(
"sphericalPosition",
"Spherical coordinates",
glm::vec2(0.f, M_PI_2),
glm::vec2(-M_PI),
glm::vec2(M_PI)
glm::vec2(0.f, static_cast<float>(M_PI_2)),
glm::vec2(-static_cast<float>(M_PI)),
glm::vec2(static_cast<float>(M_PI))
)
, _depth("depth", "Depth", 0.f, 0.f, 1.f)
, _scale("scale", "Scale", 0.25f, 0.f, 2.f)
@@ -241,7 +241,7 @@ glm::vec2 ScreenSpaceRenderable::toEuclidean(const glm::vec2& spherical, float r
glm::vec2 ScreenSpaceRenderable::toSpherical(const glm::vec2& euclidean) {
_radius = -sqrt(pow(euclidean[0],2)+pow(euclidean[1],2)+pow(PlaneDepth,2));
float theta = atan2(-PlaneDepth,euclidean[0])-M_PI/2.0;
float theta = atan2(-PlaneDepth, euclidean[0]) - static_cast<float>(M_PI_2);
float phi = acos(euclidean[1]/_radius);
return glm::vec2(theta, phi);
+5 -2
View File
@@ -130,8 +130,11 @@ int property_setValueRegex(lua_State* L) {
lua_type(L, -1)
);
}
catch (const std::regex_error& e) {
LERRORC("property_setValueRegex", "Malformed regular expression: '" << regex << "'");
catch (const std::regex_error&) {
LERRORC(
"property_setValueRegex",
"Malformed regular expression: '" << regex << "'"
);
}
return 0;
+6 -3
View File
@@ -107,11 +107,14 @@ void ScriptEngine::addLibrary(LuaLibrary library) {
LuaLibrary merged = *it;
for (const LuaLibrary::Function& fun : library.functions) {
auto it = std::find_if(merged.functions.begin(), merged.functions.end(),
auto itf = std::find_if(
merged.functions.begin(),
merged.functions.end(),
[&fun](const LuaLibrary::Function& function) {
return fun.name == function.name;
});
if (it != merged.functions.end()) {
}
);
if (itf != merged.functions.end()) {
// the function with the desired name is already present, but we don't
// want to overwrite it
LERROR("Lua function '" << fun.name << "' in library '" << library.name <<
+6 -7
View File
@@ -210,8 +210,8 @@ ScriptScheduler::progressTo(double newTime)
);
// How many values did we pass over?
int n = std::distance(_timings.begin() + prevIndex, it);
_currentIndex = prevIndex + n;
ptrdiff_t n = std::distance(_timings.begin() + prevIndex, it);
_currentIndex = static_cast<int>(prevIndex + n);
// Update the new time
_currentTime = newTime;
@@ -232,16 +232,15 @@ ScriptScheduler::progressTo(double newTime)
);
// How many values did we pass over?
int n = std::distance(it, _timings.begin() + prevIndex);
_currentIndex = prevIndex - n;
ptrdiff_t n = std::distance(it, _timings.begin() + prevIndex);
_currentIndex = static_cast<int>(prevIndex - n);
// Update the new time
_currentTime = newTime;
int size = _timings.size();
return {
_backwardScripts.begin() + (size - prevIndex),
_backwardScripts.begin() + (size - _currentIndex)
_backwardScripts.begin() + (_timings.size() - prevIndex),
_backwardScripts.begin() + (_timings.size() - _currentIndex)
};
}
}
+1 -1
View File
@@ -171,7 +171,7 @@ bool BlockPlaneIntersectionGeometry::initialize() {
void BlockPlaneIntersectionGeometry::render() {
glBindVertexArray(_vaoId);
//glDisable(GL_CULL_FACE);
glDrawArrays(GL_TRIANGLE_FAN, 0, _vertices.size() / 3);
glDrawArrays(GL_TRIANGLE_FAN, 0, static_cast<GLsizei>(_vertices.size() / 3));
//glEnable(GL_CULL_FACE);
}
+3 -3
View File
@@ -46,9 +46,9 @@ BoxGeometry::~BoxGeometry() {
bool BoxGeometry::initialize() {
// Initialize and upload to GPU
float x = _size.x * 0.5;
float y = _size.y * 0.5;
float z = _size.z * 0.5;
float x = _size.x * 0.5f;
float y = _size.y * 0.5f;
float z = _size.z * 0.5f;
const GLfloat vertices[] = {
-x, -y, z, // blue corner
+6 -1
View File
@@ -75,7 +75,12 @@ KeyModifier operator|=(KeyModifier& lhs, KeyModifier rhs) {
KeyWithModifier stringToKey(std::string str) {
// key only uppercase
std::transform(str.begin(), str.end(), str.begin(), ::toupper);
std::transform(
str.begin(),
str.end(),
str.begin(),
[](char v) { return static_cast<char>(toupper(v)); }
);
std::vector<std::string> tokens = ghoul::tokenizeString(str, '+');
+12 -2
View File
@@ -44,7 +44,12 @@ OpenSpaceModule::OpenSpaceModule(std::string name)
void OpenSpaceModule::initialize() {
std::string upperName = name();
std::transform(upperName.begin(), upperName.end(), upperName.begin(), toupper);
std::transform(
upperName.begin(),
upperName.end(),
upperName.begin(),
[](char v) { return static_cast<char>(toupper(v)); }
);
std::string moduleToken =
ghoul::filesystem::FileSystem::TokenOpeningBraces +
@@ -77,7 +82,12 @@ ghoul::systemcapabilities::Version OpenSpaceModule::requiredOpenGLVersion() cons
std::string OpenSpaceModule::modulePath() const {
std::string moduleName = name();
std::transform(moduleName.begin(), moduleName.end(), moduleName.begin(), tolower);
std::transform(
moduleName.begin(),
moduleName.end(),
moduleName.begin(),
[](char v) { return static_cast<char>(tolower(v)); }
);
if (FileSys.directoryExists("${MODULES}/" + moduleName)) {
return absPath("${MODULES}/" + moduleName);
+1 -1
View File
@@ -452,7 +452,7 @@ void SpiceManager::getValue(const std::string& body, const std::string& value,
{
ghoul_assert(!v.empty(), "Array for values has to be preallocaed");
getValueInternal(body, value, v.size(), v.data());
getValueInternal(body, value, static_cast<int>(v.size()), v.data());
}
double SpiceManager::spacecraftClockToET(const std::string& craft, double craftTicks) {
+1
View File
@@ -81,6 +81,7 @@ int unloadKernel(lua_State* L) {
if (isNumber) {
unsigned int argument = static_cast<unsigned int>(lua_tonumber(L, -1));
SpiceManager::ref().unloadKernel(argument);
return 0;
}
}