! * \brief boxaaReplaceBoxa() * * \param[in] baa * \param[in] index to the index-th boxa * \param[in] boxa insert and replace any existing one * \return 0 if OK, 1 on error * * * Notes: * (1) Any existing boxa is destroyed, and the input one * is inserted in its place. * (2) If the index is invalid, return 1 (error) * */
| 1646 | * </pre> |
| 1647 | */ |
| 1648 | l_int32 |
| 1649 | boxaaReplaceBoxa(BOXAA *baa, |
| 1650 | l_int32 index, |
| 1651 | BOXA *boxa) |
| 1652 | { |
| 1653 | l_int32 n; |
| 1654 | |
| 1655 | PROCNAME("boxaaReplaceBoxa"); |
| 1656 | |
| 1657 | if (!baa) |
| 1658 | return ERROR_INT("baa not defined", procName, 1); |
| 1659 | if (!boxa) |
| 1660 | return ERROR_INT("boxa not defined", procName, 1); |
| 1661 | n = boxaaGetCount(baa); |
| 1662 | if (index < 0 || index >= n) |
| 1663 | return ERROR_INT("index not valid", procName, 1); |
| 1664 | |
| 1665 | boxaDestroy(&baa->boxa[index]); |
| 1666 | baa->boxa[index] = boxa; |
| 1667 | return 0; |
| 1668 | } |
| 1669 | |
| 1670 | |
| 1671 | /*! |
no test coverage detected