aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuiz Henrique de Figueiredo <lhf@tecgraf.puc-rio.br>1996-11-18 09:18:29 -0200
committerLuiz Henrique de Figueiredo <lhf@tecgraf.puc-rio.br>1996-11-18 09:18:29 -0200
commit81411e8913a5aabd0c58926c7a399e1a6de4fe90 (patch)
treeaa1499ea1adbba98af8db60ca98edd93f1e76d1d
parent62aa717f7eb522e7674b01720ec3ba73f84ccb07 (diff)
downloadlua-81411e8913a5aabd0c58926c7a399e1a6de4fe90.tar.gz
lua-81411e8913a5aabd0c58926c7a399e1a6de4fe90.tar.bz2
lua-81411e8913a5aabd0c58926c7a399e1a6de4fe90.zip
headers includes sizeof(Word) not sizeof(int)
-rw-r--r--undump.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/undump.c b/undump.c
index e32ec4e5..a3eb881f 100644
--- a/undump.c
+++ b/undump.c
@@ -3,7 +3,7 @@
3** load bytecodes from files 3** load bytecodes from files
4*/ 4*/
5 5
6char* rcs_undump="$Id: undump.c,v 1.19 1996/11/14 15:00:32 lhf Exp lhf $"; 6char* rcs_undump="$Id: undump.c,v 1.20 1996/11/16 20:14:23 lhf Exp lhf $";
7 7
8#include <stdio.h> 8#include <stdio.h>
9#include <string.h> 9#include <string.h>
@@ -255,12 +255,15 @@ static void LoadHeader(FILE* D) /* TODO: error handling */
255 version=getc(D); 255 version=getc(D);
256 if (version>0x23) /* after 2.5 */ 256 if (version>0x23) /* after 2.5 */
257 { 257 {
258 int oldsizeofI=getc(D); 258 int oldsizeofW=getc(D);
259 int oldsizeofF=getc(D); 259 int oldsizeofF=getc(D);
260 int oldsizeofP=getc(D); 260 int oldsizeofP=getc(D);
261 if (oldsizeofF!=4) lua_error("sizeof(float)!=4. not an IEEE machine?"); 261 if (oldsizeofW!=2)
262 lua_error("cannot load binary file created on machine with sizeof(Word)!=2");
263 if (oldsizeofF!=4)
264 lua_error("cannot load binary file created on machine with sizeof(float)!=4. not an IEEE machine?");
262 if (oldsizeofP!=sizeof(TFunc*)) /* TODO: pack */ 265 if (oldsizeofP!=sizeof(TFunc*)) /* TODO: pack */
263 lua_error("different pointer sizes"); 266 lua_error("cannot load binary file: different pointer sizes");
264 } 267 }
265 fread(&w,sizeof(w),1,D); /* test word */ 268 fread(&w,sizeof(w),1,D); /* test word */
266 if (w!=tw) 269 if (w!=tw)