diff options
author | Daniel Elstner <daniel@src.gnome.org> | 2007-08-03 23:07:43 +0000 |
---|---|---|
committer | Daniel Elstner <daniel@src.gnome.org> | 2007-08-03 23:07:43 +0000 |
commit | 3dc5e0d4e1e9ea885613520fdc4077232faa4286 (patch) | |
tree | 793629a01e301c17327bb377a6679a0688744229 /glib/glibmm/containerhandle_shared.h | |
parent | 4db1ac2437c6b09970f0f8a727ac98e8436ea7ee (diff) | |
download | glibmm-3dc5e0d4e1e9ea885613520fdc4077232faa4286.tar.gz |
Rewrite completely broken type adapter (bug #406960). Fix the
* containerhandle_shared.h (TypeTraits<bool>): Rewrite completely
broken type adapter (bug #406960).
* src/keyfile.{ccg,hg}: Fix the implementation to correctly use
ArrayHandle<>. Fix compilation with the new ArrayHandle<bool>
code.
svn path=/trunk/; revision=430
Diffstat (limited to 'glib/glibmm/containerhandle_shared.h')
-rw-r--r-- | glib/glibmm/containerhandle_shared.h | 38 |
1 files changed, 9 insertions, 29 deletions
diff --git a/glib/glibmm/containerhandle_shared.h b/glib/glibmm/containerhandle_shared.h index 4a82b69f..45ca462a 100644 --- a/glib/glibmm/containerhandle_shared.h +++ b/glib/glibmm/containerhandle_shared.h @@ -314,40 +314,22 @@ struct TypeTraits<std::string> { g_free(const_cast<CTypeNonConst>(str)); } }; -/** Specialization for bool +/** Specialization for bool. * @ingroup ContHelpers */ template <> struct TypeTraits<bool> { - typedef bool CppType; - typedef gboolean* CType; - typedef gboolean* CTypeNonConst; - - static CType to_c_type (CppType val) { return (int*)GINT_TO_POINTER(val); } - static CType to_c_type (CType ptr) { return ptr; } - - static CppType to_cpp_type(CType ptr) - { - if(ptr) - { - //We use this for gboolean too, because it is actually an int. - return GPOINTER_TO_INT(ptr); - } - else - return CppType(); - } - - static void release_c_type(CType /* ptr */) - { - - } + typedef bool CppType; + typedef gboolean CType; + typedef gboolean CTypeNonConst; + + static CType to_c_type (CppType item) { return static_cast<CType>(item); } + static CType to_c_type (CType item) { return item; } + static CppType to_cpp_type (CType item) { return (item != 0); } + static void release_c_type (CType) {} }; -#endif /* DOXYGEN_SHOULD_SKIP_THIS */ - - -#ifndef DOXYGEN_SHOULD_SKIP_THIS #ifndef GLIBMM_HAVE_TEMPLATE_SEQUENCE_CTORS /* The STL containers in Sun's libCstd don't support templated sequence @@ -368,6 +350,4 @@ void fill_container(Cont& container, In pbegin, In pend) } // namespace Glib - #endif /* _GLIBMM_CONTAINERHANDLE_SHARED_H */ - |