Logo Search packages:      
Sourcecode: libgphoto2 version File versions

int gp_file_copy ( CameraFile destination,
CameraFile source 
)

Parameters:
destination a CameraFile
source a CameraFile
Returns:
a gphoto2 error code.

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

References CHECK_NULL.

{
      int ref_count;

      CHECK_NULL (destination && source);

      gp_log (GP_LOG_DEBUG, "gphoto2-file", "Copying '%s' onto '%s'...",
            source->name, destination->name);

      ref_count = destination->ref_count;
      if (destination->data) {
            free (destination->data);
            destination->data = NULL;
      }

      memcpy (destination, source, sizeof (CameraFile));
      destination->ref_count = ref_count;

      destination->data = malloc (sizeof (char) * source->size);
      if (!destination->data)
            return (GP_ERROR_NO_MEMORY);
      memcpy (destination->data, source->data, source->size);

      return (GP_OK);
}


Generated by  Doxygen 1.6.0   Back to index