Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Retail Compiler Warning Removal #960

Open
wants to merge 5 commits into
base: Sapphire_Retail
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions deps/datReader/Dat.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 = o_data.size();
const uint32_t data_size = static_cast<uint32_t>(o_data.size());
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

styling, spaces between ( ) and < >

o_data.resize( data_size + block_header.uncompressed_size );

// 32000 in compressed_size means it is not compressed so take uncompressed_size
Expand All @@ -308,7 +308,7 @@ namespace xiv::dat
m_handle.read( temp_buffer.data(), block_header.compressed_size );

utils::zlib::no_header_decompress( reinterpret_cast<uint8_t*>(temp_buffer.data()),
temp_buffer.size(),
static_cast<uint32_t>(temp_buffer.size()),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

styling, spaces between ( ) and < >

reinterpret_cast<uint8_t*>(o_data.data() + data_size),
block_header.uncompressed_size );
}
Expand Down
2 changes: 1 addition & 1 deletion deps/datReader/DatCategories/bg/sgb.h
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,7 @@ struct SGB_FILE
if( stateCount > 0 )
{
stateCount = stateCount;
for( int i = 0; i < stateCount; ++i )
for( uint32_t i = 0; i < stateCount; ++i )
{
auto state = SGB_STATE_ENTRY( buf + baseOffset + header.statesOffset + 8 + i * sizeof( SGB_STATE_HEADER ) );
stateEntries.push_back( state );
Expand Down
4 changes: 2 additions & 2 deletions deps/datReader/Exd.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 = _exh->get_members().size();
const uint32_t memberCount = static_cast<uint32_t>(_exh->get_members().size());
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

styling, spaces between ( ) and < >

for( auto& cacheEntry : _idCache )
{
std::vector< char > dataCpy = cacheEntry.second.file->get_data_sections().front();
Expand All @@ -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, i };
ExdRow row = { cacheEntry.first, static_cast<uint8_t>(i) };
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

styling, spaces between ( ) and < >

auto& fields = data[ row ];
fields.reserve( memberCount );

Expand Down
4 changes: 2 additions & 2 deletions deps/datReader/GameData.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<const uint8_t*>( dirPart.data() ), dirPart.size() ) ^ 0xFFFFFFFF;
filenameHash = crc32( 0, reinterpret_cast<const uint8_t*>( filenamePart.data() ), filenamePart.size() ) ^ 0xFFFFFFFF;
dirHash = crc32( 0, reinterpret_cast<const uint8_t*>( dirPart.data() ), static_cast<uInt>(dirPart.size()) ) ^ 0xFFFFFFFF;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

styling, spaces between ( ) and < >

filenameHash = crc32( 0, reinterpret_cast<const uint8_t*>( filenamePart.data() ), static_cast<uInt>(filenamePart.size()) ) ^ 0xFFFFFFFF;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

styling, spaces between ( ) and < >

}

void GameData::createCategory( uint32_t catNum )
Expand Down
4 changes: 2 additions & 2 deletions deps/datReader/crc32.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<char*>(i_format.data());
const uint32_t str_size = i_format.size();
const uint32_t str_size = static_cast<uint32_t>(i_format.size());
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

styling, spaces between ( ) and < >


o_hashes.resize( 10000 );

