diff options
author | Roland McGrath <[email protected]> | 2009-06-18 13:56:02 -0700 |
---|---|---|
committer | Roland McGrath <[email protected]> | 2009-06-18 13:56:02 -0700 |
commit | 05c4e04640d173a4d1ce6e2f25a24060c21a67ab (patch) | |
tree | f1052ed5ea333ead54b01b4f7f9ea4c659cb1af2 | |
parent | 99d2372b25d1231d786b70278478c7a112f2b27c (diff) |
Do some constification to avoid dubious casts.
-rw-r--r-- | libdw/ChangeLog | 9 | ||||
-rw-r--r-- | libdw/dwarf_getaranges.c | 15 | ||||
-rw-r--r-- | libdw/dwarf_getlocation.c | 4 | ||||
-rw-r--r-- | libdw/dwarf_getsrclines.c | 3 | ||||
-rw-r--r-- | libdw/dwarf_nextcu.c | 6 | ||||
-rw-r--r-- | libdw/libdwP.h | 8 |
6 files changed, 26 insertions, 19 deletions
diff --git a/libdw/ChangeLog b/libdw/ChangeLog index 525bb329..6ae3154a 100644 --- a/libdw/ChangeLog +++ b/libdw/ChangeLog @@ -1,3 +1,12 @@ +2009-06-18 Roland McGrath <[email protected]> + + * libdwP.h (__libdw_read_address_inc): Constify. + (__libdw_read_offset_inc): Likewise. + * dwarf_getaranges.c: Likewise. + * dwarf_getlocation.c: Likewise. + * dwarf_getsrclines.c: Likewise. + * dwarf_nextcu.c: Likewise. + 2009-05-05 Petr Machata <[email protected]> * libdwP.h (__libdw_formptr): Declare new function. diff --git a/libdw/dwarf_getaranges.c b/libdw/dwarf_getaranges.c index 74f04ea5..72334f5f 100644 --- a/libdw/dwarf_getaranges.c +++ b/libdw/dwarf_getaranges.c @@ -1,5 +1,5 @@ /* Return list address ranges. - Copyright (C) 2000, 2001, 2002, 2004, 2005, 2006, 2008 Red Hat, Inc. + Copyright (C) 2000-2009 Red Hat, Inc. This file is part of Red Hat elfutils. Written by Ulrich Drepper <[email protected]>, 2000. @@ -104,13 +104,13 @@ dwarf_getaranges (dbg, aranges, naranges) struct arangelist *arangelist = NULL; unsigned int narangelist = 0; - const char *readp - = (const char *) dbg->sectiondata[IDX_debug_aranges]->d_buf; - const char *readendp = readp + dbg->sectiondata[IDX_debug_aranges]->d_size; + const unsigned char *readp = dbg->sectiondata[IDX_debug_aranges]->d_buf; + const unsigned char *readendp + = readp + dbg->sectiondata[IDX_debug_aranges]->d_size; while (readp < readendp) { - const char *hdrstart = readp; + const unsigned char *hdrstart = readp; /* Each entry starts with a header: @@ -150,7 +150,7 @@ dwarf_getaranges (dbg, aranges, naranges) Dwarf_Word offset; if (__libdw_read_offset_inc (dbg, - IDX_debug_aranges, (unsigned char **)&readp, + IDX_debug_aranges, &readp, length_bytes, &offset, IDX_debug_info, 4)) return -1; @@ -171,8 +171,7 @@ dwarf_getaranges (dbg, aranges, naranges) Dwarf_Word range_address; Dwarf_Word range_length; - if (__libdw_read_address_inc (dbg, IDX_debug_aranges, - (unsigned char **)&readp, + if (__libdw_read_address_inc (dbg, IDX_debug_aranges, &readp, address_size, &range_address)) return -1; diff --git a/libdw/dwarf_getlocation.c b/libdw/dwarf_getlocation.c index f829e72b..504db376 100644 --- a/libdw/dwarf_getlocation.c +++ b/libdw/dwarf_getlocation.c @@ -1,5 +1,5 @@ /* Return location expression list. - Copyright (C) 2000, 2001, 2002, 2004, 2005, 2006 Red Hat, Inc. + Copyright (C) 2000-2009 Red Hat, Inc. This file is part of Red Hat elfutils. Written by Ulrich Drepper <[email protected]>, 2000. @@ -151,7 +151,7 @@ getlocation (struct Dwarf_CU *cu, const Dwarf_Block *block, { case DW_OP_addr: /* Address, depends on address size of CU. */ - if (__libdw_read_address_inc (dbg, sec_index, (unsigned char **)&data, + if (__libdw_read_address_inc (dbg, sec_index, &data, cu->address_size, &newloc->number)) return -1; break; diff --git a/libdw/dwarf_getsrclines.c b/libdw/dwarf_getsrclines.c index efd0459f..43fad99a 100644 --- a/libdw/dwarf_getsrclines.c +++ b/libdw/dwarf_getsrclines.c @@ -424,8 +424,7 @@ dwarf_getsrclines (Dwarf_Die *cudie, Dwarf_Lines **lines, size_t *nlines) /* The value is an address. The size is defined as apporiate for the target machine. We use the address size field from the CU header. */ - if (__libdw_read_address_inc (dbg, IDX_debug_line, - (unsigned char **)&linep, + if (__libdw_read_address_inc (dbg, IDX_debug_line, &linep, cu->address_size, &address)) goto out; break; diff --git a/libdw/dwarf_nextcu.c b/libdw/dwarf_nextcu.c index 66cde78a..e436e115 100644 --- a/libdw/dwarf_nextcu.c +++ b/libdw/dwarf_nextcu.c @@ -1,5 +1,5 @@ /* Advance to next CU header. - Copyright (C) 2002, 2003, 2004, 2005, 2008 Red Hat, Inc. + Copyright (C) 2002-2009 Red Hat, Inc. This file is part of Red Hat elfutils. Written by Ulrich Drepper <[email protected]>, 2002. @@ -84,8 +84,8 @@ dwarf_nextcu (dwarf, off, next_off, header_sizep, abbrev_offsetp, /* This points into the .debug_info section to the beginning of the CU entry. */ - unsigned char *data = dwarf->sectiondata[IDX_debug_info]->d_buf; - unsigned char *bytes = data + off; + const unsigned char *data = dwarf->sectiondata[IDX_debug_info]->d_buf; + const unsigned char *bytes = data + off; /* The format of the CU header is described in dwarf2p1 7.5.1: diff --git a/libdw/libdwP.h b/libdw/libdwP.h index 97a2e042..eacc49fc 100644 --- a/libdw/libdwP.h +++ b/libdw/libdwP.h @@ -511,10 +511,10 @@ __libdw_in_section (Dwarf *dbg, int sec_index, static inline int __libdw_read_address_inc (Dwarf *dbg, - int sec_index, unsigned char **addrp, + int sec_index, const unsigned char **addrp, int width, Dwarf_Addr *ret) { - unsigned char *addr = *addrp; + const unsigned char *addr = *addrp; READ_AND_RELOCATE (__libdw_relocate_address, (*ret)); *addrp = addr; return 0; @@ -531,11 +531,11 @@ __libdw_read_address (Dwarf *dbg, static inline int __libdw_read_offset_inc (Dwarf *dbg, - int sec_index, unsigned char **addrp, + int sec_index, const unsigned char **addrp, int width, Dwarf_Off *ret, int sec_ret, size_t size) { - unsigned char *addr = *addrp; + const unsigned char *addr = *addrp; READ_AND_RELOCATE (__libdw_relocate_offset, (*ret)); *addrp = addr; return __libdw_offset_in_section (dbg, sec_ret, *ret, size); |