Skip to content

Commit 9c79c09

Browse files
committed
Plugins (dancingparticles): Use result of fgets() for condition of read loop.
1 parent 31e7eaa commit 9c79c09

File tree

2 files changed

+3
-7
lines changed

2 files changed

+3
-7
lines changed

libvisual-plugins/plugins/actor/dancingparticles/epic.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -62,8 +62,8 @@ void loadepic2(const char *file)
6262
}
6363
numCenters2 = 0;
6464
totLength=0;
65-
fgets(buf,255,f);
66-
while(!feof(f))
65+
66+
while(fgets(buf,sizeof(buf),f))
6767
{
6868

6969
if(buf[0]=='\\')
@@ -85,7 +85,6 @@ void loadepic2(const char *file)
8585

8686

8787
}
88-
fgets(buf,255,f);
8988
}
9089
fclose(f);
9190
if(!numCenters2)

libvisual-plugins/plugins/actor/dancingparticles/parameters.cpp

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -105,9 +105,7 @@ int load_parameters(const char * filename)
105105
freeparams();
106106
p_parsed.name = 0;
107107

108-
fgets(buf,1024, f);
109-
110-
while(!feof(f))
108+
while(fgets(buf,sizeof(buf),f))
111109
{
112110
ptr = buf;
113111
word = nextword(ptr);
@@ -209,7 +207,6 @@ int load_parameters(const char * filename)
209207
}
210208
}
211209
}
212-
fgets(buf,1024, f);
213210
}
214211
if(mode == 1)
215212
{

0 commit comments

Comments
 (0)