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

Function l_binaryRead

deps/leptonica/src/utils2.c:1153–1173  ·  view source on GitHub ↗

--------------------------------------------------------------------* * Read and write between file and memory * *--------------------------------------------------------------------*/ ! * \brief l_binaryRead() * * \param[in] filename * \param[out] pnbytes number of bytes read * \return data, or NULL on error */

Source from the content-addressed store, hash-verified

1151 * \return data, or NULL on error
1152 */
1153l_uint8 *
1154l_binaryRead(const char *filename,
1155 size_t *pnbytes)
1156{
1157l_uint8 *data;
1158FILE *fp;
1159
1160 PROCNAME("l_binaryRead");
1161
1162 if (!pnbytes)
1163 return (l_uint8 *)ERROR_PTR("pnbytes not defined", procName, NULL);
1164 *pnbytes = 0;
1165 if (!filename)
1166 return (l_uint8 *)ERROR_PTR("filename not defined", procName, NULL);
1167
1168 if ((fp = fopenReadStream(filename)) == NULL)
1169 return (l_uint8 *)ERROR_PTR("file stream not opened", procName, NULL);
1170 data = l_binaryReadStream(fp, pnbytes);
1171 fclose(fp);
1172 return data;
1173}
1174
1175
1176/*!

Callers 15

l_generateFlateDataPdfFunction · 0.85
l_generateJpegDataFunction · 0.85
l_generateJp2kDataFunction · 0.85
parseForProtosFunction · 0.85
fmorphautogen1Function · 0.85
fmorphautogen2Function · 0.85
selaCreateFromFileFunction · 0.85
fhmtautogen1Function · 0.85
fhmtautogen2Function · 0.85
jbDataReadFunction · 0.85
sudokuReadFileFunction · 0.85
strcodeCreateFromFileFunction · 0.85

Calls 2

fopenReadStreamFunction · 0.85
l_binaryReadStreamFunction · 0.85

Tested by

no test coverage detected