Permalink
Browse files

fix last commit breakage

  • Loading branch information...
1 parent 619650a commit 45032b5487575c4f9200472e6552cc9167b8ebea @dwight dwight committed Jun 27, 2011
Showing with 13 additions and 7 deletions.
  1. +2 −2 db/btree.cpp
  2. +1 −1 db/btree.h
  3. +3 −3 db/btreebuilder.cpp
  4. +7 −1 db/key.h
View
@@ -309,12 +309,12 @@ namespace mongo {
* does not bother returning that value.
*/
template< class V >
- void BucketBasics<V>::popBack(DiskLoc& recLoc, const Key *&key) {
+ void BucketBasics<V>::popBack(DiskLoc& recLoc, Key &key) {
massert( 10282 , "n==0 in btree popBack()", this->n > 0 );
assert( k(this->n-1).isUsed() ); // no unused skipping in this function at this point - btreebuilder doesn't require that
KeyNode kn = keyNode(this->n-1);
recLoc = kn.recordLoc;
- key = &kn.key;
+ key.assign(kn.key);
int keysize = kn.key.dataSize();
massert( 10283 , "rchild not null in btree popBack()", this->nextChild.isNull());
View
@@ -429,7 +429,7 @@ namespace mongo {
* - The last key of the bucket is removed, and its key and recLoc are
* returned. As mentioned above, the key points to unallocated memory.
*/
- void popBack(DiskLoc& recLoc, const Key *&key);
+ void popBack(DiskLoc& recLoc, Key &key);
/**
* Preconditions:
View
@@ -114,19 +114,19 @@ namespace mongo {
}
BtreeBucket<V> *x = xloc.btreemod<V>();
- const Key *k;
+ Key k;
DiskLoc r;
x->popBack(r,k);
bool keepX = ( x->n != 0 );
DiskLoc keepLoc = keepX ? xloc : x->nextChild;
- if ( ! up->_pushBack(r, *k, ordering, keepLoc) ) {
+ if ( ! up->_pushBack(r, k, ordering, keepLoc) ) {
// current bucket full
DiskLoc n = BtreeBucket<V>::addBucket(idx);
up->setTempNext(n);
upLoc = n;
up = upLoc.btreemod<V>();
- up->pushBack(r, *k, ordering, keepLoc);
+ up->pushBack(r, k, ordering, keepLoc);
}
DiskLoc nextLoc = x->tempNext(); // get next in chain at current level
View
@@ -28,7 +28,7 @@ namespace mongo {
KeyV1 is the new implementation.
*/
- class KeyBson {
+ class KeyBson /* "KeyV0" */ {
public:
KeyBson() { }
explicit KeyBson(const char *keyData) : _o(keyData) { }
@@ -41,6 +41,7 @@ namespace mongo {
BSONElement _firstElement() const { return _o.firstElement(); }
bool isCompactFormat() const { return false; }
bool woEqual(const KeyBson& r) const;
+ void assign(const KeyBson& rhs) { *this = rhs; }
private:
BSONObj _o;
};
@@ -59,6 +60,11 @@ namespace mongo {
dassert( _keyData > (const unsigned char *) 1 );
}
+ // explicit version of operator= to be safe
+ void assign(const KeyV1& rhs) {
+ _keyData = rhs._keyData;
+ }
+
/** @param keyData can be a buffer containing data in either BSON format, OR in KeyV1 format.
when BSON, we are just a wrapper
*/

0 comments on commit 45032b5

Please sign in to comment.