diff options
Diffstat (limited to 'src/server/shared')
-rw-r--r-- | src/server/shared/DataStores/DB2DatabaseLoader.cpp | 2 | ||||
-rw-r--r-- | src/server/shared/DataStores/DB2Store.cpp | 2 | ||||
-rw-r--r-- | src/server/shared/JSON/ProtobufJSON.cpp | 20 | ||||
-rw-r--r-- | src/server/shared/Networking/AsyncAcceptor.h | 12 | ||||
-rw-r--r-- | src/server/shared/Networking/Socket.h | 8 | ||||
-rw-r--r-- | src/server/shared/Networking/SocketMgr.h | 4 | ||||
-rw-r--r-- | src/server/shared/Packets/ByteBuffer.cpp | 8 | ||||
-rw-r--r-- | src/server/shared/Realm/Realm.cpp | 4 | ||||
-rw-r--r-- | src/server/shared/Realm/RealmList.cpp | 14 | ||||
-rw-r--r-- | src/server/shared/Secrets/SecretMgr.cpp | 18 |
10 files changed, 46 insertions, 46 deletions
diff --git a/src/server/shared/DataStores/DB2DatabaseLoader.cpp b/src/server/shared/DataStores/DB2DatabaseLoader.cpp index 0435ba939c3..c34950aab01 100644 --- a/src/server/shared/DataStores/DB2DatabaseLoader.cpp +++ b/src/server/shared/DataStores/DB2DatabaseLoader.cpp @@ -265,7 +265,7 @@ void DB2DatabaseLoader::LoadStrings(bool custom, LocaleConstant locale, uint32 r ASSERT(offset == recordSize); } else - TC_LOG_ERROR("sql.sql", "Hotfix locale table for storage %s references row that does not exist %u locale %s!", _storageName.c_str(), indexValue, localeNames[locale]); + TC_LOG_ERROR("sql.sql", "Hotfix locale table for storage {} references row that does not exist {} locale {}!", _storageName, indexValue, localeNames[locale]); } while (result->NextRow()); } diff --git a/src/server/shared/DataStores/DB2Store.cpp b/src/server/shared/DataStores/DB2Store.cpp index 25ca0c2fd42..382881d2f65 100644 --- a/src/server/shared/DataStores/DB2Store.cpp +++ b/src/server/shared/DataStores/DB2Store.cpp @@ -110,7 +110,7 @@ void DB2StorageBase::LoadStringsFrom(std::string const& path, LocaleConstant loc { // DB2 must be already loaded using Load if (!_indexTable) - throw DB2FileLoadException(Trinity::StringFormat("%s was not loaded properly, cannot load strings", path.c_str())); + throw DB2FileLoadException(Trinity::StringFormat("{} was not loaded properly, cannot load strings", path)); DB2FileLoader db2; DB2FileSystemSource source(path + _fileName); diff --git a/src/server/shared/JSON/ProtobufJSON.cpp b/src/server/shared/JSON/ProtobufJSON.cpp index b4fbd813c24..a0fe9b3a68f 100644 --- a/src/server/shared/JSON/ProtobufJSON.cpp +++ b/src/server/shared/JSON/ProtobufJSON.cpp @@ -231,7 +231,7 @@ bool Deserializer::Key(const Ch* str, rapidjson::SizeType /*length*/, bool /*cop google::protobuf::FieldDescriptor const* field = _objectState.top()->GetDescriptor()->FindFieldByName(str); if (!field) { - _errors.push_back(Trinity::StringFormat("Message %s has no field %s.", _objectState.top()->GetTypeName().c_str(), str)); + _errors.push_back(Trinity::StringFormat("Message {} has no field {}.", _objectState.top()->GetTypeName(), str)); return false; } @@ -293,7 +293,7 @@ bool Deserializer::Uint(uint32 i) break; } default: - _errors.push_back(Trinity::StringFormat("Expected field type to be uint32 or string but got %s instead.", _state.top()->cpp_type_name())); + _errors.push_back(Trinity::StringFormat("Expected field type to be uint32 or string but got {} instead.", _state.top()->cpp_type_name())); return false; } @@ -331,7 +331,7 @@ bool Deserializer::Double(double d) SET_FIELD(message, field, Double, d); break; default: - _errors.push_back(Trinity::StringFormat("Expected field type to be float or double but got %s instead.", _state.top()->cpp_type_name())); + _errors.push_back(Trinity::StringFormat("Expected field type to be float or double but got {} instead.", _state.top()->cpp_type_name())); return false; } @@ -349,7 +349,7 @@ bool Deserializer::String(const Ch* str, rapidjson::SizeType /*length*/, bool /* google::protobuf::EnumValueDescriptor const* enumValue = field->enum_type()->FindValueByName(str); if (!enumValue) { - _errors.push_back(Trinity::StringFormat("Field %s enum %s does not have a value named %s.", field->full_name().c_str(), field->enum_type()->full_name().c_str(), str)); + _errors.push_back(Trinity::StringFormat("Field {} enum {} does not have a value named {}.", field->full_name(), field->enum_type()->full_name(), str)); return false; } @@ -360,7 +360,7 @@ bool Deserializer::String(const Ch* str, rapidjson::SizeType /*length*/, bool /* SET_FIELD(message, field, String, str); break; default: - _errors.push_back(Trinity::StringFormat("Expected field type to be string or enum but got %s instead.", _state.top()->cpp_type_name())); + _errors.push_back(Trinity::StringFormat("Expected field type to be string or enum but got {} instead.", _state.top()->cpp_type_name())); return false; } @@ -374,7 +374,7 @@ bool Deserializer::StartObject() { if (_state.top()->cpp_type() != google::protobuf::FieldDescriptor::CPPTYPE_MESSAGE) { - _errors.push_back(Trinity::StringFormat("Expected field %s to be a message but got %s instead.", _state.top()->cpp_type_name())); + _errors.push_back(Trinity::StringFormat("Expected field {} to be a message but got {} instead.", _state.top()->name(), _state.top()->cpp_type_name())); return false; } @@ -409,7 +409,7 @@ bool Deserializer::StartArray() if (_state.top()->is_repeated() ^ (_state.top()->type() != google::protobuf::FieldDescriptor::TYPE_BYTES)) { - _errors.push_back(Trinity::StringFormat("Expected field %s type to be exactly an array OR bytes but it was both or none.", _state.top()->full_name().c_str())); + _errors.push_back(Trinity::StringFormat("Expected field {} type to be exactly an array OR bytes but it was both or none.", _state.top()->full_name())); return false; } @@ -420,8 +420,8 @@ bool Deserializer::CheckType(google::protobuf::FieldDescriptor::CppType expected { if (_state.top()->cpp_type() != expectedType) { - _errors.push_back(Trinity::StringFormat("Expected field %s type to be %s but got %s instead.", - _state.top()->full_name().c_str(), google::protobuf::FieldDescriptor::CppTypeName(expectedType), _state.top()->cpp_type_name())); + _errors.push_back(Trinity::StringFormat("Expected field {} type to be {} but got {} instead.", + _state.top()->full_name(), google::protobuf::FieldDescriptor::CppTypeName(expectedType), _state.top()->cpp_type_name())); return false; } @@ -449,7 +449,7 @@ bool JSON::Deserialize(std::string const& json, google::protobuf::Message* messa if (!deserializer.ReadMessage(json, message)) { for (std::size_t i = 0; i < deserializer.GetErrors().size(); ++i) - TC_LOG_ERROR("json", "%s", deserializer.GetErrors()[i].c_str()); + TC_LOG_ERROR("json", "{}", deserializer.GetErrors()[i]); return false; } diff --git a/src/server/shared/Networking/AsyncAcceptor.h b/src/server/shared/Networking/AsyncAcceptor.h index ffc694340fc..e88330ebdba 100644 --- a/src/server/shared/Networking/AsyncAcceptor.h +++ b/src/server/shared/Networking/AsyncAcceptor.h @@ -61,7 +61,7 @@ public: } catch (boost::system::system_error const& err) { - TC_LOG_INFO("network", "Failed to initialize client's socket %s", err.what()); + TC_LOG_INFO("network", "Failed to initialize client's socket {}", err.what()); } } @@ -76,7 +76,7 @@ public: _acceptor.open(_endpoint.protocol(), errorCode); if (errorCode) { - TC_LOG_INFO("network", "Failed to open acceptor %s", errorCode.message().c_str()); + TC_LOG_INFO("network", "Failed to open acceptor {}", errorCode.message()); return false; } @@ -84,7 +84,7 @@ public: _acceptor.set_option(boost::asio::ip::tcp::acceptor::reuse_address(true), errorCode); if (errorCode) { - TC_LOG_INFO("network", "Failed to set reuse_address option on acceptor %s", errorCode.message().c_str()); + TC_LOG_INFO("network", "Failed to set reuse_address option on acceptor {}", errorCode.message()); return false; } #endif @@ -92,14 +92,14 @@ public: _acceptor.bind(_endpoint, errorCode); if (errorCode) { - TC_LOG_INFO("network", "Could not bind to %s:%u %s", _endpoint.address().to_string().c_str(), _endpoint.port(), errorCode.message().c_str()); + TC_LOG_INFO("network", "Could not bind to {}:{} {}", _endpoint.address().to_string(), _endpoint.port(), errorCode.message()); return false; } _acceptor.listen(TRINITY_MAX_LISTEN_CONNECTIONS, errorCode); if (errorCode) { - TC_LOG_INFO("network", "Failed to start listening on %s:%u %s", _endpoint.address().to_string().c_str(), _endpoint.port(), errorCode.message().c_str()); + TC_LOG_INFO("network", "Failed to start listening on {}:{} {}", _endpoint.address().to_string(), _endpoint.port(), errorCode.message()); return false; } @@ -141,7 +141,7 @@ void AsyncAcceptor::AsyncAccept() } catch (boost::system::system_error const& err) { - TC_LOG_INFO("network", "Failed to retrieve client's remote address %s", err.what()); + TC_LOG_INFO("network", "Failed to retrieve client's remote address {}", err.what()); } } diff --git a/src/server/shared/Networking/Socket.h b/src/server/shared/Networking/Socket.h index d81bcc2c8cc..f86b116e5c7 100644 --- a/src/server/shared/Networking/Socket.h +++ b/src/server/shared/Networking/Socket.h @@ -147,8 +147,8 @@ public: boost::system::error_code shutdownError; _socket.shutdown(boost::asio::socket_base::shutdown_send, shutdownError); if (shutdownError) - TC_LOG_DEBUG("network", "Socket::CloseSocket: %s errored when shutting down socket: %i (%s)", GetRemoteIpAddress().to_string().c_str(), - shutdownError.value(), shutdownError.message().c_str()); + TC_LOG_DEBUG("network", "Socket::CloseSocket: {} errored when shutting down socket: {} ({})", GetRemoteIpAddress().to_string(), + shutdownError.value(), shutdownError.message()); OnClose(); } @@ -187,8 +187,8 @@ protected: boost::system::error_code err; _socket.set_option(tcp::no_delay(enable), err); if (err) - TC_LOG_DEBUG("network", "Socket::SetNoDelay: failed to set_option(boost::asio::ip::tcp::no_delay) for %s - %d (%s)", - GetRemoteIpAddress().to_string().c_str(), err.value(), err.message().c_str()); + TC_LOG_DEBUG("network", "Socket::SetNoDelay: failed to set_option(boost::asio::ip::tcp::no_delay) for {} - {} ({})", + GetRemoteIpAddress().to_string(), err.value(), err.message()); } Stream& underlying_stream() diff --git a/src/server/shared/Networking/SocketMgr.h b/src/server/shared/Networking/SocketMgr.h index 0aa443f4cc8..31ec4e6390b 100644 --- a/src/server/shared/Networking/SocketMgr.h +++ b/src/server/shared/Networking/SocketMgr.h @@ -46,7 +46,7 @@ public: } catch (boost::system::system_error const& err) { - TC_LOG_ERROR("network", "Exception caught in SocketMgr.StartNetwork (%s:%u): %s", bindIp.c_str(), port, err.what()); + TC_LOG_ERROR("network", "Exception caught in SocketMgr.StartNetwork ({}:{}): {}", bindIp, port, err.what()); return false; } @@ -106,7 +106,7 @@ public: } catch (boost::system::system_error const& err) { - TC_LOG_WARN("network", "Failed to retrieve client's remote address %s", err.what()); + TC_LOG_WARN("network", "Failed to retrieve client's remote address {}", err.what()); } } diff --git a/src/server/shared/Packets/ByteBuffer.cpp b/src/server/shared/Packets/ByteBuffer.cpp index 11029ae1a10..1775192227a 100644 --- a/src/server/shared/Packets/ByteBuffer.cpp +++ b/src/server/shared/Packets/ByteBuffer.cpp @@ -42,7 +42,7 @@ ByteBufferPositionException::ByteBufferPositionException(size_t pos, size_t size ByteBufferInvalidValueException::ByteBufferInvalidValueException(char const* type, char const* value) { - message().assign(Trinity::StringFormat("Invalid %s value (%s) found in ByteBuffer", type, value)); + message().assign(Trinity::StringFormat("Invalid {} value ({}) found in ByteBuffer", type, value)); } ByteBuffer& ByteBuffer::operator>>(float& value) @@ -177,7 +177,7 @@ void ByteBuffer::print_storage() const o << read<uint8>(i) << " - "; o << " "; - TC_LOG_TRACE("network", "%s", o.str().c_str()); + TC_LOG_TRACE("network", "{}", o.str()); } void ByteBuffer::textlike() const @@ -194,7 +194,7 @@ void ByteBuffer::textlike() const o << buf; } o << " "; - TC_LOG_TRACE("network", "%s", o.str().c_str()); + TC_LOG_TRACE("network", "{}", o.str()); } void ByteBuffer::hexlike() const @@ -226,5 +226,5 @@ void ByteBuffer::hexlike() const o << buf; } o << " "; - TC_LOG_TRACE("network", "%s", o.str().c_str()); + TC_LOG_TRACE("network", "{}", o.str()); } diff --git a/src/server/shared/Realm/Realm.cpp b/src/server/shared/Realm/Realm.cpp index f137cd573de..0648de535a3 100644 --- a/src/server/shared/Realm/Realm.cpp +++ b/src/server/shared/Realm/Realm.cpp @@ -70,10 +70,10 @@ uint32 const Realm::ConfigIdByType[MAX_CLIENT_REALM_TYPE] = std::string Battlenet::RealmHandle::GetAddressString() const { - return Trinity::StringFormat("%u-%u-%u", Region, Site, Realm); + return Trinity::StringFormat("{}-{}-{}", Region, Site, Realm); } std::string Battlenet::RealmHandle::GetSubRegionAddress() const { - return Trinity::StringFormat("%u-%u-0", Region, Site); + return Trinity::StringFormat("{}-{}-0", Region, Site); } diff --git a/src/server/shared/Realm/RealmList.cpp b/src/server/shared/Realm/RealmList.cpp index 4442857dc3d..361e87872e2 100644 --- a/src/server/shared/Realm/RealmList.cpp +++ b/src/server/shared/Realm/RealmList.cpp @@ -149,21 +149,21 @@ void RealmList::UpdateRealms(boost::system::error_code const& error) Optional<boost::asio::ip::tcp::endpoint> externalAddress = _resolver->Resolve(boost::asio::ip::tcp::v4(), externalAddressString, ""); if (!externalAddress) { - TC_LOG_ERROR("realmlist", "Could not resolve address %s for realm \"%s\" id %u", externalAddressString.c_str(), name.c_str(), realmId); + TC_LOG_ERROR("realmlist", "Could not resolve address {} for realm \"{}\" id {}", externalAddressString, name, realmId); continue; } Optional<boost::asio::ip::tcp::endpoint> localAddress = _resolver->Resolve(boost::asio::ip::tcp::v4(), localAddressString, ""); if (!localAddress) { - TC_LOG_ERROR("realmlist", "Could not resolve localAddress %s for realm \"%s\" id %u", localAddressString.c_str(), name.c_str(), realmId); + TC_LOG_ERROR("realmlist", "Could not resolve localAddress {} for realm \"{}\" id {}", localAddressString, name, realmId); continue; } Optional<boost::asio::ip::tcp::endpoint> localSubmask = _resolver->Resolve(boost::asio::ip::tcp::v4(), localSubmaskString, ""); if (!localSubmask) { - TC_LOG_ERROR("realmlist", "Could not resolve localSubnetMask %s for realm \"%s\" id %u", localSubmaskString.c_str(), name.c_str(), realmId); + TC_LOG_ERROR("realmlist", "Could not resolve localSubnetMask {} for realm \"{}\" id {}", localSubmaskString, name, realmId); continue; } @@ -189,15 +189,15 @@ void RealmList::UpdateRealms(boost::system::error_code const& error) newSubRegions.insert(Battlenet::RealmHandle{ region, battlegroup, 0 }.GetAddressString()); if (!existingRealms.count(id)) - TC_LOG_INFO("realmlist", "Added realm \"%s\" at %s:%u.", name.c_str(), externalAddressString.c_str(), port); + TC_LOG_INFO("realmlist", "Added realm \"{}\" at {}:{}.", name, externalAddressString, port); else - TC_LOG_DEBUG("realmlist", "Updating realm \"%s\" at %s:%u.", name.c_str(), externalAddressString.c_str(), port); + TC_LOG_DEBUG("realmlist", "Updating realm \"{}\" at {}:{}.", name, externalAddressString, port); existingRealms.erase(id); } catch (std::exception& ex) { - TC_LOG_ERROR("realmlist", "Realmlist::UpdateRealms has thrown an exception: %s", ex.what()); + TC_LOG_ERROR("realmlist", "Realmlist::UpdateRealms has thrown an exception: {}", ex.what()); ABORT(); } } @@ -205,7 +205,7 @@ void RealmList::UpdateRealms(boost::system::error_code const& error) } for (auto itr = existingRealms.begin(); itr != existingRealms.end(); ++itr) - TC_LOG_INFO("realmlist", "Removed realm \"%s\".", itr->second.c_str()); + TC_LOG_INFO("realmlist", "Removed realm \"{}\".", itr->second); { std::unique_lock<std::shared_mutex> lock(_realmsMutex); diff --git a/src/server/shared/Secrets/SecretMgr.cpp b/src/server/shared/Secrets/SecretMgr.cpp index 82c8d2e395c..81bc2c1c392 100644 --- a/src/server/shared/Secrets/SecretMgr.cpp +++ b/src/server/shared/Secrets/SecretMgr.cpp @@ -66,7 +66,7 @@ static Optional<BigNumber> GetHexFromConfig(char const* configKey, int bits) BigNumber secret; if (!secret.SetHexStr(str.c_str())) { - TC_LOG_FATAL("server.loading", "Invalid value for '%s' - specify a hexadecimal integer of up to %d bits with no prefix.", configKey, bits); + TC_LOG_FATAL("server.loading", "Invalid value for '{}' - specify a hexadecimal integer of up to {} bits with no prefix.", configKey, bits); ABORT(); } @@ -74,7 +74,7 @@ static Optional<BigNumber> GetHexFromConfig(char const* configKey, int bits) threshold <<= bits; if (!((BigNumber(0) <= secret) && (secret < threshold))) { - TC_LOG_ERROR("server.loading", "Value for '%s' is out of bounds (should be an integer of up to %d bits with no prefix). Truncated to %d bits.", configKey, bits, bits); + TC_LOG_ERROR("server.loading", "Value for '{}' is out of bounds (should be an integer of up to {} bits with no prefix). Truncated to {} bits.", configKey, bits, bits); secret %= threshold; } ASSERT(((BigNumber(0) <= secret) && (secret < threshold))); @@ -128,9 +128,9 @@ void SecretMgr::AttemptLoad(Secrets i, LogLevel errorLevel, std::unique_lock<std if (info.owner != OWNER) { if (currentValue) - TC_LOG_MESSAGE_BODY("server.loading", errorLevel, "Invalid value for '%s' specified - this is not actually the secret being used in your auth DB.", info.configKey); + TC_LOG_MESSAGE_BODY("server.loading", errorLevel, "Invalid value for '{}' specified - this is not actually the secret being used in your auth DB.", info.configKey); else - TC_LOG_MESSAGE_BODY("server.loading", errorLevel, "No value for '%s' specified - please specify the secret currently being used in your auth DB.", info.configKey); + TC_LOG_MESSAGE_BODY("server.loading", errorLevel, "No value for '{}' specified - please specify the secret currently being used in your auth DB.", info.configKey); _secrets[i].state = Secret::LOAD_FAILED; return; } @@ -141,7 +141,7 @@ void SecretMgr::AttemptLoad(Secrets i, LogLevel errorLevel, std::unique_lock<std oldSecret = GetHexFromConfig(info.oldKey, info.bits); if (oldSecret && !Trinity::Crypto::Argon2::Verify(oldSecret->AsHexStr(), *oldDigest)) { - TC_LOG_MESSAGE_BODY("server.loading", errorLevel, "Invalid value for '%s' specified - this is not actually the secret previously used in your auth DB.", info.oldKey); + TC_LOG_MESSAGE_BODY("server.loading", errorLevel, "Invalid value for '{}' specified - this is not actually the secret previously used in your auth DB.", info.oldKey); _secrets[i].state = Secret::LOAD_FAILED; return; } @@ -151,12 +151,12 @@ void SecretMgr::AttemptLoad(Secrets i, LogLevel errorLevel, std::unique_lock<std Optional<std::string> error = AttemptTransition(Secrets(i), currentValue, oldSecret, !!oldDigest); if (error) { - TC_LOG_MESSAGE_BODY("server.loading", errorLevel, "Your value of '%s' changed, but we cannot transition your database to the new value:\n%s", info.configKey, error->c_str()); + TC_LOG_MESSAGE_BODY("server.loading", errorLevel, "Your value of '{}' changed, but we cannot transition your database to the new value:\n{}", info.configKey, error->c_str()); _secrets[i].state = Secret::LOAD_FAILED; return; } - TC_LOG_INFO("server.loading", "Successfully transitioned database to new '%s' value.", info.configKey); + TC_LOG_INFO("server.loading", "Successfully transitioned database to new '{}' value.", info.configKey); } if (currentValue) @@ -189,11 +189,11 @@ Optional<std::string> SecretMgr::AttemptTransition(Secrets i, Optional<BigNumber if (hadOldSecret) { if (!oldSecret) - return Trinity::StringFormat("Cannot decrypt old TOTP tokens - add config key '%s' to authserver.conf!", secret_info[i].oldKey); + return Trinity::StringFormat("Cannot decrypt old TOTP tokens - add config key '{}' to authserver.conf!", secret_info[i].oldKey); bool success = Trinity::Crypto::AEDecrypt<Trinity::Crypto::AES>(totpSecret, oldSecret->ToByteArray<Trinity::Crypto::AES::KEY_SIZE_BYTES>()); if (!success) - return Trinity::StringFormat("Cannot decrypt old TOTP tokens - value of '%s' is incorrect for some users!", secret_info[i].oldKey); + return Trinity::StringFormat("Cannot decrypt old TOTP tokens - value of '{}' is incorrect for some users!", secret_info[i].oldKey); } if (newSecret) |