aboutsummaryrefslogtreecommitdiff
path: root/bfd/cache.c
diff options
context:
space:
mode:
authorNick Clifton <nickc@redhat.com>2008-10-30 09:05:32 +0000
committerNick Clifton <nickc@redhat.com>2008-10-30 09:05:32 +0000
commitcb5220a03f6da7bfc09ce5b58d2b1a74eb1d306a (patch)
tree6e78d5e6e0aae085b0233ef292c06c543c468264 /bfd/cache.c
parent462f405c6e81967cd75dcc6e1254a49f283ded64 (diff)
downloadgdb-cb5220a03f6da7bfc09ce5b58d2b1a74eb1d306a.zip
gdb-cb5220a03f6da7bfc09ce5b58d2b1a74eb1d306a.tar.gz
gdb-cb5220a03f6da7bfc09ce5b58d2b1a74eb1d306a.tar.bz2
* cache.c (cache_bread): Cast void * pointer before performing
arithmetic on it.
Diffstat (limited to 'bfd/cache.c')
-rw-r--r--bfd/cache.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/bfd/cache.c b/bfd/cache.c
index 3906335..50674e8 100644
--- a/bfd/cache.c
+++ b/bfd/cache.c
@@ -317,7 +317,7 @@ cache_bread (struct bfd *abfd, void *buf, file_ptr nbytes)
if (chunk_size > max_chunk_size)
chunk_size = max_chunk_size;
- chunk_nread = cache_bread_1 (abfd, buf + nread, chunk_size);
+ chunk_nread = cache_bread_1 (abfd, (char *) buf + nread, chunk_size);
/* Update the nread count.
@@ -342,6 +342,7 @@ cache_bwrite (struct bfd *abfd, const void *where, file_ptr nbytes)
{
file_ptr nwrite;
FILE *f = bfd_cache_lookup (abfd, 0);
+
if (f == NULL)
return 0;
nwrite = fwrite (where, 1, nbytes, f);
@@ -364,6 +365,7 @@ cache_bflush (struct bfd *abfd)
{
int sts;
FILE *f = bfd_cache_lookup (abfd, CACHE_NO_OPEN);
+
if (f == NULL)
return 0;
sts = fflush (f);
@@ -377,6 +379,7 @@ cache_bstat (struct bfd *abfd, struct stat *sb)
{
int sts;
FILE *f = bfd_cache_lookup (abfd, CACHE_NO_SEEK_ERROR);
+
if (f == NULL)
return -1;
sts = fstat (fileno (f), sb);
@@ -385,7 +388,8 @@ cache_bstat (struct bfd *abfd, struct stat *sb)
return sts;
}
-static const struct bfd_iovec cache_iovec = {
+static const struct bfd_iovec cache_iovec =
+{
&cache_bread, &cache_bwrite, &cache_btell, &cache_bseek,
&cache_bclose, &cache_bflush, &cache_bstat
};