! * \brief l_getIndexFromStructname() * * \param[in] sn structname e.g., "Pixa" * \param[out] pindex found index * \return 0 if found, 1 if not. * * * Notes: * (1) This is used to identify the type of serialized file; * the first word in the file is the structname. * (2) For valid structname, %found == true and %index > 0. * */
| 608 | * </pre> |
| 609 | */ |
| 610 | static l_int32 |
| 611 | l_getIndexFromStructname(const char *sn, |
| 612 | l_int32 *pindex) |
| 613 | { |
| 614 | l_int32 i, found; |
| 615 | |
| 616 | PROCNAME("l_getIndexFromStructname"); |
| 617 | |
| 618 | if (!pindex) |
| 619 | return ERROR_INT("&index not defined", procName, 1); |
| 620 | *pindex = 0; |
| 621 | if (!sn) |
| 622 | return ERROR_INT("sn string not defined", procName, 1); |
| 623 | |
| 624 | found = 0; |
| 625 | for (i = 1; i <= l_ntypes; i++) { |
| 626 | if (strcmp(sn, l_assoc[i].structname) == 0) { |
| 627 | found = 1; |
| 628 | *pindex = i; |
| 629 | break; |
| 630 | } |
| 631 | } |
| 632 | return !found; |
| 633 | } |
| 634 | |
| 635 | |
| 636 | /*! |
no outgoing calls
no test coverage detected