diff --git a/deps/datReader/Dat.cpp b/deps/datReader/Dat.cpp index ca4244b3..f3e9a3a7 100644 --- a/deps/datReader/Dat.cpp +++ b/deps/datReader/Dat.cpp @@ -292,7 +292,7 @@ namespace xiv::dat DatBlockHeader block_header = extract< DatBlockHeader >( m_handle ); // Resizing the vector to write directly into it - const uint32_t data_size = (uint32_t)o_data.size(); + const uint32_t data_size = static_cast(o_data.size()); o_data.resize( data_size + block_header.uncompressed_size ); // 32000 in compressed_size means it is not compressed so take uncompressed_size @@ -308,7 +308,7 @@ namespace xiv::dat m_handle.read( temp_buffer.data(), block_header.compressed_size ); utils::zlib::no_header_decompress( reinterpret_cast(temp_buffer.data()), - (uint32_t)temp_buffer.size(), + static_cast(temp_buffer.size()), reinterpret_cast(o_data.data() + data_size), block_header.uncompressed_size ); } diff --git a/deps/datReader/Exd.cpp b/deps/datReader/Exd.cpp index 6ebf5a9c..0e4b68c6 100644 --- a/deps/datReader/Exd.cpp +++ b/deps/datReader/Exd.cpp @@ -238,7 +238,7 @@ namespace xiv::exd std::map< ExdRow, std::vector< Field >, exdRowSort > data; // Iterates over all the cached ids - const uint32_t memberCount = (uint32_t)_exh->get_members().size(); + const uint32_t memberCount = static_cast(_exh->get_members().size()); for( auto& cacheEntry : _idCache ) { std::vector< char > dataCpy = cacheEntry.second.file->get_data_sections().front(); @@ -249,7 +249,7 @@ namespace xiv::exd for( int32_t i = 0; i < cacheEntry.second.subRows; i++ ) { // Get the vector fields for the given record and preallocate it - ExdRow row = { cacheEntry.first, (uint8_t)i }; + ExdRow row = { cacheEntry.first, static_cast(i) }; auto& fields = data[ row ]; fields.reserve( memberCount ); diff --git a/deps/datReader/GameData.cpp b/deps/datReader/GameData.cpp index b7028834..16ed810b 100644 --- a/deps/datReader/GameData.cpp +++ b/deps/datReader/GameData.cpp @@ -273,8 +273,8 @@ namespace xiv::dat std::string filenamePart = pathLower.substr( lastSlashPos + 1 ); // Get the crc32 values from zlib, to compensate the final XOR 0xFFFFFFFF that isnot done in the exe we just reXOR - dirHash = crc32( 0, reinterpret_cast( dirPart.data() ), (uInt)dirPart.size() ) ^ 0xFFFFFFFF; - filenameHash = crc32( 0, reinterpret_cast( filenamePart.data() ), (uInt)filenamePart.size() ) ^ 0xFFFFFFFF; + dirHash = crc32( 0, reinterpret_cast( dirPart.data() ), static_cast(dirPart.size()) ) ^ 0xFFFFFFFF; + filenameHash = crc32( 0, reinterpret_cast( filenamePart.data() ), static_cast(filenamePart.size()) ) ^ 0xFFFFFFFF; } void GameData::createCategory( uint32_t catNum ) diff --git a/deps/datReader/crc32.cpp b/deps/datReader/crc32.cpp index 1c739733..49c48e6d 100644 --- a/deps/datReader/crc32.cpp +++ b/deps/datReader/crc32.cpp @@ -101,7 +101,7 @@ namespace xiv::utils::crc32 void generate_hashes_1( std::string& i_format, const uint32_t i_first_index, std::vector< uint32_t >& o_hashes ) { char* str = const_cast(i_format.data()); - const uint32_t str_size = (uint32_t)i_format.size(); + const uint32_t str_size = static_cast(i_format.size()); o_hashes.resize( 10000 ); @@ -130,7 +130,7 @@ namespace xiv::utils::crc32 std::vector< uint32_t >& o_hashes ) { char* str = const_cast(i_format.data()); - const uint32_t str_size = (uint32_t)i_format.size(); + const uint32_t str_size = static_cast(i_format.size()); o_hashes.resize( 100000000 ); diff --git a/deps/datReader/zlib.cpp b/deps/datReader/zlib.cpp index 8eae19a0..fa033ca7 100644 --- a/deps/datReader/zlib.cpp +++ b/deps/datReader/zlib.cpp @@ -14,7 +14,7 @@ namespace xiv::utils::zlib out.resize( out_size ); auto ret = compress2( reinterpret_cast(out.data()), &out_size, - reinterpret_cast(in.data()), (uLong)in.size(), Z_BEST_COMPRESSION ); + reinterpret_cast(in.data()), static_cast(in.size()), Z_BEST_COMPRESSION ); if( ret != Z_OK ) { diff --git a/deps/mysqlConnector/Connection.cpp b/deps/mysqlConnector/Connection.cpp index 4a2ad5f9..1d667939 100644 --- a/deps/mysqlConnector/Connection.cpp +++ b/deps/mysqlConnector/Connection.cpp @@ -29,7 +29,8 @@ Mysql::Connection::Connection( std::shared_ptr< MySqlBase > pBase, const std::string& password, const optionMap& options, uint16_t port ) : - m_pBase( pBase ) + m_pBase( pBase ), + m_bConnected( false ) { m_pRawCon = mysql_init( nullptr ); // Different mysql versions support different options, for now whatever was unsupporter here was commented out @@ -165,7 +166,7 @@ bool Mysql::Connection::getAutoCommit() { // TODO: should be replaced with wrapped sql query function once available std::string query("SELECT @@autocommit"); - auto res = mysql_real_query( m_pRawCon, query.c_str(), (unsigned long)query.length() ); + auto res = mysql_real_query( m_pRawCon, query.c_str(), static_cast(query.length()) ); if( res != 0 ) throw std::runtime_error( "Query failed!" ); @@ -237,7 +238,7 @@ std::shared_ptr< Mysql::PreparedStatement > Mysql::Connection::prepareStatement( if( !stmt ) throw std::runtime_error( "Could not init prepared statement: " + getError() ); - if( mysql_stmt_prepare( stmt, sql.c_str(), (unsigned long)sql.size() ) ) + if( mysql_stmt_prepare( stmt, sql.c_str(), static_cast(sql.size()) ) ) throw std::runtime_error( "Could not prepare statement: " + getError() ); return std::make_shared< PreparedStatement >( stmt, shared_from_this() ); diff --git a/deps/mysqlConnector/PreparedStatement.cpp b/deps/mysqlConnector/PreparedStatement.cpp index 9ad0d7cb..7089bd53 100644 --- a/deps/mysqlConnector/PreparedStatement.cpp +++ b/deps/mysqlConnector/PreparedStatement.cpp @@ -18,7 +18,7 @@ struct LongDataSender { unsigned position; MYSQL_STMT* m_pStmt; - LongDataSender() + LongDataSender() : position( 0 ), m_pStmt(nullptr) {} @@ -77,9 +77,9 @@ struct LongDataSender while( sent < str->length() ) { - chunkSize = (uint32_t)( sent + MAX_SEND_LONGDATA_CHUNK > str->length() + chunkSize = static_cast(( sent + MAX_SEND_LONGDATA_CHUNK > str->length() ? str->length() - sent - : MAX_SEND_LONGDATA_CHUNK ); + : MAX_SEND_LONGDATA_CHUNK )); if( mysql_stmt_send_long_data( m_pStmt, position, str->c_str() + sent, chunkSize ) ) { @@ -307,7 +307,7 @@ public: } Mysql::PreparedStatement::PreparedStatement( MYSQL_STMT* pStmt, std::shared_ptr< Mysql::Connection > pConn ) - : Statement( pConn ) + : Statement( pConn ), m_paramCount( 0 ), resultSetConcurrency ( 0 ), resultSetType( 0 ), warningsCount( 0 ) { m_pStmt = pStmt; m_pConnection = pConn; diff --git a/deps/mysqlConnector/Statement.cpp b/deps/mysqlConnector/Statement.cpp index f4677c5e..f873d147 100644 --- a/deps/mysqlConnector/Statement.cpp +++ b/deps/mysqlConnector/Statement.cpp @@ -10,14 +10,14 @@ std::shared_ptr< Mysql::Connection > Mysql::Statement::getConnection() } Mysql::Statement::Statement( std::shared_ptr< Mysql::Connection > conn ) : - m_pConnection( conn ) + m_pConnection( conn ), m_lastUpdateCount( 0 ), m_warningsCount( 0 ) { } void Mysql::Statement::doQuery( const std::string &q ) { - mysql_real_query( m_pConnection->getRawCon(), q.c_str(), (unsigned long)q.length() ); + mysql_real_query( m_pConnection->getRawCon(), q.c_str(), static_cast(q.length()) ); if( errNo() ) throw std::runtime_error( m_pConnection->getError() ); diff --git a/src/api/SapphireApi.cpp b/src/api/SapphireApi.cpp index 5866d830..7995eead 100644 --- a/src/api/SapphireApi.cpp +++ b/src/api/SapphireApi.cpp @@ -114,7 +114,7 @@ int SapphireApi::createCharacter( const uint32_t accountId, const std::string& n const char* ptr = infoJson.c_str() + 50; std::string lookPart( ptr ); - int32_t pos = (int32_t)lookPart.find_first_of( "]" ); + int32_t pos = static_cast(lookPart.find_first_of( "]" )); if( pos != std::string::npos ) { lookPart = lookPart.substr( 0, pos + 1 ); diff --git a/src/api/server_http.hpp b/src/api/server_http.hpp index 596e2f6d..a2a0b98f 100644 --- a/src/api/server_http.hpp +++ b/src/api/server_http.hpp @@ -242,7 +242,7 @@ namespace SimpleWeb { std::shared_ptr request(new Request(*socket)); //Set timeout on the following asio::async-read or write function - auto timer=this->get_timeout_timer(socket, (long)config.timeout_request); + auto timer=this->get_timeout_timer(socket, static_cast(config.timeout_request)); asio::async_read_until(*socket, request->streambuf, "\r\n\r\n", [this, socket, request, timer](const std::error_code& ec, size_t bytes_transferred) { @@ -272,7 +272,7 @@ namespace SimpleWeb { } if(content_length>num_additional_bytes) { //Set timeout on the following asio::async-read or write function - auto timer=this->get_timeout_timer(socket, (long)config.timeout_content); + auto timer=this->get_timeout_timer(socket, static_cast(config.timeout_content)); asio::async_read(*socket, request->streambuf, asio::transfer_exactly(static_cast< size_t >(content_length-num_additional_bytes)), [this, socket, request, timer] @@ -368,7 +368,7 @@ namespace SimpleWeb { std::function::Response>, std::shared_ptr::Request>)>& resource_function) { //Set timeout on the following asio::async-read or write function - auto timer=this->get_timeout_timer(socket, (long)config.timeout_content); + auto timer=this->get_timeout_timer(socket, static_cast(config.timeout_content)); auto response=std::shared_ptr(new Response(socket), [this, request, timer](Response *response_ptr) { auto response=std::shared_ptr(response_ptr); diff --git a/src/world/Manager/HousingMgr.h b/src/world/Manager/HousingMgr.h index b5d76178..144b0a77 100644 --- a/src/world/Manager/HousingMgr.h +++ b/src/world/Manager/HousingMgr.h @@ -26,32 +26,32 @@ namespace Sapphire::World::Manager struct LandCacheEntry { // land table - uint64_t m_landSetId; - uint16_t m_landId; + uint64_t m_landSetId{}; + uint16_t m_landId{}; - Common::LandType m_type; - Common::HouseSize m_size; - Common::HouseStatus m_status; + Common::LandType m_type{}; + Common::HouseSize m_size{}; + Common::HouseStatus m_status{}; - uint64_t m_currentPrice; + uint64_t m_currentPrice{}; - uint64_t m_updateTime; - uint64_t m_ownerId; - uint64_t m_houseId; + uint64_t m_updateTime{}; + uint64_t m_ownerId{}; + uint64_t m_houseId{}; // house table - std::string m_estateWelcome; - std::string m_estateComment; - std::string m_estateName; + std::string m_estateWelcome{}; + std::string m_estateComment{}; + std::string m_estateName{}; - bool m_hasAetheryte; + bool m_hasAetheryte{}; - uint64_t m_buildTime; - uint64_t m_endorsements; + uint64_t m_buildTime{}; + uint64_t m_endorsements{}; - uint16_t m_maxPlacedExternalItems; - uint16_t m_maxPlacedInternalItems; + uint16_t m_maxPlacedExternalItems{}; + uint16_t m_maxPlacedInternalItems{}; }; /*!