1
Fork 0
mirror of https://github.com/SapphireServer/Sapphire.git synced 2025-05-06 10:47:45 +00:00

Warning removals round 2

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.
This commit is contained in:
Reyli 2024-06-21 09:51:53 -05:00
parent 9435e6e66a
commit 5c7d90ff84
12 changed files with 40 additions and 36 deletions

View file

@ -242,7 +242,7 @@ namespace SimpleWeb {
std::shared_ptr<Request> request(new Request(*socket)); std::shared_ptr<Request> request(new Request(*socket));
//Set timeout on the following asio::async-read or write function //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, (long)config.timeout_request);
asio::async_read_until(*socket, request->streambuf, "\r\n\r\n", asio::async_read_until(*socket, request->streambuf, "\r\n\r\n",
[this, socket, request, timer](const std::error_code& ec, size_t bytes_transferred) { [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) { if(content_length>num_additional_bytes) {
//Set timeout on the following asio::async-read or write 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, (long)config.timeout_content);
asio::async_read(*socket, request->streambuf, asio::async_read(*socket, request->streambuf,
asio::transfer_exactly(static_cast< size_t >(content_length-num_additional_bytes)), asio::transfer_exactly(static_cast< size_t >(content_length-num_additional_bytes)),
[this, socket, request, timer] [this, socket, request, timer]
@ -368,7 +368,7 @@ namespace SimpleWeb {
std::function<void(std::shared_ptr<typename ServerBase<socket_type>::Response>, std::function<void(std::shared_ptr<typename ServerBase<socket_type>::Response>,
std::shared_ptr<typename ServerBase<socket_type>::Request>)>& resource_function) { std::shared_ptr<typename ServerBase<socket_type>::Request>)>& resource_function) {
//Set timeout on the following asio::async-read or write 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, (long)config.timeout_content);
auto response=std::shared_ptr<Response>(new Response(socket), [this, request, timer](Response *response_ptr) { auto response=std::shared_ptr<Response>(new Response(socket), [this, request, timer](Response *response_ptr) {
auto response=std::shared_ptr<Response>(response_ptr); auto response=std::shared_ptr<Response>(response_ptr);

View file

@ -119,6 +119,7 @@ private:
} }
catch( std::exception& e ) catch( std::exception& e )
{ {
(void)e; // suppress unused var warning
std::vector< char > empty; std::vector< char > empty;
return empty; return empty;
} }

View file

@ -70,12 +70,12 @@ enum class LgbEntryType :
struct InstanceObject struct InstanceObject
{ {
LgbEntryType type; LgbEntryType type{};
uint32_t unknown; uint32_t unknown{};
uint32_t nameOffset; uint32_t nameOffset{};
vec3 translation; vec3 translation{};
vec3 rotation; vec3 rotation{};
vec3 scale; vec3 scale{};
}; };
class LgbEntry class LgbEntry
@ -221,10 +221,10 @@ public:
struct MapRangeData : struct MapRangeData :
public InstanceObject public InstanceObject
{ {
uint32_t type; uint32_t type{};
uint16_t unknown2; uint16_t unknown2{};
uint16_t unknown3; uint16_t unknown3{};
uint8_t unknown4[0x10]; uint8_t unknown4[0x10]{};
}; };
struct LGB_MAP_RANGE_ENTRY : struct LGB_MAP_RANGE_ENTRY :
@ -380,7 +380,7 @@ struct LGB_FILE
for( auto i = 0; i < header.groupCount; ++i ) for( auto i = 0; i < header.groupCount; ++i )
{ {
const auto groupOffset = baseOffset + *reinterpret_cast< int32_t* >( buf + ( baseOffset + i * 4 ) ); 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, (uint32_t)groupOffset );
groups.push_back( group ); groups.push_back( group );
} }
}; };

View file

@ -332,6 +332,7 @@ int main( int argc, char* argv[] )
} }
catch( std::exception& e ) catch( std::exception& e )
{ {
printf("An exception has occurred: %s", e.what());
printf( "Unable to initialise EXD!\n" ); printf( "Unable to initialise EXD!\n" );
return -1; return -1;
} }
@ -492,7 +493,7 @@ int main( int argc, char* argv[] )
printf( "Built export struct for %s in %lu seconds \n", printf( "Built export struct for %s in %lu seconds \n",
zoneName.c_str(), zoneName.c_str(),
std::chrono::duration_cast< std::chrono::seconds >( std::chrono::high_resolution_clock::now() - entryStartTime ).count() ); (unsigned long)std::chrono::duration_cast< std::chrono::seconds >( std::chrono::high_resolution_clock::now() - entryStartTime ).count() );
} }
catch( std::exception& e ) catch( std::exception& e )
{ {
@ -506,7 +507,7 @@ int main( int argc, char* argv[] )
std::cout << "\n\n\n"; std::cout << "\n\n\n";
printf( "Finished all tasks in %lu seconds\n", printf( "Finished all tasks in %lu seconds\n",
std::chrono::duration_cast< std::chrono::seconds >( std::chrono::high_resolution_clock::now() - startTime ).count() ); (unsigned long)std::chrono::duration_cast< std::chrono::seconds >( std::chrono::high_resolution_clock::now() - startTime ).count() );
delete eData; delete eData;
delete gameData; delete gameData;

View file

@ -52,7 +52,7 @@ public:
auto end = std::chrono::high_resolution_clock::now(); auto end = std::chrono::high_resolution_clock::now();
printf( "[Navmesh] Finished exporting %s in %lu ms\n", zone.name.c_str(), printf( "[Navmesh] Finished exporting %s in %lu ms\n", zone.name.c_str(),
std::chrono::duration_cast< std::chrono::milliseconds >( end - start ).count() ); (unsigned long)std::chrono::duration_cast< std::chrono::milliseconds >( end - start ).count() );
} }
}; };

View file

@ -53,7 +53,7 @@ public:
printf( "[Obj] Finished exporting %s in %lu ms\n", printf( "[Obj] Finished exporting %s in %lu ms\n",
fileName.substr( fileName.find( "pcb_export" ) - 1 ).c_str(), fileName.substr( fileName.find( "pcb_export" ) - 1 ).c_str(),
std::chrono::duration_cast< std::chrono::milliseconds >( end - start ).count() ); (unsigned long)std::chrono::duration_cast< std::chrono::milliseconds >( end - start ).count() );
return fileName; return fileName;
} }
@ -91,7 +91,7 @@ public:
auto end = std::chrono::high_resolution_clock::now(); auto end = std::chrono::high_resolution_clock::now();
printf( "[Obj] Finished exporting %s in %lu ms\n", printf( "[Obj] Finished exporting %s in %lu ms\n",
fileName.substr( fileName.find( "pcb_export" ) - 1 ).c_str(), fileName.substr( fileName.find( "pcb_export" ) - 1 ).c_str(),
std::chrono::duration_cast< std::chrono::milliseconds >( end - start ).count() ); (unsigned long)std::chrono::duration_cast< std::chrono::milliseconds >( end - start ).count() );
return fileName; return fileName;
} }
@ -128,7 +128,7 @@ private:
std::to_string( mesh.indices[ i + 1 ] + indicesOffset + 1 ) << ' ' + std::to_string( mesh.indices[ i + 1 ] + indicesOffset + 1 ) << ' ' +
std::to_string( mesh.indices[ i + 2 ] + indicesOffset + 1 ) << '\n'; std::to_string( mesh.indices[ i + 2 ] + indicesOffset + 1 ) << '\n';
} }
indicesOffset += mesh.verts.size() / 3; indicesOffset += (int)mesh.verts.size() / 3;
} }
} }
//of.flush(); //of.flush();

