! * \brief boxaaExtendWithInit() * * \param[in] baa * \param[in] maxindex * \param[in] boxa to be replicated into the extended ptr array * \return 0 if OK, 1 on error * * * Notes: * (1) This should be used on an existing boxaa that has been * fully loaded with boxa. It then extends the boxaa, * loading all the additional ptrs with copies of box
| 1605 | * </pre> |
| 1606 | */ |
| 1607 | l_int32 |
| 1608 | boxaaExtendWithInit(BOXAA *baa, |
| 1609 | l_int32 maxindex, |
| 1610 | BOXA *boxa) |
| 1611 | { |
| 1612 | l_int32 i, n; |
| 1613 | |
| 1614 | PROCNAME("boxaaExtendWithInit"); |
| 1615 | |
| 1616 | if (!baa) |
| 1617 | return ERROR_INT("baa not defined", procName, 1); |
| 1618 | if (!boxa) |
| 1619 | return ERROR_INT("boxa not defined", procName, 1); |
| 1620 | |
| 1621 | /* Extend the ptr array if necessary */ |
| 1622 | n = boxaaGetCount(baa); |
| 1623 | if (maxindex < n) return 0; |
| 1624 | boxaaExtendArrayToSize(baa, maxindex + 1); |
| 1625 | |
| 1626 | /* Fill the new entries with copies of boxa */ |
| 1627 | for (i = n; i <= maxindex; i++) |
| 1628 | boxaaAddBoxa(baa, boxa, L_COPY); |
| 1629 | return 0; |
| 1630 | } |
| 1631 | |
| 1632 | |
| 1633 | /*! |
no test coverage detected