[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: libltdl & 64-bit lint
From: |
libtool |
Subject: |
Re: libltdl & 64-bit lint |
Date: |
Sun, 30 Sep 2001 23:05:52 -0500 |
User-agent: |
Mutt/1.2.5i |
On Sun, Sep 30, 2001 at 11:04:35AM -0500, Bob Friesenhahn wrote:
> Here is the output from Sun's 64-bit lint tool when run on libltdl
> current as of September 29. You will notice that there are a number of
> type down-conversions going on when the code is 64-bit. In order to
> be safe, these types should jive for both the ILP32 and LP64 data type
> models.
>
> (390) warning: suspicious comparison of unsigned with 0: op "<="
static lt_ptr
realloc (ptr, size)
lt_ptr ptr;
size_t size;
{
if (size <= 0)
Is size_t always unsigned?
> (1994) warning: cast from 64-bit integer to 32-bit integer
sprintf (filename, "%.*s/%s", (int) dirname_len, dirname, dlname);
According to sprintf(3) on a Linux box, when using %*, the field width
must be of type int.
> (2167) warning: assignment of 64-bit integer to 32-bit integer
int lenbase = LT_STRLEN (base_name);
Should be size_t as return type of strlen is size_t (at least on the
platforms I checked).
> (2184) warning: argument #3 is incompatible with prototype:
> prototype: pointer to unsigned long : "ltdl.c", line 2125
> argument : pointer to int
?
> (2191) warning: assignment of 64-bit integer to 32-bit integer
int lendir = LT_STRLEN (dir_name);
Should be size_t
> (2502) warning: assignment of 64-bit integer to 32-bit integer
int len = LT_STRLEN (str);
Should be size_t
> (2643) warning: comparing 32-bit integer with 64-bit integer
for (i = 0; i < ext - base_name; ++i)
ext and base_name are char *. Should we make i a size_t?
> (2718) warning: passing 64-bit integer arg, expecting 32-bit integer:
> fgets(arg 2)
if (!fgets (line, line_len, file))
line_len is size_t. fgets expects second argument to be int.
> (2728) warning: passing 64-bit integer arg, expecting 32-bit integer:
> fgets(arg 2)
Ditto.
> (2960) warning: assignment of 64-bit integer to 32-bit integer
len = LT_STRLEN (filename);
len should be size_t
> (3235) warning: argument #4 is incompatible with prototype:
> prototype: pointer to void : "ltdl.c", line 2159
> argument : pointer to function(pointer to const char, pointer to void)
> returning int
> (3241) warning: argument #4 is incompatible with prototype:
> prototype: pointer to void : "ltdl.c", line 2159
> argument : pointer to function(pointer to const char, pointer to void)
> returning int
> (3245) warning: argument #4 is incompatible with prototype:
> prototype: pointer to void : "ltdl.c", line 2159
> argument : pointer to function(pointer to const char, pointer to void)
> returning int
> (3252) warning: argument #4 is incompatible with prototype:
> prototype: pointer to void : "ltdl.c", line 2159
> argument : pointer to function(pointer to const char, pointer to void)
> returning int
> (3259) warning: argument #4 is incompatible with prototype:
> prototype: pointer to void : "ltdl.c", line 2159
> argument : pointer to function(pointer to const char, pointer to void)
> returning int
We've already discussed this. No clear solution.
> (3358) warning: assignment of 64-bit integer to 32-bit integer
lensym = LT_STRLEN (symbol) + LT_STRLEN (handle->loader->sym_prefix)
+ LT_STRLEN (handle->info.name);
lensym should be size_t
--
albert chin (address@hidden)
-- snip snip
2001-09-30 Albert Chin-A-Young <address@hidden>
* ltdl.c: change some types to size_t from int because
strlen() returns size_t. argz_len changed to size_t in
foreach_dirinpath() because argzize_path() takes 3rd
argument as size_t, not int. Based on lint run from
Bob Friesenhahn <address@hidden>.
Index: libltdl/ltdl.c
===================================================================
RCS file: /cvsroot/libtool/libtool/libltdl/ltdl.c,v
retrieving revision 1.159
diff -u -3 -p -r1.159 ltdl.c
--- libltdl/ltdl.c 2001/09/21 17:38:39 1.159
+++ libltdl/ltdl.c 2001/10/01 03:59:41
@@ -2164,8 +2164,8 @@ foreach_dirinpath (search_path, base_nam
{
int result = 0;
int filenamesize = 0;
- int lenbase = LT_STRLEN (base_name);
- int argz_len = 0;
+ size_t lenbase = LT_STRLEN (base_name);
+ size_t argz_len = 0;
char *argz = 0;
char *filename = 0;
char *canonical = 0;
@@ -2188,7 +2188,7 @@ foreach_dirinpath (search_path, base_nam
char *dir_name = 0;
while ((dir_name = argz_next (argz, argz_len, dir_name)))
{
- int lendir = LT_STRLEN (dir_name);
+ size_t lendir = LT_STRLEN (dir_name);
if (lendir +1 +lenbase >= filenamesize)
{
@@ -2499,7 +2499,7 @@ trim (dest, str)
/* remove the leading and trailing "'" from str
and store the result in dest */
const char *end = strrchr (str, '\'');
- int len = LT_STRLEN (str);
+ size_t len = LT_STRLEN (str);
char *tmp;
LT_DLFREE (*dest);
@@ -2947,7 +2947,7 @@ lt_dlopenext (filename)
lt_dlhandle handle = 0;
char * tmp = 0;
char * ext = 0;
- int len;
+ size_t len;
int errors = 0;
if (!filename)
@@ -3337,7 +3337,7 @@ lt_dlsym (handle, symbol)
lt_dlhandle handle;
const char *symbol;
{
- int lensym;
+ size_t lensym;
char lsym[LT_SYMBOL_LENGTH];
char *sym;
lt_ptr address;
- Re: libltdl & 64-bit lint,
libtool <=