]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
Fix some casts that removed const-ness as pointed out by
authorFlorian Krohm <florian@eich-krohm.de>
Sat, 24 Nov 2012 19:41:54 +0000 (19:41 +0000)
committerFlorian Krohm <florian@eich-krohm.de>
Sat, 24 Nov 2012 19:41:54 +0000 (19:41 +0000)
GCC's -Wcast-qual.

git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13138

32 files changed:
cachegrind/cg_main.c
callgrind/fn.c
coregrind/m_aspacemgr/aspacemgr-linux.c
coregrind/m_coredump/coredump-elf.c
coregrind/m_debuginfo/debuginfo.c
coregrind/m_debuginfo/readdwarf3.c
coregrind/m_debuginfo/readpdb.c
coregrind/m_errormgr.c
coregrind/m_gdbserver/regcache.c
coregrind/m_gdbserver/regcache.h
coregrind/m_gdbserver/remote-utils.c
coregrind/m_gdbserver/server.h
coregrind/m_libcbase.c
coregrind/m_mallocfree.c
coregrind/m_oset.c
coregrind/m_redir.c
coregrind/m_seqmatch.c
coregrind/m_signals.c
coregrind/m_syswrap/syswrap-generic.c
coregrind/m_translate.c
coregrind/m_ume/main.c
coregrind/m_ume/script.c
coregrind/m_xarray.c
coregrind/pub_core_aspacemgr.h
coregrind/pub_core_ume.h
coregrind/vgdb.c
exp-sgcheck/h_intercepts.c
include/pub_tool_seqmatch.h
massif/ms_main.c
memcheck/mc_leakcheck.c
memcheck/mc_malloc_wrappers.c
memcheck/mc_replace_strmem.c

