-
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?
Conversation
* A lot of hit has to do with size_t being unsigned long long in 64 bit. - Just explicitly casting for a lot of cases removes the warning * Good bit are also the differences in struct definitions to match packets and function definitions - Also just cast to fix * Used a lot of #pragma warning( disable : 4244/4267 ) for template warnings * InviteHandlers.cpp line 118 was definitely a typo bug. Needed assignment "=" instead of "=="
Chugged through the rest of the warnings by casting and builds without warnings. I was going through the intellisense stuff and initializing struct variables but like... it stopped working after I restarted Visual Studio. Guess you get what I got.
Was told that though removing warnings was good for build, to avoid C style casts.
Replacing the stuff I did for warning removal during build from C style casts to static_cast.
Decided Intellisense is weird and inconsistent so if it's not a build warning I just ignored it.
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.
mostly styling issues, some other strange changes
the branch also has conflicts and cannot be merged
static_cast< uint32_t >( _exh->get_members().size() );
is how it should ideally look like
your IDE may have support for reading project styling (CodeStyle.xml) and applying them on save instead of having to manually fix each 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()); |
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 < >
@@ -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 comment
The reason will be displayed to describe this comment to others. Learn more.
styling, spaces between ( ) and < >
@@ -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 comment
The reason will be displayed to describe this comment to others. Learn more.
styling, spaces between ( ) and < >
@@ -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 comment
The reason will be displayed to describe this comment to others. Learn more.
styling, spaces between ( ) and < >
@@ -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 comment
The reason will be displayed to describe this comment to others. Learn more.
styling, spaces between ( ) and < >
@@ -409,11 +409,11 @@ void Sapphire::HousingZone::updateYardObjectPos( Entity::Player& sourcePlayer, u | |||
|
|||
auto packet = makeZonePacket< Server::FFXIVIpcHousingObjectMove >( player.second->getId() ); | |||
|
|||
packet->data().itemRotation = item.getRot(); | |||
packet->data().itemRotation = static_cast<uint16_t>(item.getRot()); |
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 < >
packet->data().pos = item.getPos(); | ||
|
||
packet->data().landId = landId; | ||
packet->data().objectArray = slot; | ||
packet->data().landId = static_cast<uint8_t>(landId); |
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 < >
packet->data().landId = landId; | ||
packet->data().objectArray = slot; | ||
packet->data().landId = static_cast<uint8_t>(landId); | ||
packet->data().objectArray = static_cast<uint8_t>(slot); |
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 < >
@@ -474,7 +474,7 @@ bool Sapphire::Territory::update( uint64_t tickCount ) | |||
auto dt = std::difftime( tickCount, m_lastUpdate ) / 1000.f; | |||
|
|||
if( m_pNaviProvider ) | |||
m_pNaviProvider->updateCrowd( dt ); | |||
m_pNaviProvider->updateCrowd( static_cast<float>(dt) ); |
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 < >
@@ -242,18 +242,16 @@ Sapphire::Land::InvMaxItemsPair Sapphire::Land::getInventoryItemMax() const | |||
{ | |||
switch( m_size ) | |||
{ | |||
default: |
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.
return already breaks out of the case implicitly, and thus break
is unnecessary
same for all break
s below
Builds without warnings now. Mostly casting for size_t or conversions for function definitions.