Fix warnings

This commit is contained in:
Raymond S Brand 2020-12-19 15:10:10 -05:00 committed by Leonardo Zide
parent fe15bc03dd
commit fd24accea7
2 changed files with 3 additions and 3 deletions

View file

@ -356,7 +356,7 @@ bool lcPiecesLibrary::OpenArchive(std::unique_ptr<lcFile> File, lcZipFileType Zi
mTextures.push_back(Texture);
*Dst = 0;
strncpy(Texture->mName, Name + (ZipFileType == LC_ZIPFILE_OFFICIAL ? 21 : 15), sizeof(Texture->mName));
strncpy(Texture->mName, Name + (ZipFileType == LC_ZIPFILE_OFFICIAL ? 21 : 15), sizeof(Texture->mName)-1);
Texture->mName[sizeof(Texture->mName) - 1] = 0;
}
}
@ -384,7 +384,7 @@ bool lcPiecesLibrary::OpenArchive(std::unique_ptr<lcFile> File, lcZipFileType Zi
{
Info = new PieceInfo();
strncpy(Info->mFileName, FileInfo.file_name + (Name - NameBuffer), sizeof(Info->mFileName));
strncpy(Info->mFileName, FileInfo.file_name + (Name - NameBuffer), sizeof(Info->mFileName)-1);
Info->mFileName[sizeof(Info->mFileName) - 1] = 0;
mPieces[Name] = Info;

View file

@ -37,7 +37,7 @@ public:
explicit lcLibraryPrimitive(QString&& FileName, const char* Name, lcZipFileType ZipFileType, quint32 ZipFileIndex, bool Stud, bool SubFile)
: mFileName(std::move(FileName))
{
strncpy(mName, Name, sizeof(mName));
strncpy(mName, Name, sizeof(mName)-1);
mName[sizeof(mName) - 1] = 0;
mZipFileType = ZipFileType;