View file

@ -119,6 +119,7 @@ private:
} }
catch( std::exception& e ) catch( std::exception& e )
{ {
(void)e; // suppress unused warning
std::vector< char > empty; std::vector< char > empty;
return empty; return empty;
} }

View file

@ -70,12 +70,12 @@ enum class LgbEntryType :
struct InstanceObject struct InstanceObject
{ {
LgbEntryType type; LgbEntryType type{};
uint32_t unknown; uint32_t unknown{};
uint32_t nameOffset; uint32_t nameOffset{};
vec3 translation; vec3 translation{};
vec3 rotation; vec3 rotation{};
vec3 scale; vec3 scale{};
}; };
class LgbEntry class LgbEntry
@ -379,7 +379,7 @@ struct LGB_FILE
for( auto i = 0; i < header.groupCount; ++i ) for( auto i = 0; i < header.groupCount; ++i )
{ {
const auto groupOffset = baseOffset + *reinterpret_cast< int32_t* >( buf + ( baseOffset + i * 4 ) ); 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, (uint32_t)groupOffset );
groups.push_back( group ); groups.push_back( group );
} }
}; };

View file

@ -212,6 +212,7 @@ int main( int argc, char* argv[] )
} }
catch( std::exception& e ) catch( std::exception& e )
{ {
printf("An exception has occurred: %s", e.what());
printf( "Unable to initialise EXD!\n Usage: pcb_reader <teri> \"path/to/FINAL FANTASY XIV - A REALM REBORN/game/sqpack\" [--no-obj, --dump-all, --navmesh, --jobs #]\n" ); printf( "Unable to initialise EXD!\n Usage: pcb_reader <teri> \"path/to/FINAL FANTASY XIV - A REALM REBORN/game/sqpack\" [--no-obj, --dump-all, --navmesh, --jobs #]\n" );
return -1; return -1;
} }
@ -390,7 +391,7 @@ int main( int argc, char* argv[] )
mesh.indices[ indices++ ] = index.index[ 2 ]; mesh.indices[ indices++ ] = index.index[ 2 ];
// std::cout << std::to_string( index.unknown[0] )<< " " << std::to_string( index.unknown[1] )<< " " << std::to_string( index.unknown[2]) << std::endl; // std::cout << std::to_string( index.unknown[0] )<< " " << std::to_string( index.unknown[1] )<< " " << std::to_string( index.unknown[2]) << std::endl;
} }
max_index += entry.data.vertices.size() + entry.data.vertices_i16.size(); max_index += (uint32_t)(entry.data.vertices.size() + entry.data.vertices_i16.size());
model.meshes[ meshCount++ ] = mesh; model.meshes[ meshCount++ ] = mesh;
} }
exportedGroup.models[model.name] = model; exportedGroup.models[model.name] = model;
@ -521,7 +522,7 @@ int main( int argc, char* argv[] )
printf( "Built export struct for %s in %lu seconds \n", printf( "Built export struct for %s in %lu seconds \n",
zoneName.c_str(), zoneName.c_str(),
std::chrono::duration_cast< std::chrono::seconds >( std::chrono::high_resolution_clock::now() - entryStartTime ).count() ); (unsigned long)std::chrono::duration_cast< std::chrono::seconds >( std::chrono::high_resolution_clock::now() - entryStartTime ).count() );
if( zoneCount++ % nJobs == 0 ) if( zoneCount++ % nJobs == 0 )
{ {
exportMgr.restart(); exportMgr.restart();
@ -540,7 +541,7 @@ int main( int argc, char* argv[] )
std::cout << "\n\n\n"; std::cout << "\n\n\n";
printf( "Finished all tasks in %lu seconds\n", printf( "Finished all tasks in %lu seconds\n",
std::chrono::duration_cast< std::chrono::seconds >( std::chrono::high_resolution_clock::now() - startTime ).count() ); (unsigned long)std::chrono::duration_cast< std::chrono::seconds >( std::chrono::high_resolution_clock::now() - startTime ).count() );
delete eData; delete eData;
delete gameData; delete gameData;

View file

@ -53,7 +53,7 @@ public:
auto end = std::chrono::high_resolution_clock::now(); auto end = std::chrono::high_resolution_clock::now();
printf( "[Navmesh] Finished exporting %s in %lu ms\n", printf( "[Navmesh] Finished exporting %s in %lu ms\n",
zone.name.c_str(), zone.name.c_str(),
std::chrono::duration_cast< std::chrono::milliseconds >( end - start ).count() ); (unsigned long)std::chrono::duration_cast< std::chrono::milliseconds >( end - start ).count() );
} }
static void exportGroup( const std::string& zoneName, const ExportedGroup& group ) static void exportGroup( const std::string& zoneName, const ExportedGroup& group )
@ -91,7 +91,7 @@ public:
auto end = std::chrono::high_resolution_clock::now(); auto end = std::chrono::high_resolution_clock::now();
printf( "[Navmesh] Finished exporting %s in %lu ms\n", printf( "[Navmesh] Finished exporting %s in %lu ms\n",
fileName.c_str(), fileName.c_str(),
std::chrono::duration_cast< std::chrono::milliseconds >( end - start ).count() ); (unsigned long)std::chrono::duration_cast< std::chrono::milliseconds >( end - start ).count() );
} }
}; };
#endif // !OBJ_EXPORTER_H #endif // !OBJ_EXPORTER_H

