Resolve most compiler warnings (#1053)

This commit is contained in:
David Markowitz 2023-04-12 09:48:20 -07:00 committed by GitHub
parent ce51438bc8
commit 4734996c7c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 23 additions and 10 deletions

View File

@ -65,6 +65,15 @@ void RakNet::BitStream::Write<AMFValue*>(AMFValue* value) {
this->Write((AMFArrayValue*)value); this->Write((AMFArrayValue*)value);
break; break;
} }
case AMFObject:
case AMFXML:
case AMFByteArray:
case AMFVectorInt:
case AMFVectorUInt:
case AMFVectorDouble:
case AMFVectorObject:
case AMFDictionary:
break;
} }
} }
} }

View File

@ -111,7 +111,7 @@ static void ErrorCallback(void* data, const char* msg, int errnum) {
void GenerateDump() { void GenerateDump() {
std::string cmd = "sudo gcore " + std::to_string(getpid()); std::string cmd = "sudo gcore " + std::to_string(getpid());
system(cmd.c_str()); int ret = system(cmd.c_str()); // Saving a return just to prevent warning
} }
void CatchUnhandled(int sig) { void CatchUnhandled(int sig) {

View File

@ -47,6 +47,10 @@ AssetManager::AssetManager(const std::filesystem::path& path) {
this->LoadPackIndex(); this->LoadPackIndex();
break; break;
} }
case eAssetBundleType::None:
case eAssetBundleType::Unpacked: {
break;
}
} }
} }
@ -111,7 +115,7 @@ bool AssetManager::GetFile(const char* name, char** data, uint32_t* len) {
*len = ftell(file); *len = ftell(file);
*data = (char*)malloc(*len); *data = (char*)malloc(*len);
fseek(file, 0, SEEK_SET); fseek(file, 0, SEEK_SET);
fread(*data, sizeof(uint8_t), *len, file); int32_t readInData = fread(*data, sizeof(uint8_t), *len, file);
fclose(file); fclose(file);
return true; return true;

View File

@ -77,7 +77,7 @@ bool Pack::ReadFileFromPack(uint32_t crc, char** data, uint32_t* len) {
if (!isCompressed) { if (!isCompressed) {
char* tempData = (char*)malloc(pkRecord.m_UncompressedSize); char* tempData = (char*)malloc(pkRecord.m_UncompressedSize);
fread(tempData, sizeof(uint8_t), pkRecord.m_UncompressedSize, file); int32_t readInData = fread(tempData, sizeof(uint8_t), pkRecord.m_UncompressedSize, file);
*data = tempData; *data = tempData;
*len = pkRecord.m_UncompressedSize; *len = pkRecord.m_UncompressedSize;
@ -97,11 +97,11 @@ bool Pack::ReadFileFromPack(uint32_t crc, char** data, uint32_t* len) {
if (currentReadPos >= pkRecord.m_UncompressedSize) break; if (currentReadPos >= pkRecord.m_UncompressedSize) break;
uint32_t size; uint32_t size;
fread(&size, sizeof(uint32_t), 1, file); int32_t readInData = fread(&size, sizeof(uint32_t), 1, file);
pos += 4; // Move pointer position 4 to the right pos += 4; // Move pointer position 4 to the right
char* chunk = (char*)malloc(size); char* chunk = (char*)malloc(size);
fread(chunk, sizeof(int8_t), size, file); int32_t readInData2 = fread(chunk, sizeof(int8_t), size, file);
pos += size; // Move pointer position the amount of bytes read to the right pos += size; // Move pointer position the amount of bytes read to the right
int32_t err; int32_t err;

View File

@ -234,6 +234,7 @@ void RebuildComponent::Update(float deltaTime) {
} }
break; break;
} }
case REBUILD_RESETTING: break;
} }
} }

View File

@ -2570,7 +2570,7 @@ void GameMessages::HandleBBBSaveRequest(RakNet::BitStream* inStream, Entity* ent
//We runs this in async because the http library here is blocking, meaning it'll halt the thread. //We runs this in async because the http library here is blocking, meaning it'll halt the thread.
//But we don't want the server to go unresponsive, because then the client would disconnect. //But we don't want the server to go unresponsive, because then the client would disconnect.
std::async(std::launch::async, [&]() { auto returnVal = std::async(std::launch::async, [&]() {
//We need to get a new ID for our model first: //We need to get a new ID for our model first:
ObjectIDManager::Instance()->RequestPersistentID([=](uint32_t newID) { ObjectIDManager::Instance()->RequestPersistentID([=](uint32_t newID) {

View File

@ -130,7 +130,7 @@ void Mail::HandleMailStuff(RakNet::BitStream* packet, const SystemAddress& sysAd
int mailStuffID = 0; int mailStuffID = 0;
packet->Read(mailStuffID); packet->Read(mailStuffID);
std::async(std::launch::async, [packet, &sysAddr, entity, mailStuffID]() { auto returnVal = std::async(std::launch::async, [packet, &sysAddr, entity, mailStuffID]() {
Mail::MailMessageID stuffID = MailMessageID(mailStuffID); Mail::MailMessageID stuffID = MailMessageID(mailStuffID);
switch (stuffID) { switch (stuffID) {
case MailMessageID::AttachmentCollect: case MailMessageID::AttachmentCollect:
@ -393,7 +393,7 @@ void Mail::HandleMailRead(RakNet::BitStream* packet, const SystemAddress& sysAdd
} }
void Mail::HandleNotificationRequest(const SystemAddress& sysAddr, uint32_t objectID) { void Mail::HandleNotificationRequest(const SystemAddress& sysAddr, uint32_t objectID) {
std::async(std::launch::async, [&]() { auto returnVal = std::async(std::launch::async, [&]() {
sql::PreparedStatement* stmt = Database::CreatePreppedStmt("SELECT id FROM mail WHERE receiver_id=? AND was_read=0"); sql::PreparedStatement* stmt = Database::CreatePreppedStmt("SELECT id FROM mail WHERE receiver_id=? AND was_read=0");
stmt->setUInt(1, objectID); stmt->setUInt(1, objectID);
sql::ResultSet* res = stmt->executeQuery(); sql::ResultSet* res = stmt->executeQuery();

View File

@ -173,9 +173,8 @@ TEST(dCommonTests, AMFDeserializeAMFArrayTest) {
/** /**
* @brief This test checks that if we recieve an unimplemented AMFValueType * @brief This test checks that if we recieve an unimplemented AMFValueType
* we correctly throw an error and can actch it. * we correctly throw an error and can actch it.
* * Yes this leaks memory.
*/ */
#pragma message("-- The AMFDeserializeUnimplementedValuesTest causes a known memory leak of 880 bytes since it throws errors! --")
TEST(dCommonTests, AMFDeserializeUnimplementedValuesTest) { TEST(dCommonTests, AMFDeserializeUnimplementedValuesTest) {
std::vector<AMFValueType> unimplementedValues = { std::vector<AMFValueType> unimplementedValues = {
AMFValueType::AMFXMLDoc, AMFValueType::AMFXMLDoc,