Skip to content

Commit

Permalink
Restore removed va_start calls; add missing va_end as reported in #264.
Browse files Browse the repository at this point in the history
  • Loading branch information
pdimov committed Mar 14, 2024
1 parent 2805bc3 commit d52537a
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 12 deletions.
15 changes: 9 additions & 6 deletions include/boost/serialization/extended_type_info_no_rtti.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -129,23 +129,26 @@ class extended_type_info_no_rtti :
}
void * construct(unsigned int count, ...) const BOOST_OVERRIDE {
// count up the arguments
void * r = NULL;
std::va_list ap;
va_start(ap, count);
switch(count){
case 0:
return factory<typename boost::remove_const< T >::type, 0>(ap);
r = factory<typename boost::remove_const< T >::type, 0>(ap);
case 1:
return factory<typename boost::remove_const< T >::type, 1>(ap);
r = factory<typename boost::remove_const< T >::type, 1>(ap);
case 2:
return factory<typename boost::remove_const< T >::type, 2>(ap);
r = factory<typename boost::remove_const< T >::type, 2>(ap);
case 3:
return factory<typename boost::remove_const< T >::type, 3>(ap);
r = factory<typename boost::remove_const< T >::type, 3>(ap);
case 4:
return factory<typename boost::remove_const< T >::type, 4>(ap);
r = factory<typename boost::remove_const< T >::type, 4>(ap);
default:
BOOST_ASSERT(false); // too many arguments
// throw exception here?
return NULL;
}
va_end(ap);
return r;
}
void destroy(void const * const p) const BOOST_OVERRIDE {
boost::serialization::access::destroy(
Expand Down
15 changes: 9 additions & 6 deletions include/boost/serialization/extended_type_info_typeid.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -112,23 +112,26 @@ class extended_type_info_typeid :
}
void * construct(unsigned int count, ...) const BOOST_OVERRIDE {
// count up the arguments
void * r = NULL;
std::va_list ap;
va_start(ap, count);
switch(count){
case 0:
return factory<typename boost::remove_const< T >::type, 0>(ap);
r = factory<typename boost::remove_const< T >::type, 0>(ap);
case 1:
return factory<typename boost::remove_const< T >::type, 1>(ap);
r = factory<typename boost::remove_const< T >::type, 1>(ap);
case 2:
return factory<typename boost::remove_const< T >::type, 2>(ap);
r = factory<typename boost::remove_const< T >::type, 2>(ap);
case 3:
return factory<typename boost::remove_const< T >::type, 3>(ap);
r = factory<typename boost::remove_const< T >::type, 3>(ap);
case 4:
return factory<typename boost::remove_const< T >::type, 4>(ap);
r = factory<typename boost::remove_const< T >::type, 4>(ap);
default:
BOOST_ASSERT(false); // too many arguments
// throw exception here?
return NULL;
}
va_end(ap);
return r;
}
void destroy(void const * const p) const BOOST_OVERRIDE {
boost::serialization::access::destroy(
Expand Down

0 comments on commit d52537a

Please sign in to comment.