summaryrefslogtreecommitdiffstats
path: root/src/usr/targeting/attrrp.C
diff options
context:
space:
mode:
authorBrian Horton <brianh@linux.ibm.com>2013-03-20 13:18:15 -0500
committerA. Patrick Williams III <iawillia@us.ibm.com>2013-04-03 11:00:44 -0500
commitcb09cefc89425d13fbc587c984c54ca1fc065a26 (patch)
tree5892756b813165a5075495d0c71af7a4e1bc3144 /src/usr/targeting/attrrp.C
parent4e113fa7bd9e069cf727566b8d8ea85c04588a0b (diff)
downloadtalos-hostboot-cb09cefc89425d13fbc587c984c54ca1fc065a26.tar.gz
talos-hostboot-cb09cefc89425d13fbc587c984c54ca1fc065a26.zip
loops: replace ++ and .size() with C++ iterators where possible.
Change-Id: I42a23fe81f08cb533b76ec5ff043bfe31b60bbdd RTC: 52905 Reviewed-on: http://gfw160.austin.ibm.com:8080/gerrit/3697 Tested-by: Jenkins Server Reviewed-by: MIKE J. JONES <mjjones@us.ibm.com> Reviewed-by: A. Patrick Williams III <iawillia@us.ibm.com>
Diffstat (limited to 'src/usr/targeting/attrrp.C')
-rw-r--r--src/usr/targeting/attrrp.C23
1 files changed, 13 insertions, 10 deletions
diff --git a/src/usr/targeting/attrrp.C b/src/usr/targeting/attrrp.C
index 7c6c9e55f..b5ae745ef 100644
--- a/src/usr/targeting/attrrp.C
+++ b/src/usr/targeting/attrrp.C
@@ -154,7 +154,7 @@ namespace TARGETING
// Locate corresponding attribute section for message.
ssize_t section = -1;
- for (size_t i = 0; i < iv_sectionCount; i++)
+ for (size_t i = 0; i < iv_sectionCount; ++i)
{
if ((vAddr >= iv_sections[i].vmmAddress) &&
(vAddr < iv_sections[i].vmmAddress + iv_sections[i].size))
@@ -338,7 +338,7 @@ namespace TARGETING
);
// Parse each section.
- for (size_t i = 0; i < iv_sectionCount; i++, l_section++)
+ for (size_t i = 0; i < iv_sectionCount; i++, ++l_section)
{
iv_sections[i].type = l_section->sectionType;
@@ -379,7 +379,7 @@ namespace TARGETING
iv_msgQ = msg_q_create();
// Create VMM block for each section, assign permissions.
- for (size_t i = 0; i < iv_sectionCount; i++)
+ for (size_t i = 0; i < iv_sectionCount; ++i)
{
uint64_t l_perm = 0;
switch(iv_sections[i].type)
@@ -515,12 +515,15 @@ namespace TARGETING
bool l_rc = true; // true if write to section is successful
// for each page
- for ( size_t i = 0; (i < i_pages.size()) && (true == l_rc); i++ )
+ for (std::vector<TARGETING::sectionRefData>::const_iterator
+ pageIter = i_pages.begin();
+ (pageIter != i_pages.end()) && (true == l_rc);
+ ++pageIter)
{
// search for the section we need
- for ( size_t j = 0; j < iv_sectionCount; j++ )
+ for ( size_t j = 0; j < iv_sectionCount; ++j )
{
- if ( iv_sections[j].type == i_pages[i].sectionId )
+ if ( iv_sections[j].type == (*pageIter).sectionId )
{
// found it..
TARG_DBG( "Writing Attribute Section: ID: %u, "
@@ -528,10 +531,10 @@ namespace TARGETING
iv_sections[j].type,
iv_sections[j].vmmAddress,
iv_sections[j].size,
- i_pages[i].pageNumber);
+ (*pageIter).pageNumber);
// check that page number is within range
- uint64_t l_pageOffset = i_pages[i].pageNumber * PAGESIZE;
+ uint64_t l_pageOffset = (*pageIter).pageNumber * PAGESIZE;
if ( iv_sections[j].size < (l_pageOffset + PAGESIZE) )
{
TARG_ERR("page offset 0x%lx is greater than "
@@ -549,7 +552,7 @@ namespace TARGETING
reinterpret_cast<uint8_t *>
(iv_sections[j].vmmAddress) + l_pageOffset;
- memcpy( l_dataPtr, i_pages[i].dataPtr, PAGESIZE );
+ memcpy( l_dataPtr, (*pageIter).dataPtr, PAGESIZE );
break;
}
}
@@ -573,7 +576,7 @@ namespace TARGETING
uint16_t pages = 0;
// search for the section we need
- for (size_t i = 0; i < iv_sectionCount; i++ )
+ for (size_t i = 0; i < iv_sectionCount; ++i )
{
if ( iv_sections[i].type == i_sectionId )
{
OpenPOWER on IntegriCloud