From 4cb155e3f6bbc69b604d8e6c76a2c52842217f6a Mon Sep 17 00:00:00 2001 From: sam Date: Mon, 15 Sep 2003 12:53:36 +0000 Subject: [PATCH] * Fixed all signed/unsigned and undeclared function warnings. git-svn-id: svn://svn.zoy.org/elk/trunk@158 55e467fa-43c5-0310-a8a2-de718669efc6 --- include/cstring.h | 4 ++-- include/extern.h | 21 +++++++++++++-------- include/intern.h | 4 +--- include/object.h | 8 ++++---- lib/misc/monitor.c | 1 + lib/misc/regexp.c | 3 ++- lib/unix/fdescr.c | 3 ++- lib/unix/file.c | 4 ++-- lib/unix/system.c | 2 +- lib/unix/unix.c | 2 +- lib/unix/unix.h | 3 +++ lib/xlib/graphics.c | 2 +- lib/xlib/pixmap.c | 4 ++-- lib/xlib/type.c | 2 +- lib/xlib/xlib.h | 3 ++- lib/xwidgets/motif/support.d | 6 +++--- lib/xwidgets/widget.c | 2 ++ src/bool.c | 3 ++- src/cont.c | 2 +- src/cstring.c | 7 ++++--- src/dump-hp9k.c | 2 +- src/feature.c | 2 +- src/heap-gen.c | 4 ++-- src/io.c | 12 +++++++----- src/list.c | 6 +++--- src/load.c | 2 +- src/print.c | 27 ++++++++++++++------------- src/stab-bsd.c | 2 ++ src/stab-ecoff.c | 2 ++ src/stab-elf.c | 10 ++++++---- src/stab-hp9k300.c | 2 ++ src/stab-hp9k800.c | 2 ++ src/string.c | 19 +++++++++++-------- src/symbol.c | 12 ++++++------ src/vector.c | 14 +++++++------- 35 files changed, 117 insertions(+), 87 deletions(-) diff --git a/include/cstring.h b/include/cstring.h index 32efb3b..857e74e 100644 --- a/include/cstring.h +++ b/include/cstring.h @@ -32,7 +32,7 @@ */ #define Get_String_Stack(_from,_to) {\ - int _len;\ + unsigned int _len;\ Check_Type(_from, T_String);\ _len = STRING(_from)->size;\ Alloca ((_to), char*, _len+1);\ @@ -41,7 +41,7 @@ } #define Get_Strsym_Stack(_from,_to) {\ - int _len;\ + unsigned int _len;\ if (TYPE(_from) == T_Symbol)\ (_from) = SYMBOL(_from)->name;\ else if (TYPE(_from) != T_String)\ diff --git a/include/extern.h b/include/extern.h index 9cc0068..36666a6 100644 --- a/include/extern.h +++ b/include/extern.h @@ -39,6 +39,7 @@ extern Object P_Autoload P_((Object, Object)); */ extern Object Make_Uninitialized_Bignum P_((int)); extern void Bignum_Normalize_In_Place P_((struct S_Bignum *)); +extern double Bignum_To_Double P_((Object)); /* Boolean operators */ @@ -119,6 +120,7 @@ extern const char *Error_Tag; /* will be removed in the near future */ extern const char *Get_Error_Tag P_((void)); extern void Set_Error_Tag P_((const char *)); extern void Set_App_Name P_((char *)); +extern void Reader_Error P_((Object, char *)) elk_attribute(__noreturn__); /* Interrupts */ @@ -172,7 +174,7 @@ extern Object P_Close_Output_Port P_((Object)); extern Object P_Port_Line_Number P_((Object)); extern Object Terminate_File P_((Object)); extern Object Make_Port P_((int, FILE*, Object)); -extern int Path_Max P_((void)); +extern unsigned int Path_Max P_((void)); /* Loading of files */ @@ -236,7 +238,7 @@ extern Object P_Memv P_((Object, Object)); extern Object P_Member P_((Object, Object)); extern Object P_Make_List P_((Object, Object)); extern Object Copy_List P_((Object)); -extern int Fast_Length P_((Object)); +extern unsigned int Fast_Length P_((Object)); extern Object Const_Cons P_((Object, Object)); /* Startup and termination @@ -244,6 +246,7 @@ extern Object Const_Cons P_((Object, Object)); extern Object P_Command_Line_Args P_((void)); extern Object P_Exit P_((int, Object*)); extern void Elk_Init P_((int, char **av, int, char *)); +extern void Exit_Handler P_((void)); /* malloc() and realloc() */ @@ -341,9 +344,9 @@ extern Object P_Get_Output_String P_((Object)); extern void Check_Output_Port P_((Object)); extern void Discard_Output P_((Object)); extern void Printf P_((Object, const char *, ...)); -extern void Print_Object P_((Object, Object, int, int, int)); +extern void Print_Object P_((Object, Object, int, int, unsigned int)); extern void General_Print_Object P_((Object, Object, int)); -extern void Format P_((Object, const char*, int, int, Object*)); +extern void Format P_((Object, const char*, unsigned int, int, Object*)); extern int Saved_Errno; /* Evaluator, procedures, macros @@ -406,8 +409,8 @@ extern Object P_Begin1 P_((Object)); /* Strings */ -extern Object Make_String P_((const char*, int)); -extern Object Make_Const_String P_((const char*, int)); +extern Object Make_String P_((const char*, unsigned int)); +extern Object Make_Const_String P_((const char*, unsigned int)); extern Object P_Make_String P_((int, Object*)); extern Object P_Stringp P_((Object)); extern Object P_String P_((int, Object*)); @@ -434,6 +437,8 @@ extern Object P_Substring_Fill P_((Object, Object, Object, Object)); extern Object P_String_Fill P_((Object, Object)); extern Object P_Substringp P_((Object, Object)); extern Object P_CI_Substringp P_((Object, Object)); +extern int String_Getc P_((Object)); +extern void String_Ungetc P_((Object, register int)); /* Symbols, variables, frequently used Scheme objects */ @@ -478,8 +483,8 @@ extern int Define_Type P_((int, const char*, int (*)(Object), int, /* Vectors */ -extern Object Make_Vector P_((int, Object)); -extern Object Make_Const_Vector P_((int, Object)); +extern Object Make_Vector P_((unsigned int, Object)); +extern Object Make_Const_Vector P_((unsigned int, Object)); extern Object P_Make_Vector P_((int, Object*)); extern Object P_Vectorp P_((Object)); extern Object P_Vector P_((int, Object*)); diff --git a/include/intern.h b/include/intern.h index d2c7868..9c4c1e5 100644 --- a/include/intern.h +++ b/include/intern.h @@ -59,7 +59,6 @@ extern unsigned Bignum_To_Unsigned P_((Object)); extern unsigned long Bignum_To_Unsigned_Long P_((Object)); extern long Bignum_To_Long P_((Object)); extern Object Bignum_To_String P_((Object, int)); -extern double Bignum_To_Double P_((Object)); extern int Bignum_Equal P_((Object, Object)); extern int Bignum_Greater P_((Object, Object)); extern int Bignum_Less P_((Object, Object)); @@ -120,7 +119,6 @@ extern int Interpreter_Initialized, Was_Dumped; extern char *Brk_On_Dump; extern int Verb_Load, Verb_Init, Case_Insensitive; extern SYMTAB *The_Symbols; -extern void Exit_Handler P_((void)); extern char *Scm_Dir; extern char *Lib_Dir; #ifndef HAVE_ATEXIT @@ -158,7 +156,7 @@ extern Object Save_GC_Nodes P_((void)); /* string.c */ extern char Char_Map[]; -extern Object General_Make_String P_((const char*, int, int)); +extern Object General_Make_String P_((const char*, unsigned int, int)); /* symbol.c */ diff --git a/include/object.h b/include/object.h index 800e505..148295f 100644 --- a/include/object.h +++ b/include/object.h @@ -171,13 +171,13 @@ struct S_Pair { struct S_String { Object tag; - int size; + unsigned int size; char data[1]; }; struct S_Vector { Object tag; - int size; + unsigned int size; Object data[1]; }; @@ -242,7 +242,7 @@ struct S_Control { int reloc; #endif jmp_buf j; - int size; + unsigned int size; unsigned long int intrlevel; char stack[1]; /* must be word aligned */ }; @@ -257,7 +257,7 @@ struct S_Port { Object name; /* string */ short flags; char unread; - int ptr; + unsigned int ptr; FILE *file; unsigned int lno; int (*closefun) P_((FILE*)); diff --git a/lib/misc/monitor.c b/lib/misc/monitor.c index e860987..f656789 100644 --- a/lib/misc/monitor.c +++ b/lib/misc/monitor.c @@ -53,6 +53,7 @@ #include "config.h" #include +#include #include "scheme.h" diff --git a/lib/misc/regexp.c b/lib/misc/regexp.c index 97f5e26..7a32cd6 100644 --- a/lib/misc/regexp.c +++ b/lib/misc/regexp.c @@ -168,7 +168,8 @@ static Object P_Regexp_Exec(int argc, Object *argv) { char *str, msg[256]; Object r, m; size_t num; - int from, flags, ret; + unsigned int from; + int flags, ret; GC_Node; r = argv[0]; diff --git a/lib/unix/fdescr.c b/lib/unix/fdescr.c index 36f9929..7e7abcb 100644 --- a/lib/unix/fdescr.c +++ b/lib/unix/fdescr.c @@ -243,7 +243,8 @@ static Object Read_Write(int argc, Object *argv, int readflg) { Check_Type(argv[1], T_String); sp = STRING(argv[1]); if (argc == 3) { - if ((len = Get_Integer(argv[2])) < 0 || len > sp->size) + len = Get_Integer(argv[2]); + if (len < 0 || (unsigned int)len > sp->size) Range_Error(argv[2]); } else len = sp->size; if (readflg) diff --git a/lib/unix/file.c b/lib/unix/file.c index 91d76f5..b032ace 100644 --- a/lib/unix/file.c +++ b/lib/unix/file.c @@ -154,8 +154,8 @@ static Object P_Rename(Object fromfn, Object tofn) { static Object General_Stat(Object obj, Object ret, int l) { Object x; struct stat st; - char *s, *fn = 0; - int fd, result; + char *s, *fn = NULL; + int fd = -1, result; GC_Node; Check_Result_Vector(ret, 11); diff --git a/lib/unix/system.c b/lib/unix/system.c index d4157b0..a1d8f29 100644 --- a/lib/unix/system.c +++ b/lib/unix/system.c @@ -52,7 +52,7 @@ static SYMDESCR Limit_Syms[] = { }; static Object P_File_Limit(Object lim, Object f) { - int op, fd; + int op = 0, fd = -1; long ret; char *fn = 0; diff --git a/lib/unix/unix.c b/lib/unix/unix.c index d34169e..90002df 100644 --- a/lib/unix/unix.c +++ b/lib/unix/unix.c @@ -57,7 +57,7 @@ Object Syms_To_List(SYMDESCR *p) { return P_Reverse(ret); } -void Check_Result_Vector(Object x, int len) { +void Check_Result_Vector(Object x, unsigned int len) { Check_Type(x, T_Vector); if (VECTOR(x)->size != len) Primitive_Error("argument vector has the wrong length"); diff --git a/lib/unix/unix.h b/lib/unix/unix.h index c8f08cf..22daf4b 100644 --- a/lib/unix/unix.h +++ b/lib/unix/unix.h @@ -53,6 +53,9 @@ extern SYMDESCR Lseek_Syms[]; Object Integer_Pair P_((int, int)); Object Syms_To_List P_((SYMDESCR*)); +extern void Check_Result_Vector P_((Object, unsigned int)); +extern int Num_Filedescriptors P_(()); + #define Get_Filename_Or_Filedescr(obj,fd,fn) \ switch (TYPE(obj)) {\ case T_String: case T_Symbol:\ diff --git a/lib/xlib/graphics.c b/lib/xlib/graphics.c index c98f05b..311980a 100644 --- a/lib/xlib/graphics.c +++ b/lib/xlib/graphics.c @@ -89,7 +89,7 @@ static Object Internal_Draw_Points (Object d, Object gc, Object v, Drawable dr = Get_Drawable (d, &dpy); register XPoint *p; register int i, n; - int rel, sh; + int rel, sh = 0; Alloca_Begin; Check_Type (gc, T_Gc); diff --git a/lib/xlib/pixmap.c b/lib/xlib/pixmap.c index 384cf3a..87dd71e 100644 --- a/lib/xlib/pixmap.c +++ b/lib/xlib/pixmap.c @@ -89,7 +89,7 @@ static Object P_Create_Pixmap (Object d, Object w, Object h, Object depth) { static Object P_Create_Bitmap_From_Data (Object win, Object data, Object pw, Object ph) { - register int w, h; + register unsigned int w, h; Check_Type (win, T_Window); Check_Type (data, T_String); @@ -106,7 +106,7 @@ static Object P_Create_Pixmap_From_Bitmap_Data (Object win, Object data, Object pw, Object ph, Object fg, Object bg, Object depth) { - register int w, h; + register unsigned int w, h; Check_Type (win, T_Window); Check_Type (data, T_String); diff --git a/lib/xlib/type.c b/lib/xlib/type.c index a93bb82..74fbd78 100644 --- a/lib/xlib/type.c +++ b/lib/xlib/type.c @@ -299,7 +299,7 @@ RECORD Size_Hints_Rec[] = { }; int Size_Hints_Size = sizeof Size_Hints_Rec / sizeof (RECORD); -unsigned long Vector_To_Record (Object v, int len, Object sym, +unsigned long Vector_To_Record (Object v, unsigned int len, Object sym, register RECORD *rp) { register Object *p; unsigned long mask = 0; diff --git a/lib/xlib/xlib.h b/lib/xlib/xlib.h index c18de3c..ee8f6aa 100644 --- a/lib/xlib/xlib.h +++ b/lib/xlib/xlib.h @@ -196,7 +196,8 @@ extern Object P_Free_Pixmap P_((Object)); extern Object P_Window_Unique_Id P_((Object)); extern Object Record_To_Vector P_((RECORD*, int, Object, Display*, unsigned long int)); -extern unsigned long int Vector_To_Record P_((Object, int, Object, RECORD*)); +extern unsigned long int Vector_To_Record + P_((Object, unsigned int, Object, RECORD*)); C_LINKAGE_END diff --git a/lib/xwidgets/motif/support.d b/lib/xwidgets/motif/support.d index 568bbc5..6382d07 100644 --- a/lib/xwidgets/motif/support.d +++ b/lib/xwidgets/motif/support.d @@ -150,19 +150,19 @@ " Check_Type (x, T_Character); return (XtArgVal)CHAR(x);") (define position->scheme -" return Make_Integer (*(Position *)&x);") +" return Make_Integer (*(Position *)(void *)&x);") (define scheme->position " return (XtArgVal)Get_Integer (x);") (define dimension->scheme -" return Make_Integer (*(Dimension *)&x);") +" return Make_Integer (*(Dimension *)(void *)&x);") (define scheme->dimension " return (XtArgVal)Get_Unsigned (x);") (define int->scheme -" return Make_Integer (*(int *)&x);") +" return Make_Integer (*(int *)(void *)&x);") (define scheme->int " return (XtArgVal)Get_Integer (x);") diff --git a/lib/xwidgets/widget.c b/lib/xwidgets/widget.c index ee05649..7878c10 100644 --- a/lib/xwidgets/widget.c +++ b/lib/xwidgets/widget.c @@ -320,7 +320,9 @@ static Object P_Widget_Translate_Coordinates (Object w, Object x, Object y) { #include #include #include + #undef XtIsComposite +Boolean XtIsComposite (Widget object); static int Widget_Visit (Object *root, int (*func)()) { Object obj; diff --git a/src/bool.c b/src/bool.c index 7f9dcec..b231515 100644 --- a/src/bool.c +++ b/src/bool.c @@ -84,7 +84,8 @@ int Eqv (Object x1, Object x2) { } int Equal (Object x1, Object x2) { - register int t1, t2, i; + register int t1, t2; + register unsigned int i; again: if (EQ(x1, x2)) diff --git a/src/cont.c b/src/cont.c index 666b4c1..2033d8c 100644 --- a/src/cont.c +++ b/src/cont.c @@ -146,7 +146,7 @@ void Jump_Cont (struct S_Control *cp, Object val) { p = cp; Cont_Value = val; if (Stack_Grows_Down) { - if (stkbase - &foo < p->size) Grow_Stack (cp, val); + if (stkbase < &foo + p->size) Grow_Stack (cp, val); to = stkbase - p->size; } else { if (stkbase + p->size > &foo) Grow_Stack (cp, val); diff --git a/src/cstring.c b/src/cstring.c index 4960cb7..df6014b 100644 --- a/src/cstring.c +++ b/src/cstring.c @@ -43,7 +43,7 @@ #include "kernel.h" static char *heapstr[NUMSTRBUFS]; -static int heaplen[NUMSTRBUFS]; +static unsigned int heaplen[NUMSTRBUFS]; static int nextstr; void Init_Cstring() { /* Preallocate memory to avoid fragmentation */ @@ -55,10 +55,11 @@ void Init_Cstring() { /* Preallocate memory to avoid fragmentation */ char *Get_String (Object str) { char **pp = &heapstr[nextstr]; - int len; + unsigned int len; Check_Type (str, T_String); - if ((len = STRING(str)->size+1) > heaplen[nextstr]) { + len = STRING(str)->size + 1; + if (len > heaplen[nextstr]) { Disable_Interrupts; *pp = Safe_Realloc (*pp, len); heaplen[nextstr] = len; diff --git a/src/dump-hp9k.c b/src/dump-hp9k.c index 8bb099d..3cf6831 100644 --- a/src/dump-hp9k.c +++ b/src/dump-hp9k.c @@ -48,7 +48,7 @@ #define copy(from,to,size) {\ char buf[4096];\ - int len = (size), n;\ + unsigned int len = (size), n;\ \ while (len > 0) {\ if ((n = read (from, buf, 4096)) == -1) {\ diff --git a/src/feature.c b/src/feature.c index af12367..c8bcb35 100644 --- a/src/feature.c +++ b/src/feature.c @@ -71,7 +71,7 @@ Object P_Provide (Object sym) { static Object Feature_Filename (Object str) { struct S_String *sp = STRING(str); - int len = sp->size; + unsigned int len = sp->size; char *p; Object s; GC_Node; diff --git a/src/heap-gen.c b/src/heap-gen.c index 642c2e7..53acf13 100644 --- a/src/heap-gen.c +++ b/src/heap-gen.c @@ -348,7 +348,7 @@ static void DetermineCluster (gcptr_t *addr, int *len) { * is 0, DetermineCluster is called to set length accordingly. */ -static void ProtectCluster (gcptr_t addr, int len) { +static void ProtectCluster (gcptr_t addr, unsigned int len) { if (!len) DetermineCluster (&addr, &len); if (len > 1) { while (len) { @@ -372,7 +372,7 @@ static void ProtectCluster (gcptr_t addr, int len) { } -static void UnprotectCluster (gcptr_t addr, int len) { +static void UnprotectCluster (gcptr_t addr, unsigned int len) { if (!len) DetermineCluster (&addr, &len); MPROTECT (addr, len << pp_shift, PROT_RW); while (len--) { diff --git a/src/io.c b/src/io.c index 45b671c..8ce47af 100644 --- a/src/io.c +++ b/src/io.c @@ -117,7 +117,7 @@ Object P_Output_Portp (Object x) { return TYPE(x) == T_Port && IS_OUTPUT(x) ? True : False; } -int Path_Max () { +unsigned int Path_Max () { #if defined(PATH_MAX) /* POSIX */ return PATH_MAX; #elif defined(MAXPATHLEN) /* 4.3 BSD */ @@ -136,13 +136,14 @@ int Path_Max () { } Object Get_File_Name (Object name) { - register int len; + register unsigned int len; if (TYPE(name) == T_Symbol) name = SYMBOL(name)->name; else if (TYPE(name) != T_String) Wrong_Type_Combination (name, "string or symbol"); - if ((len = STRING(name)->size) > Path_Max () || len == 0) + len = STRING(name)->size; + if (len > Path_Max () || len == 0) Primitive_Error ("invalid file name"); return name; } @@ -273,7 +274,7 @@ Object General_Open_File (Object name, int flags, Object path) { Object port, pref; char *buf = 0; register char *fn; - register int plen, len, blen = 0, gotpath = 0; + register unsigned int plen, len, blen = 0, gotpath = 0; Alloca_Begin; name = Get_File_Name (name); @@ -291,7 +292,8 @@ Object General_Open_File (Object name, int flags, Object path) { if (TYPE(pref) != T_String) continue; gotpath = 1; - if ((plen = STRING(pref)->size) > Path_Max () || plen == 0) + plen = STRING(pref)->size; + if (plen > Path_Max () || plen == 0) continue; if (len + plen + 2 > blen) { blen = len + plen + 2; diff --git a/src/list.c b/src/list.c index 51dfe47..43c552d 100644 --- a/src/list.c +++ b/src/list.c @@ -83,7 +83,7 @@ Object P_Cdr (Object x) { return Cdr (x); } -Object Cxr (Object x, register char *pat, register int len) { +Object Cxr (Object x, register char *pat, register unsigned int len) { Object ret; for (ret = x, pat += len; len > 0; len--) @@ -232,7 +232,7 @@ Object P_Assoc (Object key, Object alist) { return General_Assoc (key, alist, 2); } -int Fast_Length (Object list) { +unsigned int Fast_Length (Object list) { Object tail; register int i; @@ -251,7 +251,7 @@ Object P_Length (Object list) { } Object P_Make_List (Object n, Object init) { - register int len; + register unsigned int len; Object list; GC_Node; diff --git a/src/load.c b/src/load.c index ffbf2ca..a9a9023 100644 --- a/src/load.c +++ b/src/load.c @@ -73,7 +73,7 @@ void Init_Loadpath (char *s) { /* No GC possible here */ int Has_Suffix (Object name, char const *suffix) { register char *p; - register int len = strlen(suffix); + register unsigned int len = strlen(suffix); register struct S_String *str; if (TYPE(name) == T_Symbol) diff --git a/src/print.c b/src/print.c index 9fbfd8d..57f5c37 100644 --- a/src/print.c +++ b/src/print.c @@ -52,12 +52,12 @@ extern void Print_Bignum (Object, Object); extern int errno; void Flush_Output (Object); -void Print_String (Object, register char *, register int); +void Print_String (Object, register char *, register unsigned int); void Pr_Char (Object, register int); void Pr_Symbol (Object, Object, int); -void Pr_List (Object, Object, register int, register int, register int); +void Pr_List (Object, Object, register int, register int, register unsigned int); void Pr_String (Object, Object, int); -void Pr_Vector (Object, Object, register int, register int, register int); +void Pr_Vector (Object, Object, register int, register int, register unsigned int); void Print_Special (Object, register int); int Saved_Errno; @@ -99,7 +99,7 @@ void Print_Char (Object port, register int c) { } } -void Print_String (Object port, register char *buf, register int len) { +void Print_String (Object port, register char *buf, register unsigned int len) { register int n; register struct S_Port *p; Object new; @@ -107,7 +107,7 @@ void Print_String (Object port, register char *buf, register int len) { p = PORT(port); n = STRING(p->name)->size - p->ptr; - if (n < len) { + if (n < (int)len) { GC_Link (port); n = len - n; if (n < STRING_GROW_SIZE) @@ -263,7 +263,7 @@ void General_Print_Object (Object x, Object port, int raw) { } void Print_Object (Object x, Object port, register int raw, register int depth, - register int length) { + register unsigned int length) { register int t; GC_Node2; @@ -408,9 +408,9 @@ void Pr_Char (Object port, register int c) { } void Pr_List (Object port, Object list, register int raw, register int depth, - register int length) { + register unsigned int length) { Object tail; - register int len; + register unsigned int len; register char *s = 0; GC_Node2; @@ -463,8 +463,8 @@ void Pr_List (Object port, Object list, register int raw, register int depth, } void Pr_Vector (Object port, Object vec, register int raw, register int depth, - register int length) { - register int i, j; + register unsigned int length) { + register unsigned int i, j; GC_Node2; if (depth == 0) { @@ -488,7 +488,7 @@ void Pr_Vector (Object port, Object vec, register int raw, register int depth, void Pr_Symbol (Object port, Object sym, int raw) { Object str; - register int c, i; + register unsigned int c, i; GC_Node2; str = SYMBOL(sym)->name; @@ -518,7 +518,7 @@ void Pr_Symbol (Object port, Object sym, int raw) { void Pr_String (Object port, Object str, int raw) { register char *p = STRING(str)->data; - register int c, i; + register unsigned int c, i; register size_t len = STRING(str)->size; GC_Node2; @@ -586,7 +586,8 @@ Object P_Format (int argc, Object *argv) { return stringret ? P_Get_Output_String (port) : Void; } -void Format (Object port, char const *fmt, int len, int argc, Object *argv) { +void Format (Object port, char const *fmt, unsigned int len, int argc, + Object *argv) { register char const *s, *ep; char *p; register int c; diff --git a/src/stab-bsd.c b/src/stab-bsd.c index af6175a..36036e8 100644 --- a/src/stab-bsd.c +++ b/src/stab-bsd.c @@ -33,6 +33,8 @@ #include #include +extern void Free_Symbols (SYMTAB *); + extern int errno; #ifndef O_BINARY diff --git a/src/stab-ecoff.c b/src/stab-ecoff.c index 8c5a6e3..fc546a6 100644 --- a/src/stab-ecoff.c +++ b/src/stab-ecoff.c @@ -37,6 +37,8 @@ #include AOUT_H +extern void Free_Symbols (SYMTAB *); + SYMTAB *Snarf_Symbols (FILE *fp) { long fdi; /* a counter for the file desc table */ FDR *file_desc; /* pointer to the filedesc table */ diff --git a/src/stab-elf.c b/src/stab-elf.c index e2cc448..024303d 100644 --- a/src/stab-elf.c +++ b/src/stab-elf.c @@ -39,6 +39,8 @@ #include "kernel.h" +extern void Free_Symbols (SYMTAB *); + SYMTAB * Snarf_Symbols (lf) int lf; @@ -98,10 +100,10 @@ Snarf_Symbols (lf) * of the interesting symbols. */ while ((elf_data_ptr = elf_getdata (symtab_scn_ptr, elf_data_ptr))) { - char *name = NULL; - int symbol_count; - Elf32_Sym *symbol_ptr = elf_data_ptr->d_buf; - Elf32_Sym *current_symbol; + char *name = NULL; + unsigned int symbol_count; + Elf32_Sym *symbol_ptr = elf_data_ptr->d_buf; + Elf32_Sym *current_symbol; tab = (SYMTAB *)Safe_Malloc (sizeof (SYMTAB)); tab->first = 0; diff --git a/src/stab-hp9k300.c b/src/stab-hp9k300.c index df9c634..0b83d07 100644 --- a/src/stab-hp9k300.c +++ b/src/stab-hp9k300.c @@ -43,6 +43,8 @@ #define STRING_BLOCK 8192 +extern void Free_Symbols (SYMTAB *); + SYMTAB *Snarf_Symbols (FILE *f, struct exec *ep) { SYMTAB *tab; register SYM *sp; diff --git a/src/stab-hp9k800.c b/src/stab-hp9k800.c index bb75837..206c7ed 100644 --- a/src/stab-hp9k800.c +++ b/src/stab-hp9k800.c @@ -31,6 +31,8 @@ #include AOUT_H #include +extern void Free_Symbols (SYMTAB *); + SYMTAB *Snarf_Symbols (FILE *f, struct header *hp) { SYMTAB *tab; register SYM *sp, **nextp; diff --git a/src/string.c b/src/string.c index 33d4507..10bb353 100644 --- a/src/string.c +++ b/src/string.c @@ -48,7 +48,7 @@ void Init_String () { Char_Map[i] = tolower (i); } -Object General_Make_String (char const *s, int len, int konst) { +Object General_Make_String (char const *s, unsigned int len, int konst) { Object str; str = Alloc_Object (len + sizeof (struct S_String) - 1, T_String, konst); @@ -59,11 +59,11 @@ Object General_Make_String (char const *s, int len, int konst) { return str; } -Object Make_String (char const *s, int len) { +Object Make_String (char const *s, unsigned int len) { return General_Make_String (s, len, 0); } -Object Make_Const_String (char const *s, int len) { +Object Make_Const_String (char const *s, unsigned int len) { return General_Make_String (s, len, 1); } @@ -72,7 +72,7 @@ Object P_Stringp (Object s) { } Object P_Make_String (int argc, Object *argv) { - register int len, c = ' '; + register unsigned int len, c = ' '; Object str; register char *p; @@ -150,9 +150,11 @@ Object P_Substring (Object s, Object a, Object b) { register int i, j; Check_Type (s, T_String); - if ((i = Get_Exact_Integer (a)) < 0 || i > STRING(s)->size) + i = Get_Exact_Integer (a); + if (i < 0 || i > (int)STRING(s)->size) Range_Error (a); - if ((j = Get_Exact_Integer (b)) < 0 || j > STRING(s)->size) + j = Get_Exact_Integer (b); + if (j < 0 || j > (int)STRING(s)->size) Range_Error (b); if (i > j) Primitive_Error ("`end' less than `start'"); @@ -198,7 +200,7 @@ Object P_List_To_String (Object list) { } Object P_String_To_List (Object s) { - register int i; + register unsigned int i; Object list, tail, cell; GC_Node3; @@ -223,7 +225,8 @@ Object P_Substring_Fill (Object s, Object a, Object b, Object c) { Check_Mutable (s); Check_Type (c, T_Character); i = Get_Index (a, s); - if ((j = Get_Exact_Integer (b)) < 0 || j > STRING(s)->size) + j = Get_Exact_Integer (b); + if (j < 0 || j > (int)STRING(s)->size) Range_Error (b); if (i > j) Primitive_Error ("`end' less than `start'"); diff --git a/src/symbol.c b/src/symbol.c index 3b18f29..1abc201 100644 --- a/src/symbol.c +++ b/src/symbol.c @@ -35,7 +35,7 @@ #include "kernel.h" -int Hash (char const *, int); +int Hash (char const *, unsigned int); Object Obarray; @@ -91,7 +91,7 @@ Object P_Symbol_To_String (Object x) { return SYMBOL(x)->name; } -Object Obarray_Lookup (register char const *str, register int len) { +Object Obarray_Lookup (register char const *str, register unsigned int len) { register int h; register struct S_String *s; register struct S_Symbol *sym; @@ -109,7 +109,7 @@ Object Obarray_Lookup (register char const *str, register int len) { Object CI_Intern (char const *str) { Object s, *p, sym, ostr; - register int len; + register unsigned int len; register char const *src; char *dst; char buf[128]; @@ -140,7 +140,7 @@ Object CI_Intern (char const *str) { Object Intern (char const *str) { Object s, *p, sym, ostr; - register int len; + register unsigned int len; if (Case_Insensitive) return CI_Intern (str); @@ -245,7 +245,7 @@ Object P_Symbol_Plist (Object sym) { return Copy_List (SYMBOL(sym)->plist); } -int Hash (char const *str, int len) { +int Hash (char const *str, unsigned int len) { register int h; register char const *p, *ep; @@ -325,7 +325,7 @@ Object Bits_To_Symbols (unsigned long int x, int mflag, SYMDESCR *stab) { if (mflag) { GC_Link2 (list, tail); for (list = tail = Null, syms = stab; syms->name; syms++) - if ((x & syms->val) && syms->val != ~0) { + if ((x & syms->val) && syms->val != ~0U) { Object z; z = Intern (syms->name); diff --git a/src/vector.c b/src/vector.c index 2de04e0..ca8ef2c 100644 --- a/src/vector.c +++ b/src/vector.c @@ -36,7 +36,7 @@ extern int Get_Index (Object, Object); -Object General_Make_Vector (int len, Object fill, int konst) { +Object General_Make_Vector (unsigned int len, Object fill, int konst) { Object vec; register Object *op; GC_Node; @@ -52,16 +52,16 @@ Object General_Make_Vector (int len, Object fill, int konst) { return vec; } -Object Make_Vector (int len, Object fill) { +Object Make_Vector (unsigned int len, Object fill) { return General_Make_Vector (len, fill, 0); } -Object Make_Const_Vector (int len, Object fill) { +Object Make_Const_Vector (unsigned int len, Object fill) { return General_Make_Vector (len, fill, 1); } Object P_Make_Vector (int argc, Object *argv) { - register int len; + register unsigned int len; if ((len = Get_Exact_Integer (argv[0])) < 0) Range_Error (argv[0]); @@ -94,7 +94,7 @@ Object P_Vector_Ref (Object vec, Object n) { Object P_Vector_Set (Object vec, Object n, Object new) { Object old; - register int i; + register unsigned int i; Check_Type (vec, T_Vector); Check_Mutable (vec); @@ -107,7 +107,7 @@ Object P_Vector_Set (Object vec, Object n, Object new) { * because the latter can change during GC. */ Object P_Vector_To_List (Object vec) { - register int i; + register unsigned int i; Object list, tail, cell; GC_Node3; @@ -147,7 +147,7 @@ Object P_List_To_Vector (Object list) { } Object P_Vector_Fill (Object vec, Object fill) { - register int i; + register unsigned int i; Check_Type (vec, T_Vector); Check_Mutable (vec);