Logo Search packages:      
Sourcecode: libgphoto2 version File versions

int gp_file_append ( CameraFile file,
const char *  data,
unsigned long int  size 
)

Parameters:
file a CameraFile
data 
size 
Returns:
a gphoto2 error code.

Definition at line 158 of file gphoto2-file.c.

References CHECK_NULL.

{
        char *t;

      CHECK_NULL (file);

        if (!file->data)
            file->data = malloc (sizeof(char) * (size));
        else {
            t = realloc (file->data, sizeof (char) * (file->size + size));
            if (!t)
                  return GP_ERROR_NO_MEMORY;
            file->data = t;
        }
        memcpy (&file->data[file->size], data, size);

        file->bytes_read = size;
        file->size += size;

        return (GP_OK);
}


Generated by  Doxygen 1.6.0   Back to index