OSDN Git Service

libutils: Fix an improper const-cast in RefBase honeycomb-x86
authorJosh Stone <cuviper@gmail.com>
Fri, 22 Apr 2011 18:13:35 +0000 (11:13 -0700)
committerChih-Wei Huang <cwhuang@linux.org.tw>
Wed, 11 Jan 2012 11:31:28 +0000 (19:31 +0800)
Under Fedora 15 Beta, gcc 4.6.0 warns:

  frameworks/base/libs/utils/RefBase.cpp: In member function
    ‘void android::RefBase::weakref_type::trackMe(bool, bool)’:
  frameworks/base/libs/utils/RefBase.cpp:483:67: error: passing
    ‘const android::RefBase::weakref_impl’ as ‘this’ argument of
    ‘void android::RefBase::weakref_impl::trackMe(bool, bool)’
    discards qualifiers [-fpermissive]

trackMe is not a const function, so don't use const in the static_cast
to a weakref_impl pointer.

Change-Id: I3c9ba73eb127985f5f54197ffecf2939c50f632c

libs/utils/RefBase.cpp

index bb6c125..2034486 100644 (file)
@@ -524,7 +524,7 @@ void RefBase::weakref_type::printRefs() const
 
 void RefBase::weakref_type::trackMe(bool enable, bool retain)
 {
-    static_cast<const weakref_impl*>(this)->trackMe(enable, retain);
+    static_cast<weakref_impl*>(this)->trackMe(enable, retain);
 }
 
 RefBase::weakref_type* RefBase::createWeak(const void* id) const