updated unittest
[senf.git] / senf / Packets / DefaultBundle / IPv6ExtOptionType.ct
index 95dc085..2b2d79a 100644 (file)
@@ -34,11 +34,10 @@ template <class ForwardReadableRange>
 prefix_ void senf::IPv6GenericOptionTLVParser::value(ForwardReadableRange const &range)
 {
     unsigned int rangeSize = boost::size(range);
-    safe_data_iterator si( data(),  boost::next(i(), 2 + optionLength() ) );
+    
     if ( (rangeSize-2) != optionLength() )
         resize(optionLength()+2, rangeSize);
-
-    std::copy(boost::next(boost::begin(range), 2), boost::next(boost::end(range)), si);
+    std::copy(boost::next(boost::begin(range), 2), boost::next(boost::end(range)), boost::next(i(), 2 + optionLength() ));
     unsigned int val = *(boost::begin(range));
     unsigned int mask = 192u;
     altAction() = (val & mask) >> 6;
@@ -55,8 +54,7 @@ prefix_ void senf::IPv6GenericOptionTLVParser::setPayload(ForwardReadableRange c
     unsigned int rangeSize = boost::size(range);
     if ( rangeSize != optionLength() )
         resize( (optionLength() + 2), (rangeSize + 2) );
-    safe_data_iterator si( data(), boost::next( i(), 2) );
-    std::copy( boost::begin(range), boost::end(range), si);
+    std::copy( boost::begin(range), boost::end(range), boost::next( i(), 2));
     optionLength() = rangeSize;
 }
 
@@ -65,11 +63,12 @@ template <class Parser>
 prefix_ Parser& senf::IPv6GenericOptionTLVParser::init()
 {
     size_type oldSize ( bytes() );
-    safe_data_iterator j( data(), i() );
     resize( oldSize, senf::init_bytes<Parser>::value);
+    data_iterator j = i();
     std::advance(j, senf::init_bytes<Parser>::value);
-    std::fill(safe_data_iterator(data(), i()) , j, 0u);
-    Parser::optionType() = typeCode;
+    std::fill(i() , j, 0u);
+    Parser::init();
+    Parser::optionType() = Parser::typeCode;
     return *(this);
 }