From b7fec7bdb767e95165097f43e52cf1cbc4ee6017 Mon Sep 17 00:00:00 2001 From: borutr Date: Thu, 5 Feb 2009 21:02:00 +0000 Subject: [PATCH] fixed warnings and errors git-svn-id: https://sdcc.svn.sourceforge.net/svnroot/sdcc/trunk/sdcc@5355 4a8a32a2-be11-0410-ad9d-d568d2c75423 --- as/asranlib/asranlib.c | 3 ++- as/link/lkar.c | 19 +++++++++++++------ 2 files changed, 15 insertions(+), 7 deletions(-) diff --git a/as/asranlib/asranlib.c b/as/asranlib/asranlib.c index ba92f7e1..ab13c678 100644 --- a/as/asranlib/asranlib.c +++ b/as/asranlib/asranlib.c @@ -26,7 +26,8 @@ along with this program. If not, see . */ #ifdef _WIN32 #include -#define mktemp _mktemp +#else +#include #endif #define NELEM(x) (sizeof (x) / sizeof (*x)) diff --git a/as/link/lkar.c b/as/link/lkar.c index 3334b29d..cdc3077b 100644 --- a/as/link/lkar.c +++ b/as/link/lkar.c @@ -454,6 +454,8 @@ buildlibraryindex_ar (struct lbname *lbnh, FILE * libfp, pmlibraryfile This, int { long moduleOffset = ftell (libfp); + free (obj_name); + /* Opened OK - create a new libraryfile object for it */ if (This == NULL) { @@ -600,9 +602,10 @@ fndsym_ar (const char *name, struct lbname *lbnh, FILE * libfp, int type) struct ar_hdr hdr; int ret = 0; size_t hdr_size; + char *obj_name; /* walk trough all archive members */ - while ((hdr_size = ar_get_header (&hdr, libfp, NULL)) != 0) + while ((hdr_size = ar_get_header (&hdr, libfp, &obj_name)) != 0) { char filspc[PATH_MAX]; @@ -627,7 +630,7 @@ fndsym_ar (const char *name, struct lbname *lbnh, FILE * libfp, int type) buf = (char *) new (hdr.ar_size); - if ((off_t) fread (buf, 1, hdr.ar_size, libfp) != hdr.ar_size) + if (fread (buf, 1, hdr.ar_size, libfp) != hdr.ar_size) { free (buf); return 0; @@ -653,7 +656,7 @@ fndsym_ar (const char *name, struct lbname *lbnh, FILE * libfp, int type) if (0 == strcmp (name, sym)) { fseek (libfp, offset, SEEK_SET); - if (ar_get_header (&hdr, libfp)) + if (ar_get_header (&hdr, libfp, NULL)) { sprintf (&filspc[strlen (filspc)], "%s", hdr.ar_name); @@ -715,7 +718,7 @@ fndsym_ar (const char *name, struct lbname *lbnh, FILE * libfp, int type) buf = (char *) new (hdr.ar_size); - if ((off_t) fread (buf, 1, hdr.ar_size, libfp) != hdr.ar_size) + if (fread (buf, 1, hdr.ar_size, libfp) != hdr.ar_size) { free (buf); return 0; @@ -741,7 +744,7 @@ fndsym_ar (const char *name, struct lbname *lbnh, FILE * libfp, int type) if (0 == strcmp (name, sym)) { fseek (libfp, offset, SEEK_SET); - if (ar_get_header (&hdr, libfp)) + if (ar_get_header (&hdr, libfp, NULL)) { sprintf (&filspc[strlen (filspc)], "%s", hdr.ar_name); @@ -795,12 +798,14 @@ fndsym_ar (const char *name, struct lbname *lbnh, FILE * libfp, int type) } else if (AR_IS_STRING_TABLE (obj_name)) { + free (obj_name); + if (sym_tab) free (sym_tab); sym_tab = (char *) new (hdr.ar_size); - if ((off_t) fread (sym_tab, 1, hdr.ar_size, libfp) != hdr.ar_size) + if (fread (sym_tab, 1, hdr.ar_size, libfp) != hdr.ar_size) { free (sym_tab); sym_tab = NULL; @@ -813,6 +818,8 @@ fndsym_ar (const char *name, struct lbname *lbnh, FILE * libfp, int type) { long moduleOffset = ftell (libfp); + free (obj_name); + D (" Module: %s\n", hdr.ar_name); sprintf (&filspc[strlen (filspc)], "%s", hdr.ar_name); -- 2.30.2