Fix compiler warnings.

This commit is contained in:
momo5502 2016-02-07 02:31:30 +01:00
parent 4a5743c67b
commit 0a54d940bb
3 changed files with 6 additions and 6 deletions

View File

@ -97,7 +97,7 @@ workspace "iw4x"
-- Pre-compiled header -- Pre-compiled header
pchheader "STDInclude.hpp" -- must be exactly same as used in #include directives pchheader "STDInclude.hpp" -- must be exactly same as used in #include directives
pchsource "src/STDInclude.cpp" -- real path pchsource "src/STDInclude.cpp" -- real path
buildoptions { "-Zm200" } -- allocate ~150mb memory for the precompiled header. This should be enough, increase if necessary buildoptions { "-Zm88" }
-- Dependency on zlib, json11 and asio -- Dependency on zlib, json11 and asio
links { "zlib", "json11", "pdcurses", "libtomcrypt", "libtommath" } links { "zlib", "json11", "pdcurses", "libtomcrypt", "libtommath" }

View File

@ -86,7 +86,7 @@ namespace Components
path.append(".ff"); path.append(".ff");
} }
return (GetFileAttributes(path.data()) != INVALID_FILE_ATTRIBUTES); return std::ifstream(path.data()).good();
} }
const char* FastFiles::GetZoneLocation(const char* file) const char* FastFiles::GetZoneLocation(const char* file)
@ -104,7 +104,7 @@ namespace Components
} }
// Check if FastFile exists // Check if FastFile exists
if (GetFileAttributes(absoluteFile.data()) != INVALID_FILE_ATTRIBUTES) if (std::ifstream(absoluteFile.data()).good())
{ {
return Utils::VA("%s", path.data()); return Utils::VA("%s", path.data());
} }

View File

@ -26,7 +26,7 @@ namespace Components
void StructuredData::PatchPlayerDataEnum(Game::structuredDataDef_t* data, StructuredData::PlayerDataType type, std::vector<StructuredData::EnumEntry>& entries) void StructuredData::PatchPlayerDataEnum(Game::structuredDataDef_t* data, StructuredData::PlayerDataType type, std::vector<StructuredData::EnumEntry>& entries)
{ {
if (!data || !data->data) return; if (!data || !data->data || type >= StructuredData::ENUM_MAX) return;
Game::structuredDataEnum_t* dataEnum = &data->data->enums[type]; Game::structuredDataEnum_t* dataEnum = &data->data->enums[type];
@ -74,9 +74,9 @@ namespace Components
} }
} }
for (unsigned int j = dataEnum->numIndices + i; j > pos; j--) for (unsigned int j = dataEnum->numIndices + i; j > pos && j < static_cast<unsigned int>(StructuredData::IndexCount[type]); j--)
{ {
StructuredData::Indices[type][j] = StructuredData::Indices[type][j - 1]; memcpy(&StructuredData::Indices[type][j], &StructuredData::Indices[type][j - 1], sizeof(Game::structuredDataEnumIndex_t));
} }
StructuredData::Indices[type][pos].index = entries[i].statOffset + lastIndex; StructuredData::Indices[type][pos].index = entries[i].statOffset + lastIndex;