diff --git a/simgear/structure/SGReferenced.hxx b/simgear/structure/SGReferenced.hxx index 69788b3f..67e4fb1e 100644 --- a/simgear/structure/SGReferenced.hxx +++ b/simgear/structure/SGReferenced.hxx @@ -42,11 +42,11 @@ public: { return *this; } static unsigned get(const SGReferenced* ref) - { if (ref) return ++(ref->_refcount); else return ~0u; } + { if (ref) return ++(ref->_refcount); else return 0; } static unsigned put(const SGReferenced* ref) - { if (ref) return --(ref->_refcount); else return ~0u; } + { if (ref) return --(ref->_refcount); else return 0; } static unsigned count(const SGReferenced* ref) - { if (ref) return ref->_refcount; else return ~0u; } + { if (ref) return ref->_refcount; else return 0; } static bool shared(const SGReferenced* ref) { if (ref) return 1u < ref->_refcount; else return false; } diff --git a/simgear/structure/SGWeakReferenced.hxx b/simgear/structure/SGWeakReferenced.hxx index dbe50574..7a2bcaf5 100644 --- a/simgear/structure/SGWeakReferenced.hxx +++ b/simgear/structure/SGWeakReferenced.hxx @@ -71,11 +71,11 @@ public: /// The usual operations on weak pointers. /// The interface should stay the same then what we have in Referenced. static unsigned get(const SGWeakReferenced* ref) - { if (ref) return ++(ref->mWeakData->mRefcount); else return 0u; } + { if (ref) return ++(ref->mWeakData->mRefcount); else return 0; } static unsigned put(const SGWeakReferenced* ref) - { if (ref) return --(ref->mWeakData->mRefcount); else return ~0u; } + { if (ref) return --(ref->mWeakData->mRefcount); else return 0; } static unsigned count(const SGWeakReferenced* ref) - { if (ref) return ref->mWeakData->mRefcount; else return 0u; } + { if (ref) return ref->mWeakData->mRefcount; else return 0; } private: /// Support for weak references, not increasing the reference count