Expand Down Expand Up @@ -130,7 +130,7 @@ namespace xiv::utils::crc32
std::vector< uint32_t >& o_hashes )
{
char* str = const_cast<char*>(i_format.data());
const uint32_t str_size = i_format.size();
const uint32_t str_size = static_cast<uint32_t>(i_format.size());
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

styling, spaces between ( ) and < >


o_hashes.resize( 100000000 );

Expand Down
4 changes: 2 additions & 2 deletions deps/datReader/zlib.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@ namespace xiv::utils::zlib
void compress( const std::vector< char >& in, std::vector< char >& out )
{
// Fetching upper bound for out size
auto out_size = compressBound( in.size() );
auto out_size = compressBound( static_cast<uLong>(in.size()) );
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

styling, spaces between ( ) and < >

out.resize( out_size );

auto ret = compress2( reinterpret_cast<uint8_t*>(out.data()), &out_size,
reinterpret_cast<const uint8_t*>(in.data()), in.size(), Z_BEST_COMPRESSION );
reinterpret_cast<const uint8_t*>(in.data()), static_cast<uLong>(in.size()), Z_BEST_COMPRESSION );
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

styling, spaces between ( ) and < >


if( ret != Z_OK )
{
Expand Down
7 changes: 4 additions & 3 deletions deps/mysqlConnector/Connection.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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(), query.length() );
auto res = mysql_real_query( m_pRawCon, query.c_str(), static_cast<unsigned long>(query.length()) );
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

styling, spaces between ( ) and < >


if( res != 0 )
throw std::runtime_error( "Query failed!" );
Expand Down Expand Up @@ -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(), sql.size() ) )
if( mysql_stmt_prepare( stmt, sql.c_str(), static_cast<unsigned long>(sql.size()) ) )
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

styling, spaces between ( ) and < >

throw std::runtime_error( "Could not prepare statement: " + getError() );

