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

Function fileCopy

deps/leptonica/src/utils2.c:1496–1516  ·  view source on GitHub ↗

--------------------------------------------------------------------* * File copy operations * *--------------------------------------------------------------------*/ ! * \brief fileCopy() * * \param[in] srcfile copy this file * \param[in] newfile to this file * \return 0 if OK, 1 on error */

Source from the content-addressed store, hash-verified

1494 * \return 0 if OK, 1 on error
1495 */
1496l_int32
1497fileCopy(const char *srcfile,
1498 const char *newfile)
1499{
1500l_int32 ret;
1501size_t nbytes;
1502l_uint8 *data;
1503
1504 PROCNAME("fileCopy");
1505
1506 if (!srcfile)
1507 return ERROR_INT("srcfile not defined", procName, 1);
1508 if (!newfile)
1509 return ERROR_INT("newfile not defined", procName, 1);
1510
1511 if ((data = l_binaryRead(srcfile, &nbytes)) == NULL)
1512 return ERROR_INT("data not returned", procName, 1);
1513 ret = l_binaryWrite(newfile, "w", data, nbytes);
1514 LEPT_FREE(data);
1515 return ret;
1516}
1517
1518
1519/*!

Callers 3

regTestCheckFileFunction · 0.85
lept_mvFunction · 0.85
lept_cpFunction · 0.85

Calls 2

l_binaryReadFunction · 0.85
l_binaryWriteFunction · 0.85

Tested by

no test coverage detected