summaryrefslogtreecommitdiffstats
path: root/rtemstoolkit/elftoolchain/libelf/libelf_checksum.c
diff options
context:
space:
mode:
Diffstat (limited to 'rtemstoolkit/elftoolchain/libelf/libelf_checksum.c')
-rw-r--r--rtemstoolkit/elftoolchain/libelf/libelf_checksum.c10
1 files changed, 4 insertions, 6 deletions
diff --git a/rtemstoolkit/elftoolchain/libelf/libelf_checksum.c b/rtemstoolkit/elftoolchain/libelf/libelf_checksum.c
index 0bece9a..ef86877 100644
--- a/rtemstoolkit/elftoolchain/libelf/libelf_checksum.c
+++ b/rtemstoolkit/elftoolchain/libelf/libelf_checksum.c
@@ -24,13 +24,11 @@
* SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-
#include <gelf.h>
#include "_libelf.h"
-LIBELF_VCSID("$Id: libelf_checksum.c 189 2008-07-20 10:38:08Z jkoshy $");
+ELFTC_VCSID("$Id: libelf_checksum.c 3174 2015-03-27 17:13:41Z emaste $");
static unsigned long
_libelf_sum(unsigned long c, const unsigned char *s, size_t size)
@@ -44,7 +42,7 @@ _libelf_sum(unsigned long c, const unsigned char *s, size_t size)
return (c);
}
-unsigned long
+long
_libelf_checksum(Elf *e, int elfclass)
{
size_t shn;
@@ -90,11 +88,11 @@ _libelf_checksum(Elf *e, int elfclass)
d = NULL;
while ((d = elf_rawdata(scn, d)) != NULL)
checksum = _libelf_sum(checksum,
- (unsigned char *) d->d_buf, d->d_size);
+ (unsigned char *) d->d_buf, (size_t) d->d_size);
}
/*
* Return a 16-bit checksum compatible with Solaris.
*/
- return (((checksum >> 16) & 0xFFFFUL) + (checksum & 0xFFFFUL));
+ return (long) (((checksum >> 16) & 0xFFFFUL) + (checksum & 0xFFFFUL));
}