Fix incorrect uses of feof() (#957)
Using feof() as the while loop condition for detecting the end of the file is incorrect.
This commit is contained in:
@ -236,9 +236,8 @@ public plugin_precache()
|
||||
if( fp )
|
||||
{
|
||||
new xvarname[32], xvarid
|
||||
while( !feof(fp) )
|
||||
while( fgets(fp, buffer, charsmax(buffer)) )
|
||||
{
|
||||
fgets(fp, buffer, charsmax(buffer))
|
||||
trim(buffer)
|
||||
if( buffer[0] != ';' )
|
||||
{
|
||||
@ -257,9 +256,8 @@ public plugin_precache()
|
||||
if( fp )
|
||||
{
|
||||
new szSoundKey[32], szSoundFile[SOUNDFILE_PATH_MAXLEN]
|
||||
while( !feof(fp) )
|
||||
while( fgets(fp, buffer, charsmax(buffer)) )
|
||||
{
|
||||
fgets(fp, buffer, charsmax(buffer))
|
||||
trim(buffer)
|
||||
if( buffer[0] != ';' && parse(buffer, szSoundKey, charsmax(szSoundKey), szSoundFile, charsmax(szSoundFile)) == 2 )
|
||||
{
|
||||
|
@ -594,9 +594,11 @@ bool:loadSettings(const filename[])
|
||||
arrayset(RestrictedBotEquipAmmos, '0', charsmax(RestrictedBotEquipAmmos));
|
||||
arrayset(RestrictedBotWeapons, '0', charsmax(RestrictedBotWeapons));
|
||||
|
||||
while (!feof(fp))
|
||||
while (fgets(fp, lineRead, charsmax(lineRead)))
|
||||
{
|
||||
if (fgets(fp, lineRead, charsmax(lineRead)) - trim(lineRead) <= 0)
|
||||
trim(lineRead)
|
||||
|
||||
if (!lineRead[0])
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
Reference in New Issue
Block a user