Commit c0b1738d by Richard Kenner Committed by Geert Bosch

* gmem.c (__gnat_gmem_read_next): Properly check for EOF

From-SVN: r46552
parent 5b09c153
2001-10-26 Richard Kenner <kenner@gnat.com> 2001-10-26 Richard Kenner <kenner@gnat.com>
* gmem.c (__gnat_gmem_read_next): Properly check for EOF
2001-10-26 Richard Kenner <kenner@gnat.com>
* decl.c (validate_size): Modify message for bad size to avoid * decl.c (validate_size): Modify message for bad size to avoid
implication that compiler is modifying the size. implication that compiler is modifying the size.
......
...@@ -112,7 +112,7 @@ __gnat_gmem_initialize (dumpname) ...@@ -112,7 +112,7 @@ __gnat_gmem_initialize (dumpname)
fclose (gmemfile); fclose (gmemfile);
return 0; return 0;
} }
return 1; return 1;
} }
...@@ -140,16 +140,17 @@ __gnat_gmem_read_next (buf) ...@@ -140,16 +140,17 @@ __gnat_gmem_read_next (buf)
{ {
void *addr; void *addr;
int size; int size;
char c; int j;
if ((c = fgetc (gmemfile)) == EOF) j = fgetc (gmemfile);
if (j == EOF)
{ {
fclose (gmemfile); fclose (gmemfile);
sprintf (buf, "Program exited."); sprintf (buf, "Program exited.");
} }
else else
{ {
switch (c) switch (j)
{ {
case 'A' : case 'A' :
fread (&addr, sizeof (char *), 1, gmemfile); fread (&addr, sizeof (char *), 1, gmemfile);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment