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:
@@ -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;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user