#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "rdd.h"
#include "rdd_internals.h"
#include "reader.h"
#include "writer.h"
#include "filter.h"
#include "filterset.h"
#include "copier.h"
Go to the source code of this file.
Data Structures | |
struct | _RDD_SIMPLE_COPIER |
State structure for a simple copier. More... | |
Defines | |
#define | SIMPLE_READ_SIZE 65536 |
Size of the read buffer in bytes; a simple copier reads at most SIMPLE_READ_SIZE bytes at a time from its reader. | |
Typedefs | |
typedef struct _RDD_SIMPLE_COPIER | RDD_SIMPLE_COPIER |
State structure for a simple copier. | |
Functions | |
int | rdd_new_simple_copier (RDD_COPIER **self, RDD_SIMPLE_PARAMS *params) |
Creates a new simple copier. | |
static int | simple_exec (RDD_COPIER *c, RDD_READER *r, RDD_FILTERSET *fset, RDD_COPIER_RETURN *ret) |
Variables | |
static RDD_COPY_OPS | simple_ops |
#define SIMPLE_READ_SIZE 65536 |
Size of the read buffer in bytes; a simple copier reads at most SIMPLE_READ_SIZE
bytes at a time from its reader.
Definition at line 52 of file simplecopier.c.
typedef struct _RDD_SIMPLE_COPIER RDD_SIMPLE_COPIER |
State structure for a simple copier.
At present, a simple reader's state consists only of a read buffer. The read buffer could also be allocated on the stack in simple_exec()
, which would eliminate all state, but I prefer to keep large data objects off the stack.
int rdd_new_simple_copier | ( | RDD_COPIER ** | c, | |
RDD_SIMPLE_PARAMS * | params | |||
) |
Creates a new simple copier.
c | output value: will be set to a pointer to the new simple copier object. | |
params | the copier's parameters |
RDD_OK
on success. Returns RDD_NOMEM
if there is insufficient memory to create the object.rdd_copy_exec()
) until it reached end-of-file or until it encounters any error, including a read error.
The parameters params
specify a callback function and its environment. This function is called periodically and can be used to report or track progress.
Definition at line 76 of file simplecopier.c.
References _RDD_SIMPLE_PARAMS::progressenv, _RDD_SIMPLE_COPIER::progressenv, _RDD_SIMPLE_PARAMS::progressfun, _RDD_SIMPLE_COPIER::progressfun, rdd_new_copier(), RDD_OK, _RDD_SIMPLE_COPIER::readbuf, and _RDD_COPIER::state.
static int simple_exec | ( | RDD_COPIER * | c, | |
RDD_READER * | r, | |||
RDD_FILTERSET * | fset, | |||
RDD_COPIER_RETURN * | ret | |||
) | [static] |
Definition at line 103 of file simplecopier.c.
References _RDD_COPIER_RETURN::nbyte, _RDD_COPIER_RETURN::nlost, _RDD_COPIER_RETURN::nread_err, _RDD_COPIER_RETURN::nsubst, _RDD_SIMPLE_COPIER::progressenv, _RDD_SIMPLE_COPIER::progressfun, RDD_ABORTED, rdd_fset_close(), rdd_fset_push(), RDD_OK, rdd_reader_read(), _RDD_SIMPLE_COPIER::readbuf, SIMPLE_READ_SIZE, and _RDD_COPIER::state.
RDD_COPY_OPS simple_ops [static] |