@@ -223,7 +223,7 @@ OptionLoader::OptionArray OptionLoader::loadOptions( void* av_class, int req_fla
223
223
{
224
224
OptionArray options;
225
225
226
- std::map <std::string, int > optionUnitToIndex;
226
+ std::multimap <std::string, int > optionUnitToIndex;
227
227
std::vector<Option> childOptions;
228
228
229
229
const AVOption* avOption = NULL ;
@@ -262,19 +262,25 @@ OptionLoader::OptionArray OptionLoader::loadOptions( void* av_class, int req_fla
262
262
}
263
263
264
264
// iterate on child options
265
- for ( std::vector<Option>::iterator it = childOptions.begin (); it != childOptions.end (); ++it )
265
+ for ( std::vector<Option>::iterator itOption = childOptions.begin (); itOption != childOptions.end (); ++itOption )
266
266
{
267
- int indexParentOption = optionUnitToIndex.at ( it->getUnit () );
268
- Option& parentOption = options.at ( indexParentOption );
269
-
270
- parentOption.appendChild ( *it );
271
-
272
- // child of a Choice
273
- if ( parentOption.getType () == TypeChoice )
267
+ for ( std::multimap<std::string, int >::iterator itUnit = optionUnitToIndex.begin (); itUnit != optionUnitToIndex.end (); ++itUnit )
274
268
{
275
- if ( it->getDefaultValueInt () == parentOption.getDefaultValueInt () )
276
- parentOption.setDefaultChildIndex ( parentOption.getNbChilds () - 1 );
277
- }
269
+ if ( itUnit->first == itOption->getUnit () )
270
+ {
271
+ int indexParentOption = itUnit->second ;
272
+ Option& parentOption = options.at ( indexParentOption );
273
+
274
+ parentOption.appendChild ( *itOption );
275
+
276
+ // child of a Choice
277
+ if ( parentOption.getType () == TypeChoice )
278
+ {
279
+ if ( itOption->getDefaultValueInt () == parentOption.getDefaultValueInt () )
280
+ parentOption.setDefaultChildIndex ( parentOption.getNbChilds () - 1 );
281
+ }
282
+ }
283
+ }
278
284
}
279
285
return options;
280
286
}
0 commit comments