Skip to content

Commit

Permalink
Replace feof() with read check, and add EOF check - EOF is subtly wro…
Browse files Browse the repository at this point in the history
…ng, but WEOF doesn't work here due to sign difference (fixes #21)
  • Loading branch information
TinoDidriksen committed Jun 6, 2019
1 parent 4165215 commit 2a77a50
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions lrx_processor.cc
Expand Up @@ -798,9 +798,9 @@ LRXProcessor::processME(FILE *input, FILE *output)
vector<State*> alive_states ;
alive_states.push_back(new State(*initial_state));

while(!feof(input))
int val = 0;
while((val = fgetwc_unlocked(input)) != EOF)
{
int val = fgetwc_unlocked(input);

if(nullFlush && val == L'\0')
{
Expand Down Expand Up @@ -828,7 +828,7 @@ LRXProcessor::processME(FILE *input, FILE *output)
// Read in target equivalences
wstring trad = L"";
val = fgetwc_unlocked(input);
while(val != L'$')
while(val != L'$' && val != EOF)
{
if(val != L'$')
{
Expand Down

0 comments on commit 2a77a50

Please sign in to comment.