View file

@ -53,7 +53,7 @@ public:
printf( "[Obj] Finished exporting %s in %lu ms\n", printf( "[Obj] Finished exporting %s in %lu ms\n",
fileName.substr( fileName.find( "pcb_export" ) - 1 ).c_str(), fileName.substr( fileName.find( "pcb_export" ) - 1 ).c_str(),
std::chrono::duration_cast< std::chrono::milliseconds >( end - start ).count() ); (unsigned long)std::chrono::duration_cast< std::chrono::milliseconds >( end - start ).count() );
return fileName; return fileName;
} }
@ -91,7 +91,7 @@ public:
auto end = std::chrono::high_resolution_clock::now(); auto end = std::chrono::high_resolution_clock::now();
printf( "[Obj] Finished exporting %s in %lu ms\n", printf( "[Obj] Finished exporting %s in %lu ms\n",
fileName.substr( fileName.find( "pcb_export" ) - 1 ).c_str(), fileName.substr( fileName.find( "pcb_export" ) - 1 ).c_str(),
std::chrono::duration_cast< std::chrono::milliseconds >( end - start ).count() ); (unsigned long)std::chrono::duration_cast< std::chrono::milliseconds >( end - start ).count() );
return fileName; return fileName;
} }
@ -128,7 +128,7 @@ private:
std::to_string( mesh.indices[ i + 1 ] + indicesOffset + 1 ) << ' ' + std::to_string( mesh.indices[ i + 1 ] + indicesOffset + 1 ) << ' ' +
std::to_string( mesh.indices[ i + 2 ] + indicesOffset + 1 ) << '\n'; std::to_string( mesh.indices[ i + 2 ] + indicesOffset + 1 ) << '\n';
} }
indicesOffset += mesh.verts.size() / 3; indicesOffset += (int)mesh.verts.size() / 3;
} }
} }
//of.flush(); //of.flush();

View file

@ -121,7 +121,7 @@ struct PCB_FILE
/* printf( "\tnum_v16: %i, num_indices: %i, num_vertices: %i\n\n", /* printf( "\tnum_v16: %i, num_indices: %i, num_vertices: %i\n\n",
block_entry.header.num_v16, block_entry.header.num_indices, block_entry.header.num_vertices );*/ block_entry.header.num_v16, block_entry.header.num_indices, block_entry.header.num_vertices );*/
int doffset = sizeof( block_entry.header ) + offset; int doffset = sizeof( block_entry.header ) + offset;
uint16_t block_size = sizeof( block_entry.header ) + uint16_t block_size = (uint16_t)sizeof( block_entry.header ) +
block_entry.header.num_vertices * 3 * 4 + block_entry.header.num_vertices * 3 * 4 +
block_entry.header.num_v16 * 6 + block_entry.header.num_v16 * 6 +
block_entry.header.num_indices * 6; block_entry.header.num_indices * 6;