summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorKrzysztof Kosi??ski <tweenk.pl@gmail.com>2009-02-25 22:52:12 +0000
committertweenk <tweenk@users.sourceforge.net>2009-02-25 22:52:12 +0000
commit54ddc75c664986621ca0c60cb6aabfde61e49544 (patch)
treea7615c490ed774f9d4dc6e9ae7d05012f2e9e752 /src
parentSnap guides to (intersections of) guides (closes bug #331143) (diff)
downloadinkscape-54ddc75c664986621ca0c60cb6aabfde61e49544.tar.gz
inkscape-54ddc75c664986621ca0c60cb6aabfde61e49544.zip
Revert commit 20742 that opened a can of worms.
(bzr r7371)
Diffstat (limited to 'src')
-rw-r--r--src/util/glib-list-iterators.h39
1 files changed, 12 insertions, 27 deletions
diff --git a/src/util/glib-list-iterators.h b/src/util/glib-list-iterators.h
index 3779cad1e..586bc314a 100644
--- a/src/util/glib-list-iterators.h
+++ b/src/util/glib-list-iterators.h
@@ -1,14 +1,11 @@
-/** @file
- * @brief STL iterators for Glib list types
- */
-/* Inkscape::Util::GSListIterator - STL iterator for GSList
+/*
+ * Inkscape::Util::GSListIterator - STL iterator for GSList
* Inkscape::Util::GSListConstIterator - STL iterator for GSList
* Inkscape::Util::GListIterator - STL iterator for GList
* Inkscape::Util::GListConstIterator - STL iterator for GList
*
* Authors:
* MenTaLguY <mental@rydia.net>
- * Krzysztof KosiƄski <tweenk.pl@gmail.com>
*
* Copyright (C) 2005 MenTaLguY
*
@@ -24,6 +21,7 @@
#include "glib/glist.h"
namespace Inkscape {
+
namespace Util {
template <typename T> class GSListConstIterator;
@@ -46,9 +44,7 @@ public:
GSList const *list() const { return _list; }
reference operator*() const {
- _ref_union u;
- u._gp = _list->data;
- return *u._p;
+ return *reinterpret_cast<pointer>(&_list->data);
}
bool operator==(GSListConstIterator const &other) {
@@ -69,7 +65,6 @@ public:
}
private:
- union _ref_union {gpointer _gp; pointer _p;};
GSList const *_list;
};
@@ -91,12 +86,10 @@ public:
GSList *list() { return _list; }
const_reference operator*() const {
- return const_cast<GSListIterator<T *> *>(this)->operator*();
+ return *reinterpret_cast<pointer>(&_list->data);
}
reference operator*() {
- _ref_union u;
- u._gp = _list->data;
- return *u._p;
+ return *reinterpret_cast<pointer>(&_list->data);
}
bool operator==(GSListIterator const &other) {
@@ -117,7 +110,6 @@ public:
}
private:
- union _ref_union {gpointer _gp; pointer _p;};
GSList *_list;
};
@@ -136,9 +128,7 @@ public:
GList const *list() const { return _list; }
reference operator*() const {
- _ref_union u;
- u._gp = _list->data;
- return *u._p;
+ return *reinterpret_cast<pointer>(&_list->data);
}
bool operator==(GListConstIterator const &other) {
@@ -169,7 +159,6 @@ public:
}
private:
- union _ref_union {gpointer _gp; pointer _p;};
GList const *_list;
};
@@ -197,13 +186,9 @@ public:
GList *list() { return _list; }
const_reference operator*() const {
- return const_cast<GListIterator<T *> *>(this)->operator*();
- }
- reference operator*() {
- _ref_union u;
- u._gp = _list->data;
- return *u._p;
+ return *reinterpret_cast<pointer>(&_list->data);
}
+ reference operator*() { return *reinterpret_cast<pointer>(&_list->data); }
bool operator==(GListIterator const &other) {
return other._list == _list;
@@ -233,12 +218,12 @@ public:
}
private:
- union _ref_union {gpointer _gp; pointer _p;};
GList *_list;
};
-} // namespace Util
-} // Namespace Inkscape
+}
+
+}
#endif
/*