| 1386 | // hardwired to only use the 'x-default' item, so we copy that value to the other item. |
| 1387 | |
| 1388 | void |
| 1389 | NormalizeLangArray ( XMP_Node * array ) |
| 1390 | { |
| 1391 | XMP_Assert ( XMP_ArrayIsAltText(array->options) ); |
| 1392 | |
| 1393 | size_t itemNum; |
| 1394 | size_t itemLim = array->children.size(); |
| 1395 | bool hasDefault = false; |
| 1396 | |
| 1397 | for ( itemNum = 0; itemNum < itemLim; ++itemNum ) { |
| 1398 | |
| 1399 | if ( array->children[itemNum]->qualifiers.empty() || |
| 1400 | (array->children[itemNum]->qualifiers[0]->name != "xml:lang") ) { |
| 1401 | XMP_Throw ( "AltText array items must have an xml:lang qualifier", kXMPErr_BadXMP ); |
| 1402 | } |
| 1403 | |
| 1404 | if ( array->children[itemNum]->qualifiers[0]->value == "x-default" ) { |
| 1405 | hasDefault = true; |
| 1406 | break; |
| 1407 | } |
| 1408 | |
| 1409 | } |
| 1410 | |
| 1411 | if ( hasDefault ) { |
| 1412 | |
| 1413 | if ( itemNum != 0 ) { |
| 1414 | XMP_Node * temp = array->children[0]; |
| 1415 | array->children[0] = array->children[itemNum]; |
| 1416 | array->children[itemNum] = temp; |
| 1417 | } |
| 1418 | |
| 1419 | // 09-Oct-07, ahu: disabled to avoid unexpected behaviour |
| 1420 | // if ( itemLim == 2 ) array->children[1]->value = array->children[0]->value; |
| 1421 | |
| 1422 | } |
| 1423 | |
| 1424 | } // NormalizeLangArray |
| 1425 | |
| 1426 | // ================================================================================================= |
| 1427 | // DetectAltText |
no test coverage detected