return std::make_shared< PreparedStatement >( stmt, shared_from_this() );
Expand Down
8 changes: 4 additions & 4 deletions deps/mysqlConnector/PreparedStatement.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ struct LongDataSender
{
unsigned position;
MYSQL_STMT* m_pStmt;
LongDataSender()
LongDataSender() : position( 0 ), m_pStmt(nullptr)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

styling, spaces between ( ) and < >

{}


Expand Down Expand Up @@ -77,9 +77,9 @@ struct LongDataSender

while( sent < str->length() )
{
chunkSize = ( sent + MAX_SEND_LONGDATA_CHUNK > str->length()
chunkSize = static_cast<uint32_t>(( sent + MAX_SEND_LONGDATA_CHUNK > str->length()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

styling, spaces between ( ) and < >

? 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 ) )
{
Expand Down Expand Up @@ -307,7 +307,7 @@ class ParamBind
}

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;
Expand Down
4 changes: 2 additions & 2 deletions deps/mysqlConnector/Statement.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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(), q.length() );
mysql_real_query( m_pConnection->getRawCon(), q.c_str(), static_cast<unsigned long>(q.length()) );
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

styling, spaces between ( ) and < >


if( errNo() )
throw std::runtime_error( m_pConnection->getError() );
Expand Down
2 changes: 1 addition & 1 deletion src/api/SapphireApi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 = lookPart.find_first_of( "]" );
int32_t pos = static_cast<int32_t>(lookPart.find_first_of( "]" ));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

styling, spaces between ( ) and < >

if( pos != std::string::npos )
{
lookPart = lookPart.substr( 0, pos + 1 );
Expand Down
6 changes: 3 additions & 3 deletions src/api/server_http.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,7 @@ namespace SimpleWeb {
std::shared_ptr<Request> request(new Request(*socket));

//Set timeout on the following asio::async-read or write function
auto timer=this->get_timeout_timer(socket, config.timeout_request);
auto timer=this->get_timeout_timer(socket, static_cast<long>(config.timeout_request));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

styling, spaces between ( ) and < >


asio::async_read_until(*socket, request->streambuf, "\r\n\r\n",
[this, socket, request, timer](const std::error_code& ec, size_t bytes_transferred) {
Expand Down Expand Up @@ -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, config.timeout_content);
auto timer=this->get_timeout_timer(socket, static_cast<long>(config.timeout_content));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

styling, spaces between ( ) and < >

asio::async_read(*socket, request->streambuf,
asio::transfer_exactly(static_cast< size_t >(content_length-num_additional_bytes)),
[this, socket, request, timer]
Expand Down Expand Up @@ -368,7 +368,7 @@ namespace SimpleWeb {
std::function<void(std::shared_ptr<typename ServerBase<socket_type>::Response>,
std::shared_ptr<typename ServerBase<socket_type>::Request>)>& resource_function) {
//Set timeout on the following asio::async-read or write function
auto timer=this->get_timeout_timer(socket, config.timeout_content);
auto timer=this->get_timeout_timer(socket, static_cast<long>(config.timeout_content));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

styling, spaces between ( ) and < >


auto response=std::shared_ptr<Response>(new Response(socket), [this, request, timer](Response *response_ptr) {
auto response=std::shared_ptr<Response>(response_ptr);
Expand Down
3 changes: 3 additions & 0 deletions src/common/Config/ConfigMgr.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ namespace Sapphire::Common
template< class T >
T getValue( const std::string& section, const std::string& name, T defaultValue = T() )
{
#pragma warning( push )
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this pragma warning may only signal for MSVC (visual studio) compilers, not gcc or clang

#pragma warning( disable : 4244 )
if constexpr ( std::is_same_v< T, uint32_t > )
return m_pInih->GetInteger( section, name, defaultValue );
else if constexpr ( std::is_same_v< T, int32_t > )
Expand All @@ -48,6 +50,7 @@ namespace Sapphire::Common
return m_pInih->GetBoolean( section, name, defaultValue );
else
static_assert( always_false< T >::value, "non-exhaustive getter!" );
#pragma warning( pop )
}

template< class T >
Expand Down
2 changes: 1 addition & 1 deletion src/common/Crypt/base64.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ std::string Sapphire::Common::Util::base64Encode( uint8_t const* bytes_to_encode

std::string Sapphire::Common::Util::base64Decode( std::string const& encoded_string )
{
int32_t in_len = encoded_string.size();
int32_t in_len = static_cast<int32_t>(encoded_string.size());
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

styling, spaces between ( ) and < >

int32_t i = 0;
int32_t j = 0;
int32_t in_ = 0;
Expand Down
2 changes: 1 addition & 1 deletion src/common/Database/DbWorkerPool.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ void Sapphire::Db::DbWorkerPool< T >::escapeString( std::string& str )
return;

char* buf = new char[str.size() * 2 + 1];
escapeString( buf, str.c_str(), str.size() );
escapeString( buf, str.c_str(), static_cast<unsigned long>(str.size()) );
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

styling, spaces between ( ) and < >

str = buf;
delete[] buf;
}
Expand Down
2 changes: 1 addition & 1 deletion src/common/Network/GamePacketParser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ PacketParseResult Network::Packets::getPackets( const std::vector< uint8_t >& bu
std::vector< uint8_t > outBuf;
outBuf.resize( packetHeader.oodleDecompressedSize );

bool oodleSuccess = oodle->oodleDecode( inBuf, bytesExpected, outBuf, packetHeader.oodleDecompressedSize );
bool oodleSuccess = oodle->oodleDecode( inBuf, static_cast<uint32_t>(bytesExpected), outBuf, packetHeader.oodleDecompressedSize );
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

styling, spaces between ( ) and < >


if( !oodleSuccess )
{
Expand Down
4 changes: 2 additions & 2 deletions src/common/Network/PacketContainer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -65,14 +65,14 @@ void Network::Packets::PacketContainer::fillSendBuffer( std::vector< uint8_t >&
std::vector< uint8_t > outBuf;
outBuf.resize( m_ipcHdr.size );

auto compLen = oodle->oodleEncode(inBuf, inBuf.size(), outBuf);
auto compLen = oodle->oodleEncode(inBuf, static_cast<uint32_t>(inBuf.size()), outBuf);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

styling, spaces between ( ) and < >


// Check if we compressed at all
if (compLen != m_ipcHdr.size) {
tempBuffer.resize(compLen);
memcpy(&inBuf[0], &outBuf[0], compLen);
m_ipcHdr.oodleDecompressedSize = m_ipcHdr.size;
m_ipcHdr.size = compLen;
m_ipcHdr.size = static_cast<uint32_t>(compLen);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

styling, spaces between ( ) and < >

m_ipcHdr.compressionType = static_cast< uint8_t >(Packets::CompressionType::Oodle);
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/common/Util/Util.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ uint64_t Util::getTimeMs()
uint32_t Util::getTimeSeconds()
{
auto currClock = std::chrono::system_clock::now();
return std::chrono::time_point_cast< std::chrono::seconds >( currClock ).time_since_epoch().count();
return static_cast<uint32_t>(std::chrono::time_point_cast< std::chrono::seconds >( currClock ).time_since_epoch().count());
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

consider changing the function's return type instead of static_cast

}

uint64_t Util::getEorzeanTimeStamp()
Expand Down
2 changes: 1 addition & 1 deletion src/lobby/GameConnection.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -470,7 +470,7 @@ void Lobby::GameConnection::handlePackets( const Network::Packets::FFXIVARR_PACK
BlowFish blowfish;
blowfish.initialize( m_encKey, 0x10 );
blowfish.Decode( ( uint8_t* ) ( &inPacket.data[ 0 ] ), ( uint8_t* ) ( &inPacket.data[ 0 ] ),
( inPacket.data.size() ) - 0x10 );
( static_cast<uint32_t>(inPacket.data.size() ) - 0x10 ));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

styling, spaces between ( ) and < >

}

switch( inPacket.segHdr.type )
Expand Down
4 changes: 2 additions & 2 deletions src/lobby/LobbyPacketContainer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,10 @@ void LobbyPacketContainer::addPacket( FFXIVPacketBasePtr pEntry )
{
BlowFish blowfish;
blowfish.initialize( m_encKey, 0x10 );
blowfish.Encode( m_dataBuf + m_header.size + 0x10, m_dataBuf + m_header.size + 0x10, pEntry->getSize() - 0x10 );
blowfish.Encode( m_dataBuf + m_header.size + 0x10, m_dataBuf + m_header.size + 0x10, (uint32_t)pEntry->getSize() - 0x10 );
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

styling, spaces between ( ) and < >

}

m_header.size += pEntry->getSize();
m_header.size += static_cast<uint32_t>(pEntry->getSize());
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

styling, spaces between ( ) and < >

m_header.count++;
}

Expand Down
2 changes: 1 addition & 1 deletion src/lobby/RestConnector.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,7 @@ int Lobby::RestConnector::createCharacter( char* sId, std::string name, std::str
{
std::string json_string =
"{\"sId\": \"" + std::string( sId, 56 ) + "\",\"secret\": \"" + serverSecret + "\",\"name\": \"" + name +
"\",\"infoJson\": \"" + Common::Util::base64Encode( ( uint8_t* ) infoJson.c_str(), infoJson.length() ) + "\"}";
"\",\"infoJson\": \"" + Common::Util::base64Encode( ( uint8_t* ) infoJson.c_str(), static_cast<uint32_t>(infoJson.length()) ) + "\"}";
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

styling, spaces between ( ) and < >


HttpResponse r = requestApi( "createCharacter", json_string );

Expand Down
2 changes: 1 addition & 1 deletion src/scripts/quest/subquest/gridania/SubFst008.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ class SubFst008 :
{
if( player.giveQuestRewards( getId(), result.param3 ) )
{
player.setQuestUI8BH( getId(), result.param3 );
player.setQuestUI8BH( getId(), static_cast<uint8_t>(result.param3) );
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

styling, spaces between ( ) and < >

player.finishQuest( getId() );
}
}
Expand Down
6 changes: 3 additions & 3 deletions src/tools/discovery_parser/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -77,11 +77,11 @@ struct DiscoveryMap : std::enable_shared_from_this< DiscoveryMap >
{
auto ogX = x, ogY = y;
int col = ( mapIndex % ( int ) ( ( float ) img.width / ( float ) tileWidth ) );
int row = ( mapIndex / ( ( float ) img.width / ( float ) tileWidth ) );
int row = static_cast<int>(( mapIndex / ( ( float ) img.width / ( float ) tileWidth ) ));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

mixing C-style casts with static_cast
see: ( float ) img.width
styling, spaces between ( ) and < >

x = ( x / 2048.f ) * ( float ) tileWidth;
y = ( y / 2048.f ) * ( float ) tileWidth;
int tileX = ( col * ( float ) tileWidth ) + x;
int tileY = ( row * ( float ) tileWidth ) + y;
int tileX = static_cast<int>((col * (float)tileWidth) + x);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

mixing C-style casts with static_cast
see: ( float ) tileWidth
styling, spaces between ( ) and < >

int tileY = static_cast<int>(( row * ( float ) tileWidth ) + y);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

mixing C-style casts with static_cast
see: ( float ) tileWidth
styling, spaces between ( ) and < >


if( tileX < 0 || tileY < 0 || tileY > img.data.size() - 1 || tileX > img.data[ 0 ].size() - 1 )
{
Expand Down
6 changes: 3 additions & 3 deletions src/tools/discovery_parser/tex_decode.h
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ struct Image
data[ y ].resize( entries );
offset += 8;

for( auto x = 0; x < entries; ++x )
for( uint32_t x = 0; x < entries; ++x )
data[ y ][ x ] = *reinterpret_cast< uint32_t* >( buf + offset + ( x * 4 ) );
offset += entries * 4;
}
Expand Down Expand Up @@ -254,9 +254,9 @@ Image DecodeTexDXT1( const TEX_FILE& tex, uint32_t offset, uint32_t targetHeight

Image img( targetHeight, targetWidth );

for( int y = 0; y < compressedHeight; y++ )
for( uint32_t y = 0; y < compressedHeight; y++ )
{
for( int x = 0; x < compressedWidth; x++ )
for( uint32_t x = 0; x < compressedWidth; x++ )
{
const int t0 = *reinterpret_cast< const uint16_t* >( data + pos + 0 ) & 0xffff;
const int t1 = *reinterpret_cast< const uint16_t* >( data + pos + 2 ) & 0xffff;
Expand Down
2 changes: 1 addition & 1 deletion src/tools/event_object_parser/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ void loadAllInstanceContentEntries()
if( name.empty() )
continue;

auto i = 0;
size_t i = 0;
while( ( i = name.find( ' ' ) ) != std::string::npos )
name = name.replace( name.begin() + i, name.begin() + i + 1, { '_' } );

Expand Down
2 changes: 1 addition & 1 deletion src/tools/exd_struct_gen/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -313,7 +313,7 @@ std::string generateConstructorsDecl( const std::string& exd )
{

uint32_t amount = indexCountMap[ count ];
for( int i = 0; i < amount; i++ )
for( uint32_t i = 0; i < amount; i++ )
{

result += indent + indexToNameMap[ count ] + ".push_back( exdData->getField< " + indexToTypeMap[ count ] +
Expand Down
1 change: 1 addition & 0 deletions src/tools/nav_export/cache.h
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,7 @@ class Cache : public std::enable_shared_from_this< Cache >
}
catch( std::exception& e )
{
(void)e; // suppress unused var warning
std::vector< char > empty;
return empty;
}
Expand Down
2 changes: 1 addition & 1 deletion src/tools/nav_export/lgb.h
Original file line number Diff line number Diff line change
Expand Up @@ -380,7 +380,7 @@ struct LGB_FILE
for( auto i = 0; i < header.groupCount; ++i )
{
const auto groupOffset = baseOffset + *reinterpret_cast< int32_t* >( buf + ( baseOffset + i * 4 ) );
const auto group = LGB_GROUP( buf, this, groupOffset );
const auto group = LGB_GROUP( buf, this, static_cast<uint32_t>(groupOffset) );
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

styling, spaces between ( ) and < >

groups.push_back( group );
}
};
Expand Down
Loading