#At file:///home/msvensson/mysql/6.2-bug46113/ based on revid:jonas@strippedhvoijfkawsg93
3018 Magnus Blåudd 2009-10-07
Bug#46113 ndbd fails to start when built with gcc-4.4.0 (e.g Fedora 11)
- Make DataBuffer.hpp strict aliasing safe
modified:
storage/ndb/src/kernel/vm/DataBuffer.hpp
=== modified file 'storage/ndb/src/kernel/vm/DataBuffer.hpp'
--- a/storage/ndb/src/kernel/vm/DataBuffer.hpp 2009-05-26 18:53:34 +0000
+++ b/storage/ndb/src/kernel/vm/DataBuffer.hpp 2009-10-07 14:08:22 +0000
@@ -410,21 +410,89 @@ template<Uint32 sz>
inline
bool
DataBuffer<sz>::first(DataBufferIterator & it){
- return first((ConstDataBufferIterator&)it);
+ it.curr.i = head.firstItem;
+ if(it.curr.i == RNIL){
+ it.setNull();
+ return false;
+ }
+ thePool.getPtr(it.curr);
+ it.data = &it.curr.p->data[0];
+ it.ind = 0;
+ it.pos = 0;
+ return true;
}
template<Uint32 sz>
inline
bool
DataBuffer<sz>::next(DataBufferIterator & it){
- return next((ConstDataBufferIterator&)it);
+ it.ind ++;
+ it.data ++;
+ it.pos ++;
+ if(it.ind < sz && it.pos < head.used){
+ return true;
+ }
+
+ if(it.pos < head.used){
+ it.curr.i = it.curr.p->nextPool;
+#ifdef ARRAY_GUARD
+ if(it.curr.i == RNIL){
+ /**
+ * This is actually "internal error"
+ * pos can't be less than head.used and at the same time we can't
+ * find next segment
+ *
+ * Note this must not "really" be checked since thePool.getPtr will
+ * abort when trying to get RNIL. That's why the check is within
+ * ARRAY_GUARD
+ */
+ ErrorReporter::handleAssert("DataBuffer<sz>::next", __FILE__, __LINE__);
+ }
+#endif
+ thePool.getPtr(it.curr);
+ it.data = &it.curr.p->data[0];
+ it.ind = 0;
+ return true;
+ }
+ it.setNull();
+ return false;
}
template<Uint32 sz>
inline
bool
DataBuffer<sz>::next(DataBufferIterator & it, Uint32 hops){
- return next((ConstDataBufferIterator&)it, hops);
+#if 0
+ for (Uint32 i=0; i<hops; i++) {
+ if (!this->next(it))
+ return false;
+ }
+ return true;
+#else
+ if(it.pos + hops < head.used){
+ while(hops >= sz){
+ it.curr.i = it.curr.p->nextPool;
+ thePool.getPtr(it.curr);
+ hops -= sz;
+ it.pos += sz;
+ }
+
+ it.ind += hops;
+ it.pos += hops;
+ if(it.ind < sz){
+ it.data = &it.curr.p->data[it.ind];
+ return true;
+ }
+
+ it.curr.i = it.curr.p->nextPool;
+ thePool.getPtr(it.curr);
+ it.ind -= sz;
+ it.data = &it.curr.p->data[it.ind];
+ return true;
+ }
+ it.setNull();
+ return false;
+#endif
}
template<Uint32 sz>
Attachment: [text/bzr-bundle] bzr/magnus.blaudd@sun.com-20091007140822-z4ssy9kqsg33ezlo.bundle
| Thread |
|---|
| • bzr commit into mysql-5.1-telco-6.2 branch (magnus.blaudd:3018)Bug#46113 | Magnus Blåudd | 7 Oct |