[vms/committed] Avoid arithmetic on void * in vms-lib.c

Tristan Gingold gingold@adacore.com
Tue Aug 3 08:48:00 GMT 2010


Hi,

DEC-C doesn't like this and AFAIK this is not standard ANSI-C too.

Tristan.

bfd/
2010-08-03  Tristan Gingold  <gingold@adacore.com>

	* vms-lib.c (vms_lib_bread_raw): Change type of BUF argument.
	(vms_lib_bread, vms_lib_bopen): Adjust.

Index: vms-lib.c
===================================================================
RCS file: /cvs/src/src/bfd/vms-lib.c,v
retrieving revision 1.11
diff -c -r1.11 vms-lib.c
*** vms-lib.c	8 Jun 2010 14:04:25 -0000	1.11
--- vms-lib.c	3 Aug 2010 08:45:27 -0000
***************
*** 833,839 ****
     function does not handle records nor EOF.  */
  
  static file_ptr
! vms_lib_bread_raw (struct bfd *abfd, void *buf, file_ptr nbytes)
  {
    struct vms_lib_iovec *vec = (struct vms_lib_iovec *) abfd->iostream;
    file_ptr res;
--- 833,839 ----
     function does not handle records nor EOF.  */
  
  static file_ptr
! vms_lib_bread_raw (struct bfd *abfd, unsigned char *buf, file_ptr nbytes)
  {
    struct vms_lib_iovec *vec = (struct vms_lib_iovec *) abfd->iostream;
    file_ptr res;
***************
*** 969,975 ****
            unsigned char blen[2];
  
            /* Read record length.  */
!           if (vms_lib_bread_raw (abfd, &blen, sizeof (blen)) != sizeof (blen))
              return -1;
            vec->rec_len = bfd_getl16 (blen);
            if (bfd_libdata (abfd->my_archive)->kind == vms_lib_txt)
--- 969,975 ----
            unsigned char blen[2];
  
            /* Read record length.  */
!           if (vms_lib_bread_raw (abfd, blen, sizeof (blen)) != sizeof (blen))
              return -1;
            vec->rec_len = bfd_getl16 (blen);
            if (bfd_libdata (abfd->my_archive)->kind == vms_lib_txt)
***************
*** 1215,1221 ****
  vms_lib_bopen (bfd *el, file_ptr filepos)
  {
    struct vms_lib_iovec *vec;
!   char buf[256];
    struct vms_mhd *mhd;
    struct lib_tdata *tdata = bfd_libdata (el->my_archive);
    unsigned int len;
--- 1215,1221 ----
  vms_lib_bopen (bfd *el, file_ptr filepos)
  {
    struct vms_lib_iovec *vec;
!   unsigned char buf[256];
    struct vms_mhd *mhd;
    struct lib_tdata *tdata = bfd_libdata (el->my_archive);
    unsigned int len;



More information about the Binutils mailing list