From: <mar...@us...> - 2009-02-16 08:09:55
|
Revision: 11818 http://gphoto.svn.sourceforge.net/gphoto/?rev=11818&view=rev Author: marcusmeissner Date: 2009-02-16 08:09:49 +0000 (Mon, 16 Feb 2009) Log Message: ----------- Batch commit from weekend work: - removed "type" from CameraFile handling: - all put_file functions and hooks get "type" as argument now - added type to the set_file_info_noop call - started removal of "name" from CameraFile - generate new filename from original filename + camerafile type + mimetype - new gp_camera_autodetect() helper function - adapted all drivers. Modified Paths: -------------- trunk/libgphoto2/NEWS trunk/libgphoto2/camlibs/canon/library.c trunk/libgphoto2/camlibs/digigr8/library.c trunk/libgphoto2/camlibs/digita/digita.c trunk/libgphoto2/camlibs/dimera/dimera3500.c trunk/libgphoto2/camlibs/directory/directory.c trunk/libgphoto2/camlibs/enigma13/enigma13.c trunk/libgphoto2/camlibs/fuji/library.c trunk/libgphoto2/camlibs/gsmart300/library.c trunk/libgphoto2/camlibs/iclick/library.c trunk/libgphoto2/camlibs/jamcam/jamcam.c trunk/libgphoto2/camlibs/jd11/decomp.c trunk/libgphoto2/camlibs/jd11/decomp.h trunk/libgphoto2/camlibs/jd11/jd11.c trunk/libgphoto2/camlibs/jd11/serial.c trunk/libgphoto2/camlibs/jl2005a/library.c trunk/libgphoto2/camlibs/jl2005c/library.c trunk/libgphoto2/camlibs/konica/library.c trunk/libgphoto2/camlibs/konica/qm150.c trunk/libgphoto2/camlibs/largan/lmini/largan.c trunk/libgphoto2/camlibs/mars/library.c trunk/libgphoto2/camlibs/minolta/dimagev/data.c trunk/libgphoto2/camlibs/minolta/dimagev/dimagev.c trunk/libgphoto2/camlibs/mustek/mdc800.c trunk/libgphoto2/camlibs/panasonic/dc1000.c trunk/libgphoto2/camlibs/panasonic/dc1580.c trunk/libgphoto2/camlibs/panasonic/l859/l859.c trunk/libgphoto2/camlibs/pccam300/library.c trunk/libgphoto2/camlibs/pccam600/library.c trunk/libgphoto2/camlibs/pccam600/pccam600.c trunk/libgphoto2/camlibs/polaroid/pdc320.c trunk/libgphoto2/camlibs/polaroid/pdc640.c trunk/libgphoto2/camlibs/ptp2/library.c trunk/libgphoto2/camlibs/ricoh/library.c trunk/libgphoto2/camlibs/sierra/sierra.c trunk/libgphoto2/camlibs/sipix/blink.c trunk/libgphoto2/camlibs/sipix/blink2.c trunk/libgphoto2/camlibs/sipix/web2.c trunk/libgphoto2/camlibs/smal/smal.c trunk/libgphoto2/camlibs/sonix/library.c trunk/libgphoto2/camlibs/sonydscf1/sonydscf1.c trunk/libgphoto2/camlibs/sonydscf55/camera.c trunk/libgphoto2/camlibs/sonydscf55/sony.c trunk/libgphoto2/camlibs/soundvision/soundvision.c trunk/libgphoto2/camlibs/spca50x/library.c trunk/libgphoto2/camlibs/sq905/library.c trunk/libgphoto2/camlibs/stv0680/stv0680.c trunk/libgphoto2/camlibs/template/template.c trunk/libgphoto2/configure.ac trunk/libgphoto2/gphoto2/gphoto2-camera.h trunk/libgphoto2/gphoto2/gphoto2-file.h trunk/libgphoto2/gphoto2/gphoto2-filesys.h trunk/libgphoto2/libgphoto2/gphoto2-camera.c trunk/libgphoto2/libgphoto2/gphoto2-file.c trunk/libgphoto2/libgphoto2/gphoto2-filesys.c trunk/libgphoto2/libgphoto2/libgphoto2.sym Modified: trunk/libgphoto2/NEWS =================================================================== --- trunk/libgphoto2/NEWS 2009-02-16 07:46:55 UTC (rev 11817) +++ trunk/libgphoto2/NEWS 2009-02-16 08:09:49 UTC (rev 11818) @@ -1,19 +1,37 @@ -libgphoto2 2.4.99.1 development state +libgphoto2 2.4.99.2 development state libgphoto2 API: * CameraFileInfoFile: removed "name" structmember and GP_FILE_INFO_NAME flags. Use direct passing in of the filename to the API functions. - * gp_file_set_name() passing in is no longer needed and the API will - go away. + * New: gp_camera_autodetect(CameraList *list, GPContext*); + Simple autodetection function returning all current detected cameras. + + * (not yet New: gp_camera_open (Camera *camera, const char *name, const char *port, GPContext *context); + + Simple open function without needing to involve libgphoto2_port. + ) + * gp_file_set_name() and _get_name() passing in is no longer needed + and the API will go away. + + * New gp_file_get_name_by_type() will convert a regular filename ("normal") + into one depending on type (e.g. "raw_" prefix) and adjusted suffix + (like ".ppm" turning into ".pgm" for grayscale previews). + + * gp_file_set_type() and gp_file_get_type() are gone, these functions + are now implicit passed via arguments to the the put_file and + set_file_noop() functions. + * gp_filesystem_set_info_noop(), gp_filesystem_set_file_noop(), gp_filesystem_put_file(), gp_camera_folder_put_file(): Added "filename" argument to pass in the filename. The one from CameraFileInfoFile and CameraFile are no longer used. + Added "type" argument to pass in the filetype (GP_FILE_TYPE_*). + * Adjusted to new GPPortInfo handling. * Rewrote gphoto2-filesys.c to be directory based (in a tree structure). Modified: trunk/libgphoto2/camlibs/canon/library.c =================================================================== --- trunk/libgphoto2/camlibs/canon/library.c 2009-02-16 07:46:55 UTC (rev 11817) +++ trunk/libgphoto2/camlibs/canon/library.c 2009-02-16 08:09:49 UTC (rev 11818) @@ -557,9 +557,6 @@ } gp_file_set_data_and_size ( file, (char *)data, size ); gp_file_set_mime_type (file, GP_MIME_JPEG); /* always */ - /* Add an arbitrary file name so caller won't crash */ - gp_file_set_name (file, "canon_preview.jpg"); - return GP_OK; } @@ -875,7 +872,6 @@ } /* do different things with the data fetched above */ - /* FIXME: For which file type(s) should we gp_file_set_name(file,filename) ? */ switch (type) { case GP_FILE_TYPE_PREVIEW: /* Either this camera model does not support EXIF, @@ -904,19 +900,16 @@ gp_file_set_data_and_size (file, (char *)data, datalen); gp_file_set_mime_type (file, GP_MIME_JPEG); /* always */ - gp_file_set_name (file, filename); break; case GP_FILE_TYPE_AUDIO: gp_file_set_mime_type (file, GP_MIME_WAV); gp_file_set_data_and_size (file, (char *)data, datalen); - gp_file_set_name (file, filename); break; case GP_FILE_TYPE_NORMAL: gp_file_set_mime_type (file, filename2mimetype (filename)); gp_file_set_data_and_size (file, (char *)data, datalen); - gp_file_set_name (file, filename); break; #ifdef HAVE_LIBEXIF case GP_FILE_TYPE_EXIF: @@ -1285,7 +1278,8 @@ /* XXX This function should be merged with the other one of the same name */ static int -put_file_func (CameraFilesystem *fs, const char *folder, const char *filename, CameraFile *file, void *data, +put_file_func (CameraFilesystem *fs, const char *folder, const char *filename, + CameraFileType type, CameraFile *file, void *data, GPContext *context) { Camera *camera = data; @@ -1296,6 +1290,9 @@ GP_DEBUG ("camera_folder_put_file()"); + if (type != GP_FILE_TYPE_NORMAL) + return GP_ERROR_BAD_PARAMETERS; + if (!check_readiness (camera, context)) return GP_ERROR; @@ -1408,7 +1405,7 @@ static int put_file_func (CameraFilesystem __unused__ *fs, const char __unused__ *folder, const char *filename, - CameraFile *file, void *data, + CameraFileType type, CameraFile *file, void *data, GPContext *context) { Camera *camera = data; @@ -1419,6 +1416,8 @@ CameraAbilities a; GP_DEBUG ("camera_folder_put_file()"); + if (type != GP_FILE_TYPE_NORMAL) + return GP_ERROR_BAD_PARAMETERS; if (camera->port->type == GP_PORT_USB) { gp_context_error (context, Modified: trunk/libgphoto2/camlibs/digigr8/library.c =================================================================== --- trunk/libgphoto2/camlibs/digigr8/library.c 2009-02-16 07:46:55 UTC (rev 11817) +++ trunk/libgphoto2/camlibs/digigr8/library.c 2009-02-16 08:09:49 UTC (rev 11818) @@ -251,7 +251,6 @@ if (GP_FILE_TYPE_RAW == type) { /* type is GP_FILE_TYPE_RAW */ size = b; gp_file_set_mime_type (file, GP_MIME_RAW); - gp_file_set_name (file, filename); gp_file_append(file, (char *)data, size); /* Save photo's catalog entry as a footer for the raw file */ gp_file_append(file, (char *)camera->pl->catalog + k*0x10, 0x10); @@ -301,7 +300,6 @@ } else white_balance (ptr, w*h, 1.1); gp_file_set_mime_type (file, GP_MIME_PPM); - gp_file_set_name (file, filename); gp_file_set_data_and_size (file, (char *)ppm, size); /* Reset camera when done, for more graceful exit. */ if (k +1 == camera->pl->nb_entries) { @@ -380,7 +378,6 @@ } else white_balance (ptr, w*h, 1.1); gp_file_set_mime_type (file, GP_MIME_PPM); - gp_file_set_name (file, filename); gp_file_set_data_and_size (file, (char *)ppm, size); digi_reset(camera->port); return (GP_OK); Modified: trunk/libgphoto2/camlibs/digita/digita.c =================================================================== --- trunk/libgphoto2/camlibs/digita/digita.c 2009-02-16 07:46:55 UTC (rev 11817) +++ trunk/libgphoto2/camlibs/digita/digita.c 2009-02-16 08:09:49 UTC (rev 11818) @@ -340,8 +340,6 @@ if (!data) return GP_ERROR; - gp_file_set_name(file, filename); - switch (type) { case GP_FILE_TYPE_NORMAL: gp_file_set_data_and_size(file, (char*)data, buflen); Modified: trunk/libgphoto2/camlibs/dimera/dimera3500.c =================================================================== --- trunk/libgphoto2/camlibs/dimera/dimera3500.c 2009-02-16 07:46:55 UTC (rev 11817) +++ trunk/libgphoto2/camlibs/dimera/dimera3500.c 2009-02-16 08:09:49 UTC (rev 11818) @@ -279,7 +279,6 @@ if (num < 0) return num; - gp_file_set_name (file, filename); switch (type) { case GP_FILE_TYPE_NORMAL: data = Dimera_Get_Full_Image (num, &size, @@ -391,7 +390,6 @@ long size; uint8_t *data; - gp_file_set_name (file, RAM_IMAGE_TEMPLATE); gp_file_set_mime_type (file, GP_MIME_PGM); data = Dimera_Preview( &size, camera, context); Modified: trunk/libgphoto2/camlibs/directory/directory.c =================================================================== --- trunk/libgphoto2/camlibs/directory/directory.c 2009-02-16 07:46:55 UTC (rev 11817) +++ trunk/libgphoto2/camlibs/directory/directory.c 2009-02-16 08:09:49 UTC (rev 11818) @@ -637,7 +637,7 @@ static int put_file_func (CameraFilesystem *fs, const char *folder, const char *name, - CameraFile *file, void *data, GPContext *context) + CameraFileType type, CameraFile *file, void *data, GPContext *context) { char path[2048]; int result; Modified: trunk/libgphoto2/camlibs/enigma13/enigma13.c =================================================================== --- trunk/libgphoto2/camlibs/enigma13/enigma13.c 2009-02-16 07:46:55 UTC (rev 11817) +++ trunk/libgphoto2/camlibs/enigma13/enigma13.c 2009-02-16 08:09:49 UTC (rev 11818) @@ -344,19 +344,12 @@ Camera *camera = data; int image_no, result; //int i, ret, numpics; - - char* img_data=NULL; int img_size=-1; image_no = gp_filesystem_number(fs, folder, filename, context); - gp_file_set_name (file, filename); - gp_log(GP_LOG_DEBUG, "enigma13","Index of image %d is %s",image_no, filename); - - switch (type) { - case GP_FILE_TYPE_NORMAL: { gp_log(GP_LOG_DEBUG, "enigma13","Downloading raw image"); @@ -366,13 +359,10 @@ break; } - - default: result = GP_ERROR_NOT_SUPPORTED; break; } - if (result < 0) return result; return (GP_OK); Modified: trunk/libgphoto2/camlibs/fuji/library.c =================================================================== --- trunk/libgphoto2/camlibs/fuji/library.c 2009-02-16 07:46:55 UTC (rev 11817) +++ trunk/libgphoto2/camlibs/fuji/library.c 2009-02-16 08:09:49 UTC (rev 11818) @@ -225,12 +225,14 @@ static int put_file_func (CameraFilesystem *fs, const char *folder, const char *name, - CameraFile *file, void *data, GPContext *context) + CameraFileType type, CameraFile *file, void *data, GPContext *context) { Camera *camera = data; const char *d; unsigned long int d_len; + if (type != GP_FILE_TYPE_NORMAL) + return GP_ERROR_BAD_PARAMETERS; CR (gp_file_get_data_and_size (file, &d, &d_len)); CR (fuji_upload_init (camera, name, context)); return fuji_upload (camera, d, d_len, context); Modified: trunk/libgphoto2/camlibs/gsmart300/library.c =================================================================== --- trunk/libgphoto2/camlibs/gsmart300/library.c 2009-02-16 07:46:55 UTC (rev 11817) +++ trunk/libgphoto2/camlibs/gsmart300/library.c 2009-02-16 08:09:49 UTC (rev 11818) @@ -276,7 +276,6 @@ default: return GP_ERROR_NOT_SUPPORTED; } - CHECK (gp_file_set_name (file, filename)); return GP_OK; } Modified: trunk/libgphoto2/camlibs/iclick/library.c =================================================================== --- trunk/libgphoto2/camlibs/iclick/library.c 2009-02-16 07:46:55 UTC (rev 11817) +++ trunk/libgphoto2/camlibs/iclick/library.c 2009-02-16 08:09:49 UTC (rev 11818) @@ -258,7 +258,6 @@ /* Unsupported format, fallthrough to raw */ case GP_FILE_TYPE_RAW: gp_file_set_mime_type (file, GP_MIME_RAW); - gp_file_set_name (file, filename); gp_file_adjust_name_for_mime_type (file); gp_file_set_data_and_size (file, (char *)frame_data, datasize); return (GP_OK); @@ -296,11 +295,8 @@ ptr += w*h*3; gp_file_set_mime_type (file, GP_MIME_PPM); - gp_file_set_name (file, filename); gp_file_set_data_and_size (file, (char *)ppm, ppmsize); - free (frame_data); - return GP_OK; } Modified: trunk/libgphoto2/camlibs/jamcam/jamcam.c =================================================================== --- trunk/libgphoto2/camlibs/jamcam/jamcam.c 2009-02-16 07:46:55 UTC (rev 11817) +++ trunk/libgphoto2/camlibs/jamcam/jamcam.c 2009-02-16 08:09:49 UTC (rev 11818) @@ -179,7 +179,6 @@ { Camera *camera = user_data; char *raw, *ppm; - char tmp_filename[128]; unsigned char gtable[256]; char *ptr; int size = 0, n = 0; @@ -224,7 +223,6 @@ gp_gamma_correct_single( gtable, ptr, height * width ); CHECK_free (gp_file_set_mime_type (file, GP_MIME_PPM)); - CHECK_free (gp_file_set_name (file, filename)); CHECK_free (gp_file_append (file, ppm, size)); break; @@ -249,18 +247,12 @@ gp_gamma_correct_single( gtable, ptr, jc_file->width * jc_file->height ); CHECK_free (gp_file_set_mime_type (file, GP_MIME_PPM)); - CHECK_free (gp_file_set_name (file, filename)); CHECK_free (gp_file_append (file, ppm, size)); break; case GP_FILE_TYPE_RAW: CHECK_free (jamcam_request_image (camera, file, raw, &size, n, context)); CHECK_free (gp_file_set_mime_type (file, GP_MIME_RAW)); - strcpy( tmp_filename, filename ); - tmp_filename[strlen(tmp_filename)-3] = 'r'; - tmp_filename[strlen(tmp_filename)-2] = 'a'; - tmp_filename[strlen(tmp_filename)-1] = 'w'; - CHECK_free (gp_file_set_name (file, tmp_filename)); CHECK_free (gp_file_append (file, raw, size)); break; default: Modified: trunk/libgphoto2/camlibs/jd11/decomp.c =================================================================== --- trunk/libgphoto2/camlibs/jd11/decomp.c 2009-02-16 07:46:55 UTC (rev 11817) +++ trunk/libgphoto2/camlibs/jd11/decomp.c 2009-02-16 08:09:49 UTC (rev 11818) @@ -99,7 +99,7 @@ #define F4 0.0 void -picture_decomp_v1(char *compressed,char *uncompressed,int width,int height) { +picture_decomp_v1(unsigned char *compressed,unsigned char *uncompressed,int width,int height) { struct compstate cs; unsigned char xbyte; int i=0,curbyte=0,diff,lastval; @@ -152,7 +152,7 @@ /* Just blow up the picture from 6 bit uncompressed to 8 bit uncompressed */ void -picture_decomp_v2(char *compressed,char *uncompressed,int width,int height) { +picture_decomp_v2(unsigned char *compressed,unsigned char *uncompressed,int width,int height) { struct compstate cs; int i,j; unsigned char xbyte; Modified: trunk/libgphoto2/camlibs/jd11/decomp.h =================================================================== --- trunk/libgphoto2/camlibs/jd11/decomp.h 2009-02-16 07:46:55 UTC (rev 11817) +++ trunk/libgphoto2/camlibs/jd11/decomp.h 2009-02-16 08:09:49 UTC (rev 11818) @@ -20,6 +20,6 @@ #ifndef _JD11_DECOMP_H #define _JD11_DECOMP_H -extern void picture_decomp_v1(char *compressed,char *uncompressed,int width,int height); -extern void picture_decomp_v2(char *compressed,char *uncompressed,int width,int height); +extern void picture_decomp_v1(unsigned char *compressed,unsigned char *uncompressed,int width,int height); +extern void picture_decomp_v2(unsigned char *compressed,unsigned char *uncompressed,int width,int height); #endif Modified: trunk/libgphoto2/camlibs/jd11/jd11.c =================================================================== --- trunk/libgphoto2/camlibs/jd11/jd11.c 2009-02-16 07:46:55 UTC (rev 11817) +++ trunk/libgphoto2/camlibs/jd11/jd11.c 2009-02-16 08:09:49 UTC (rev 11818) @@ -124,7 +124,6 @@ if(image_no < 0) return image_no; - gp_file_set_name (file, filename); gp_file_set_mime_type (file, GP_MIME_PNM); switch (type) { case GP_FILE_TYPE_RAW: Modified: trunk/libgphoto2/camlibs/jd11/serial.c =================================================================== --- trunk/libgphoto2/camlibs/jd11/serial.c 2009-02-16 07:46:55 UTC (rev 11817) +++ trunk/libgphoto2/camlibs/jd11/serial.c 2009-02-16 08:09:49 UTC (rev 11818) @@ -83,8 +83,8 @@ } #endif -#define READ gp_port_read -#define WRITE gp_port_write +#define READ(port,buf,len) gp_port_read(port,(char*)(buf),len) +#define WRITE(port,buf,len) gp_port_write(port,(char*)(buf),len) static int _send_cmd(GPPort *port,unsigned short cmd) { unsigned char buf[2]; @@ -358,7 +358,7 @@ int jd11_index_reader(GPPort *port, CameraFilesystem *fs, GPContext *context) { int i, id, count, xsize, curread=0, ret=0; - char *indexbuf; + unsigned char *indexbuf; ret = jd11_select_index(port); if (ret != GP_OK) @@ -394,7 +394,8 @@ gp_context_progress_stop (context, id); for (i=0;i<count;i++) { CameraFile *file; - char *src, fn[20]; + char fn[20]; + unsigned char *src; unsigned char thumb[64*48]; int y; CameraFileInfo info; @@ -405,8 +406,6 @@ return ret; } sprintf(fn,"image%02i.pgm",i); - gp_file_set_type (file, GP_FILE_TYPE_PREVIEW); - gp_file_set_name(file, fn); gp_file_set_mime_type(file, GP_MIME_PGM); gp_file_append(file, THUMBHEADER, strlen(THUMBHEADER)); src = indexbuf+(i*64*48); @@ -415,7 +414,7 @@ for (x=0;x<64;x++) thumb[47*64-off+(63-x)] = src[off+x]; } - ret = gp_file_append(file,thumb,sizeof(thumb)); + ret = gp_file_append(file,(char*)thumb,sizeof(thumb)); if (ret != GP_OK) { gp_file_free (file); return ret; @@ -426,7 +425,7 @@ gp_file_free (file); return ret; } - ret = gp_filesystem_set_file_noop(fs, "/", fn, file, context); + ret = gp_filesystem_set_file_noop(fs, "/", fn, GP_FILE_TYPE_PREVIEW, file, context); if (ret != GP_OK) return ret; /* we also get the fs info for free, so just set it */ @@ -497,7 +496,7 @@ ) { unsigned char *s,*uncomp[3],**imagebufs; int ret,sizes[3]; - char *data; + unsigned char *data; int h; ret = serial_image_reader(camera,file,nr,&imagebufs,sizes, context); @@ -551,7 +550,7 @@ } free(uncomp[0]);free(uncomp[1]);free(uncomp[2]); free(imagebufs[0]);free(imagebufs[1]);free(imagebufs[2]);free(imagebufs); - gp_file_append(file, data, 640*480*3); + gp_file_append(file, (char*)data, 640*480*3); free(data); return GP_OK; } Modified: trunk/libgphoto2/camlibs/jl2005a/library.c =================================================================== --- trunk/libgphoto2/camlibs/jl2005a/library.c 2009-02-16 07:46:55 UTC (rev 11817) +++ trunk/libgphoto2/camlibs/jl2005a/library.c 2009-02-16 08:09:49 UTC (rev 11818) @@ -200,7 +200,6 @@ if (GP_FILE_TYPE_RAW == type) { gp_file_set_mime_type(file, GP_MIME_RAW); - gp_file_set_name(file, filename); gp_file_set_data_and_size(file, (char *)data , b+14 ); return GP_OK; } @@ -258,7 +257,6 @@ gp_gamma_fill_table (gtable, .65); gp_gamma_correct_single (gtable, ptr, w * h); gp_file_set_mime_type (file, GP_MIME_PPM); - gp_file_set_name (file, filename); gp_file_set_data_and_size (file, (char *)ppm, size); end: free(data); Modified: trunk/libgphoto2/camlibs/jl2005c/library.c =================================================================== --- trunk/libgphoto2/camlibs/jl2005c/library.c 2009-02-16 07:46:55 UTC (rev 11817) +++ trunk/libgphoto2/camlibs/jl2005c/library.c 2009-02-16 08:09:49 UTC (rev 11818) @@ -312,12 +312,9 @@ if (GP_FILE_TYPE_RAW == type) { gp_file_set_mime_type(file, GP_MIME_RAW); - gp_file_set_name(file, filename); gp_file_set_data_and_size(file, (char *)pic_buffer , b+16 ); return GP_OK; } else return GP_ERROR_NOT_SUPPORTED; - - return GP_OK; } Modified: trunk/libgphoto2/camlibs/konica/library.c =================================================================== --- trunk/libgphoto2/camlibs/konica/library.c 2009-02-16 07:46:55 UTC (rev 11817) +++ trunk/libgphoto2/camlibs/konica/library.c 2009-02-16 08:09:49 UTC (rev 11818) @@ -125,11 +125,9 @@ strcpy (info->file.type, GP_MIME_JPEG); sprintf (fn, "%06i.jpeg", (int) image_id); - if (file) { - gp_file_set_type (file, GP_FILE_TYPE_EXIF); - gp_file_set_name (file, fn); + if (file) gp_file_set_data_and_size (file, buffer, buffer_size); - } else + else free (buffer); return (GP_OK); @@ -171,7 +169,7 @@ */ gp_filesystem_append (camera->fs, folder, fn, context); gp_filesystem_set_info_noop (camera->fs, folder, fn, info, context); - gp_filesystem_set_file_noop (camera->fs, folder, fn, file, context); + gp_filesystem_set_file_noop (camera->fs, folder, fn, GP_FILE_TYPE_PREVIEW, file, context); gp_file_unref (file); gp_context_idle (context); @@ -389,7 +387,7 @@ gp_file_unref (file); return (result); } - gp_filesystem_set_file_noop (fs, folder, filename, file, context); + gp_filesystem_set_file_noop (fs, folder, filename, GP_FILE_TYPE_PREVIEW, file, context); gp_file_unref (file); return (GP_OK); } @@ -596,11 +594,9 @@ gp_filesystem_set_info_noop (camera->fs, path->folder, fn, info, context); gp_file_new (&file); - gp_file_set_name (file, fn); gp_file_set_mime_type (file, GP_MIME_JPEG); - gp_file_set_type (file, GP_FILE_TYPE_EXIF); gp_file_set_data_and_size (file, buffer, buffer_size); - gp_filesystem_set_file_noop (camera->fs, path->folder, fn, file, context); + gp_filesystem_set_file_noop (camera->fs, path->folder, fn, GP_FILE_TYPE_EXIF, file, context); gp_file_unref (file); return (GP_OK); Modified: trunk/libgphoto2/camlibs/konica/qm150.c =================================================================== --- trunk/libgphoto2/camlibs/konica/qm150.c 2009-02-16 07:46:55 UTC (rev 11817) +++ trunk/libgphoto2/camlibs/konica/qm150.c 2009-02-16 08:09:49 UTC (rev 11818) @@ -177,9 +177,9 @@ cmd[3] = 0x30 + ((image_no/100 )%10); cmd[4] = 0x30 + ((image_no/10 )%10); cmd[5] = 0x30 + ( image_no %10); - ret = gp_port_write (camera->port, cmd, sizeof(cmd)); + ret = gp_port_write (camera->port, (char*)cmd, sizeof(cmd)); if (ret<GP_OK) return ret; - ret = gp_port_read (camera->port, buf, INFO_BUFFER); + ret = gp_port_read (camera->port, (char*)buf, INFO_BUFFER); if (ret<GP_OK) return ret; /* Search the image data number into the memory */ @@ -240,9 +240,9 @@ cmd[5] = 0x30 + ((image_no/10 )%10); cmd[6] = 0x30 + ( image_no %10); - ret = gp_port_write (camera->port, cmd, sizeof(cmd)); + ret = gp_port_write (camera->port, (char*)cmd, sizeof(cmd)); if (ret<GP_OK) return ret; - ret = gp_port_read (camera->port, &ack, ACK_LEN); + ret = gp_port_read (camera->port, (char*)&ack, ACK_LEN); if (ret < GP_OK) return ret; if (ack == NACK) { gp_context_error(context, _("This preview doesn't exist.")); @@ -257,13 +257,13 @@ unsigned char csum; int xret; - xret = gp_port_read (camera->port, buf, DATA_BUFFER); + xret = gp_port_read (camera->port, (char*)buf, DATA_BUFFER); if (xret < GP_OK) { if (type == GP_FILE_TYPE_NORMAL) gp_context_progress_stop (context, id); return xret; } - ret = gp_port_read (camera->port, &csum, CSUM_LEN); + ret = gp_port_read (camera->port, (char*)&csum, CSUM_LEN); if (ret < GP_OK) { if (type == GP_FILE_TYPE_NORMAL) gp_context_progress_stop (context, id); @@ -274,7 +274,7 @@ gp_context_progress_stop (context, id); /* acknowledge the packet */ ack = NACK; - ret = gp_port_write (camera->port, &ack, ACK_LEN); + ret = gp_port_write (camera->port, (char*)&ack, ACK_LEN); if (ret < GP_OK) return ret; gp_context_error(context, _("Data has been corrupted.")); @@ -290,13 +290,13 @@ /* acknowledge the packet */ ack = ACK; - ret = gp_port_write (camera->port, &ack, ACK_LEN); + ret = gp_port_write (camera->port, (char*)&ack, ACK_LEN); if (ret < GP_OK) { if (type == GP_FILE_TYPE_NORMAL) gp_context_progress_stop (context, id); return ret; } - ret = gp_port_read (camera->port, &state, STATE_LEN); + ret = gp_port_read (camera->port, (char*)&state, STATE_LEN); if (ret < GP_OK) { if (type == GP_FILE_TYPE_NORMAL) gp_context_progress_stop (context, id); @@ -310,7 +310,7 @@ } /* acknowledge the packet */ ack = ACK; - ret = gp_port_write (camera->port, &ack, ACK_LEN); + ret = gp_port_write (camera->port, (char*)&ack, ACK_LEN); if (ret < GP_OK) { if (type == GP_FILE_TYPE_NORMAL) gp_context_progress_stop (context, id); @@ -333,7 +333,8 @@ GPContext *context) { unsigned char *d,*thumbnail; - int image_no, len, ret, image_number; + unsigned int image_number; + int image_no, len, ret; long long_len; CameraFileInfo file_info; exifparser exifdat; @@ -396,11 +397,8 @@ _("Image type %d is not supported by this camera !"), type); return (GP_ERROR_NOT_SUPPORTED); } - gp_file_set_name (file, filename); gp_file_set_mime_type (file, GP_MIME_JPEG); - if (type == GP_FILE_TYPE_EXIF) - gp_file_set_type (file, GP_FILE_TYPE_EXIF); - ret = gp_file_append(file, d, len); + ret = gp_file_append(file, (char*)d, len); free(d); return (ret); } @@ -416,7 +414,8 @@ Camera *camera = data; CameraFileInfo file_info; unsigned char cmd[7], ack; - int image_no, ret; + unsigned int image_no; + int ret; GP_DEBUG ("*** ENTER: delete_file_func ***"); @@ -444,9 +443,9 @@ cmd[4] = 0x30 + ((image_no/100 )%10); cmd[5] = 0x30 + ((image_no/10 )%10); cmd[6] = 0x30 + ( image_no %10); - ret = gp_port_write (camera->port, cmd, sizeof(cmd)); + ret = gp_port_write (camera->port, (char*)cmd, sizeof(cmd)); if (ret<GP_OK) return ret; - ret = gp_port_read (camera->port, &ack, ACK_LEN); + ret = gp_port_read (camera->port, (char*)&ack, ACK_LEN); if (ret<GP_OK) return ret; if (ack != ACK) { gp_context_error(context, _("Can't delete image %s."),filename); @@ -475,9 +474,9 @@ cmd[4] = 0x30; cmd[5] = 0x30; cmd[6] = 0x30; - ret = gp_port_write (camera->port, cmd, sizeof(cmd)); + ret = gp_port_write (camera->port, (char*)cmd, sizeof(cmd)); if (ret<GP_OK) return ret; - ret = gp_port_read (camera->port, &ack, ACK_LEN); + ret = gp_port_read (camera->port, (char*)&ack, ACK_LEN); if (ret<GP_OK) return ret; if (ack != ACK) { gp_context_error(context, _("Can't delete all images.")); @@ -493,7 +492,8 @@ * Upload an image to the camera */ static int -put_file_func (CameraFilesystem *fs, const char *folder, const char *name, CameraFile *file, +put_file_func (CameraFilesystem *fs, const char *folder, const char *name, + CameraFileType type, CameraFile *file, void *data, GPContext *context) { Camera *camera = data; @@ -508,13 +508,13 @@ /* Send function */ cmd[0] = ESC; cmd[1] = UPLOADDATA; - ret = gp_port_write (camera->port, cmd, sizeof(cmd)); + ret = gp_port_write (camera->port, (char*)cmd, sizeof(cmd)); if (ret<GP_OK) return ret; gp_file_get_data_and_size(file, &d, &len); id = gp_context_progress_start (context, len, _("Uploading image...")); for (i=0; i < ((len+DATA_BUFFER-1) / DATA_BUFFER); i++) { - ret = gp_port_read (camera->port, &ack, ACK_LEN); + ret = gp_port_read (camera->port, (char*)&ack, ACK_LEN); if (ret<GP_OK) { gp_context_progress_stop (context, id); return ret; @@ -527,14 +527,14 @@ return (GP_ERROR); } state = NEXTFRAME; - ret = gp_port_write (camera->port, &state, STATE_LEN); + ret = gp_port_write (camera->port, (char*)&state, STATE_LEN); if (ret<GP_OK) { gp_context_progress_stop (context, id); return ret; } if ((len - len_sent) <= DATA_BUFFER) { /* Send the last datas */ - ret = gp_port_write (camera->port, &d[i*DATA_BUFFER], + ret = gp_port_write (camera->port, (char*)&d[i*DATA_BUFFER], (len - len_sent)); if (ret<GP_OK) { gp_context_progress_stop (context, id); @@ -542,7 +542,7 @@ } /* and complete with zeros */ bzero(buf,DATA_BUFFER); - ret = gp_port_write (camera->port, buf, (DATA_BUFFER - + ret = gp_port_write (camera->port, (char*)buf, (DATA_BUFFER - (len - len_sent))); if (ret<GP_OK) { gp_context_progress_stop (context, id); @@ -567,7 +567,7 @@ (unsigned char *)&d[i*DATA_BUFFER], DATA_BUFFER); } - ret = gp_port_write (camera->port, &sum, CSUM_LEN); + ret = gp_port_write (camera->port, (char*)&sum, CSUM_LEN); if (ret<GP_OK) { gp_context_progress_stop (context, id); return ret; @@ -575,12 +575,12 @@ gp_context_progress_update (context, id, len_sent); } state = EOT; - ret = gp_port_write (camera->port, &state, STATE_LEN); + ret = gp_port_write (camera->port, (char*)&state, STATE_LEN); if (ret<GP_OK) { gp_context_progress_stop (context, id); return ret; } - ret = gp_port_read (camera->port, &ack, ACK_LEN); + ret = gp_port_read (camera->port, (char*)&ack, ACK_LEN); if (ret<GP_OK) { gp_context_progress_stop (context, id); return ret; @@ -610,10 +610,10 @@ /* Just check if there is space available yet */ cmd[0] = ESC; cmd[1] = GETCAMINFO; - ret = gp_port_write (camera->port, cmd, 2); + ret = gp_port_write (camera->port, (char*)cmd, 2); if (ret<GP_OK) return ret; - ret = gp_port_read (camera->port, buf, INFO_BUFFER); + ret = gp_port_read (camera->port, (char*)buf, INFO_BUFFER); nbr_images = (buf[FREE_IMAGE_PTR] << 8) | (buf[FREE_IMAGE_PTR+1]); images_taken = (buf[TAKEN_IMAGE_PTR] << 8) | (buf[TAKEN_IMAGE_PTR+1]); @@ -621,10 +621,10 @@ cmd[0] = ESC; cmd[1] = CAPTUREIMAGE_CMD1; cmd[2] = CAPTUREIMAGE_CMD2; - ret = gp_port_write (camera->port, cmd, sizeof(cmd)); + ret = gp_port_write (camera->port, (char*)cmd, sizeof(cmd)); if (ret<GP_OK) return ret; - ret = gp_port_read (camera->port, &ack, ACK_LEN); + ret = gp_port_read (camera->port, (char*)&ack, ACK_LEN); if (ret<GP_OK) return ret; if (ack == NACK) { @@ -695,10 +695,10 @@ cmd[0] = ESC; cmd[1] = GETCAMINFO; - ret = gp_port_write (camera->port, cmd, sizeof(cmd)); + ret = gp_port_write (camera->port, (char*)cmd, sizeof(cmd)); if (ret<GP_OK) return ret; - ret = gp_port_read (camera->port, buf, INFO_BUFFER); + ret = gp_port_read (camera->port, (char*)buf, INFO_BUFFER); if (ret<GP_OK) return ret; num = (buf[TAKEN_IMAGE_PTR] << 8) | (buf[TAKEN_IMAGE_PTR+1]); @@ -726,10 +726,10 @@ /* get informations about camera */ cmd[0] = ESC; cmd[1] = GETCAMINFO; - ret = gp_port_write (camera->port, cmd, sizeof(cmd)); + ret = gp_port_write (camera->port, (char*)cmd, sizeof(cmd)); if (ret<GP_OK) return ret; - ret = gp_port_read (camera->port, buf, INFO_BUFFER); + ret = gp_port_read (camera->port, (char*)buf, INFO_BUFFER); if (ret<GP_OK) return ret; @@ -1111,7 +1111,8 @@ camera_summary (Camera *camera, CameraText *text, GPContext *context) { unsigned char cmd[2], buf[INFO_BUFFER]; - unsigned char power[20],mode[20],date_disp[20],date[50]; + char date_disp[20],date[50]; + char power[20],mode[20]; int ret,capacity=0,autopoweroff=0,image_taken=0,image_remained=0; time_t timestamp=0; struct tm tmp; @@ -1121,10 +1122,10 @@ /* get informations about camera */ cmd[0] = ESC; cmd[1] = GETCAMINFO; - ret = gp_port_write (camera->port, cmd, sizeof(cmd)); + ret = gp_port_write (camera->port, (char*)cmd, sizeof(cmd)); if (ret<GP_OK) return ret; - ret = gp_port_read (camera->port, buf, INFO_BUFFER); + ret = gp_port_read (camera->port, (char*)buf, INFO_BUFFER); if (ret<GP_OK) return ret; Modified: trunk/libgphoto2/camlibs/largan/lmini/largan.c =================================================================== --- trunk/libgphoto2/camlibs/largan/lmini/largan.c 2009-02-16 07:46:55 UTC (rev 11817) +++ trunk/libgphoto2/camlibs/largan/lmini/largan.c 2009-02-16 08:09:49 UTC (rev 11818) @@ -156,11 +156,9 @@ ret = largan_get_pict (camera, pict_type, (uint8_t)index, pict); if (ret == GP_OK) { gp_file_append (file, pict->data , pict->data_size); - gp_file_set_name (file, filename); if (pict->type == LARGAN_THUMBNAIL) { gp_file_set_mime_type (file, GP_MIME_BMP); - } - else { + } else { gp_file_set_mime_type (file, GP_MIME_JPEG); } } Modified: trunk/libgphoto2/camlibs/mars/library.c =================================================================== --- trunk/libgphoto2/camlibs/mars/library.c 2009-02-16 07:46:55 UTC (rev 11817) +++ trunk/libgphoto2/camlibs/mars/library.c 2009-02-16 08:09:49 UTC (rev 11818) @@ -268,7 +268,6 @@ p_data[43] = ((raw_size)>>24)&0xff; memcpy (p_data+44, data, raw_size); gp_file_set_mime_type(file, GP_MIME_WAV); - gp_file_set_name(file, filename); gp_file_set_data_and_size(file, (char *)p_data , raw_size+44); return GP_OK; } @@ -286,7 +285,6 @@ if (!audio) data[6] = (data[6] | res_code); gp_file_set_mime_type(file, GP_MIME_RAW); - gp_file_set_name(file, filename); gp_file_set_data_and_size(file, (char *)data , raw_size ); return GP_OK; } @@ -322,7 +320,6 @@ gp_gamma_correct_single (gtable, ptr, w * h); mars_white_balance (ptr, w*h, 1.4, gamma_factor); gp_file_set_mime_type (file, GP_MIME_PPM); - gp_file_set_name (file, filename); gp_file_set_data_and_size (file, (char *)ppm, size); free (p_data); Modified: trunk/libgphoto2/camlibs/minolta/dimagev/data.c =================================================================== --- trunk/libgphoto2/camlibs/minolta/dimagev/data.c 2009-02-16 07:46:55 UTC (rev 11817) +++ trunk/libgphoto2/camlibs/minolta/dimagev/data.c 2009-02-16 08:09:49 UTC (rev 11818) @@ -47,11 +47,11 @@ return GP_ERROR_NO_MEMORY; } - if ( gp_port_write(dimagev->dev, p->buffer, p->length) < GP_OK ) { + if ( gp_port_write(dimagev->dev, (char*)p->buffer, p->length) < GP_OK ) { GP_DEBUG( "dimagev_get_camera_data::unable to write packet"); free(p); return GP_ERROR_IO; - } else if ( gp_port_read(dimagev->dev, &char_buffer, 1) < GP_OK ) { + } else if ( gp_port_read(dimagev->dev, (char*)&char_buffer, 1) < GP_OK ) { GP_DEBUG( "dimagev_get_camera_data::no response from camera"); free(p); return GP_ERROR_IO; @@ -79,13 +79,13 @@ } char_buffer = DIMAGEV_EOT; - if ( gp_port_write(dimagev->dev, &char_buffer, 1) < GP_OK ) { + if ( gp_port_write(dimagev->dev, (char*)&char_buffer, 1) < GP_OK ) { GP_DEBUG( "dimagev_get_camera_data::unable to send EOT"); free(p); return GP_ERROR_IO; } - if ( gp_port_read(dimagev->dev, &char_buffer, 1) < GP_OK ) { + if ( gp_port_read(dimagev->dev, (char*)&char_buffer, 1) < GP_OK ) { GP_DEBUG( "dimagev_get_camera_data::no response from camera"); free(p); return GP_ERROR_IO; @@ -155,12 +155,12 @@ return GP_ERROR_NO_MEMORY; } - if ( gp_port_write(dimagev->dev, p->buffer, p->length) < GP_OK ) { + if ( gp_port_write(dimagev->dev, (char*)p->buffer, p->length) < GP_OK ) { GP_DEBUG( "dimagev_send_data::unable to send set_data packet"); free(p); free(export_data); return GP_ERROR_IO; - } else if ( gp_port_read(dimagev->dev, &char_buffer, 1) < GP_OK ) { + } else if ( gp_port_read(dimagev->dev, (char*)&char_buffer, 1) < GP_OK ) { GP_DEBUG( "dimagev_send_data::no response from camera - trying to send NAK"); free(p); free(export_data); @@ -194,7 +194,7 @@ free(export_data); - if ( gp_port_write(dimagev->dev, p->buffer, p->length) < GP_OK ) { + if ( gp_port_write(dimagev->dev, (char*)p->buffer, p->length) < GP_OK ) { GP_DEBUG( "dimagev_send_data::unable to send data packet"); free(p); return GP_ERROR_IO; @@ -202,7 +202,7 @@ free(p); - if ( gp_port_read(dimagev->dev, &char_buffer, 1) < GP_OK ) { + if ( gp_port_read(dimagev->dev, (char*)&char_buffer, 1) < GP_OK ) { GP_DEBUG( "dimagev_send_data::no response from camera"); return GP_ERROR_IO; } @@ -223,12 +223,12 @@ char_buffer = DIMAGEV_EOT; - if ( gp_port_write(dimagev->dev, &char_buffer, 1) < GP_OK ) { + if ( gp_port_write(dimagev->dev, (char*)&char_buffer, 1) < GP_OK ) { GP_DEBUG( "dimagev_send_data::unable to send EOT"); return GP_ERROR_IO; } - if ( gp_port_read(dimagev->dev, &char_buffer, 1) < GP_OK ) { + if ( gp_port_read(dimagev->dev, (char*)&char_buffer, 1) < GP_OK ) { GP_DEBUG( "dimagev_send_data::no response from camera"); return GP_ERROR_IO; } Modified: trunk/libgphoto2/camlibs/minolta/dimagev/dimagev.c =================================================================== --- trunk/libgphoto2/camlibs/minolta/dimagev/dimagev.c 2009-02-16 07:46:55 UTC (rev 11817) +++ trunk/libgphoto2/camlibs/minolta/dimagev/dimagev.c 2009-02-16 08:09:49 UTC (rev 11818) @@ -135,7 +135,6 @@ { Camera *camera = data; int file_number=0, result; - char buffer[128]; file_number = gp_filesystem_number(fs, folder, filename, context); if (file_number < 0) @@ -144,17 +143,10 @@ switch (type) { case GP_FILE_TYPE_NORMAL: gp_file_set_mime_type (file, GP_MIME_JPEG); - gp_file_set_name (file, filename); result = dimagev_get_picture (camera->pl, file_number + 1, file); break; case GP_FILE_TYPE_PREVIEW: gp_file_set_mime_type (file, GP_MIME_PPM); -#if defined HAVE_SNPRINTF - snprintf(buffer, sizeof(buffer), DIMAGEV_THUMBNAIL_FMT, ( file_number + 1) ); -#else - sprintf(buffer, DIMAGEV_THUMBNAIL_FMT, ( file_number + 1) ); -#endif - gp_file_set_name (file, buffer); result = dimagev_get_thumbnail (camera->pl, file_number + 1, file); break; default: @@ -215,7 +207,7 @@ } static int put_file_func (CameraFilesystem *fs, const char *folder, const char *name, - CameraFile *file, void *data, GPContext *context) + CameraFileType type, CameraFile *file, void *data, GPContext *context) { Camera *camera = data; Modified: trunk/libgphoto2/camlibs/mustek/mdc800.c =================================================================== --- trunk/libgphoto2/camlibs/mustek/mdc800.c 2009-02-16 07:46:55 UTC (rev 11817) +++ trunk/libgphoto2/camlibs/mustek/mdc800.c 2009-02-16 08:09:49 UTC (rev 11818) @@ -113,8 +113,7 @@ if (result < 0) return result; - gp_file_set_name(file,filename); - gp_file_set_mime_type (file, "image/jpeg"); + gp_file_set_mime_type (file, GP_MIME_JPEG); gp_file_set_data_and_size(file, data, size); return (GP_OK); } Modified: trunk/libgphoto2/camlibs/panasonic/dc1000.c =================================================================== --- trunk/libgphoto2/camlibs/panasonic/dc1000.c 2009-02-16 07:46:55 UTC (rev 11817) +++ trunk/libgphoto2/camlibs/panasonic/dc1000.c 2009-02-16 08:09:49 UTC (rev 11818) @@ -413,8 +413,7 @@ if ((size = dsc1_selectimage(camera, index + 1)) < 0) return (GP_ERROR); - gp_file_set_name (file, filename); - gp_file_set_mime_type (file, "image/jpeg"); + gp_file_set_mime_type (file, GP_MIME_JPEG); id = gp_context_progress_start (context, size, _("Getting data...")); for (i = 0, s = 0; s < size; i++) { @@ -432,14 +431,14 @@ } static int put_file_func (CameraFilesystem *fs, const char *folder, const char *name, - CameraFile *file, void *user_data, + CameraFileType type, CameraFile *file, void *user_data, GPContext *context) { Camera *camera = user_data; int blocks, blocksize, i; int result; const char *data; - long int size; + unsigned long int size; unsigned int id; gp_context_status(context, _("Uploading image: %s."), name); Modified: trunk/libgphoto2/camlibs/panasonic/dc1580.c =================================================================== --- trunk/libgphoto2/camlibs/panasonic/dc1580.c 2009-02-16 07:46:55 UTC (rev 11817) +++ trunk/libgphoto2/camlibs/panasonic/dc1580.c 2009-02-16 08:09:49 UTC (rev 11818) @@ -535,7 +535,6 @@ if (size < 0) return (size); - CHECK (gp_file_set_name(file, filename)); CHECK (gp_file_set_mime_type(file, GP_MIME_JPEG)); blocks = (size - 1)/DSC_BLOCKSIZE + 1; @@ -554,7 +553,7 @@ } static int put_file_func (CameraFilesystem *fs, const char *folder, const char *name, - CameraFile *file, void *user_data, + CameraFileType type, CameraFile *file, void *user_data, GPContext *context) { Camera *camera = user_data; @@ -565,7 +564,7 @@ gp_context_status(context, _("Uploading image: %s."), name); -/* We can not figure out file type, at least by now. +/* We can not figure out file type, at least by now. (? curious, mime type -Marcus) if (strcmp(file->type, "image/jpg") != 0) { dsc_print_message(camera, "JPEG image format allowed only."); Modified: trunk/libgphoto2/camlibs/panasonic/l859/l859.c =================================================================== --- trunk/libgphoto2/camlibs/panasonic/l859/l859.c 2009-02-16 07:46:55 UTC (rev 11817) +++ trunk/libgphoto2/camlibs/panasonic/l859/l859.c 2009-02-16 08:09:49 UTC (rev 11818) @@ -523,11 +523,8 @@ } } - gp_file_set_name (file, filename); gp_file_set_mime_type (file, GP_MIME_JPEG); - GP_DEBUG ("Camera Get File Done"); - return (GP_OK); } Modified: trunk/libgphoto2/camlibs/pccam300/library.c =================================================================== --- trunk/libgphoto2/camlibs/pccam300/library.c 2009-02-16 07:46:55 UTC (rev 11817) +++ trunk/libgphoto2/camlibs/pccam300/library.c 2009-02-16 08:09:49 UTC (rev 11818) @@ -150,11 +150,9 @@ break; } - if (file) { - gp_file_set_type (file, GP_FILE_TYPE_NORMAL); - gp_file_set_name (file, fn); + if (file) gp_file_set_data_and_size (file, buffer, size); - } else + else free (buffer); /* @@ -163,16 +161,8 @@ * */ gp_filesystem_append (camera->fs, folder, fn, context); gp_filesystem_set_info_noop (camera->fs, folder, fn, info, context); - /* FIXME: This is disabled for now, due to it seeming to - * cause corruption within libgphoto itself. - * A side effect of this is that file caching does - * not happen, so files must be downloaded twice if - * they are to be saved to disk. - * NWG: Sun 19th January 2003. - * - * gp_filesystem_set_file_noop (camera->fs, folder, file, - * context); - */ + gp_filesystem_set_file_noop (camera->fs, folder, fn, GP_FILE_TYPE_NORMAL, + file, context); gp_file_unref (file); gp_context_idle (context); @@ -206,9 +196,7 @@ default: return GP_ERROR_NOT_SUPPORTED; } - gp_file_set_data_and_size (file, data, size); - gp_file_set_name (file, filename); - return GP_OK; + return gp_file_set_data_and_size (file, data, size); } static int Modified: trunk/libgphoto2/camlibs/pccam600/library.c =================================================================== --- trunk/libgphoto2/camlibs/pccam600/library.c 2009-02-16 07:46:55 UTC (rev 11817) +++ trunk/libgphoto2/camlibs/pccam600/library.c 2009-02-16 08:09:49 UTC (rev 11818) @@ -228,9 +228,7 @@ default: return GP_ERROR_NOT_SUPPORTED; } - gp_file_set_data_and_size(file, data, size); - gp_file_set_name (file, filename); - return GP_OK; + return gp_file_set_data_and_size(file, data, size); } static int camera_summary(Camera *camera, CameraText *summary, GPContext *context) Modified: trunk/libgphoto2/camlibs/pccam600/pccam600.c =================================================================== --- trunk/libgphoto2/camlibs/pccam600/pccam600.c 2009-02-16 07:46:55 UTC (rev 11817) +++ trunk/libgphoto2/camlibs/pccam600/pccam600.c 2009-02-16 08:09:49 UTC (rev 11818) @@ -61,16 +61,16 @@ unsigned char status = 1; while(status != 0x00){ gp_port_set_timeout(port,3000); - ret = gp_port_usb_msg_read(port,0x06,0x00,0x00,&status,1); + ret = gp_port_usb_msg_read(port,0x06,0x00,0x00,(char*)&status,1); if (status == 0 || status == 8) return; if (status == 0xb0){ gp_port_set_timeout(port,200000); - ret = gp_port_usb_msg_read(port,0x06,0x00,0x00,&status,1); + ret = gp_port_usb_msg_read(port,0x06,0x00,0x00,(char*)&status,1); } if (status == 0x40){ gp_port_set_timeout(port,400000); - ret = gp_port_usb_msg_read(port,0x06,0x00,0x00,&status,1); + ret = gp_port_usb_msg_read(port,0x06,0x00,0x00,(char*)&status,1); } } } @@ -86,9 +86,9 @@ ret = gp_port_usb_msg_write(port,0x09,index,0x1001,NULL,0x00); pccam600_wait_for_status(port); gp_port_set_timeout(port, 400000); - ret = gp_port_usb_msg_read(port,0x60,0x00,0x03,response,0x04); + ret = gp_port_usb_msg_read(port,0x60,0x00,0x03,(char*)response,0x04); pccam600_wait_for_status(port); - ret = gp_port_usb_msg_read(port,0x60,0x00,0x04,response,0x04); + ret = gp_port_usb_msg_read(port,0x60,0x00,0x04,(char*)response,0x04); pccam600_wait_for_status(port); return GP_OK; } @@ -99,10 +99,10 @@ unsigned char response[4]; int ret; gp_port_set_timeout(port, 400000); - ret = gp_port_usb_msg_read(port,0x60,0x00,0x03,response,0x04); + ret = gp_port_usb_msg_read(port,0x60,0x00,0x03,(char*)response,0x04); *totalmem = response[2]*65536+response[1]*256+response[0]; pccam600_wait_for_status(port); - ret = gp_port_usb_msg_read(port,0x60,0x00,0x04,response,0x04); + ret = gp_port_usb_msg_read(port,0x60,0x00,0x04,(char*)response,0x04); *freemem = response[2]*65536+response[1]*256+response[0]; pccam600_wait_for_status(port); return GP_OK; @@ -120,7 +120,7 @@ gp_port_set_timeout(port, 200000); ret = gp_port_usb_msg_write(port,0x08,0x00,0x1021,NULL,0x00); pccam600_wait_for_status(port); - ret = gp_port_usb_msg_read(port,0x08,0x00,0x1000,response,0x04); + ret = gp_port_usb_msg_read(port,0x08,0x00,0x1000,(char*)response,0x04); nr_of_blocks = response[2]*256+response[1]; if (nr_of_blocks == 0){ gp_log(GP_LOG_DEBUG,"pccam600 library: pccam600_get_file_list", @@ -143,13 +143,13 @@ return GP_ERROR; } gp_port_set_timeout(port,200000); - ret = gp_port_usb_msg_read(port,0x08,index,0x1001,response,0x04); + ret = gp_port_usb_msg_read(port,0x08,index,0x1001,(char*)response,0x04); gp_port_set_timeout(port,3000); ret = gp_port_usb_msg_write(port,0x04,0x00,0x00,NULL,0x00); pccam600_wait_for_status(port); gp_port_set_timeout(port,200000); - ret = gp_port_usb_msg_read(port,0x08,index,0x1002,response,0x04); - ret = gp_port_usb_msg_read(port,0x08,index,0x1001,response,0x04); + ret = gp_port_usb_msg_read(port,0x08,index,0x1002,(char*)response,0x04); + ret = gp_port_usb_msg_read(port,0x08,index,0x1001,(char*)response,0x04); nr_of_blocks = response[2]*256+response[1]; if (nr_of_blocks == 0){ gp_log(GP_LOG_DEBUG, @@ -167,7 +167,7 @@ int pccam600_read_data(GPPort *port, unsigned char *buffer){ int ret; gp_port_set_timeout(port,500); - ret = gp_port_read(port,buffer,512); + ret = gp_port_read(port,(char*)buffer,512); return GP_OK; } @@ -204,12 +204,12 @@ pccam600_wait_for_status(port); if (ret <0) return ret; gp_port_set_timeout(port,100000); - ret = gp_port_usb_msg_read(port,0x08,0x00,0xff,response,0x1); + ret = gp_port_usb_msg_read(port,0x08,0x00,0xff,(char*)response,0x1); gp_port_set_timeout(port,500); ret = gp_port_usb_msg_write(port,0x08,0x00,0x1020,NULL,0x0); pccam600_wait_for_status(port); gp_port_set_timeout(port,200000); - ret = gp_port_usb_msg_read(port,0x08,0x00,0x1000,response,0x4); + ret = gp_port_usb_msg_read(port,0x08,0x00,0x1000,(char*)response,0x4); nr_of_blocks = response[2]*256+response[1]; nr_of_blocks = 512 / nr_of_blocks; gp_log(GP_LOG_DEBUG,"pccam600 library: init","nr_of_blocks %d",nr_of_blocks); @@ -220,7 +220,7 @@ } gp_port_set_timeout(port,500); for (i = 0; i<nr_of_blocks; i++){ - ret = gp_port_read(port, buffer,512); + ret = gp_port_read(port, (char*)buffer,512); if (ret < 0){ gp_log(GP_LOG_DEBUG, "pccam600 library: init"," gp_port_read returned %d:", Modified: trunk/libgphoto2/camlibs/polaroid/pdc320.c =================================================================== --- trunk/libgphoto2/camlibs/polaroid/pdc320.c 2009-02-16 07:46:55 UTC (rev 11817) +++ trunk/libgphoto2/camlibs/polaroid/pdc320.c 2009-02-16 08:09:49 UTC (rev 11818) @@ -413,7 +413,6 @@ switch (type) { case GP_FILE_TYPE_RAW: CR (gp_file_set_data_and_size (file, data, size)); - CR (gp_file_set_name (file, filename)); CR (gp_file_set_mime_type (file, GP_MIME_RAW)); break; case GP_FILE_TYPE_NORMAL: Modified: trunk/libgphoto2/camlibs/polaroid/pdc640.c =================================================================== --- trunk/libgphoto2/camlibs/polaroid/pdc640.c 2009-02-16 07:46:55 UTC (rev 11817) +++ trunk/libgphoto2/camlibs/polaroid/pdc640.c 2009-02-16 08:09:49 UTC (rev 11818) @@ -208,7 +208,7 @@ }; static int -pdc640_read_packet (GPPort *port, char *buf, int buf_size) +pdc640_read_packet (GPPort *port, unsigned char *buf, int buf_size) { int i; char checksum, c; @@ -218,7 +218,7 @@ buf[i] = 0; /* Read the packet */ - CHECK_RESULT (gp_port_read (port, buf, buf_size)); + CHECK_RESULT (gp_port_read (port, (char*)buf, buf_size)); /* Calculate the checksum */ for (i = 0, checksum = 0; i < buf_size; i++) @@ -234,8 +234,8 @@ } static int -pdc640_transmit (GPPort *port, char *cmd, int cmd_size, - char *buf, int buf_size) +pdc640_transmit (GPPort *port, unsigned char *cmd, int cmd_size, + unsigned char *buf, int buf_size) { int r, tries; @@ -250,7 +250,7 @@ xcmd[3] = checksum & 0xff; /* Wait until we get back the echo of the command. */ - r = gp_port_usb_msg_read( port, 0x10, xcmd[0]|(xcmd[1]<<8),xcmd[2]|(xcmd[3]<<8),xbuf,sizeof(xbuf)); + r = gp_port_usb_msg_read( port, 0x10, xcmd[0]|(xcmd[1]<<8),xcmd[2]|(xcmd[3]<<8),(char*)xbuf,sizeof(xbuf)); /* Sometimes we want to read here, sometimes not. if (r < GP_OK) return r; @@ -261,7 +261,7 @@ */ int curr = 0, readsize = (buf_size + 63) & ~63; while (curr < readsize) { - r = gp_port_read( port, buf + curr, readsize - curr); + r = gp_port_read( port, (char*)buf + curr, readsize - curr); if (r < GP_OK) break; curr += r; } @@ -276,7 +276,7 @@ * The first byte returned is always the same as the first byte * of the command. */ - CHECK_RESULT (gp_port_write (port, cmd, cmd_size)); + CHECK_RESULT (gp_port_write (port, (char*)cmd, cmd_size)); r = gp_port_read (port, &c, 1); if ((r < 0) || (c != cmd[0])) continue; @@ -296,10 +296,10 @@ static int pdc640_transmit_pic (GPPort *port, char cmd, int width, int thumbnail, - char *buf, int buf_size) + unsigned char *buf, int buf_size) { - char cmd1[] = {0x61, 0x00}; - char cmd2[] = {0x15, 0x00, 0x00, 0x00, 0x00}; + unsigned char cmd1[] = {0x61, 0x00}; + unsigned char cmd2[] = {0x15, 0x00, 0x00, 0x00, 0x00}; /* First send the command ... */ cmd1[1] = cmd; @@ -311,7 +311,7 @@ return pdc640_transmit (port, cmd2, 4, buf, buf_size); } else { int i, packet_size, result, size, ofs; - char *data; + unsigned char *data; /* Set how many scanlines worth of data to get at once */ cmd2[4] = 0x06; @@ -351,20 +351,20 @@ } static int -pdc640_transmit_packet (GPPort *port, char cmd, char *buf, int buf_size) { - char cmd1[] = {0x61, 0x00}; +pdc640_transmit_packet (GPPort *port, char cmd, unsigned char *buf, int buf_size) { + unsigned char cmd1[] = {0x61, 0x00}; /* Send the command and get the packet */ cmd1[1] = cmd; CHECK_RESULT (pdc640_transmit (port, cmd1, 2, NULL, 0)); if (port->type == GP_PORT_USB) { - char cmd2[] = {0x15, 0x00, 0x00, 0x00}; + unsigned char cmd2[] = {0x15, 0x00, 0x00, 0x00}; cmd2[1] = ((buf_size+63)/64) & 0xff; cmd2[2] = (((buf_size+63)/64) >> 8) & 0xff; return pdc640_transmit (port, cmd2, 4, buf, buf_size); } else { - char cmd2[] = {0x15, 0x00, 0x00, 0x00, 0x01}; + unsigned char cmd2[] = {0x15, 0x00, 0x00, 0x00, 0x01}; return pdc640_transmit (port, cmd2, 5, buf, buf_size); } @@ -374,7 +374,7 @@ static int pdc640_ping_low (GPPort *port) { - char cmd[] = {0x01}; + unsigned char cmd[] = {0x01}; CHECK_RESULT (pdc640_transmit (port, cmd, 1, NULL, 0)); @@ -396,7 +396,7 @@ static int pdc640_ping_high (GPPort *port) { - char cmd[] = {0x41}; + unsigned char cmd[] = {0x41}; CHECK_RESULT (pdc640_transmit (port, cmd, 1, NULL, 0)); @@ -406,7 +406,7 @@ static int pdc640_speed (GPPort *port, int speed) { - char cmd[] = {0x69, 0x00}; + unsigned char cmd[] = {0x69, 0x00}; cmd[1] = (speed / 9600) - 1; CHECK_RESULT (pdc640_transmit (port, cmd, 2, NULL, 0)); @@ -435,7 +435,7 @@ static int pdc640_unknown20 (GPPort* port) { - char buf[128]; + unsigned char buf[128]; CHECK_RESULT (pdc640_transmit_packet (port, 0x20, buf, 128)); @@ -446,7 +446,7 @@ static int pdc640_caminfo (GPPort *port, int *numpic) { - char buf[1280]; + unsigned char buf[1280]; CHECK_RESULT (pdc640_transmit_packet (port, 0x40, buf, 1280)); *numpic = buf[2]; /* thats the only useful info :( */ @@ -456,14 +456,14 @@ static int pdc640_setpic (GPPort *port, char n) { - char cmd[2] = {0xf6, 0x00}; + unsigned char cmd[2] = {0xf6, 0x00}; cmd[1] = n; if (port->type == GP_PORT_USB) { /* USB does not like a bulkread afterwards */ return pdc640_transmit (port, cmd, 2, NULL, 0); } else { - char buf[8]; + unsigned char buf[8]; return pdc640_transmit (port, cmd, 2, buf, 7); } @@ -506,8 +506,8 @@ } static int -pdc640_processtn (int width, int height, char **data, int size) { - char *newdata; +pdc640_processtn (int width, int height, unsigned char **data, int size) { + unsigned char *newdata; int y; /* Sanity checks */ @@ -533,7 +533,7 @@ } static int -pdc640_getbit (char *data, int *ofs, int size, int *bit) { +pdc640_getbit (unsigned char *data, int *ofs, int size, int *bit) { static char c; int b; @@ -558,10 +558,10 @@ } static int -pdc640_deltadecode (int width, int height, char **rawdata, int *rawsize) +pdc640_deltadecode (int width, int height, unsigned char **rawdata, int *rawsize) { char col1, col2; - char *data; + unsigned char *data; int rawofs, x, y, ofs, bit, ones; int size; int e, d, o, val; @@ -636,14 +636,14 @@ static int pdc640_getpic (Camera *camera, int n, int thumbnail, int justraw, - char **data, int *size) + unsigned char **data, int *size) { char cmd, ppmheader[100]; int size_pic, width_pic, height_pic; int size_thumb, width_thumb, height_thumb; int height, width, outsize, result, pmmhdr_len; int compression_type; - char *outdata; + unsigned char *outdata; /* Get the size of the picture */ CHECK_RESULT (pdc640_picinfo (camera->port, n, @@ -755,7 +755,7 @@ static int pdc640_delpic (GPPort *port) { - char cmd[2] = {0x59, 0x01}; + unsigned char cmd[2] = {0x59, 0x01}; CHECK_RESULT (pdc640_transmit (port, cmd, 2, NULL, 0)); @@ -765,7 +765,7 @@ static int pdc640_takepic (GPPort *port) { - char cmd[2] = {0x2D, 0x00}; + unsigned char cmd[2] = {0x2D, 0x00}; CHECK_RESULT (pdc640_transmit (port, cmd, 2, NULL, 0)); @@ -817,7 +817,7 @@ { Camera *camera = user_data; int n, size; - char *data, *p; + unsigned char *data; /* * Get the number of the picture from the filesystem and increment @@ -827,8 +827,6 @@ context)); n++; - CHECK_RESULT (gp_file_set_name (file, filename)); - /* Get the picture */ switch (type) { case GP_FILE_TYPE_NORMAL: @@ -838,18 +836,6 @@ case GP_FILE_TYPE_RAW: CHECK_RESULT (pdc640_getpic (camera, n, 0, 1, &data, &size)); CHECK_RESULT (gp_file_set_mime_type (file, GP_MIME_RAW)); - - /* Change extension to raw */ - n = strlen(filename); - p = malloc (n + 1); - if (p) { - strcpy (p, filename); - p[n-3] = 'r'; - p[n-2] = 'a'; - p[n-1] = 'w'; - CHECK_RESULT (gp_file_set_name (file, p)); - free (p); - } break; case GP_FILE_TYPE_PREVIEW: CHECK_RESULT (pdc640_getpic (camera, n, 1, 0, &data, &size)); @@ -859,7 +845,7 @@ return (GP_ERROR_NOT_SUPPORTED); } - CHECK_RESULT (gp_file_set_data_and_size (file, data, size)); + CHECK_RESULT (gp_file_set_data_and_size (file, (char*)data, size)); return (GP_OK); } @@ -869,7 +855,7 @@ GPContext *context) { Camera *camera = data; - char cmd[2] = {0x59, 0x00}; + unsigned char cmd[2] = {0x59, 0x00}; CHECK_RESULT (pdc640_transmit (camera->port, cmd, 2, NULL, 0)); Modified: trunk/libgphoto2/camlibs/ptp2/library.c =================================================================== --- trunk/libgphoto2/camlibs/ptp2/library.c 2009-02-16 07:46:55 UTC (rev 11817) +++ trunk/libgphoto2/camlibs/ptp2/library.c 2009-02-16 08:09:49 UTC (rev 11818) @@ -1539,9 +1539,6 @@ } gp_file_set_data_and_size ( file, (char*)data, size ); gp_file_set_mime_type (file, GP_MIME_JPEG); /* always */ - /* Add an arbitrary file name so caller won't crash */ - gp_file_set_name (file, "canon_preview.jpg"); - #if 0 /* Leave out, otherwise we refocus all the time */ ret = ptp_canon_viewfinderoff (params); @@ -1588,8 +1585,6 @@ ret = gp_file_new(&file); if (ret!=GP_OK) return ret; - gp_file_set_type (file, GP_FILE_TYPE_NORMAL); - gp_file_set_name(file, path->name); set_mimetype (camera, file, params->deviceinfo.VendorExtensionID, oi->ObjectFormat); CPR (context, ptp_getobject(params, newobject, &ximage)); @@ -1606,7 +1601,7 @@ return ret; } gp_log (GP_LOG_DEBUG, "ptp/add_objectid_and_upload", "adding filedata to fs"); - ret = gp_filesystem_set_file_noop(camera->fs, path->folder, path->name, file, context); + ret = gp_filesystem_set_file_noop(camera->fs, path->folder, path->name, GP_FILE_TYPE_NORMAL, file, context); if (ret != GP_OK) { gp_file_free (file); return ret; @@ -1821,8 +1816,6 @@ ret = gp_file_new(&file); if (ret!=GP_OK) return ret; - gp_file_set_type (file, GP_FILE_TYPE_NORMAL); - gp_file_set_name(file, path->name); gp_log (GP_LOG_DEBUG, "ptp2/canon_eos_capture", "trying to get object size=0x%x", oi.ObjectCompressedSize); CPR (context, ptp_canon_eos_getpartialobject (params, newobject, 0, oi.ObjectCompressedSize, &ximage)); @@ -1837,7 +1830,7 @@ gp_file_free (file); return ret; } - ret = gp_filesystem_set_file_noop(camera->fs, path->folder, path->name, file, context); + ret = gp_filesystem_set_file_noop(camera->fs, path->folder, path->name, GP_FILE_TYPE_NORMAL, file, context); if (ret != GP_OK) { gp_file_free (file); return ret; @@ -2212,7 +2205,6 @@ strcpy (path->folder,"/"); ret = gp_file_new(&file); if (ret!=GP_OK) return ret; - gp_file_set_type (file, GP_FILE_TYPE_NORMAL); sprintf (path->name, "capt%04d.", capcnt++); if (entries[i].u.object.oi.ObjectFormat == PTP_OFC_CANON_CRW) { strcat(path->name, "cr2"); @@ -2221,7 +2213,6 @@ strcat(path->name, "jpg"); gp_file_set_mime_type (file, GP_MIME_JPEG); } - gp_file_set_name(file, path->name); gp_log (GP_LOG_DEBUG, "ptp2/canon_eos_capture", "trying to get object size=0x%x", entries[i].u.object.oi.ObjectCompressedSize); CPR (context, ptp_canon_eos_getpartialobject (params, newobject, 0, entries[i].u.object.oi.ObjectCompressedSize, &ximage)); @@ -2236,7 +2227,7 @@ gp_file_free (file); return ret; } - ret = gp_filesystem_set_file_noop(camera->fs, path->folder, path->name, file, context); + ret = gp_filesystem_set_file_noop(camera->fs, path->folder, path->name, GP_FILE_TYPE_NORMAL, file, context); if (ret != GP_OK) { gp_file_free (file); return ret; @@ -3743,7 +3734,7 @@ static int put_file_func (Cam... [truncated message content] |