@@ -88,7 +88,7 @@ void BIF_File::Process(Options& options)
8888 }
8989 }
9090
91- ReplaceFiles ();
91+ AppendAndReplaceFilesinBIF ();
9292 options.bifOptionsList = bifOptionList = includeBifOptionList;
9393 }
9494
@@ -779,7 +779,7 @@ void BIF_File::ParseBifFile(Options& options)
779779}
780780
781781/* *****************************************************************************/
782- void BIF_File::ReplaceFiles ()
782+ void BIF_File::AppendAndReplaceFilesinBIF ()
783783{
784784 /* If slr number matches between partitions - replace the files */
785785 for (size_t i = 0 ; i < includeBifOptionList.size (); i++)
@@ -803,6 +803,7 @@ void BIF_File::ReplaceFiles()
803803
804804 (*itr2)->filename = (*itr1)->filename ;
805805 (*itr2)->filelist = (*itr1)->filelist ;
806+ (*itr1)->erasePartition = true ;
806807 break ;
807808 }
808809 }
@@ -826,6 +827,7 @@ void BIF_File::ReplaceFiles()
826827 includeBifOptionList[i]->ClearPmcCdoFileList ();
827828 for (size_t listSize = 0 ; listSize < (*itr1)->filelist .size (); listSize++)
828829 includeBifOptionList[i]->SetPmcCdoFileList ((*itr1)->filelist [listSize]);
830+ (*itr1)->erasePartition = true ;
829831 break ;
830832 }
831833 }
@@ -844,12 +846,65 @@ void BIF_File::ReplaceFiles()
844846
845847 (*itr2)->filename = (*itr1)->filename ;
846848 (*itr2)->filelist = (*itr1)->filelist ;
849+ (*itr1)->erasePartition = true ;
847850 break ;
848851 }
849852 }
850853 }
851854 }
852855 }
856+ for (std::list<ImageBifOptions*>::iterator itr1 = bifOptionList[j]->imageBifOptionList .begin (); itr1 != bifOptionList[j]->imageBifOptionList .end (); )
857+ {
858+ bool incremented = false ;
859+ for (std::list<PartitionBifOptions*>::iterator itr2 = (*itr1)->partitionBifOptionsList .begin (); itr2 != (*itr1)->partitionBifOptionsList .end (); )
860+ {
861+ if ((*itr2)->erasePartition )
862+ {
863+ (*itr1)->partitionBifOptionsList .remove (*itr2++);
864+ if ((*itr1)->partitionBifOptionsList .size () == 0 )
865+ {
866+ bifOptionList[j]->imageBifOptionList .remove (*itr1++);
867+ incremented = true ;
868+ break ;
869+ }
870+ // break;
871+ }
872+ else
873+ {
874+ itr2++;
875+ }
876+ }
877+ if (!incremented)
878+ itr1++;
879+ }
880+ }
881+ }
882+
883+ for (size_t i = 0 ; i < includeBifOptionList.size (); i++)
884+ {
885+ if ((includeBifOptionList[i]->pdiType == PartitionType::SLR_CONFIG) || (includeBifOptionList[i]->slrNum == 0 ))
886+ {
887+ for (size_t j = 0 ; j < bifOptionList.size (); j++)
888+ {
889+ for (std::list<ImageBifOptions*>::iterator itr1 = bifOptionList[j]->imageBifOptionList .begin (); itr1 != bifOptionList[j]->imageBifOptionList .end (); itr1++)
890+ {
891+ std::list<PartitionBifOptions*>::iterator itr2 = (*itr1)->partitionBifOptionsList .begin ();
892+ {
893+ if (includeBifOptionList[i]->slrNum == (*itr2)->slrNum )
894+ {
895+ includeBifOptionList[i]->imageBifOptionList .push_back ((*itr1));
896+ includeBifOptionList[i]->partitionBifOptionList .insert (includeBifOptionList[i]->partitionBifOptionList .end (), (*itr1)->partitionBifOptionsList .begin (), (*itr1)->partitionBifOptionsList .end ());
897+ }
898+ }
899+ }
900+ }
901+ }
902+ else if (includeBifOptionList[i]->slrNum == 0xFF )
903+ {
904+ for (size_t j = 0 ; j < bifOptionList.size (); j++)
905+ {
906+ includeBifOptionList[i]->imageBifOptionList .splice (includeBifOptionList[i]->imageBifOptionList .end (), bifOptionList[j]->imageBifOptionList );
907+ }
853908 }
854909 }
855910}
0 commit comments