Logo Search packages:      
Sourcecode: libgphoto2 version File versions

static int gp_file_raw_to_ppm ( CameraFile file  )  [static]

For internal use only.

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

References CHECK_MEM, CHECK_NULL, CHECK_RESULT, gp_file_conversion_chuck(), gp_file_set_data_and_size(), and gp_file_set_mime_type().

Referenced by gp_file_convert().

{
      unsigned char *new_data, *b;
      long int new_size;
      int result;

      CHECK_NULL (file);

      new_size = (file->width * file->height * 3) + strlen (file->header);
      CHECK_MEM (new_data = malloc (sizeof (char) * new_size));

      strcpy (new_data, file->header);

      b = new_data + strlen (file->header);
      switch (file->method) {
      case GP_FILE_CONVERSION_METHOD_CHUCK:
            result = gp_file_conversion_chuck (file, b);
            break;
      default:
            result = GP_ERROR_NOT_SUPPORTED;
            break;
      }
      if (result != GP_OK) {
            free (new_data);
            return (result);
      }

      CHECK_RESULT (gp_file_set_data_and_size (file, new_data, new_size));
      CHECK_RESULT (gp_file_set_mime_type (file, GP_MIME_PPM));

      return (GP_OK);
}


Generated by  Doxygen 1.6.0   Back to index