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

Conversation

Reyli
Copy link

@Reyli Reyli commented Jun 21, 2024

Builds without warnings now. Mostly casting for size_t or conversions for function definitions.

* 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.
@Reyli Reyli changed the title Compiler Warning Removal Retail Compiler Warning Removal Jun 24, 2024
Copy link
Member

@hkAlice hkAlice left a 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());
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 < >

@@ -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 < >

@@ -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 < >

@@ -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 < >

@@ -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 < >

@@ -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());
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 < >

packet->data().pos = item.getPos();

packet->data().landId = landId;
packet->data().objectArray = slot;
packet->data().landId = static_cast<uint8_t>(landId);
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 < >

packet->data().landId = landId;
packet->data().objectArray = slot;
packet->data().landId = static_cast<uint8_t>(landId);
packet->data().objectArray = static_cast<uint8_t>(slot);
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 < >

@@ -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) );
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 < >

@@ -242,18 +242,16 @@ Sapphire::Land::InvMaxItemsPair Sapphire::Land::getInventoryItemMax() const
{
switch( m_size )
{
default:
Copy link
Member

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 breaks below

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants