return NT_STATUS_OK;
}
-static NTSTATUS cli_read_sink(char *buf, size_t n, void *priv)
+/*
+ * Helper function for cli_pull(). This takes a chunk of data (buf) read from
+ * a remote file and copies it into the return buffer (priv).
+ */
+NTSTATUS cli_read_sink(char *buf, size_t n, void *priv)
{
char **pbuf = (char **)priv;
memcpy(*pbuf, buf, n);
off_t start_offset, off_t size, size_t window_size,
NTSTATUS (*sink)(char *buf, size_t n, void *priv),
void *priv, off_t *received);
+NTSTATUS cli_read_sink(char *buf, size_t n, void *priv);
struct tevent_req *cli_read_send(
TALLOC_CTX *mem_ctx,
struct tevent_context *ev,
return status;
}
-static NTSTATUS pull_helper(char *buf, size_t n, void *priv)
-{
- char **dest_buf = (char **)priv;
- memcpy(*dest_buf, buf, n);
- *dest_buf += n;
- return NT_STATUS_OK;
-}
-
/*
* Loads the specified file's contents and returns it
*/
/* read the file contents */
buf = PyBytes_AS_STRING(result);
req = cli_pull_send(NULL, self->ev, self->cli, fnum, 0, size,
- size, pull_helper, &buf);
+ size, cli_read_sink, &buf);
if (!py_tevent_req_wait_exc(self, req)) {
Py_XDECREF(result);
return NULL;