cosmetic fixes.

This commit is contained in:
Vitor Santos Costa 2011-09-01 06:20:21 -07:00
parent 521d65c058
commit 11a84ec0a2
2 changed files with 14 additions and 3 deletions

View File

@ -43,7 +43,8 @@ typedef enum {
UNKNOWN_DBREF = 7, UNKNOWN_DBREF = 7,
BAD_ATOM = 8, BAD_ATOM = 8,
MISMATCH = 9, MISMATCH = 9,
INCONSISTENT_CPRED = 10 INCONSISTENT_CPRED = 10,
BAD_READ = 11
} qlfr_err_t; } qlfr_err_t;
static char * static char *
@ -616,7 +617,11 @@ RestoreAtomList(Atom atm USES_REGS)
static size_t static size_t
read_bytes(IOSTREAM *stream, void *ptr, size_t sz) read_bytes(IOSTREAM *stream, void *ptr, size_t sz)
{ {
return Sfread(ptr, sz, 1, stream); size_t bytes_read;
if ((bytes_read = Sfread(ptr, sz, 1, stream)) < sz) {
ERROR(BAD_READ);
}
return sz;
} }
static unsigned char static unsigned char
@ -1024,5 +1029,8 @@ void Yap_InitQLYR(void)
{ {
Yap_InitCPred("$qload_module_preds", 1, p_read_module_preds, SyncPredFlag|HiddenPredFlag|UserCPredFlag); Yap_InitCPred("$qload_module_preds", 1, p_read_module_preds, SyncPredFlag|HiddenPredFlag|UserCPredFlag);
Yap_InitCPred("$qload_program", 1, p_read_program, SyncPredFlag|HiddenPredFlag|UserCPredFlag); Yap_InitCPred("$qload_program", 1, p_read_program, SyncPredFlag|HiddenPredFlag|UserCPredFlag);
if (FALSE) {
restore_codes();
}
} }

View File

@ -637,7 +637,7 @@ save_module(IOSTREAM *stream, Term mod) {
return 1; return 1;
} }
int static int
save_header(IOSTREAM *stream) save_header(IOSTREAM *stream)
{ {
char msg[256]; char msg[256];
@ -723,5 +723,8 @@ void Yap_InitQLY(void)
{ {
Yap_InitCPred("$qsave_module_preds", 2, p_save_module_preds, SyncPredFlag|HiddenPredFlag|UserCPredFlag); Yap_InitCPred("$qsave_module_preds", 2, p_save_module_preds, SyncPredFlag|HiddenPredFlag|UserCPredFlag);
Yap_InitCPred("$qsave_program", 1, p_save_program, SyncPredFlag|HiddenPredFlag|UserCPredFlag); Yap_InitCPred("$qsave_program", 1, p_save_program, SyncPredFlag|HiddenPredFlag|UserCPredFlag);
if (FALSE) {
restore_codes();
}
} }