summarylogtreecommitdiffstats
path: root/eof.diff
blob: d4e54c2f6de2c1057540da2c79b2fc50ca27c40f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
--- binwrap.cpp	2003/03/08 16:02:34	1.10
+++ binwrap.cpp	2009/09/29 22:06:39	1.11
@@ -14,7 +14,7 @@
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  *
  * binwrap.cpp - Binary I/O wrapper, using standard iostreams library
- * Copyright (C) 2002, 2003 Simon Peter <dn.tlp@gmx.net>
+ * Copyright (C) 2002, 2003, 2009 Simon Peter <dn.tlp@gmx.net>
  */
 
 #include "binwrap.h"
@@ -47,9 +47,12 @@
 {
   if(!in) { err = NotOpen; return 0; }
 
-  int i = in->get();
-  if(i == EOF) err |= Eof;
-  return (Byte)i;
+  if(!in->eof()) {
+    return (Byte)in->get();
+  } else {
+    err |= Eof;
+    return 0;
+  }
 }
 
 long biniwstream::pos()