1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-08-14 13:30:48 +03:00

0031972: Application Framework, FSD_CmpFile - exception on reading file in old persistence format with Windows EOL

FSD_CmpFile::ReadLine()/FSD_CmpFile::ReadString() now use TCollection_AsciiString::Trunc()
instead of ill-formed character assignment to '\0'.
This commit is contained in:
kgv
2020-12-02 14:28:38 +03:00
committed by bugmaster
parent 716cf4d96b
commit 6078550944
2 changed files with 60 additions and 2 deletions

View File

@@ -145,7 +145,9 @@ void FSD_CmpFile::ReadLine(TCollection_AsciiString& buffer)
TCollection_AsciiString aBuf('\0');
FSD_File::ReadLine(aBuf);
for (Standard_Integer lv = aBuf.Length(); lv >= 1 && (aBuf.Value(lv) == '\r' || (aBuf.Value(lv) == '\n')); lv--)
aBuf.SetValue(lv, '\0');
{
aBuf.Trunc (lv - 1);
}
buffer = aBuf;
}
@@ -214,7 +216,9 @@ void FSD_CmpFile::ReadString(TCollection_AsciiString& buffer)
TCollection_AsciiString aBuf('\0');
FSD_File::ReadString(aBuf);
for (Standard_Integer lv = aBuf.Length(); lv >= 1 && (aBuf.Value(lv) == '\r' || (aBuf.Value(lv) == '\n')); lv--)
aBuf.SetValue(lv, '\0');
{
aBuf.Trunc (lv - 1);
}
buffer = aBuf;
}