PVS: V1024 The 'file' stream is checked for EOF before reading from it, but is not checked after reading. Potential use of invalid data
This commit is contained in:
@@ -155,9 +155,8 @@ App::DocumentObjectExecReturn *FeaturePage::execute(void)
|
||||
ostringstream ofile;
|
||||
string tempendl = "--endOfLine--";
|
||||
|
||||
while (!file.eof())
|
||||
while (getline (file,line))
|
||||
{
|
||||
getline (file,line);
|
||||
// check if the marker in the template is found
|
||||
if(line.find("<!-- DrawingContent -->") == string::npos)
|
||||
// if not - write through
|
||||
@@ -259,8 +258,7 @@ std::vector<std::string> FeaturePage::getEditableTextsFromTemplate(void) const {
|
||||
}
|
||||
string tline, tfrag;
|
||||
ifstream tfile (tfi.filePath().c_str());
|
||||
while (!tfile.eof()) {
|
||||
getline (tfile,tline);
|
||||
while (getline (tfile,tline)) {
|
||||
tfrag += tline;
|
||||
tfrag += "--endOfLine--";
|
||||
}
|
||||
|
||||
@@ -88,10 +88,8 @@ void pagesize(string & page_template, int dims[4], int block[4])
|
||||
|
||||
try
|
||||
{
|
||||
while (!file.eof())
|
||||
while (getline (file,line))
|
||||
{
|
||||
getline (file,line);
|
||||
|
||||
if (line.find("<!-- Working space") != string::npos)
|
||||
{
|
||||
sscanf(line.c_str(), "%*s %*s %*s %d %d %d %d", &dims[0], &dims[1], &dims[2], &dims[3]); //eg " <!-- Working space 10 10 410 287 -->"
|
||||
|
||||
Reference in New Issue
Block a user