Fix a few casts that dropped type qualifiers. As pointed out by
-Wcast-qual.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@14554 a5019735-40e9-0310-863c-91ae7b9d1cf9
diff --git a/coregrind/m_debuginfo/image.c b/coregrind/m_debuginfo/image.c
index dfe077f..a289f44 100644
--- a/coregrind/m_debuginfo/image.c
+++ b/coregrind/m_debuginfo/image.c
@@ -877,7 +877,7 @@
    ensure_valid(img, off1, 1, "ML_(img_strcmp_c)");
    while (True) {
       UChar c1 = get(img, off1);
-      UChar c2 = *(UChar*)str2;
+      UChar c2 = *(const UChar*)str2;
       if (c1 < c2) return -1;
       if (c1 > c2) return 1;
       if (c1 == 0) return 0;
diff --git a/coregrind/m_debuginfo/storage.c b/coregrind/m_debuginfo/storage.c
index 3d8a13f..ab570be 100644
--- a/coregrind/m_debuginfo/storage.c
+++ b/coregrind/m_debuginfo/storage.c
@@ -1858,8 +1858,8 @@
 static DiLoc* sorting_loctab = NULL;
 static Int compare_DiLoc_via_ix ( const void* va, const void* vb ) 
 {
-   const DiLoc* a = &sorting_loctab[*(UInt*)va];
-   const DiLoc* b = &sorting_loctab[*(UInt*)vb];
+   const DiLoc* a = &sorting_loctab[*(const UInt*)va];
+   const DiLoc* b = &sorting_loctab[*(const UInt*)vb];
    if (a->addr < b->addr) return -1;
    if (a->addr > b->addr) return  1;
    return 0;
diff --git a/coregrind/m_deduppoolalloc.c b/coregrind/m_deduppoolalloc.c
index 916f7e8..53d6853 100644
--- a/coregrind/m_deduppoolalloc.c
+++ b/coregrind/m_deduppoolalloc.c
@@ -249,10 +249,10 @@
    // (A lot can be 10% of the elements colliding, even on
    // small nr of elements such as 10_000).
    ht_elt.key = VG_(adler32) (0, NULL, 0);
-   ht_elt.key = VG_(adler32) (ht_elt.key, (UChar*)elt, eltSzB);
+   ht_elt.key = VG_(adler32) (ht_elt.key, elt, eltSzB);
 
    ht_elt.eltSzB = eltSzB;
-   ht_elt.elt = (UChar*) elt;
+   ht_elt.elt = (void *)elt;
 
    ht_ins = VG_(HT_gen_lookup) (ddpa->ht_elements, &ht_elt, cmp_pool_elt);
    if (ht_ins)
@@ -282,9 +282,9 @@
 static __inline__
 UInt elt2nr (DedupPoolAlloc *ddpa, const void *dedup_elt)
 {
-   vg_assert ((UChar*)dedup_elt >= ddpa->curpool
-              && (UChar*)dedup_elt < ddpa->curpool_free);
-   return 1 + ((UChar*)dedup_elt - ddpa->curpool)
+   vg_assert (dedup_elt >= (const void *)ddpa->curpool
+              && dedup_elt < (const void *)ddpa->curpool_free);
+   return 1 + ((const UChar*)dedup_elt - (const UChar *)ddpa->curpool)
       / VG_ROUNDUP(ddpa->fixedSzb, ddpa->eltAlign);
 }
 
diff --git a/coregrind/m_scheduler/scheduler.c b/coregrind/m_scheduler/scheduler.c
index 14d340a..342fbe6 100644
--- a/coregrind/m_scheduler/scheduler.c
+++ b/coregrind/m_scheduler/scheduler.c
@@ -696,7 +696,7 @@
    guest state, its two copies, and the spill area.  In short, all 4
    areas must have a 16-aligned size and be 16-aligned, and placed
    back-to-back. */
-static void do_pre_run_checks ( ThreadState* tst )
+static void do_pre_run_checks ( volatile ThreadState* tst )
 {
    Addr a_vex     = (Addr) & tst->arch.vex;
    Addr a_vexsh1  = (Addr) & tst->arch.vex_shadow1;
@@ -859,7 +859,7 @@
    vg_assert(*dispatchCtrP > 0);
 
    tst = VG_(get_ThreadState)(tid);
-   do_pre_run_checks( (ThreadState*)tst );
+   do_pre_run_checks( tst );
    /* end Paranoia */
 
    /* Futz with the XIndir stats counters. */
@@ -934,7 +934,7 @@
       jumped, 
       VG_(disp_run_translations)( 
          two_words,
-         (void*)&tst->arch.vex,
+         (volatile void*)&tst->arch.vex,
          host_code_addr
       )
    );
diff --git a/coregrind/m_syswrap/syswrap-generic.c b/coregrind/m_syswrap/syswrap-generic.c
index 44564ae..79d9320 100644
--- a/coregrind/m_syswrap/syswrap-generic.c
+++ b/coregrind/m_syswrap/syswrap-generic.c
@@ -673,7 +673,8 @@
    static const unsigned char V4mappedprefix[12] = {0,0,0,0,0,0,0,0,0,0,0xff,0xff};
 
    if (!VG_(memcmp)(ip, V4mappedprefix, 12)) {
-      struct vki_in_addr *sin_addr = (struct vki_in_addr *)(ip + 12);
+      const struct vki_in_addr *sin_addr =
+          (const struct vki_in_addr *)(ip + 12);
       UInt addr = VG_(ntohl)(sin_addr->s_addr);
 
       VG_(sprintf)(s, "::ffff:%u.%u.%u.%u",
diff --git a/coregrind/pub_core_dispatch.h b/coregrind/pub_core_dispatch.h
index 1193fad..9e08e9d 100644
--- a/coregrind/pub_core_dispatch.h
+++ b/coregrind/pub_core_dispatch.h
@@ -62,7 +62,7 @@
    where we have to return a chain-me request.
 */
 void VG_(disp_run_translations)( HWord* two_words,
-                                 void*  guest_state, 
+                                 volatile void*  guest_state, 
                                  Addr   host_addr );
 
 /* We need to know addresses of the continuation-point (cp_) labels so
diff --git a/helgrind/hg_intercepts.c b/helgrind/hg_intercepts.c
index 71bd402..fb9963a 100644
--- a/helgrind/hg_intercepts.c
+++ b/helgrind/hg_intercepts.c
@@ -159,8 +159,8 @@
 __attribute__((noinline))
 static int my_memcmp ( const void* ptr1, const void* ptr2, size_t size)
 {
-   unsigned char* uchar_ptr1 = (unsigned char*) ptr1;
-   unsigned char* uchar_ptr2 = (unsigned char*) ptr2;
+   const unsigned char* uchar_ptr1 = (const unsigned char*) ptr1;
+   const unsigned char* uchar_ptr2 = (const unsigned char*) ptr2;
    size_t i;
    for (i = 0; i < size; ++i) {
       if (uchar_ptr1[i] != uchar_ptr2[i])