index 8cd633f97681154d18b8b6e98e6cf46cf97d80bc..6937d02baa76890d1666ef95acc8d59112c52814 100644 (file)
@@ -121,8 +121,8 @@ typedef struct {
 static Word cmp_CodeLoc_LineCC(const void *vloc, const void *vcc)
 {
    Word res;
-   CodeLoc* a = (CodeLoc*)vloc;
-   CodeLoc* b = &(((LineCC*)vcc)->loc);
+   const CodeLoc* a = (const CodeLoc*)vloc;
+   const CodeLoc* b = &(((const LineCC*)vcc)->loc);
 
    res = VG_(strcmp)(a->file, b->file);
    if (0 != res)
@@ -191,7 +191,7 @@ static Int  no_debugs           = 0;
 
 static Word stringCmp( const void* key, const void* elem )
 {
-   return VG_(strcmp)(*(HChar**)key, *(HChar**)elem);
+   return VG_(strcmp)(*(const HChar *const *)key, *(const HChar *const *)elem);
 }
 
 // Get a permanent string;  either pull it out of the string table if it's
index 9975c42b59643f729db0d3ce9d931920868d1c1d..983b122466cbd934eaee5fb8273a2631dc629276 100644 (file)
@@ -267,7 +267,7 @@ obj_node* CLG_(get_obj_node)(DebugInfo* di)
     UInt         objname_hash;
     const HChar* obj_name;
     
-    obj_name = di ? (HChar*) VG_(DebugInfo_get_filename)(di) : anonymous_obj;
+    obj_name = di ? VG_(DebugInfo_get_filename)(di) : anonymous_obj;
 
     /* lookup in obj hash */
     objname_hash = str_hash(obj_name, N_OBJ_ENTRIES);
index 77d9d5f5b67885c39d1cf3e152bc76120584c2fc..fa9075bb5f68a7fc7c45ba0676291070125ff0b0 100644 (file)
@@ -1209,12 +1209,12 @@ NSegment const * VG_(am_find_nsegment) ( Addr a )
 
 /* Given a pointer to a seg, tries to figure out which one it is in
    nsegments[..].  Very paranoid. */
-static Int segAddr_to_index ( NSegment* seg )
+static Int segAddr_to_index ( const NSegment* seg )
 {
    Int i;
    if (seg < &nsegments[0] || seg >= &nsegments[nsegments_used])
       return -1;
-   i = ((UChar*)seg - (UChar*)(&nsegments[0])) / sizeof(NSegment);
+   i = ((const UChar*)seg - (const UChar*)(&nsegments[0])) / sizeof(NSegment);
    if (i < 0 || i >= nsegments_used)
       return -1;
    if (seg == &nsegments[i])
@@ -1225,7 +1225,7 @@ static Int segAddr_to_index ( NSegment* seg )
 
 /* Find the next segment along from 'here', if it is a file/anon/resvn
    segment. */
-NSegment const * VG_(am_next_nsegment) ( NSegment* here, Bool fwds )
+NSegment const * VG_(am_next_nsegment) ( const NSegment* here, Bool fwds )
 {
    Int i = segAddr_to_index(here);
    if (i < 0 || i >= nsegments_used)
@@ -2732,7 +2732,7 @@ Bool VG_(am_change_ownership_v_to_c)( Addr start, SizeT len )
    (is-client-heap) flag for that area.  Otherwise do nothing.
    (Bizarre interface so that the same code works for both Linux and
    AIX and does not impose inefficiencies on the Linux version.) */
-void VG_(am_set_segment_isCH_if_SkAnonC)( NSegment* seg )
+void VG_(am_set_segment_isCH_if_SkAnonC)( const NSegment* seg )
 {
    Int i = segAddr_to_index( seg );
    aspacem_assert(i >= 0 && i < nsegments_used);
@@ -2746,7 +2746,7 @@ void VG_(am_set_segment_isCH_if_SkAnonC)( NSegment* seg )
 /* Same idea as VG_(am_set_segment_isCH_if_SkAnonC), except set the
    segment's hasT bit (has-cached-code) if this is SkFileC or SkAnonC
    segment. */
-void VG_(am_set_segment_hasT_if_SkFileC_or_SkAnonC)( NSegment* seg )
+void VG_(am_set_segment_hasT_if_SkFileC_or_SkAnonC)( const NSegment* seg )
 {
    Int i = segAddr_to_index( seg );
    aspacem_assert(i >= 0 && i < nsegments_used);
@@ -2830,7 +2830,7 @@ Bool VG_(am_create_reservation) ( Addr start, SizeT length,
    the reservation segment after the operation must be at least one
    page long. */
 
-Bool VG_(am_extend_into_adjacent_reservation_client) ( NSegment* seg, 
+Bool VG_(am_extend_into_adjacent_reservation_client) ( const NSegment* seg, 
                                                        SSizeT    delta )
 {
    Int    segA, segR;
@@ -2943,7 +2943,7 @@ Bool VG_(am_extend_into_adjacent_reservation_client) ( NSegment* seg,
    immediately discard translations from the new area. */
 
 Bool VG_(am_extend_map_client)( /*OUT*/Bool* need_discard,
-                                NSegment* seg, SizeT delta )
+                                const NSegment* seg, SizeT delta )
 {
    Addr     xStart;
    SysRes   sres;
index 1f8f0c131b0a8dab9497ebaf1c703d266b79785b..bc6b3f84aeb901f9e1a56650b257ec42348007dc 100644 (file)
@@ -235,7 +235,7 @@ static void fill_prstatus(const ThreadState *tst,
                          const vki_siginfo_t *si)
 {
    struct vki_user_regs_struct *regs;
-   ThreadArchState* arch = (ThreadArchState*)&tst->arch;
+   const ThreadArchState* arch = &tst->arch;
 
    VG_(memset)(prs, 0, sizeof(*prs));
 
@@ -280,7 +280,7 @@ static void fill_prstatus(const ThreadState *tst,
    regs->gs     = arch->vex.guest_GS;
 
 #elif defined(VGP_amd64_linux)
-   regs->eflags = LibVEX_GuestAMD64_get_rflags( &((ThreadArchState*)arch)->vex );
+   regs->eflags = LibVEX_GuestAMD64_get_rflags( &arch->vex );
    regs->rsp    = arch->vex.guest_RSP;
    regs->rip    = arch->vex.guest_RIP;
 
@@ -317,8 +317,8 @@ static void fill_prstatus(const ThreadState *tst,
    regs->orig_gpr3 = arch->vex.guest_GPR3;
    regs->ctr = arch->vex.guest_CTR;
    regs->link = arch->vex.guest_LR;
-   regs->xer = LibVEX_GuestPPC32_get_XER( &((ThreadArchState*)arch)->vex );
-   regs->ccr = LibVEX_GuestPPC32_get_CR( &((ThreadArchState*)arch)->vex );
+   regs->xer = LibVEX_GuestPPC32_get_XER( &arch->vex );
+   regs->ccr = LibVEX_GuestPPC32_get_CR( &arch->vex );
    regs->mq = 0;
    regs->trap = 0;
    regs->dar = 0; /* should be fault address? */
@@ -338,8 +338,8 @@ static void fill_prstatus(const ThreadState *tst,
    regs->orig_gpr3 = arch->vex.guest_GPR3;
    regs->ctr = arch->vex.guest_CTR;
    regs->link = arch->vex.guest_LR;
-   regs->xer = LibVEX_GuestPPC64_get_XER( &((ThreadArchState*)arch)->vex );
-   regs->ccr = LibVEX_GuestPPC64_get_CR( &((ThreadArchState*)arch)->vex );
+   regs->xer = LibVEX_GuestPPC64_get_XER( &arch->vex );
+   regs->ccr = LibVEX_GuestPPC64_get_CR( &arch->vex );
    /* regs->mq = 0; */
    regs->trap = 0;
    regs->dar = 0; /* should be fault address? */
@@ -363,7 +363,7 @@ static void fill_prstatus(const ThreadState *tst,
    regs->ARM_sp   = arch->vex.guest_R13;
    regs->ARM_lr   = arch->vex.guest_R14;
    regs->ARM_pc   = arch->vex.guest_R15T;
-   regs->ARM_cpsr = LibVEX_GuestARM_get_cpsr( &((ThreadArchState*)arch)->vex );
+   regs->ARM_cpsr = LibVEX_GuestARM_get_cpsr( &arch->vex );
 
 #elif defined(VGP_s390x_linux)
 #  define DO(n)  regs->gprs[n] = arch->vex.guest_r##n
@@ -392,7 +392,7 @@ static void fill_prstatus(const ThreadState *tst,
 static void fill_fpu(const ThreadState *tst, vki_elf_fpregset_t *fpu)
 {
    __attribute__((unused))
-   ThreadArchState* arch = (ThreadArchState*)&tst->arch;
+   const ThreadArchState* arch = &tst->arch;
 
 #if defined(VGP_x86_linux)
 //:: static void fill_fpu(vki_elf_fpregset_t *fpu, const HChar *from)
@@ -479,7 +479,7 @@ static void fill_fpu(const ThreadState *tst, vki_elf_fpregset_t *fpu)
 #if defined(VGP_x86_linux) && !defined(VGPV_x86_linux_android)
 static void fill_xfpu(const ThreadState *tst, vki_elf_fpxregset_t *xfpu)
 {
-   ThreadArchState* arch = (ThreadArchState*)&tst->arch;
+   const ThreadArchState* arch = &tst->arch;
 
 //::    xfpu->cwd = ?;
 //::    xfpu->swd = ?;
index 0e7d33e53dc967ecf7b660f10e3aa72ba4cc3691..59f920d37e25d2e8945b2a1c2c6fc1bc41c61231 100644 (file)
@@ -725,7 +725,7 @@ ULong VG_(di_notify_mmap)( Addr a, Bool allow_SkFileV, Int use_fd )
       return 0;
 
    /* If the file doesn't have a name, we're hosed.  Give up. */
-   filename = VG_(am_get_filename)( (NSegment*)seg );
+   filename = VG_(am_get_filename)( seg );
    if (!filename)
       return 0;
 
index ee79a165730718b9f1d58bd20f61a86bcea18224..d058ea9d3130b41d73f3c5dfa8bd34b0f7d7aad8 100644 (file)
@@ -3394,8 +3394,8 @@ static void resolve_variable_types (
 /*------------------------------------------------------------*/
 
 static Int cmp_TempVar_by_dioff ( const void* v1, const void* v2 ) {
-   const TempVar* t1 = *(const TempVar**)v1;
-   const TempVar* t2 = *(const TempVar**)v2;
+   const TempVar* t1 = *(const TempVar *const *)v1;
+   const TempVar* t2 = *(const TempVar *const *)v2;
    if (t1->dioff < t2->dioff) return -1;
    if (t1->dioff > t2->dioff) return 1;
    return 0;
index cf542855d5708fa9cf4d11cd6872672284ed1512..1b051d191a7bcc1ef056c9a990bd91cb05e693c6 100644 (file)
@@ -1525,16 +1525,16 @@ static ULong DEBUG_SnarfLinetab(
    //VG_(printf)("DEBUG_SnarfLinetab %p %p %p %d\n", di, sectp, linetab, size);
    Int                file_segcount;
    HChar              filename[WIN32_PATH_MAX];
-   UInt               * filetab;
-   UChar              * fn;
+   const UInt         * filetab;
+   const UChar        * fn;
    Int                i;
    Int                k;
-   UInt               * lt_ptr;
+   const UInt         * lt_ptr;
    Int                nfile;
    Int                nseg;
    union any_size     pnt;
    union any_size     pnt2;
-   struct startend    * start;
+   const struct startend * start;
    Int                this_seg;
 
    Bool  debug = di->trace_symtab;
@@ -1552,14 +1552,14 @@ static ULong DEBUG_SnarfLinetab(
    nfile = *pnt.s++;
    nseg  = *pnt.s++;
 
-   filetab = (unsigned int *) pnt.c;
+   filetab = pnt.ui;
 
    /*
     * Now count up the number of segments in the file.
     */
    nseg = 0;
    for (i = 0; i < nfile; i++) {
-     pnt2.c = (HChar *)linetab + filetab[i];
+      pnt2.c = (HChar *)linetab + filetab[i];
       nseg += *pnt2.s;
    }
 
@@ -1575,13 +1575,13 @@ static ULong DEBUG_SnarfLinetab(
       file_segcount = *pnt2.s;
 
       pnt2.ui++;
-      lt_ptr = (unsigned int *) pnt2.c;
-      start = (struct startend *) (lt_ptr + file_segcount);
+      lt_ptr = pnt2.ui;
+      start = (const struct startend *) (lt_ptr + file_segcount);
 
       /*
        * Now snarf the filename for all of the segments for this file.
        */
-      fn = (UChar*) (start + file_segcount);
+      fn = (const UChar*) (start + file_segcount);
       /* fn now points at a Pascal-style string, that is, the first
          byte is the length, and the remaining up to 255 (presumably)
          are the contents. */
@@ -1626,11 +1626,11 @@ static ULong DEBUG_SnarfLinetab(
                if (debug)
                   VG_(message)(Vg_UserMsg,
                      "  Adding line %d addr=%#lx end=%#lx\n", 
-                        ((unsigned short *)(pnt2.ui + linecount))[j],
+                        ((const unsigned short *)(pnt2.ui + linecount))[j],
                         startaddr, endaddr );
                   ML_(addLineInfo)(
                      di, fnmstr, dirstr, startaddr, endaddr,
-                     ((unsigned short *)(pnt2.ui + linecount))[j], j );
+                     ((const unsigned short *)(pnt2.ui + linecount))[j], j );
                   n_lines_read++;
                }
             }
index b4fec57e8927415d78b908768cd87432ae22adb0..c325148852d172d4ab95bdc860cce22b90ecc848 100644 (file)
@@ -1390,13 +1390,13 @@ void VG_(load_suppressions) ( void )
    matching a sequence of Addrs against a pattern composed of a
    sequence of SuppLocs.
 */
-static Bool supploc_IsStar ( void* supplocV )
+static Bool supploc_IsStar ( const void* supplocV )
 {
-   SuppLoc* supploc = (SuppLoc*)supplocV;
+   const SuppLoc* supploc = supplocV;
    return supploc->ty == DotDotDot;
 }
 
-static Bool supploc_IsQuery ( void* supplocV )
+static Bool supploc_IsQuery ( const void* supplocV )
 {
    return False; /* there's no '?' equivalent in the supp syntax */
 }
@@ -1504,13 +1504,12 @@ static HChar* foComplete(IPtoFunOrObjCompleter* ip2fo,
    return ip2fo->names + (*offsets)[ixIP];
 }
 
-static Bool supp_pattEQinp ( void* supplocV, void* addrV,
+static Bool supp_pattEQinp ( const void* supplocV, const void* addrV,
                              void* inputCompleter, UWord ixAddrV )
 {
-   SuppLoc* supploc = (SuppLoc*)supplocV; /* PATTERN */
-   Addr     ip      = *(Addr*)addrV; /* INPUT */
-   IPtoFunOrObjCompleter* ip2fo 
-      = (IPtoFunOrObjCompleter*)inputCompleter;
+   const SuppLoc* supploc = supplocV; /* PATTERN */
+   Addr     ip      = *(const Addr*)addrV; /* INPUT */
+   IPtoFunOrObjCompleter* ip2fo = inputCompleter;
    HChar* funobj_name; // Fun or Obj name.
 
    /* So, does this IP address match this suppression-line? */
index 477c208d52a9596ab9de6dff31839276027127a0..6b3d54bd89520d847dba399495fde8e03fe8aa17 100644 (file)
@@ -164,7 +164,7 @@ void registers_to_string (char *buf)
    convert_int_to_ascii (registers, buf, register_bytes);
 }
 
-void registers_from_string (char *buf)
+void registers_from_string (const char *buf)
 {
    int len = strlen (buf);
    unsigned char *registers = get_regcache (current_inferior, 1)->registers;
@@ -235,7 +235,7 @@ void supply_register_from_string (int n, const char *buf, Bool *mod)
 {
    Bool new;
    unsigned char bytes_register[register_size (n)];
-   convert_ascii_to_int ((char *) buf, bytes_register, register_size (n));
+   convert_ascii_to_int (buf, bytes_register, register_size (n));
    VG_(dmemcpy) (register_data_for_supply (n, 0, &new), 
                  bytes_register, register_size (n), mod);
    if (new)
index edf6a613abfa17630cf36acffd33aeb38eb739ef..abd4eb72177d388c50c1a4cdc4e9931bb6883f7c 100644 (file)
@@ -44,7 +44,7 @@ void registers_to_string (char *buf);
 
 /* Convert a string to register values and fill our register cache.  */
 
-void registers_from_string (char *buf);
+void registers_from_string (const char *buf);
 
 /* Return the size in bytes of a string-encoded register packet.  */
 
index a08aef7e975024f8be889c9c15a25c82e0d5f63a..8c5f2c131c0661e1c28c319ad20c12afa70faf7a 100644 (file)
@@ -929,7 +929,7 @@ void write_enn (char *buf)
    buf[3] = '\0';
 }
 
-void convert_int_to_ascii (unsigned char *from, char *to, int n)
+void convert_int_to_ascii (const unsigned char *from, char *to, int n)
 {
    int nib;
    int ch;
@@ -944,7 +944,7 @@ void convert_int_to_ascii (unsigned char *from, char *to, int n)
 }
 
 
-void convert_ascii_to_int (char *from, unsigned char *to, int n)
+void convert_ascii_to_int (const char *from, unsigned char *to, int n)
 {
    int nib1, nib2;
    while (n--) {
index d0d8a9f0dd86a2f75d9f132d74931296342dcd14..f68f11ecda06429619a8d0a8c1e3248181f7e9f7 100644 (file)
@@ -282,8 +282,8 @@ void remote_close (void);
 void sync_gdb_connection (void);
 void write_ok (char *buf);
 void write_enn (char *buf);
-void convert_ascii_to_int (char *from, unsigned char *to, int n);
-void convert_int_to_ascii (unsigned char *from, char *to, int n);
+void convert_ascii_to_int (const char *from, unsigned char *to, int n);
+void convert_int_to_ascii (const unsigned char *from, char *to, int n);
 void prepare_resume_reply (char *buf, char status, unsigned char sig);
 
 void decode_address (CORE_ADDR *addrp, const char *start, int len);
index 3567882affa5d0defae5c67370147fbf31fe715d..59396d7bed84334d644857b368b654b49440c90c 100644 (file)
@@ -303,8 +303,8 @@ HChar* VG_(strncpy) ( HChar* dest, const HChar* src, SizeT ndest )
 Int VG_(strcmp) ( const HChar* s1, const HChar* s2 )
 {
    while (True) {
-      if (*(UChar*)s1 < *(UChar*)s2) return -1;
-      if (*(UChar*)s1 > *(UChar*)s2) return 1;
+      if (*(const UChar*)s1 < *(const UChar*)s2) return -1;
+      if (*(const UChar*)s1 > *(const UChar*)s2) return 1;
 
       /* *s1 == *s2 */
       if (*s1 == 0) return 0;
@@ -333,8 +333,8 @@ Int VG_(strncmp) ( const HChar* s1, const HChar* s2, SizeT nmax )
    SizeT n = 0;
    while (True) {
       if (n >= nmax) return 0;
-      if (*(UChar*)s1 < *(UChar*)s2) return -1;
-      if (*(UChar*)s1 > *(UChar*)s2) return 1;
+      if (*(const UChar*)s1 < *(const UChar*)s2) return -1;
+      if (*(const UChar*)s1 > *(const UChar*)s2) return 1;
       
       /* *s1 == *s2 */
       if (*s1 == 0) return 0;
@@ -569,12 +569,12 @@ void* VG_(memmove)(void *dest, const void *src, SizeT sz)
       return dest;
    if (dest < src) {
       for (i = 0; i < sz; i++) {
-         ((UChar*)dest)[i] = ((UChar*)src)[i];
+         ((UChar*)dest)[i] = ((const UChar*)src)[i];
       }
    }
    else if (dest > src) {
       for (i = 0; i < sz; i++) {
-         ((UChar*)dest)[sz-i-1] = ((UChar*)src)[sz-i-1];
+         ((UChar*)dest)[sz-i-1] = ((const UChar*)src)[sz-i-1];
       }
    }
    return dest;
index 7f19e8c47e92b0b1785756d6d11e8d0775424228..023cf4afa11fe024222be1725b35a86cc4232ecb 100644 (file)
@@ -810,9 +810,7 @@ Superblock* newSuperblock ( Arena* a, SizeT cszB )
       // Mark this segment as containing client heap.  The leak
       // checker needs to be able to identify such segments so as not
       // to use them as sources of roots during leak checks.
-      VG_(am_set_segment_isCH_if_SkAnonC)( 
-         (NSegment*) VG_(am_find_nsegment)( (Addr)sb )
-      );
+      VG_(am_set_segment_isCH_if_SkAnonC)( VG_(am_find_nsegment)( (Addr)sb ) );
    } else {
       // non-client allocation -- abort if it fails
       if (unsplittable)
@@ -1281,8 +1279,8 @@ typedef struct {
 static AnCC anCCs[N_AN_CCS];
 
 static Int cmp_AnCC_by_vol ( const void* v1, const void* v2 ) {
-   AnCC* ancc1 = (AnCC*)v1;
-   AnCC* ancc2 = (AnCC*)v2;
+   const AnCC* ancc1 = v1;
+   const AnCC* ancc2 = v2;
    if (ancc1->nBytes < ancc2->nBytes) return -1;
    if (ancc1->nBytes > ancc2->nBytes) return 1;
    return 0;
index 458a143ac30ffc66149273827c25b5377a115635..a2ad7d97f30701197ddcd2f249a113dc3b228f8a 100644 (file)
@@ -179,8 +179,8 @@ void* fast_key_of_node(AvlNode* n)
 // Compare the first word of each element.  Inlining is *crucial*.
 static inline Word fast_cmp(const void* k, const AvlNode* n)
 {
-   UWord w1 = *(UWord*)k;
-   UWord w2 = *(UWord*)elem_of_node(n);
+   UWord w1 = *(const UWord*)k;
+   UWord w2 = *(const UWord*)elem_of_node(n);
    // In previous versions, we tried to do this faster by doing
    // "return w1 - w2".  But it didn't work reliably, because the
    // complete result of subtracting two N-bit numbers is an N+1-bit
@@ -593,7 +593,7 @@ static AvlNode* avl_lookup(const AvlTree* t, const void* k)
       // elem_of_node because it saves about 10% on lookup time.  This
       // shouldn't be very dangerous because each node will have been
       // checked on insertion.
-      UWord w1 = *(UWord*)k;
+      UWord w1 = *(const UWord*)k;
       UWord w2;
       while (True) {
          if (curr == NULL) return NULL;
index 81f969e426e4bcb975dc7603dc963c40447f2501..40f6980066372e1e2304692132ff99bd19e66216 100644 (file)
@@ -1615,8 +1615,8 @@ static void show_redir_state ( const HChar* who )
       if (ts->seginfo)
          VG_(message)(Vg_DebugMsg, 
                       "   TOPSPECS of soname %s filename %s\n",
-                      (HChar*)VG_(DebugInfo_get_soname)(ts->seginfo),
-                      (HChar*)VG_(DebugInfo_get_filename)(ts->seginfo));
+                      VG_(DebugInfo_get_soname)(ts->seginfo),
+                      VG_(DebugInfo_get_filename)(ts->seginfo));
       else
          VG_(message)(Vg_DebugMsg, 
                       "   TOPSPECS of soname (hardwired)\n");
index d9afe4b45fa448875ae3491c15bc1be3634eba41..09db2d13609aac556867941980fea36d121f6b7a 100644 (file)
 /* See detailed comment in include/pub_tool_seqmatch.h about this. */
 Bool VG_(generic_match) ( 
         Bool matchAll,
-        void* patt,  SizeT szbPatt,  UWord nPatt,  UWord ixPatt,
-        void* input, SizeT szbInput, UWord nInput, UWord ixInput,
-        Bool (*pIsStar)(void*),
-        Bool (*pIsQuery)(void*),
-        Bool (*pattEQinp)(void*,void*,void*,UWord),
+        const void* patt,  SizeT szbPatt,  UWord nPatt,  UWord ixPatt,
+        const void* input, SizeT szbInput, UWord nInput, UWord ixInput,
+        Bool (*pIsStar)(const void*),
+        Bool (*pIsQuery)(const void*),
+        Bool (*pattEQinp)(const void*,const void*,void*,UWord),
         void* inputCompleter
      )
 {
@@ -65,7 +65,7 @@ Bool VG_(generic_match) (
       ma []       []     = True
    */
    Bool  havePatt, haveInput;
-   void  *currPatt, *currInput;
+   const HChar *currPatt, *currInput;
   tailcall:
    vg_assert(nPatt >= 0   && nPatt  < 1000000); /* arbitrary */
    vg_assert(nInput >= 0  && nInput < 1000000); /* arbitrary */
@@ -78,8 +78,8 @@ Bool VG_(generic_match) (
    /* No specific need to set NULL when !have{Patt,Input}, but guards
       against inadvertantly dereferencing an out of range pointer to
       the pattern or input arrays. */
-   currPatt  = havePatt  ? ((HChar*)patt) + szbPatt * ixPatt    : NULL;
-   currInput = haveInput ? ((HChar*)input) + szbInput * ixInput : NULL;
+   currPatt  = havePatt  ? ((const HChar*)patt) + szbPatt * ixPatt    : NULL;
+   currInput = haveInput ? ((const HChar*)input) + szbInput * ixInput : NULL;
 
    // Deal with the complex case first: wildcards.  Do frugal
    // matching.  When encountering a '*', first skip no characters
@@ -163,12 +163,12 @@ Bool VG_(generic_match) (
 /* And a parameterization of the above, to make it do
    string matching.
 */
-static Bool charIsStar  ( void* pV ) { return *(HChar*)pV == '*'; }
-static Bool charIsQuery ( void* pV ) { return *(HChar*)pV == '?'; }
-static Bool char_p_EQ_i ( void* pV, void* cV,
+static Bool charIsStar  ( const void* pV ) { return *(const HChar*)pV == '*'; }
+static Bool charIsQuery ( const void* pV ) { return *(const HChar*)pV == '?'; }
+static Bool char_p_EQ_i ( const void* pV, const void* cV,
                           void* null_completer, UWord ixcV ) {
-   HChar p = *(HChar*)pV;
-   HChar c = *(HChar*)cV;
+   HChar p = *(const HChar*)pV;
+   HChar c = *(const HChar*)cV;
    vg_assert(p != '*' && p != '?');
    return p == c;
 }
@@ -176,8 +176,8 @@ Bool VG_(string_match) ( const HChar* patt, const HChar* input )
 {
    return VG_(generic_match)(
              True/* match-all */,
-             (void*)patt,  sizeof(HChar), VG_(strlen)(patt), 0,
-             (void*)input, sizeof(HChar), VG_(strlen)(input), 0,
+             patt,  sizeof(HChar), VG_(strlen)(patt), 0,
+             input, sizeof(HChar), VG_(strlen)(input), 0,
              charIsStar, charIsQuery, char_p_EQ_i,
              NULL
           );
index e90305436c222da7f2a79a0ac66452ff963b5611..052fcb4f1020eb6bbd095d3d3890c240743c2cdc 100644 (file)
@@ -2186,7 +2186,7 @@ Bool VG_(extend_stack)(Addr addr, UInt maxsize)
    NSegment const* seg
       = VG_(am_find_nsegment)(addr);
    NSegment const* seg_next 
-      = seg ? VG_(am_next_nsegment)( (NSegment*)seg, True/*fwds*/ )
+      = seg ? VG_(am_next_nsegment)( seg, True/*fwds*/ )
             : NULL;
 
    if (seg && seg->kind == SkAnonC)
@@ -2209,7 +2209,7 @@ Bool VG_(extend_stack)(Addr addr, UInt maxsize)
                     "extending a stack base 0x%llx down by %lld\n",
                     (ULong)seg_next->start, (ULong)udelta);
    if (! VG_(am_extend_into_adjacent_reservation_client)
-            ( (NSegment*)seg_next, -(SSizeT)udelta )) {
+            ( seg_next, -(SSizeT)udelta )) {
       VG_(debugLog)(1, "signals", "extending a stack base: FAILED\n");
       return False;
    }
@@ -2340,7 +2340,7 @@ static Bool extend_stack_if_appropriate(ThreadId tid, vki_siginfo_t* info)
    fault    = (Addr)info->VKI_SIGINFO_si_addr;
    esp      = VG_(get_SP)(tid);
    seg      = VG_(am_find_nsegment)(fault);
-   seg_next = seg ? VG_(am_next_nsegment)( (NSegment*)seg, True/*fwds*/ )
+   seg_next = seg ? VG_(am_next_nsegment)( seg, True/*fwds*/ )
                   : NULL;
 
    if (VG_(clo_trace_signals)) {
index 2df0aa0a32082b612be9d4ecda2fa28b8a13e0b4..5e4426fc5790a461bdac87237e8bdad606541f4e 100644 (file)
@@ -407,7 +407,7 @@ SysRes do_mremap( Addr old_addr, SizeT old_len,
       ok = VG_(am_covered_by_single_free_segment) ( needA, needL );
    }
    if (ok && advised == needA) {
-      ok = VG_(am_extend_map_client)( &d, (NSegment*)old_seg, needL );
+      ok = VG_(am_extend_map_client)( &d, old_seg, needL );
       if (ok) {
          VG_TRACK( new_mem_mmap, needA, needL, 
                                  old_seg->hasR, 
@@ -463,7 +463,7 @@ SysRes do_mremap( Addr old_addr, SizeT old_len,
    }
    if (!ok || advised != needA)
       goto eNOMEM;
-   ok = VG_(am_extend_map_client)( &d, (NSegment*)old_seg, needL );
+   ok = VG_(am_extend_map_client)( &d, old_seg, needL );
    if (!ok)
       goto eNOMEM;
    VG_TRACK( new_mem_mmap, needA, needL, 
@@ -1093,7 +1093,7 @@ static Addr do_brk ( Addr newbrk )
       aseg = VG_(am_find_nsegment)( VG_(brk_limit)-1 );
    else
       aseg = VG_(am_find_nsegment)( VG_(brk_limit) );
-   rseg = VG_(am_next_nsegment)( (NSegment*)aseg, True/*forwards*/ );
+   rseg = VG_(am_next_nsegment)( aseg, True/*forwards*/ );
 
    /* These should be assured by setup_client_dataseg in m_main. */
    vg_assert(aseg);
@@ -1121,7 +1121,7 @@ static Addr do_brk ( Addr newbrk )
    vg_assert(delta > 0);
    vg_assert(VG_IS_PAGE_ALIGNED(delta));
    
-   ok = VG_(am_extend_into_adjacent_reservation_client)( (NSegment*)aseg, delta );
+   ok = VG_(am_extend_into_adjacent_reservation_client)( aseg, delta );
    if (!ok) goto bad;
 
    VG_(brk_limit) = newbrk;
@@ -3508,7 +3508,7 @@ PRE(sys_mprotect)
       vg_assert(aseg);
 
       if (grows == VKI_PROT_GROWSDOWN) {
-         rseg = VG_(am_next_nsegment)( (NSegment*)aseg, False/*backwards*/ );
+         rseg = VG_(am_next_nsegment)( aseg, False/*backwards*/ );
          if (rseg &&
              rseg->kind == SkResvn &&
              rseg->smode == SmUpper &&
@@ -3521,7 +3521,7 @@ PRE(sys_mprotect)
             SET_STATUS_Failure( VKI_EINVAL );
          }
       } else if (grows == VKI_PROT_GROWSUP) {
-         rseg = VG_(am_next_nsegment)( (NSegment*)aseg, True/*forwards*/ );
+         rseg = VG_(am_next_nsegment)( aseg, True/*forwards*/ );
          if (rseg &&
              rseg->kind == SkResvn &&
              rseg->smode == SmLower &&
index 762762fbeeafbc87c21f234e9beb0d0af047ed14..26e6376e324ac2e4a7306cbd5d72b2b1b2b465b8 100644 (file)
@@ -1575,14 +1575,14 @@ Bool VG_(translate) ( ThreadId tid,
 
    vg_assert( vge.base[0] == (Addr64)addr );
    /* set 'translations taken from this segment' flag */
-   VG_(am_set_segment_hasT_if_SkFileC_or_SkAnonC)( (NSegment*)seg );
+   VG_(am_set_segment_hasT_if_SkFileC_or_SkAnonC)( seg );
    } /* END new scope specially for 'seg' */
 
    for (i = 1; i < vge.n_used; i++) {
       NSegment const* seg 
          = VG_(am_find_nsegment)( vge.base[i] );
       /* set 'translations taken from this segment' flag */
-      VG_(am_set_segment_hasT_if_SkFileC_or_SkAnonC)( (NSegment*)seg );
+      VG_(am_set_segment_hasT_if_SkFileC_or_SkAnonC)( seg );
    }
 
    /* Copy data at trans_addr into the translation cache. */
index 679b106da5d1b748fc770a9230ea39e25ab979c0..ad61d6e9f8c242fa3578f5008dc1b1ed1a6a621b 100644 (file)
@@ -224,7 +224,7 @@ static Int do_exec_shell_followup(Int ret, const HChar* exe_name, ExeInfo* info)
       info->interp_name = VG_(strdup)("ume.desf.1", default_interp_name);
       info->interp_args = NULL;
       if (info->argv && info->argv[0] != NULL)
-         info->argv[0] = (HChar *)exe_name;  // FIXME: can argv be const qualified ?
+         info->argv[0] = exe_name;
 
       ret = VG_(do_exec_inner)(info->interp_name, info);
 
index bab8efecc33f08cf10be11127211b11b65aa6d77..497612637654d2409a5de5d3890f64594528ec02 100644 (file)
@@ -134,7 +134,7 @@ Int VG_(load_script)(Int fd, const HChar* name, ExeInfo* info)
    }
 
    if (info->argv && info->argv[0] != NULL)
-     info->argv[0] = (HChar *)name;   // FIXME: can argv be const qualified?
+     info->argv[0] = name;
 
    VG_(args_the_exename) = name;
 
index e110dbd8ec016aaeb617c08f3697d9dc6a0e4499..2dbd90d07d36e14e3b2371dd9bab8f2fea0210f2 100644 (file)
@@ -209,7 +209,7 @@ Word VG_(addBytesToXA) ( XArray* xao, const void* bytesV, Word nbytes )
       ensureSpaceXA( xa );
       vg_assert(xa->usedsizeE < xa->totsizeE);
       vg_assert(xa->arr);
-      * (((UChar*)xa->arr) + xa->usedsizeE) = ((UChar*)bytesV)[i];
+      * (((UChar*)xa->arr) + xa->usedsizeE) = ((const UChar*)bytesV)[i];
       xa->usedsizeE++;
    }
    xa->sorted = False;
index 0ed1c4af0dfc8d23cb0b9afa592a2caa7040a24a..17b33f677f0d742b85732566f4557b43a8ce00d6 100644 (file)
@@ -73,7 +73,8 @@ extern Addr VG_(am_startup) ( Addr sp_at_startup );
 
 /* Find the next segment along from 'here', if it is a file/anon/resvn
    segment. */
-extern NSegment const* VG_(am_next_nsegment) ( NSegment* here, Bool fwds );
+extern NSegment const* VG_(am_next_nsegment) ( const NSegment* here,
+                                               Bool fwds );
 
 /* Is the area [start .. start+len-1] validly accessible by the 
    client with at least the permissions 'prot' ?  To find out
@@ -281,12 +282,12 @@ extern Bool VG_(am_change_ownership_v_to_c)( Addr start, SizeT len );
    (is-client-heap) flag for that area.  Otherwise do nothing.
    (Bizarre interface so that the same code works for both Linux and
    AIX and does not impose inefficiencies on the Linux version.) */
-extern void VG_(am_set_segment_isCH_if_SkAnonC)( NSegment* seg );
+extern void VG_(am_set_segment_isCH_if_SkAnonC)( const NSegment* seg );
 
 /* Same idea as VG_(am_set_segment_isCH_if_SkAnonC), except set the
    segment's hasT bit (has-cached-code) if this is SkFileC or SkAnonC
    segment. */
-extern void VG_(am_set_segment_hasT_if_SkFileC_or_SkAnonC)( NSegment* );
+extern void VG_(am_set_segment_hasT_if_SkFileC_or_SkAnonC)( const NSegment* );
 
 /* --- --- --- reservations --- --- --- */
 
@@ -312,7 +313,7 @@ extern Bool VG_(am_create_reservation)
    the reservation segment after the operation must be at least one
    page long. */
 extern Bool VG_(am_extend_into_adjacent_reservation_client) 
-   ( NSegment* seg, SSizeT delta );
+   ( const NSegment* seg, SSizeT delta );
 
 /* --- --- --- resizing/move a mapping --- --- --- */
 
@@ -324,7 +325,7 @@ extern Bool VG_(am_extend_into_adjacent_reservation_client)
    *need_discard is True after a successful return, the caller should
    immediately discard translations from the new area. */
 extern Bool VG_(am_extend_map_client)( /*OUT*/Bool* need_discard,
-                                       NSegment* seg, SizeT delta );
+                                       const NSegment* seg, SizeT delta );
 
 /* Remap the old address range to the new address range.  Fails if any
    parameter is not page aligned, if the either size is zero, if any
index a9a438e777656acdc1a496052e3f2d745f1114c6..e1ab47ba28055aa7cfc35994fa5428e5239076a3 100644 (file)
@@ -44,7 +44,7 @@
 // inputs/outputs of do_exec().
 typedef
    struct {
-      HChar** argv;       // IN: the original argv
+      const HChar** argv;   // IN: the original argv
 
       Addr exe_base;     // INOUT: lowest (allowed) address of exe
       Addr exe_end;      // INOUT: highest (allowed) address
index 160b71c3d4d646ce42bfd732dde5fc7235c282fc..4b2b0afb7cc98889b604e772394504b2ab2b5bbc 100644 (file)
@@ -362,7 +362,7 @@ int ptrace_write_memory (pid_t inferior_pid, CORE_ADDR memaddr,
    if (debuglevel >= 1) {
       DEBUG (1, "Writing ");
       for (i = 0; i < len; i++)
-         PDEBUG (1, "%02x", ((unsigned char*)myaddr)[i]);
+         PDEBUG (1, "%02x", ((const unsigned char*)myaddr)[i]);
       PDEBUG(1, " to %p\n", (void *) memaddr);
    }
    
index 6873daa281e21ee61fe797702662c5daeee7794f..4c054d98342472090f58f416f761c95cb08d2118 100644 (file)
@@ -166,8 +166,8 @@ STRCPY(VG_Z_DYLD,        strcpy)
          if (*s1 == 0) return -1; \
          if (*s2 == 0) return 1; \
          \
-         if (*(unsigned char*)s1 < *(unsigned char*)s2) return -1; \
-         if (*(unsigned char*)s1 > *(unsigned char*)s2) return 1; \
+         if (*(const unsigned char*)s1 < *(const unsigned char*)s2) return -1; \
+         if (*(const unsigned char*)s1 > *(const unsigned char*)s2) return 1; \
          \
          s1++; s2++; n++; \
       } \
@@ -190,8 +190,8 @@ STRNCMP(VG_Z_DYLD,        strncmp)
       register UChar c1; \
       register UChar c2; \
       while (True) { \
-         c1 = *(UChar *)s1; \
-         c2 = *(UChar *)s2; \
+         c1 = *(const UChar *)s1; \
+         c2 = *(const UChar *)s2; \
          if (c1 != c2) break; \
          if (c1 == 0) break; \
          s1++; s2++; \
@@ -215,7 +215,7 @@ STRCMP(VG_Z_LD64_SO_1,            strcmp)
    { \
       SizeT i; \
       UChar c0 = (UChar)c; \
-      UChar* p = (UChar*)s; \
+      const UChar* p = (const UChar*)s; \
       for (i = 0; i < n; i++) \
          if (p[i] == c0) return (void*)(&p[i]); \
       return NULL; \
index a62a18ff59786facc49d0c0caab9ebffcbdfffb4..075c74d58bdb57e6643b93384830cc8d67885143 100644 (file)
 */
 Bool VG_(generic_match) ( 
         Bool matchAll,
-        void* patt,  SizeT szbPatt,  UWord nPatt,  UWord ixPatt,
-        void* input, SizeT szbInput, UWord nInput, UWord ixInput,
-        Bool (*pIsStar)(void*),
-        Bool (*pIsQuery)(void*),
-        Bool (*pattEQinp)(void*,void*,void*,UWord),
+        const void* patt,  SizeT szbPatt,  UWord nPatt,  UWord ixPatt,
+        const void* input, SizeT szbInput, UWord nInput, UWord ixInput,
+        Bool (*pIsStar)(const void*),
+        Bool (*pIsQuery)(const void*),
+        Bool (*pattEQinp)(const void*,const void*,void*,UWord),
         void* inputCompleter
      );
 
index 4374e49967374ff67089f15b77b777af47e882e2..b7bf20a13883458044db7f61cd4210a9e029c905 100644 (file)
@@ -662,8 +662,8 @@ static void add_child_xpt(XPt* parent, XPt* child)
 // Reverse comparison for a reverse sort -- biggest to smallest.
 static Int SXPt_revcmp_szB(const void* n1, const void* n2)
 {
-   const SXPt* sxpt1 = *(const SXPt**)n1;
-   const SXPt* sxpt2 = *(const SXPt**)n2;
+   const SXPt* sxpt1 = *(const SXPt *const *)n1;
+   const SXPt* sxpt2 = *(const SXPt *const *)n2;
    return ( sxpt1->szB < sxpt2->szB ?  1
           : sxpt1->szB > sxpt2->szB ? -1
           :                            0);
index 1df6303bdbf4914288c48f778ce2f6543ee5f1d4..9632391c3e76e3f8d61df298482c566e819c2293 100644 (file)
 // Compare the MC_Chunks by 'data' (i.e. the address of the block).
 static Int compare_MC_Chunks(const void* n1, const void* n2)
 {
-   const MC_Chunk* mc1 = *(const MC_Chunk**)n1;
-   const MC_Chunk* mc2 = *(const MC_Chunk**)n2;
+   const MC_Chunk* mc1 = *(const MC_Chunk *const *)n1;
+   const MC_Chunk* mc2 = *(const MC_Chunk *const *)n2;
    if (mc1->data < mc2->data) return -1;
    if (mc1->data > mc2->data) return  1;
    return 0;
@@ -834,8 +834,8 @@ static void lc_process_markstack(Int clique)
 
 static Word cmp_LossRecordKey_LossRecord(const void* key, const void* elem)
 {
-   LossRecordKey* a = (LossRecordKey*)key;
-   LossRecordKey* b = &(((LossRecord*)elem)->key);
+   const LossRecordKey* a = key;
+   const LossRecordKey* b = &(((const LossRecord*)elem)->key);
 
    // Compare on states first because that's fast.
    if (a->state < b->state) return -1;
@@ -852,8 +852,8 @@ static Word cmp_LossRecordKey_LossRecord(const void* key, const void* elem)
 
 static Int cmp_LossRecords(const void* va, const void* vb)
 {
-   const LossRecord* lr_a = *(const LossRecord**)va;
-   const LossRecord* lr_b = *(const LossRecord**)vb;
+   const LossRecord* lr_a = *(const LossRecord *const *)va;
+   const LossRecord* lr_b = *(const LossRecord *const *)vb;
    SizeT total_szB_a = lr_a->szB + lr_a->indirect_szB;
    SizeT total_szB_b = lr_b->szB + lr_b->indirect_szB;
 
@@ -1294,7 +1294,7 @@ static void scan_memory_root_set(Addr searched, SizeT szB)
       // memory by explicitly mapping /dev/zero.
       if (seg->kind == SkFileC 
           && (VKI_S_ISCHR(seg->mode) || VKI_S_ISBLK(seg->mode))) {
-         HChar* dev_name = VG_(am_get_filename)( (NSegment*)seg );
+         HChar* dev_name = VG_(am_get_filename)( seg );
          if (dev_name && 0 == VG_(strcmp)(dev_name, "/dev/zero")) {
             // Don't skip /dev/zero.
          } else {
index 5b967b09618ce0b2cf01fbce979bf4c5c8ff5c31..336693ce09c8409ac6d8c86d0f5e1d2a2b4b3e2b 100644 (file)
@@ -669,8 +669,8 @@ void MC_(destroy_mempool)(Addr pool)
 static Int 
 mp_compar(const void* n1, const void* n2)
 {
-   const MC_Chunk* mc1 = *(const MC_Chunk**)n1;
-   const MC_Chunk* mc2 = *(const MC_Chunk**)n2;
+   const MC_Chunk* mc1 = *(const MC_Chunk *const *)n1;
+   const MC_Chunk* mc2 = *(const MC_Chunk *const *)n2;
    if (mc1->data < mc2->data) return -1;
    if (mc1->data > mc2->data) return  1;
    return 0;
index 0a3d0a4365ce9efd6e2f5f4fa28d58b5f981e2b3..b6f5dfba70e0b092b366fad6ba298143891efe67 100644 (file)
@@ -536,8 +536,8 @@ static inline void my_exit ( int x )
          if (*s1 == 0) return -1; \
          if (*s2 == 0) return 1; \
          \
-         if (*(UChar*)s1 < *(UChar*)s2) return -1; \
-         if (*(UChar*)s1 > *(UChar*)s2) return 1; \
+         if (*(const UChar*)s1 < *(const UChar*)s2) return -1; \
+         if (*(const UChar*)s1 > *(const UChar*)s2) return 1; \
          \
          s1++; s2++; n++; \
       } \
@@ -567,8 +567,8 @@ static inline void my_exit ( int x )
       register UChar c1; \
       register UChar c2; \
       while (True) { \
-         c1 = tolower(*(UChar *)s1); \
-         c2 = tolower(*(UChar *)s2); \
+         c1 = tolower(*(const UChar *)s1); \
+         c2 = tolower(*(const UChar *)s2); \
          if (c1 != c2) break; \
          if (c1 == 0) break; \
          s1++; s2++; \
@@ -606,10 +606,10 @@ static inline void my_exit ( int x )
          if (*s1 == 0) return -1; \
          if (*s2 == 0) return 1; \
          \
-         if (tolower(*(UChar *)s1) \
-             < tolower(*(UChar*)s2)) return -1; \
-         if (tolower(*(UChar *)s1) \
-             > tolower(*(UChar *)s2)) return 1; \
+         if (tolower(*(const UChar *)s1) \
+             < tolower(*(const UChar*)s2)) return -1; \
+         if (tolower(*(const UChar *)s1) \
+             > tolower(*(const UChar *)s2)) return 1; \
          \
          s1++; s2++; n++; \
       } \
@@ -640,8 +640,8 @@ static inline void my_exit ( int x )
       register UChar c1; \
       register UChar c2; \
       while (True) { \
-         c1 = tolower_l(*(UChar *)s1, locale); \
-         c2 = tolower_l(*(UChar *)s2, locale); \
+         c1 = tolower_l(*(const UChar *)s1, locale); \
+         c2 = tolower_l(*(const UChar *)s2, locale); \
          if (c1 != c2) break; \
          if (c1 == 0) break; \
          s1++; s2++; \
@@ -678,10 +678,10 @@ static inline void my_exit ( int x )
          if (*s1 == 0) return -1; \
          if (*s2 == 0) return 1; \
          \
-         if (tolower_l(*(UChar *)s1, locale) \
-             < tolower_l(*(UChar *)s2, locale)) return -1; \
-         if (tolower_l(*(UChar *)s1, locale) \
-             > tolower_l(*(UChar *)s2, locale)) return 1; \
+         if (tolower_l(*(const UChar *)s1, locale) \
+             < tolower_l(*(const UChar *)s2, locale)) return -1; \
+         if (tolower_l(*(const UChar *)s1, locale) \
+             > tolower_l(*(const UChar *)s2, locale)) return 1; \
          \
          s1++; s2++; n++; \
       } \
@@ -710,8 +710,8 @@ static inline void my_exit ( int x )
       register UChar c1; \
       register UChar c2; \
       while (True) { \
-         c1 = *(UChar *)s1; \
-         c2 = *(UChar *)s2; \
+         c1 = *(const UChar *)s1; \
+         c2 = *(const UChar *)s2; \
          if (c1 != c2) break; \
          if (c1 == 0) break; \
          s1++; s2++; \
@@ -909,8 +909,8 @@ static inline void my_exit ( int x )
       int res; \
       UChar a0; \
       UChar b0; \
-      UChar* s1 = (UChar*)s1V; \
-      UChar* s2 = (UChar*)s2V; \
+      const UChar* s1 = s1V; \
+      const UChar* s2 = s2V; \
       \
       while (n != 0) { \
          a0 = s1[0]; \
@@ -1459,8 +1459,8 @@ static inline void my_exit ( int x )
    SizeT VG_REPLACE_FUNCTION_EZU(20340,soname,fnname) \
          (const char* sV, const char* acceptV) \
    { \
-      UChar* s = (UChar*)sV; \
-      UChar* accept = (UChar*)acceptV; \
+      const UChar* s = (const UChar *)sV;        \
+      const UChar* accept = (const UChar *)acceptV;     \
       \
       /* find the length of 'accept', not including terminating zero */ \
       UWord nacc = 0; \