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

Function l_genCaseString

deps/leptonica/src/stringcode.c:749–772  ·  view source on GitHub ↗

! * \brief l_genCaseString() * * \param[in] ifunc index into set of functions in generated file * \param[in] itype index into type of function to be used * \return case string for this decoding function * * * Notes: * (1) %ifunc and %itype have been validated, so no error can occur * */

Source from the content-addressed store, hash-verified

747 * </pre>
748 */
749static char *
750l_genCaseString(l_int32 ifunc,
751 l_int32 itype)
752{
753char buf[256];
754char *code = NULL;
755
756 snprintf(buf, sizeof(buf), " case %d:\n", ifunc);
757 stringJoinIP(&code, buf);
758 snprintf(buf, sizeof(buf),
759 " data1 = decodeBase64(l_strdata_%d, strlen(l_strdata_%d), "
760 "&size1);\n", ifunc, ifunc);
761 stringJoinIP(&code, buf);
762 stringJoinIP(&code,
763 " data2 = zlibUncompress(data1, size1, &size2);\n");
764 snprintf(buf, sizeof(buf),
765 " result = (void *)%s(data2, size2);\n",
766 l_assoc[itype].memreader);
767 stringJoinIP(&code, buf);
768 stringJoinIP(&code, " lept_free(data1);\n");
769 stringJoinIP(&code, " lept_free(data2);\n");
770 stringJoinIP(&code, " break;\n");
771 return code;
772}
773
774
775/*!

Callers 1

strcodeGenerateFunction · 0.85

Calls 1

stringJoinIPFunction · 0.85

Tested by

no test coverage detected