summaryrefslogtreecommitdiffstats
path: root/import/hwpf
diff options
context:
space:
mode:
authorRichard J. Knight <rjknight@us.ibm.com>2016-06-15 12:48:35 -0500
committerSachin Gupta <sgupta2m@in.ibm.com>2016-06-22 00:33:26 -0400
commit316b8fe26a87f879f53d493a78d09bab05c3fa8c (patch)
tree82e1b93dd9b03e5fb4a7f05e139a842900953bfa /import/hwpf
parent2577975e3b9abbbe2bc6f6bd1c3175474e63a210 (diff)
downloadtalos-sbe-316b8fe26a87f879f53d493a78d09bab05c3fa8c.tar.gz
talos-sbe-316b8fe26a87f879f53d493a78d09bab05c3fa8c.zip
Variable buffer issues when inserting OT variable buffer
-Added check for integral_type for OT insert. This change forces the user to insert only integral types using the generic insert interface. Change-Id: Ic207f855afff5e80d6bb342f94873964a0f60d16 RTC:151788 Reviewed-on: http://ralgit01.raleigh.ibm.com/gerrit1/25861 Tested-by: Jenkins Server Tested-by: PPE CI Reviewed-by: Soma Bhanutej <soma.bhanu@in.ibm.com> Reviewed-by: Joachim Fenkes <fenkes@de.ibm.com> Tested-by: Hostboot CI Reviewed-by: Jennifer A. Stofer <stofer@us.ibm.com> Reviewed-on: http://ralgit01.raleigh.ibm.com/gerrit1/25868 Reviewed-by: Sachin Gupta <sgupta2m@in.ibm.com>
Diffstat (limited to 'import/hwpf')
-rw-r--r--import/hwpf/fapi2/include/variable_buffer.H12
1 files changed, 8 insertions, 4 deletions
diff --git a/import/hwpf/fapi2/include/variable_buffer.H b/import/hwpf/fapi2/include/variable_buffer.H
index 227ffc52..9bf9294e 100644
--- a/import/hwpf/fapi2/include/variable_buffer.H
+++ b/import/hwpf/fapi2/include/variable_buffer.H
@@ -167,9 +167,9 @@ inline fapi2::ReturnCodes _insert(const unit_type* i_source,
/// @note Variable buffers are not (presently) declared as std::bitset
/// as bitsets' size is fixed at runtime. It is not clear if this is
/// acceptable for variable_buffers at this time.
-/// @note Variable buffers are implemented as a std::vecor of uint32_t
+/// @note Variable buffers are implemented as a std::vector of uint32_t
/// as this keeps simple compatibility with ecmdDataBuffers. Cronus (at
-//least) need to interwork the two.
+// least) needs to interwork the two.
class variable_buffer
{
@@ -788,7 +788,7 @@ class variable_buffer
/// @param[in] i_targetStart The position in this where the copy starts
/// @param[in] i_len How many bits to copy
/// @param[in] i_sourceStart The start positon in i_data, defaults to 0
- /// @return FAPI2_RC_SUCCESS on success, FAPi2_RC_OVERFLOW otherwise
+ /// @return FAPI2_RC_SUCCESS on success, FAPI2_RC_OVERFLOW otherwise
///
template<typename OT>
inline fapi2::ReturnCodes insert(const OT& i_data,
@@ -796,6 +796,10 @@ class variable_buffer
bits_type i_len = ~0,
bits_type i_sourceStart = 0)
{
+ // Compile time check to make sure OT is integral
+ static_assert( std::is_integral<OT>::value,
+ "Input must be an integral type" );
+
// _insert likes 32-bit sources. So lets make our source 32 bits.
uint32_t l_source = static_cast<uint32_t>(i_data);
bits_type l_sourceStart = i_sourceStart +
@@ -1007,7 +1011,7 @@ inline fapi2::ReturnCodes variable_buffer::insert(const uint64_t& i_source,
i_sourceStart, i_targetStart, i_len);
}
-// Insert another variable_bufer
+// Insert another variable_buffer
template<>
inline fapi2::ReturnCodes variable_buffer::insert(
const variable_buffer& i_data,
OpenPOWER on IntegriCloud