@@ -69,7 +69,7 @@ namespace mongo {
6969 break ;
7070
7171 case Timestamp:
72- timestampValue = OpTime () ;
72+ timestampValue = 0 ;
7373 break ;
7474
7575 default :
@@ -136,7 +136,8 @@ namespace mongo {
136136 }
137137
138138 case jstOID:
139- oidValue = pBsonElement->OID ();
139+ BOOST_STATIC_ASSERT (sizeof (oidValue) == sizeof (OID));
140+ memcpy (oidValue, pBsonElement->OID ().getData (), sizeof (oidValue));
140141 break ;
141142
142143 case Bool:
@@ -158,7 +159,8 @@ namespace mongo {
158159 break ;
159160
160161 case Timestamp:
161- timestampValue = pBsonElement->_opTime ();
162+ // asDate is a poorly named function that returns a ReplTime
163+ timestampValue = pBsonElement->_opTime ().asDate ();
162164 break ;
163165
164166 case NumberLong:
@@ -232,12 +234,10 @@ namespace mongo {
232234 return pValue;
233235 }
234236
235- Value::Value (const OpTime& value):
236- type(Timestamp),
237- pDocumentValue(),
238- vpValue() {
239- timestampValue = value;
240- }
237+ Value::Value (const OpTime& value)
238+ : type(Timestamp)
239+ , timestampValue(value.asDate())
240+ {}
241241
242242 intrusive_ptr<const Value> Value::createTimestamp (const OpTime& value) {
243243 intrusive_ptr<const Value> pValue (new Value (value));
@@ -332,7 +332,7 @@ namespace mongo {
332332
333333 OID Value::getOid () const {
334334 verify (getType () == jstOID);
335- return oidValue;
335+ return OID ( oidValue) ;
336336 }
337337
338338 bool Value::getBool () const {
@@ -616,7 +616,7 @@ namespace mongo {
616616 return dateValue;
617617
618618 case Timestamp:
619- return timestampValue .getSecs () * 1000LL ;
619+ return getTimestamp () .getSecs () * 1000LL ;
620620
621621 default :
622622 uassert (16006 , str::stream () <<
@@ -687,7 +687,7 @@ namespace mongo {
687687 return stringValue;
688688
689689 case Timestamp:
690- ss << timestampValue .toStringPretty ();
690+ ss << getTimestamp () .toStringPretty ();
691691 return ss.str ();
692692
693693 case Date:
@@ -858,9 +858,9 @@ namespace mongo {
858858 break ;
859859
860860 case jstOID:
861- if (rL->oidValue < rR->oidValue )
861+ if (rL->getOid () < rR->getOid () )
862862 return -1 ;
863- if (rL->oidValue == rR->oidValue )
863+ if (rL->getOid () == rR->getOid () )
864864 return 0 ;
865865 return 1 ;
866866
@@ -958,7 +958,7 @@ namespace mongo {
958958 break ;
959959
960960 case jstOID:
961- oidValue .hash_combine (seed);
961+ getOid () .hash_combine (seed);
962962 break ;
963963
964964 case Bool:
@@ -974,7 +974,7 @@ namespace mongo {
974974 break ;
975975
976976 case Timestamp:
977- boost::hash_combine (seed, timestampValue. asLL () );
977+ boost::hash_combine (seed, timestampValue);
978978 break ;
979979
980980 case Undefined:
0 commit comments