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 -->"
|
||||
|
||||
@@ -87,8 +87,7 @@ App::DocumentObjectExecReturn *LuxProject::execute(void)
|
||||
ofstream ofile(tempName.c_str());
|
||||
|
||||
// copy the input of the resource file
|
||||
while (!file.eof()) {
|
||||
getline (file,line);
|
||||
while (getline (file,line)) {
|
||||
// check if the marker in the template is found
|
||||
if(line.find("#RaytracingContent") == string::npos) {
|
||||
if(line.find("#RaytracingCamera") == string::npos) {
|
||||
|
||||
@@ -86,8 +86,7 @@ App::DocumentObjectExecReturn *RayProject::execute(void)
|
||||
ofstream ofile(tempName.c_str());
|
||||
|
||||
// copy the input of the resource file
|
||||
while (!file.eof()) {
|
||||
getline (file,line);
|
||||
while (getline (file,line)) {
|
||||
// check if the marker in the template is found
|
||||
if(line.find("//RaytracingContent") == string::npos)
|
||||
// if not - write through
|
||||
|
||||
@@ -156,9 +156,8 @@ App::DocumentObjectExecReturn * DrawSVGTemplate::execute(void)
|
||||
//remove DrawingContent comment line
|
||||
//change line endings
|
||||
//capture TitleBlock dimensions
|
||||
while (!inTemplate.eof())
|
||||
while (getline(inTemplate,line))
|
||||
{
|
||||
getline(inTemplate,line);
|
||||
// copy every line except the DrawingContent comment?
|
||||
if(line.find("<!-- DrawingContent -->") == string::npos) {
|
||||
// if not - write through
|
||||
@@ -287,8 +286,7 @@ std::map<std::string, std::string> DrawSVGTemplate::getEditableTextsFromTemplate
|
||||
}
|
||||
string tline, tfrag;
|
||||
ifstream tfile (tfi.filePath().c_str());
|
||||
while (!tfile.eof()) {
|
||||
getline (tfile,tline);
|
||||
while (getline (tfile,tline)) {
|
||||
tfrag += tline;
|
||||
tfrag += "--endOfLine--";
|
||||
}
|
||||
|
||||
@@ -154,9 +154,8 @@ void QGISVGTemplate::createClickHandles(void)
|
||||
|
||||
//read all of PageResult into oStream (except the DrawingContent marker comment - why??)
|
||||
std::ifstream ifile (fi.filePath().c_str());
|
||||
while (!ifile.eof())
|
||||
while (std::getline(ifile,line))
|
||||
{
|
||||
std::getline(ifile,line);
|
||||
// check if the marker in the template is found
|
||||
if(line.find("<!-- DrawingContent -->") == std::string::npos) {
|
||||
// if not - write line to oStream
|
||||
|
||||
Reference in New Issue
Block a user