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

Function sarrayAppendRange

deps/leptonica/src/sarray1.c:920–950  ·  view source on GitHub ↗

! * \brief sarrayAppendRange() * * \param[in] sa1 to be added to * \param[in] sa2 append specified range of strings in sa2 to sa1 * \param[in] start index of first string of sa2 to append * \param[in] end index of last string of sa2 to append; -1 to end of array * \return 0 if OK, 1 on error * * * Notes: * (1) Copies of the strings in sarray2 are added to sar

Source from the content-addressed store, hash-verified

918 * </pre>
919 */
920l_int32
921sarrayAppendRange(SARRAY *sa1,
922 SARRAY *sa2,
923 l_int32 start,
924 l_int32 end)
925{
926char *str;
927l_int32 n, i;
928
929 PROCNAME("sarrayAppendRange");
930
931 if (!sa1)
932 return ERROR_INT("sa1 not defined", procName, 1);
933 if (!sa2)
934 return ERROR_INT("sa2 not defined", procName, 1);
935
936 if (start < 0)
937 start = 0;
938 n = sarrayGetCount(sa2);
939 if (end < 0 || end >= n)
940 end = n - 1;
941 if (start > end)
942 return ERROR_INT("start > end", procName, 1);
943
944 for (i = start; i <= end; i++) {
945 str = sarrayGetString(sa2, i, L_NOCOPY);
946 sarrayAddString(sa1, str, L_COPY);
947 }
948
949 return 0;
950}
951
952
953/*----------------------------------------------------------------------*

Callers 5

fmorphautogen1Function · 0.85
fmorphautogen2Function · 0.85
fhmtautogen1Function · 0.85
fhmtautogen2Function · 0.85
strcodeFinalizeFunction · 0.85

Calls 3

sarrayGetCountFunction · 0.85
sarrayGetStringFunction · 0.85
sarrayAddStringFunction · 0.85

Tested by

no test coverage detected