-
Notifications
You must be signed in to change notification settings - Fork 213
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
base: Sapphire_Retail
Are you sure you want to change the base?
Changes from all commits
9435e6e
5c7d90f
ed156c4
6111461
b588f42
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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()); | ||
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<uint8_t*>(temp_buffer.data()), | ||
temp_buffer.size(), | ||
static_cast<uint32_t>(temp_buffer.size()), | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 ); | ||
} | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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()); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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(); | ||
|
@@ -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) }; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. styling, spaces between ( ) and < > |
||
auto& fields = data[ row ]; | ||
fields.reserve( memberCount ); | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. styling, spaces between ( ) and < > |
||
} | ||
|
||
void GameData::createCategory( uint32_t catNum ) | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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()); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. styling, spaces between ( ) and < > |
||
|
||
o_hashes.resize( 10000 ); | ||
|
||
|
@@ -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()); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. styling, spaces between ( ) and < > |
||
|
||
o_hashes.resize( 100000000 ); | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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()) ); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 ); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. styling, spaces between ( ) and < > |
||
|
||
if( ret != Z_OK ) | ||
{ | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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(), query.length() ); | ||
auto res = mysql_real_query( m_pRawCon, query.c_str(), static_cast<unsigned long>(query.length()) ); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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!" ); | ||
|
@@ -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()) ) ) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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() ); | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,7 +18,7 @@ struct LongDataSender | |
{ | ||
unsigned position; | ||
MYSQL_STMT* m_pStmt; | ||
LongDataSender() | ||
LongDataSender() : position( 0 ), m_pStmt(nullptr) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. styling, spaces between ( ) and < > |
||
{} | ||
|
||
|
||
|
@@ -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() | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 ) ) | ||
{ | ||
|
@@ -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; | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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()) ); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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() ); | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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( "]" )); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 ); | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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)); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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) { | ||
|
@@ -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)); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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] | ||
|
@@ -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)); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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); | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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 ) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 > ) | ||
|
@@ -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 > | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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()); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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; | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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()) ); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. styling, spaces between ( ) and < > |
||
str = buf; | ||
delete[] buf; | ||
} | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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 ); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. styling, spaces between ( ) and < > |
||
|
||
if( !oodleSuccess ) | ||
{ | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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); | ||
} | ||
} | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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()); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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() | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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 )); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. styling, spaces between ( ) and < > |
||
} | ||
|
||
switch( inPacket.segHdr.type ) | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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 ); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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()); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. styling, spaces between ( ) and < > |
||
m_header.count++; | ||
} | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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()) ) + "\"}"; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. styling, spaces between ( ) and < > |
||
|
||
HttpResponse r = requestApi( "createCharacter", json_string ); | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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) ); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. styling, spaces between ( ) and < > |
||
player.finishQuest( getId() ); | ||
} | ||
} | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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 ) )); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. mixing C-style casts with static_cast |
||
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); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. mixing C-style casts with static_cast |
||
int tileY = static_cast<int>(( row * ( float ) tileWidth ) + y); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. mixing C-style casts with static_cast |
||
|
||
if( tileX < 0 || tileY < 0 || tileY > img.data.size() - 1 || tileX > img.data[ 0 ].size() - 1 ) | ||
{ | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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) ); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. styling, spaces between ( ) and < > |
||
groups.push_back( group ); | ||
} | ||
}; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
styling, spaces between ( ) and < >