MCPcopy Create free account
hub / github.com/creatale/node-dv / l_getIndexFromStructname

Function l_getIndexFromStructname

deps/leptonica/src/stringcode.c:610–633  ·  view source on GitHub ↗

! * \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. * */

Source from the content-addressed store, hash-verified

608 * </pre>
609 */
610static l_int32
611l_getIndexFromStructname(const char *sn,
612 l_int32 *pindex)
613{
614l_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/*!

Callers 1

l_getIndexFromFileFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected