summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--NEWS215
-rw-r--r--camlibs/canon/canon.c44
-rw-r--r--camlibs/canon/canon.h2
-rw-r--r--camlibs/canon/library.c10
-rw-r--r--camlibs/canon/serial.c7
-rw-r--r--camlibs/canon/serial.h2
-rw-r--r--camlibs/canon/usb.c6
-rw-r--r--camlibs/canon/usb.h2
-rw-r--r--camlibs/dimera/dimera3500.c7
-rw-r--r--camlibs/directory/directory.c7
-rw-r--r--camlibs/fuji/library.c9
-rw-r--r--camlibs/jd11/serial.c4
-rw-r--r--camlibs/konica/library.c40
-rw-r--r--camlibs/konica/qm150.c2
-rw-r--r--camlibs/minolta/dimagev/dimagev.c2
-rw-r--r--camlibs/mustek/mdc800.c5
-rw-r--r--camlibs/panasonic/dc1000.c4
-rw-r--r--camlibs/panasonic/dc1580.c4
-rw-r--r--camlibs/pccam300/library.c6
-rw-r--r--camlibs/pccam600/library.c2
-rw-r--r--camlibs/ptp2/library.c14
-rw-r--r--camlibs/ricoh/g3.c8
-rw-r--r--camlibs/ricoh/library.c12
-rw-r--r--camlibs/sierra/library.c3
-rw-r--r--camlibs/sierra/sierra.c6
-rw-r--r--camlibs/sonix/library.c3
-rw-r--r--camlibs/soundvision/soundvision.c13
-rw-r--r--camlibs/sx330z/library.c9
-rw-r--r--camlibs/template/template.c11
-rw-r--r--camlibs/topfield/puppy.c11
-rw-r--r--gphoto2/gphoto2-camera.h3
-rw-r--r--gphoto2/gphoto2-filesys.h11
-rw-r--r--libgphoto2/gphoto2-camera.c10
-rw-r--r--libgphoto2/gphoto2-filesys.c62
-rw-r--r--tests/test-filesys.c4
35 files changed, 324 insertions, 236 deletions
diff --git a/NEWS b/NEWS
index befd7f79b..ebb3ccb9b 100644
--- a/NEWS
+++ b/NEWS
@@ -1,23 +1,18 @@
libgphoto2 2.4.99.1 development state
-PTP2 driver:
- * Fixed bugs in packing of PTP arrays, unpack / pack 64 bit entities.
- * Devices added:
- - Canon IXUS iZ
- - Nikon Coolpix P5100
- - <fill in from diff>
+libgphoto2 API:
+ * CameraFileInfoFile: removed "name" structmember and GP_FILE_INFO_NAME
+ flags.
+ Use direct passing in of the filename to the API functions.
-Topfield driver:
- * New driver to access Topfield PVRs (harddisc recorders).
+ * gp_file_set_name() passing in is no longer needed and the API will
+ go away.
-Sony DSC-F1 driver:
- * Did not work, now does work. Also cleaned up the code.
+ * gp_filesystem_set_info_noop(), gp_filesystem_set_file_noop(),
+ gp_filesystem_put_file(), gp_camera_folder_put_file():
-Directory driver:
- * Use GPPortInfo instead of settings to pass basepath in.
- * Abstracted common functionality.
-
-libgphoto2 API:
+ Added "filename" argument to pass in the filename. The one
+ from CameraFileInfoFile and CameraFile are no longer used.
* Adjusted to new GPPortInfo handling.
@@ -38,9 +33,13 @@ libgphoto2_port API:
* Disk Settings have been removed from the Settings union. Should
not affect frontends at all.
-
* Started using symbol versions.
+Directory driver:
+ * Use GPPortInfo instead of settings to pass basepath in.
+ * Abstracted common functionality.
+
+
Build:
* Removed dummy README file from SVN.
* Ship README.packaging in dist tarball for the first time.
@@ -55,6 +54,190 @@ Documentation:
Test cases:
* Test camlib loading of both uninstalled and installed camlibs.
+
+------------------------------------------------------------------------
+libgphoto2 2.4.4
+
+libgphoto2:
+ * Updated translations from translationproject.org
+
+PTP2 driver:
+ * Developed in parallel with TRUNK.
+ * Only retrieve and initialize the ptp filesystem if needed
+ (this will give speed ups for config operations, basic
+ init and summary.)
+ * Export the hidden vendor specific properties of the current Nikon DSLRs.
+ (over a hundred with all camera configuration details...)
+ (D80, D90, D300, D700, D40x got, D200 guessed)
+ * Lots of new Nikon DSLR and Canon Powershot properties implemented,
+ both printed in summary and available for config functions querying
+ and/or setting.
+ * Query and Set image protection flags (actually used by digikam).
+ * Lots of bugfixes and changes in Canon and Nikon specific capture routines.
+ * Some defines for PTP 1.1 added. Will have to wait for implementation until
+ a device gets available.
+ * New cameras added:
+ Kodak C913
+ Nikon D90
+ Canon Digital IXUS 960IS, EOS 1000D, SD1100 IS, SX10 IS, SX110 IS
+ Fuji FinePix A920, F100fd, S200HD
+ Apple iPod Touch (just saved screenshots and uploaded images)
+ * PTP v1.1 defines added (implementation will start once devices are available)
+ * Synced MTP device list from libmtp (0.3.5 level).
+ * Lots of bugfixes.
+
+jl2005c:
+ * Experimental driver for jl2005c based cameras added.
+ Can only retrieve raw images currently, no viewable images yet.
+ Not builtin by default. ./configure --with-drivers=all,jl2005c
+
+libgphoto2_port:
+ * Updated translations from translationproject.org
+
+ * Serial driver: do not lock device during probe to reduce startup
+ time.
+
+------------------------------------------------------------------------
+libgphoto2 2.4.3
+
+This is a 2.4 release branch update.
+
+libgphoto2:
+ * Adaptive Homogeneity-Directed Bayer array conversion added, used
+ in several camera lib drivers.
+ * Translation updates for various languages.
+ * libtool 2.x build fixes
+ * Various MacOS X compile fixes again.
+ * gp-byteorder.m4 fixes for newer glibcs.
+
+Example programs:
+ * Addes some basic library usage example programs and helpers.
+
+PTP2 driver:
+ * Merged camlib from TRUNK.
+ * Tethered Capture support for Canon EOS 40D, 400D, 450D.
+ * Always handle "no directory linking to /" problem.
+ * Disable more Panasonic cameras (product id 0x2372 is always mass storage)
+ * Some MTP fixes, lots of new MTP devices.
+ * Fixed canon viewfinder issues on Canon PowerShot SX100IS.
+ * Fixed a ptp property packing issue exposed
+ by newer Nikons.
+ * Added new devices:
+ Kodak M893 IS, C813
+ Nikon CoolPix L16, CoolPix 8700, DSC 700
+ Canon EOS 1D Mark III, IXUS 90IS, EOS 50D
+ Apple iPhone 3G
+
+Canon driver:
+ * Fixed some unlock keys problem for EOS cameras.
+ * Moved over several PTP2 supported cameras to the PTP2 driver only.
+
+Sierra driver:
+ * Implemented basic Storage Information function.
+ * Fixes for big endian or 64bit architectures by fixing struct packing.
+
+smal driver:
+ * Added support for Creative CardCam.
+
+sq905 driver:
+ * Updated postprocessing, by using "AHD" bayering and new gamma methods.
+ * Bugfixes.
+
+stv0680:
+ * Storage information function.
+
+digigr8, mars, sonix drivers:
+ * Updated postprocessing, by using "AHD" bayering and new gamma methods.
+
+jl2005a driver:
+ * Imported from TRUNK, for new small factor cameras.
+ American Idol Keychain Camera
+ NogaNet TDC-15
+------------------------------------------------------------------------
+libgphoto2 2.4.2
+
+This is a 2.4 release branch update.
+
+
+libgphoto2:
+ * Camera abilities list sorting now uses qsort(),
+ bringing startup speedups by seconds. (0.4 seconds on 2GHz machine).
+
+ * On large files, do not try to retrieve thumbnails.
+
+ * Updated lots of translations.
+
+PTP2 driver:
+ * Full merge of TRUNK ptp2 camlib.
+
+ * Lots of new IDs added. Also changed MTP id handling to share devices
+ with current libmtp.
+ * Canon now can capture to both CF/SD Card and internal memory
+ with extract/retracting the lens. "capturetarget" config option
+ determines which ones used.
+
+ * EOS capture support made working with newer Canon EOS models,
+ now reported working for EOS 400D, 450D, 40D.
+
+ * Handle MTP -> Canon/Nikon vendor id transitions better.
+ * Download cancellation support.
+ * Handle canon cameras with shorter timeouts on startup (hopefully
+ does not break) to avoid very long second startup delays.
+
+ * Lots of bugfixes.
+
+Canon driver:
+ * Configuration of Flash, Beep and Zoom added.
+ * Enable/disable remote mode only once per session (on demand)
+ * Fixed a CR2 thumbnail download problem.
+ * Fixed a THM download problem (for movies).
+ * Moved some more cameras over to PTP2 driver.
+
+Topfield driver:
+ * New driver for Topfield PVR5000 device(s).
+
+* Sony DSC F1 (old serial) driver:
+ * Merged from TRUNK, working now.
+
+libgphoto2 2.4.1
+
+This is a 2.4 release branch update.
+
+Package / System integration:
+ * HAL FDI files now use "info.subsystem" instead of "info.bus", required
+ by hal after March 2008.
+
+ * Suppress another Olympus camera in FDI file that is better of done
+ using Mass Storage only.
+
+libgphoto2_port:
+ * Suppress more known network filesystems in "disk" autodetection
+ * disabled usb_reset for Canon cameras in "usb", broke EOS cameras.
+
+PTP2 driver:
+ * Merged all new Camera IDs from TRUNK.
+ * Configuration bugfix for multiple options with the same name.
+ * Capture bugfix for Nikon Coolpix
+ * Various small bugfixes.
+
+Canon driver:
+ * Increased the event timeout, so operations work again.
+ * Fixed a bug in interval capture
+ * some additional configuration values for newer cameras
+
+Mars driver:
+ * Synced with SVN TRUNK (1:1 copy).
+ * Better whitebalance postprocessing
+ * Camera ids added
+ * Decompression fixes
+
+Digigr8 driver:
+ * Synced with SVN TRUNK (1:1 copy).
+ * bugfixes
+
+Sonix driver:
+ * Synced with SVN TRUNK (1:1 copy).
+ * bugfixes
------------------------------------------------------------------------
libgphoto2 2.4.0 release
diff --git a/camlibs/canon/canon.c b/camlibs/canon/canon.c
index 986b13694..a04240ee7 100644
--- a/camlibs/canon/canon.c
+++ b/camlibs/canon/canon.c
@@ -2876,8 +2876,6 @@ debug_fileinfo (CameraFileInfo * info)
{
GP_DEBUG ("<CameraFileInfo>");
GP_DEBUG (" <CameraFileInfoFile>");
- if ((info->file.fields & GP_FILE_INFO_NAME) != 0)
- GP_DEBUG (" Name: %s", info->file.name);
if ((info->file.fields & GP_FILE_INFO_TYPE) != 0)
GP_DEBUG (" Type: %s", info->file.type);
if ((info->file.fields & GP_FILE_INFO_SIZE) != 0)
@@ -3138,6 +3136,7 @@ canon_int_list_directory (Camera *camera, const char *folder, CameraList *list,
/* OK, this directory entry has a name in it. */
if ((list_folders && is_dir) || (list_files && is_file)) {
+ const char *filename = (char *)dirent_name;
/* we're going to fill out the info structure
in this block */
@@ -3146,9 +3145,6 @@ canon_int_list_directory (Camera *camera, const char *folder, CameraList *list,
/* we start with nothing and continously add stuff */
info.file.fields = GP_FILE_INFO_NONE;
- strncpy (info.file.name, (char *)dirent_name, sizeof (info.file.name));
- info.file.fields |= GP_FILE_INFO_NAME;
-
info.file.mtime = dirent_time;
if (info.file.mtime != 0)
info.file.fields |= GP_FILE_INFO_MTIME;
@@ -3159,7 +3155,7 @@ canon_int_list_directory (Camera *camera, const char *folder, CameraList *list,
*/
strncpy (info.file.type,
- filename2mimetype (info.file.name),
+ filename2mimetype (filename),
sizeof (info.file.type));
info.file.fields |= GP_FILE_INFO_TYPE;
@@ -3196,33 +3192,33 @@ canon_int_list_directory (Camera *camera, const char *folder, CameraList *list,
* because we have additional information.
*/
if (!camera->pl->list_all_files
- && !is_image (info.file.name)
- && !is_movie (info.file.name)
- && !is_audio (info.file.name)) {
+ && !is_image (filename)
+ && !is_movie (filename)
+ && !is_audio (filename)) {
/* FIXME: Find associated main file and add it there */
/* do nothing */
GP_DEBUG ("Ignored %s/%s", folder,
- info.file.name);
+ filename);
} else {
const char *thumbname;
res = gp_filesystem_append (camera->fs, folder,
- info.file.name, context);
+ filename, context);
if (res != GP_OK) {
GP_DEBUG ("Could not gp_filesystem_append "
"%s in folder %s: %s",
- info.file.name, folder, gp_result_as_string (res));
+ filename, folder, gp_result_as_string (res));
} else {
GP_DEBUG ("Added file %s/%s", folder,
- info.file.name);
+ filename);
thumbname =
canon_int_filename2thumbname (camera,
- info.file.name);
+ filename);
if (thumbname == NULL) {
/* no thumbnail */
} else {
- if ( is_cr2 ( info.file.name ) ) {
+ if ( is_cr2 ( filename ) ) {
/* We get the first part of the raw file as the thumbnail;
this is (almost) a valid EXIF file. */
info.preview.fields =
@@ -3242,24 +3238,24 @@ canon_int_list_directory (Camera *camera, const char *folder, CameraList *list,
}
res = gp_filesystem_set_info_noop (camera->fs,
- folder, info,
+ folder, filename, info,
context);
if (res != GP_OK) {
GP_DEBUG ("Could not gp_filesystem_set_info_noop() "
"%s in folder %s: %s",
- info.file.name, folder, gp_result_as_string (res));
+ filename, folder, gp_result_as_string (res));
}
}
GP_DEBUG ( "file \"%s\" has preview of MIME type \"%s\"",
- info.file.name, info.preview.type );
+ filename, info.preview.type );
}
}
/* Some cameras have ".." explicitly
* at the end of each directory. We
* will silently omit this from the
* directory returned. */
- if ( is_dir && strcmp ( "..", info.file.name ) ) {
- res = gp_list_append (list, info.file.name, NULL);
+ if ( is_dir && strcmp ( "..", filename ) ) {
+ res = gp_list_append (list, filename, NULL);
if (res != GP_OK)
GP_DEBUG ("Could not gp_list_append "
"folder %s: %s",
@@ -3477,16 +3473,16 @@ canon_int_delete_file (Camera *camera, const char *name, const char *dir, GPCont
*
*/
int
-canon_int_put_file (Camera *camera, CameraFile *file, char *destname, char *destpath,
- GPContext *context)
+canon_int_put_file (Camera *camera, CameraFile *file, const char *filename,
+ const char *destname, const char *destpath, GPContext *context)
{
switch (camera->port->type) {
case GP_PORT_USB:
- return canon_usb_put_file (camera, file, destname, destpath,
+ return canon_usb_put_file (camera, file, filename, destname, destpath,
context);
break;
case GP_PORT_SERIAL:
- return canon_serial_put_file (camera, file, destname, destpath,
+ return canon_serial_put_file (camera, file, filename, destname, destpath,
context);
break;
GP_PORT_DEFAULT
diff --git a/camlibs/canon/canon.h b/camlibs/canon/canon.h
index c09e8f6d4..b89870839 100644
--- a/camlibs/canon/canon.h
+++ b/camlibs/canon/canon.h
@@ -689,7 +689,7 @@ int canon_int_list_directory (Camera *camera, const char *folder, CameraList *li
int canon_int_get_file(Camera *camera, const char *name, unsigned char **data, unsigned int *length, GPContext *context);
int canon_int_get_thumbnail(Camera *camera, const char *name, unsigned char **retdata, unsigned int *length, GPContext *context);
-int canon_int_put_file(Camera *camera, CameraFile *file, char *destname, char *destpath, GPContext *context);
+int canon_int_put_file(Camera *camera, CameraFile *file, const char *filename, const char *destname, const char *destpath, GPContext *context);
int canon_int_set_file_attributes(Camera *camera, const char *file, const char *dir, canonDirentAttributeBits attrs, GPContext *context);
int canon_int_delete_file(Camera *camera, const char *name, const char *dir, GPContext *context);
int canon_int_set_shutter_speed(Camera *camera, canonShutterSpeedState shutter_speed, GPContext *context);
diff --git a/camlibs/canon/library.c b/camlibs/canon/library.c
index a30c75651..e718f785a 100644
--- a/camlibs/canon/library.c
+++ b/camlibs/canon/library.c
@@ -1263,7 +1263,7 @@ convert_filename_to_8_3(const char* filename, char* dest)
/* XXX This function should be merged with the other one of the same name */
static int
-put_file_func (CameraFilesystem *fs, const char *folder, CameraFile *file, void *data,
+put_file_func (CameraFilesystem *fs, const char *folder, const char *filename, CameraFile *file, void *data,
GPContext *context)
{
Camera *camera = data;
@@ -1317,9 +1317,7 @@ put_file_func (CameraFilesystem *fs, const char *folder, CameraFile *file, void
sprintf (destpath, "%s\\%s", dcf_root_dir, dir);
} else {
if(camera->pl->upload_keep_filename) {
- const char* filename;
char filename2[300];
- CHECK_RESULT (gp_file_get_name (file, &filename));
if(!filename)
return GP_ERROR;
convert_filename_to_8_3(filename, filename2);
@@ -1381,13 +1379,13 @@ put_file_func (CameraFilesystem *fs, const char *folder, CameraFile *file, void
clear_readiness (camera);
- return canon_int_put_file (camera, file, destname, destpath, context);
+ return canon_int_put_file (camera, file, filename, destname, destpath, context);
}
#else /* not CANON_EXPERIMENTAL_UPLOAD */
static int
-put_file_func (CameraFilesystem __unused__ *fs, const char __unused__ *folder,
+put_file_func (CameraFilesystem __unused__ *fs, const char __unused__ *folder, const char *filename,
CameraFile *file, void *data,
GPContext *context)
{
@@ -1493,7 +1491,7 @@ put_file_func (CameraFilesystem __unused__ *fs, const char __unused__ *folder,
clear_readiness (camera);
- return canon_int_put_file (camera, file, destname, destpath, context);
+ return canon_int_put_file (camera, file, filename, destname, destpath, context);
}
#endif /* CANON_EXPERIMENTAL_UPLOAD */
diff --git a/camlibs/canon/serial.c b/camlibs/canon/serial.c
index 71140afd0..7d9bfdec5 100644
--- a/camlibs/canon/serial.c
+++ b/camlibs/canon/serial.c
@@ -570,7 +570,7 @@ canon_serial_send_msg (Camera *camera, unsigned char mtype, unsigned char dir, v
len = va_arg (*ap, int);
if (pos + len - pkt > MAX_MSG_SIZE && camera->pl->uploading != 1) {
- GP_DEBUG ("FATAL ERROR: message too big (%i)", pos + len - pkt);
+ GP_DEBUG ("FATAL ERROR: message too big (%i)", (int)(pos + len - pkt));
return -1;
}
memcpy (pos, str, len);
@@ -960,7 +960,7 @@ canon_serial_error_type (Camera *camera)
*
*/
int
-canon_serial_put_file (Camera *camera, CameraFile *file, char *destname, char *destpath,
+canon_serial_put_file (Camera *camera, CameraFile *file, const char *name, const char *destname, const char *destpath,
GPContext *context)
{
unsigned char *msg;
@@ -974,11 +974,10 @@ canon_serial_put_file (Camera *camera, CameraFile *file, char *destname, char *d
int i, j = 0;
unsigned int len, hdr_len;
unsigned long int size;
- const char *data, *name;
+ const char *data;
unsigned int id;
camera->pl->uploading = 1;
- gp_file_get_name (file, &name);
for (i = 0; name[i]; i++)
filename[i] = toupper (name[i]);
filename[i] = '\0';
diff --git a/camlibs/canon/serial.h b/camlibs/canon/serial.h
index d520ef46e..d8b09b78e 100644
--- a/camlibs/canon/serial.h
+++ b/camlibs/canon/serial.h
@@ -20,7 +20,7 @@ void canon_serial_error_type(Camera *camera);
unsigned char * canon_serial_dialogue (Camera *camera, GPContext *context, unsigned char mtype, unsigned char dir, unsigned int *len, ...);
unsigned char *canon_serial_get_file (Camera *camera, const char *name, unsigned int *length, GPContext *context);
-int canon_serial_put_file (Camera *camera, CameraFile *file, char *destname, char *destpath, GPContext *context);
+int canon_serial_put_file (Camera *camera, CameraFile *file, const char *filename, const char *destname, const char *destpath, GPContext *context);
int canon_serial_get_dirents (Camera *camera, unsigned char **dirent_data, unsigned int *dirents_length, const char *path, GPContext *context);
diff --git a/camlibs/canon/usb.c b/camlibs/canon/usb.c
index e277bd54a..6eabed8e5 100644
--- a/camlibs/canon/usb.c
+++ b/camlibs/canon/usb.c
@@ -1443,7 +1443,7 @@ canon_usb_dialogue_full (Camera *camera, canonCommandIndex canon_funct, unsigned
gp_log (GP_LOG_VERBOSE, "canon/usb.c",
_("canon_usb_dialogue:"
" payload too big, won't fit into buffer (%i > %i)"),
- (payload_length + 0x50), sizeof (packet));
+ (payload_length + 0x50), (int)sizeof (packet));
return NULL;
}
@@ -2206,7 +2206,7 @@ canon_usb_set_file_attributes (Camera *camera, unsigned int attr_bits,
#ifndef CANON_EXPERIMENTAL_UPLOAD
int
canon_usb_put_file (Camera __unused__ *camera, CameraFile __unused__ *file,
- char __unused__ *destname, char __unused__ *destpath,
+ const char __unused__ *filename, const char __unused__ *destname, const char __unused__ *destpath,
GPContext __unused__ *context)
{
return GP_ERROR_NOT_SUPPORTED;
@@ -2216,7 +2216,7 @@ canon_usb_put_file (Camera __unused__ *camera, CameraFile __unused__ *file,
int
canon_usb_put_file (Camera *camera, CameraFile *file,
- char *destname, char *destpath,
+ const char *xfilename, const char *destname, const char *destpath,
GPContext *context)
{
long int packet_size = USB_BULK_WRITE_SIZE;
diff --git a/camlibs/canon/usb.h b/camlibs/canon/usb.h
index fee872566..5f2d7424c 100644
--- a/camlibs/canon/usb.h
+++ b/camlibs/canon/usb.h
@@ -253,7 +253,7 @@ struct canon_usb_status {
int canon_usb_init (Camera *camera, GPContext *context);
int canon_usb_set_file_time ( Camera *camera, char *camera_filename, time_t time, GPContext *context);
-int canon_usb_put_file (Camera *camera, CameraFile *file, char *destname, char *destpath,
+int canon_usb_put_file (Camera *camera, CameraFile *file, const char *filename, const char *destname, const char *destpath,
GPContext *context);
unsigned char *canon_usb_capture_dialogue (Camera *camera, unsigned int *return_length, int *photo_status, GPContext *context );
unsigned char *canon_usb_dialogue_full (Camera *camera, canonCommandIndex canon_funct,
diff --git a/camlibs/dimera/dimera3500.c b/camlibs/dimera/dimera3500.c
index 42f0e40f7..20d52ea45 100644
--- a/camlibs/dimera/dimera3500.c
+++ b/camlibs/dimera/dimera3500.c
@@ -347,9 +347,8 @@ static int get_info_func (CameraFilesystem *fs, const char *folder, const char *
info->preview.width = 64;
info->preview.height = 48;
- info->file.fields = GP_FILE_INFO_ALL;
+ info->file.fields = GP_FILE_INFO_TYPE|GP_FILE_INFO_PERMISSIONS|GP_FILE_INFO_WIDTH|GP_FILE_INFO_HEIGHT|GP_FILE_INFO_SIZE;
strcpy(info->file.type, GP_MIME_PPM);
- strcpy(info->file.name, filename);
info->file.permissions = GP_FILE_PERM_READ;
if (std_res) {
@@ -398,9 +397,7 @@ static int camera_capture_preview(Camera *camera, CameraFile *file, GPContext *c
data = Dimera_Preview( &size, camera, context);
if (!data)
return GP_ERROR;
- gp_file_set_data_and_size (file, data, size);
-
- return GP_OK;
+ return gp_file_set_data_and_size (file, data, size);
}
static int camera_summary (Camera *camera, CameraText *summary, GPContext *context) {
diff --git a/camlibs/directory/directory.c b/camlibs/directory/directory.c
index d6eecdab3..ad855ce7b 100644
--- a/camlibs/directory/directory.c
+++ b/camlibs/directory/directory.c
@@ -393,13 +393,11 @@ get_info_func (CameraFilesystem *fs, const char *folder, const char *file,
info->file.permissions |= GP_FILE_PERM_READ;
if (st.st_mode & S_IWUSR)
info->file.permissions |= GP_FILE_PERM_DELETE;
- strcpy (info->file.name, file);
info->file.size = st.st_size;
mime_type = get_mime_type (file);
if (!mime_type)
mime_type = "application/octet-stream";
strcpy (info->file.type, mime_type);
-
return (GP_OK);
}
@@ -638,19 +636,16 @@ delete_file_func (CameraFilesystem *fs, const char *folder,
}
static int
-put_file_func (CameraFilesystem *fs, const char *folder,
+put_file_func (CameraFilesystem *fs, const char *folder, const char *name,
CameraFile *file, void *data, GPContext *context)
{
char path[2048];
- const char *name;
int result;
#ifdef DEBUG
unsigned int i, id;
#endif
Camera *camera = (Camera*)data;
- gp_file_get_name (file, &name);
-
result = _get_path (camera->port, folder, name, path, sizeof(path));
if (result < GP_OK)
return result;
diff --git a/camlibs/fuji/library.c b/camlibs/fuji/library.c
index 91b71cdcb..de8a915ba 100644
--- a/camlibs/fuji/library.c
+++ b/camlibs/fuji/library.c
@@ -224,19 +224,16 @@ get_file_func (CameraFilesystem *fs, const char *folder,
}
static int
-put_file_func (CameraFilesystem *fs, const char *folder,
+put_file_func (CameraFilesystem *fs, const char *folder, const char *name,
CameraFile *file, void *data, GPContext *context)
{
Camera *camera = data;
- const char *d, *name;
+ const char *d;
unsigned long int d_len;
CR (gp_file_get_data_and_size (file, &d, &d_len));
- CR (gp_file_get_name (file, &name));
CR (fuji_upload_init (camera, name, context));
- CR (fuji_upload (camera, d, d_len, context));
-
- return (GP_OK);
+ return fuji_upload (camera, d, d_len, context);
}
static int
diff --git a/camlibs/jd11/serial.c b/camlibs/jd11/serial.c
index 44f0c5dd2..99c0f4929 100644
--- a/camlibs/jd11/serial.c
+++ b/camlibs/jd11/serial.c
@@ -426,7 +426,7 @@ jd11_index_reader(GPPort *port, CameraFilesystem *fs, GPContext *context) {
gp_file_free (file);
return ret;
}
- ret = gp_filesystem_set_file_noop(fs, "/", file, context);
+ ret = gp_filesystem_set_file_noop(fs, "/", fn, file, context);
if (ret != GP_OK) return ret;
/* we also get the fs info for free, so just set it */
@@ -444,7 +444,7 @@ jd11_index_reader(GPPort *port, CameraFilesystem *fs, GPContext *context) {
info.preview.width = 64;
info.preview.height = 48;
info.preview.size = 64*48+strlen(THUMBHEADER);
- ret = gp_filesystem_set_info_noop(fs, "/", info, context);
+ ret = gp_filesystem_set_info_noop(fs, "/", fn, info, context);
}
free(indexbuf);
return GP_OK;
diff --git a/camlibs/konica/library.c b/camlibs/konica/library.c
index 62124afbc..9e32a259d 100644
--- a/camlibs/konica/library.c
+++ b/camlibs/konica/library.c
@@ -92,13 +92,12 @@ timeout_func (Camera *camera, GPContext *context)
static int
get_info (Camera *camera, unsigned int n, CameraFileInfo *info,
- CameraFile *file, GPContext *context)
+ char *fn, CameraFile *file, GPContext *context)
{
unsigned long image_id;
unsigned int buffer_size, exif_size;
unsigned char *buffer = NULL;
int protected, r;
- char fn[40];
/*
* Remove the timeout, get the information and restart the
@@ -157,10 +156,10 @@ file_list_func (CameraFilesystem *fs, const char *folder, CameraList *list,
id = gp_context_progress_start (context, status.pictures,
_("Getting file list..."));
for (i = 0; i < status.pictures; i++) {
-
+ char fn[40];
/* Get information */
gp_file_new (&file);
- result = get_info (camera, i + 1, &info, file, context);
+ result = get_info (camera, i + 1, &info, fn, file, context);
if (result < 0) {
gp_file_unref (file);
return (result);
@@ -170,10 +169,9 @@ file_list_func (CameraFilesystem *fs, const char *folder, CameraList *list,
* Append directly to the filesystem instead of to the list,
* because we have additional information.
*/
- gp_filesystem_append (camera->fs, folder, info.file.name,
- context);
- gp_filesystem_set_info_noop (camera->fs, folder, info, context);
- gp_filesystem_set_file_noop (camera->fs, folder, file, context);
+ 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_file_unref (file);
gp_context_idle (context);
@@ -367,14 +365,6 @@ set_info_func (CameraFilesystem *fs, const char *folder, const char *file,
C(k_set_protect_status (camera->port, context,
camera->pl->image_id_long, image_id, protected));
}
-
- /* Name? */
- if (info.file.fields & GP_FILE_INFO_NAME) {
- gp_context_error (context, _("Your camera does not support "
- "changing filenames."));
- return (GP_ERROR_NOT_SUPPORTED);
- }
-
return (GP_OK);
}
@@ -385,6 +375,7 @@ get_info_func (CameraFilesystem *fs, const char *folder, const char *filename,
Camera *camera = data;
CameraFile *file;
int n, result;
+ char fn[40];
/* We need image numbers starting with 1 */
n = gp_filesystem_number (camera->fs, folder, filename, context);
@@ -393,14 +384,13 @@ get_info_func (CameraFilesystem *fs, const char *folder, const char *filename,
n++;
gp_file_new (&file);
- result = get_info (camera, n, info, file, context);
+ result = get_info (camera, n, info, fn, file, context);
if (result < 0) {
gp_file_unref (file);
return (result);
}
- gp_filesystem_set_file_noop (fs, folder, file, context);
+ gp_filesystem_set_file_noop (fs, folder, filename, file, context);
gp_file_unref (file);
-
return (GP_OK);
}
@@ -570,6 +560,7 @@ camera_capture (Camera* camera, CameraCaptureType type, CameraFilePath* path,
int protected, r;
CameraFile *file = NULL;
CameraFileInfo info;
+ char fn[40];
C_NULL (camera && path);
@@ -595,22 +586,21 @@ camera_capture (Camera* camera, CameraCaptureType type, CameraFilePath* path,
strcpy (info.preview.type, GP_MIME_JPEG);
info.file.fields = GP_FILE_INFO_SIZE | GP_FILE_INFO_PERMISSIONS |
- GP_FILE_INFO_TYPE | GP_FILE_INFO_NAME;
+ GP_FILE_INFO_TYPE;
info.file.size = exif_size;
info.file.permissions = GP_FILE_PERM_READ;
if (!protected)
info.file.permissions |= GP_FILE_PERM_DELETE;
strcpy (info.file.type, GP_MIME_JPEG);
- snprintf (info.file.name, sizeof (info.file.name),
- "%06i.jpeg", (int) image_id);
- gp_filesystem_set_info_noop (camera->fs, path->folder, info, context);
+ sprintf (fn, "%06i.jpeg", (int) image_id);
+ gp_filesystem_set_info_noop (camera->fs, path->folder, fn, info, context);
gp_file_new (&file);
- gp_file_set_name (file, info.file.name);
+ 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, file, context);
+ gp_filesystem_set_file_noop (camera->fs, path->folder, fn, file, context);
gp_file_unref (file);
return (GP_OK);
diff --git a/camlibs/konica/qm150.c b/camlibs/konica/qm150.c
index 443747a9c..97b557f60 100644
--- a/camlibs/konica/qm150.c
+++ b/camlibs/konica/qm150.c
@@ -493,7 +493,7 @@ delete_all_func (CameraFilesystem *fs, const char *folder, void *data,
* Upload an image to the camera
*/
static int
-put_file_func (CameraFilesystem *fs, const char *folder, CameraFile *file,
+put_file_func (CameraFilesystem *fs, const char *folder, const char *name, CameraFile *file,
void *data, GPContext *context)
{
Camera *camera = data;
diff --git a/camlibs/minolta/dimagev/dimagev.c b/camlibs/minolta/dimagev/dimagev.c
index 90046216c..81627395b 100644
--- a/camlibs/minolta/dimagev/dimagev.c
+++ b/camlibs/minolta/dimagev/dimagev.c
@@ -214,7 +214,7 @@ static int camera_capture (Camera *camera, CameraCaptureType type, CameraFilePat
return GP_OK;
}
-static int put_file_func (CameraFilesystem *fs, const char *folder,
+static int put_file_func (CameraFilesystem *fs, const char *folder, const char *name,
CameraFile *file, void *data, GPContext *context)
{
Camera *camera = data;
diff --git a/camlibs/mustek/mdc800.c b/camlibs/mustek/mdc800.c
index 56d938e7a..0f3c55ec7 100644
--- a/camlibs/mustek/mdc800.c
+++ b/camlibs/mustek/mdc800.c
@@ -120,14 +120,13 @@ get_file_func (CameraFilesystem *fs, const char *folder, const char *filename,
}
static int
-put_file_func (CameraFilesystem *fs, const char *folder, CameraFile *file,
+put_file_func (CameraFilesystem *fs, const char *folder, const char *name, CameraFile *file,
void *data, GPContext *context)
{
/* Camera *camera;*/
/*
- * Upload the file to the camera. Use gp_file_get_data_and_size,
- * gp_file_get_name, etc.
+ * Upload the file to the camera. Use gp_file_get_data_and_size,etc
*/
return (GP_OK);
diff --git a/camlibs/panasonic/dc1000.c b/camlibs/panasonic/dc1000.c
index c85de46ec..d4fe13eaf 100644
--- a/camlibs/panasonic/dc1000.c
+++ b/camlibs/panasonic/dc1000.c
@@ -431,19 +431,17 @@ static int get_file_func (CameraFilesystem *fs, const char *folder,
return GP_OK;
}
-static int put_file_func (CameraFilesystem *fs, const char *folder,
+static int put_file_func (CameraFilesystem *fs, const char *folder, const char *name,
CameraFile *file, void *user_data,
GPContext *context)
{
Camera *camera = user_data;
int blocks, blocksize, i;
int result;
- const char *name;
const char *data;
long int size;
unsigned int id;
- gp_file_get_name (file, &name);
gp_context_status(context, _("Uploading image: %s."), name);
/* We can not figure out file type, at least by now.
diff --git a/camlibs/panasonic/dc1580.c b/camlibs/panasonic/dc1580.c
index 7ab1da331..d4192d3c0 100644
--- a/camlibs/panasonic/dc1580.c
+++ b/camlibs/panasonic/dc1580.c
@@ -553,18 +553,16 @@ static int get_file_func (CameraFilesystem *fs, const char *folder,
return GP_OK;
}
-static int put_file_func (CameraFilesystem *fs, const char *folder,
+static int put_file_func (CameraFilesystem *fs, const char *folder, const char *name,
CameraFile *file, void *user_data,
GPContext *context) {
Camera *camera = user_data;
int blocks, blocksize, i, result;
- const char *name;
const char *data;
long int size;
unsigned int id;
- gp_file_get_name(file, &name);
gp_context_status(context, _("Uploading image: %s."), name);
/* We can not figure out file type, at least by now.
diff --git a/camlibs/pccam300/library.c b/camlibs/pccam300/library.c
index 71b8bc2ec..958d17838 100644
--- a/camlibs/pccam300/library.c
+++ b/camlibs/pccam300/library.c
@@ -161,10 +161,8 @@ file_list_func (CameraFilesystem *fs, const char *folder,
* Append directly to the filesystem instead of to the list,
* because we have additional information.
* */
- gp_filesystem_append (camera->fs, folder, info.file.name,
- context);
- gp_filesystem_set_info_noop (camera->fs, folder, info,
- context);
+ 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
diff --git a/camlibs/pccam600/library.c b/camlibs/pccam600/library.c
index fbd382328..698167e9b 100644
--- a/camlibs/pccam600/library.c
+++ b/camlibs/pccam600/library.c
@@ -168,7 +168,7 @@ static int file_list_func (CameraFilesystem *fs, const char *folder,
info.file.permissions = GP_FILE_PERM_READ | GP_FILE_PERM_DELETE;
info.file.fields |= GP_FILE_INFO_SIZE | GP_FILE_INFO_PERMISSIONS
|GP_FILE_INFO_TYPE;
- ret = gp_filesystem_set_info_noop(fs, folder, info, context);
+ ret = gp_filesystem_set_info_noop(fs, folder, file_entry->name, info, context);
}
}
offset = 0;
diff --git a/camlibs/ptp2/library.c b/camlibs/ptp2/library.c
index ba5cc8a38..69775b815 100644
--- a/camlibs/ptp2/library.c
+++ b/camlibs/ptp2/library.c
@@ -1599,7 +1599,7 @@ add_objectid_and_upload (Camera *camera, CameraFilePath *path, GPContext *contex
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, file, context);
+ ret = gp_filesystem_set_file_noop(camera->fs, path->folder, path->name, file, context);
if (ret != GP_OK) {
gp_file_free (file);
return ret;
@@ -1624,7 +1624,7 @@ add_objectid_and_upload (Camera *camera, CameraFilePath *path, GPContext *contex
info.preview.height = oi->ThumbPixHeight;
info.preview.size = oi->ThumbCompressedSize;
gp_log (GP_LOG_DEBUG, "ptp/add_objectid_and_upload", "setting fileinfo in fs");
- return gp_filesystem_set_info_noop(camera->fs, path->folder, info, context);
+ return gp_filesystem_set_info_noop(camera->fs, path->folder, path->name, info, context);
}
/**
@@ -1830,7 +1830,7 @@ camera_canon_eos_capture (Camera *camera, CameraCaptureType type, CameraFilePath
gp_file_free (file);
return ret;
}
- ret = gp_filesystem_set_file_noop(camera->fs, path->folder, file, context);
+ ret = gp_filesystem_set_file_noop(camera->fs, path->folder, path->name, file, context);
if (ret != GP_OK) {
gp_file_free (file);
return ret;
@@ -2229,7 +2229,7 @@ camera_wait_for_event (Camera *camera, int timeout,
gp_file_free (file);
return ret;
}
- ret = gp_filesystem_set_file_noop(camera->fs, path->folder, file, context);
+ ret = gp_filesystem_set_file_noop(camera->fs, path->folder, path->name, file, context);
if (ret != GP_OK) {
gp_file_free (file);
return ret;
@@ -3735,12 +3735,11 @@ get_file_func (CameraFilesystem *fs, const char *folder, const char *filename,
}
static int
-put_file_func (CameraFilesystem *fs, const char *folder, CameraFile *file,
- void *data, GPContext *context)
+put_file_func (CameraFilesystem *fs, const char *folder, const char *filename,
+ CameraFile *file, void *data, GPContext *context)
{
Camera *camera = data;
PTPObjectInfo oi;
- const char *filename;
uint32_t parent;
uint32_t storage;
uint32_t handle;
@@ -3752,7 +3751,6 @@ put_file_func (CameraFilesystem *fs, const char *folder, CameraFile *file,
init_ptp_fs (camera, context);
- gp_file_get_name (file, &filename);
gp_file_get_type (file, &type);
gp_log ( GP_LOG_DEBUG, "ptp2/put_file_func", "folder=%s, filename=%s", folder, filename);
diff --git a/camlibs/ricoh/g3.c b/camlibs/ricoh/g3.c
index ce39a9f5d..a1e72edc1 100644
--- a/camlibs/ricoh/g3.c
+++ b/camlibs/ricoh/g3.c
@@ -422,20 +422,18 @@ out:
* with it and sometimes refuses to send data the correct way
*/
static int
-put_file_func (CameraFilesystem *fs, const char *folder, CameraFile *file,
+put_file_func (CameraFilesystem *fs, const char *folder, const char *fn, CameraFile *file,
void *data, GPContext *context)
{
Camera *camera = data;
char *buf = NULL, *reply = NULL, *cmd =NULL;
- const char *fn = NULL, *imgdata = NULL;
+ const char *imgdata = NULL;
int ret, channel, len;
long size;
ret = g3_cwd_command (camera->port, folder);
if (ret < GP_OK) goto out;
- ret = gp_file_get_name (file, &fn);
- if (ret < GP_OK) goto out;
ret = gp_file_get_data_and_size (file, &imgdata, &size);
if (ret < GP_OK) goto out;
@@ -849,7 +847,7 @@ file_list_func (CameraFilesystem *fs, const char *folder, CameraList *list,
((year & 3) == 0 && month < 2 ? 1 : 0)+
3653);
- ret = gp_filesystem_set_info_noop(fs, folder, info, context);
+ ret = gp_filesystem_set_info_noop(fs, folder, xfn, info, context);
}
}
diff --git a/camlibs/ricoh/library.c b/camlibs/ricoh/library.c
index 8588f24d8..32623f7fd 100644
--- a/camlibs/ricoh/library.c
+++ b/camlibs/ricoh/library.c
@@ -277,19 +277,15 @@ camera_capture (Camera *camera, CameraCaptureType type,
}
static int
-put_file_func (CameraFilesystem *fs, const char *folder, CameraFile *file,
- void *user_data, GPContext *context)
+put_file_func (CameraFilesystem *fs, const char *folder, const char *name,
+ CameraFile *file, void *user_data, GPContext *context)
{
- const char *data, *name;
+ const char *data;
unsigned long int size;
Camera *camera = user_data;
CR (gp_file_get_data_and_size (file, &data, &size));
- CR (gp_file_get_name (file, &name));
-
- CR (ricoh_put_file (camera, context, name, data, size));
-
- return (GP_OK);
+ return ricoh_put_file (camera, context, name, data, size);
}
#undef N_ELEMENTS
diff --git a/camlibs/sierra/library.c b/camlibs/sierra/library.c
index c8a801aa4..bed931961 100644
--- a/camlibs/sierra/library.c
+++ b/camlibs/sierra/library.c
@@ -1230,8 +1230,7 @@ int sierra_get_string_register (Camera *camera, int reg, int fnumber,
CHECK (sierra_write_packet (camera, p, context));
if (file && total > min_progress_bytes) {
- CHECK (gp_file_get_name(file, &file_name));
- id = gp_context_progress_start (context, total, "%s", file_name);
+ id = gp_context_progress_start (context, total, _("Downloading data..."));
}
/* Read all the data packets */
diff --git a/camlibs/sierra/sierra.c b/camlibs/sierra/sierra.c
index f1ce2708a..166480398 100644
--- a/camlibs/sierra/sierra.c
+++ b/camlibs/sierra/sierra.c
@@ -728,19 +728,15 @@ camera_capture_preview (Camera *camera, CameraFile *file, GPContext *context)
}
static int
-put_file_func (CameraFilesystem * fs, const char *folder, CameraFile * file, void *data, GPContext *context)
+put_file_func (CameraFilesystem * fs, const char *folder, const char *filename, CameraFile * file, void *data, GPContext *context)
{
Camera *camera = data;
char *picture_folder;
int ret;
const char *data_file;
long data_size;
- const char *filename;
int available_memory;
- gp_file_get_name(file, &filename);
-
-
GP_DEBUG ("*** put_file_func");
GP_DEBUG ("*** folder: %s", folder);
GP_DEBUG ("*** filename: %s", filename);
diff --git a/camlibs/sonix/library.c b/camlibs/sonix/library.c
index e78bae3f0..3bb8c4631 100644
--- a/camlibs/sonix/library.c
+++ b/camlibs/sonix/library.c
@@ -539,11 +539,8 @@ camera_exit (Camera *camera, GPContext *context)
static CameraFilesystemFuncs fsfuncs = {
.file_list_func = file_list_func,
- .folder_list_func = NULL,
- .get_info_func = NULL,
.get_file_func = get_file_func,
.del_file_func = delete_file_func,
- .put_file_func = NULL,
.delete_all_func = delete_all_func,
};
diff --git a/camlibs/soundvision/soundvision.c b/camlibs/soundvision/soundvision.c
index b9aa1e7e4..e16fa5acb 100644
--- a/camlibs/soundvision/soundvision.c
+++ b/camlibs/soundvision/soundvision.c
@@ -386,21 +386,16 @@ static int delete_file_func (CameraFilesystem *fs, const char *folder,
}
-static int put_file_func (CameraFilesystem *fs, const char *folder,
+static int put_file_func (CameraFilesystem *fs, const char *folder, const char *filename,
CameraFile *file, void *data, GPContext *context) {
Camera *camera=data;
- const char *filename;
const char *data_file;
long data_size;
- /*
- * Upload the file to the camera. Use gp_file_get_data_and_size,
- * gp_file_get_name, etc.
- */
-
- gp_file_get_name(file, &filename);
-
+ /*
+ * Upload the file to the camera. Use gp_file_get_data_and_size, etc.
+ */
GP_DEBUG ("*** put_file_func");
GP_DEBUG ("*** folder: %s", folder);
GP_DEBUG ("*** filename: %s", filename);
diff --git a/camlibs/sx330z/library.c b/camlibs/sx330z/library.c
index c31b8d66b..ef0f9f99e 100644
--- a/camlibs/sx330z/library.c
+++ b/camlibs/sx330z/library.c
@@ -141,6 +141,7 @@ file_list_func (CameraFilesystem *fs, const char *folder, CameraList *list,
for (pcnt = 0; pcnt < tpages; pcnt++) {
CR (sx330z_get_toc_page (camera, context, &toc, pcnt));
for (ecnt = 0; ecnt < toc.numEntries; ecnt++) {
+ char fn[20];
info.audio.fields = GP_FILE_INFO_NONE;
info.preview.fields = GP_FILE_INFO_TYPE;
@@ -152,16 +153,14 @@ file_list_func (CameraFilesystem *fs, const char *folder, CameraList *list,
info.file.permissions = GP_FILE_PERM_READ |
GP_FILE_PERM_DELETE;
strcpy (info.file.type,GP_MIME_JPEG);
- sprintf (info.file.name, "%.12s",
- toc.entries[ecnt].name);
+ sprintf (fn, "%.12s", toc.entries[ecnt].name);
/*
* Append directly to the filesystem instead of to
* the list, because we have additional information.
*/
- gp_filesystem_append (camera->fs, folder,
- info.file.name, context);
- gp_filesystem_set_info_noop (camera->fs, folder,
+ gp_filesystem_append (camera->fs, folder, fn, context);
+ gp_filesystem_set_info_noop (camera->fs, folder, fn,
info, context);
}
gp_context_progress_update (context, id, pcnt);
diff --git a/camlibs/template/template.c b/camlibs/template/template.c
index 883a5a511..a477b4fe0 100644
--- a/camlibs/template/template.c
+++ b/camlibs/template/template.c
@@ -268,17 +268,16 @@ get_file_func (CameraFilesystem *fs, const char *folder, const char *filename,
* This function is a CameraFilesystem method.
*/
int
-put_file_func (CameraFilesystem *fs, const char *folder, CameraFile *file,
- void *data, GPContext *context);
+put_file_func (CameraFilesystem *fs, const char *folder, const char *name,
+ CameraFile *file, void *data, GPContext *context);
int
-put_file_func (CameraFilesystem *fs, const char *folder, CameraFile *file,
- void *data, GPContext *context)
+put_file_func (CameraFilesystem *fs, const char *folder, const char *name,
+ CameraFile *file, void *data, GPContext *context)
{
/*Camera *camera = data;*/
/*
- * Upload the file to the camera. Use gp_file_get_data_and_size,
- * gp_file_get_name, etc.
+ * Upload the file to the camera. Use gp_file_get_data_and_size, etc
*/
return GP_OK;
diff --git a/camlibs/topfield/puppy.c b/camlibs/topfield/puppy.c
index e331fb7cc..57774e935 100644
--- a/camlibs/topfield/puppy.c
+++ b/camlibs/topfield/puppy.c
@@ -443,7 +443,7 @@ decode_and_get_info(Camera *camera, const char *folder, struct tf_packet *p, con
xinfo.file.size = get_u64(&entries[i].size);
xinfo.file.mtime = tfdt_to_time(&entries[i].stamp);
gp_filesystem_append (camera->fs, folder, name, context); /* FIXME: might fail if exist? */
- gp_filesystem_set_info_noop (camera->fs, folder, xinfo, context);
+ gp_filesystem_set_info_noop (camera->fs, folder, name, xinfo, context);
}
break;
default:
@@ -719,14 +719,13 @@ out:
#if 0
static int
-put_file_func (CameraFilesystem *fs, const char *folder, CameraFile *file,
+put_file_func (CameraFilesystem *fs, const char *folder, const char *filename, CameraFile *file,
void *data, GPContext *context)
{
Camera *camera = data;
/*
- * Upload the file to the camera. Use gp_file_get_data_and_size,
- * gp_file_get_name, etc.
+ * Upload the file to the camera. Use gp_file_get_data_and_size etc.
*/
int result = -EPROTO;
time_t startTime = time(NULL);
@@ -746,10 +745,6 @@ put_file_func (CameraFilesystem *fs, const char *folder, CameraFile *file,
char *path;
struct tf_packet reply;
- r = gp_file_get_name (file, &filename);
- if (r < GP_OK)
- return r;
-
if(0 != fstat(src, &srcStat))
{
gp_log (GP_LOG_ERROR, "topfield", "ERROR: Can not examine source file: %s\n",
diff --git a/gphoto2/gphoto2-camera.h b/gphoto2/gphoto2-camera.h
index a16e6d71b..2d19bc215 100644
--- a/gphoto2/gphoto2-camera.h
+++ b/gphoto2/gphoto2-camera.h
@@ -335,7 +335,8 @@ int gp_camera_folder_list_folders (Camera *camera, const char *folder,
CameraList *list, GPContext *context);
int gp_camera_folder_delete_all (Camera *camera, const char *folder,
GPContext *context);
-int gp_camera_folder_put_file (Camera *camera, const char *folder,
+int gp_camera_folder_put_file (Camera *camera,
+ const char *folder, const char *filename,
CameraFile *file, GPContext *context);
int gp_camera_folder_make_dir (Camera *camera, const char *folder,
const char *name, GPContext *context);
diff --git a/gphoto2/gphoto2-filesys.h b/gphoto2/gphoto2-filesys.h
index c07b44c37..6633c93c8 100644
--- a/gphoto2/gphoto2-filesys.h
+++ b/gphoto2/gphoto2-filesys.h
@@ -54,7 +54,6 @@ extern "C" {
typedef enum {
GP_FILE_INFO_NONE = 0, /**< \brief No fields set. */
GP_FILE_INFO_TYPE = 1 << 0, /**< \brief The MIME type is set. */
- GP_FILE_INFO_NAME = 1 << 1, /**< \brief The name is set. */
GP_FILE_INFO_SIZE = 1 << 2, /**< \brief The filesize is set. */
GP_FILE_INFO_WIDTH = 1 << 3, /**< \brief The width is set. */
GP_FILE_INFO_HEIGHT = 1 << 4, /**< \brief The height is set. */
@@ -99,7 +98,6 @@ typedef struct _CameraFileInfoFile {
char type[64]; /**< \brief MIME type of the file. */
uint32_t width; /**< \brief Height of the file. */
uint32_t height; /**< \brief Width of the file. */
- char name[64]; /**< \brief Filename of the file. */
CameraFilePermissions permissions;/**< \brief Permissions of the file. */
time_t mtime; /**< \brief Modification time of the file. */
} CameraFileInfoFile;
@@ -240,9 +238,11 @@ int gp_filesystem_free (CameraFilesystem *fs);
/* Manual editing */
int gp_filesystem_append (CameraFilesystem *fs, const char *folder,
const char *filename, GPContext *context);
-int gp_filesystem_set_info_noop (CameraFilesystem *fs, const char *folder,
+int gp_filesystem_set_info_noop (CameraFilesystem *fs,
+ const char *folder, const char *filename,
CameraFileInfo info, GPContext *context);
-int gp_filesystem_set_file_noop (CameraFilesystem *fs, const char *folder,
+int gp_filesystem_set_file_noop (CameraFilesystem *fs,
+ const char *folder, const char *filename,
CameraFile *file, GPContext *context);
int gp_filesystem_delete_file_noop (CameraFilesystem *fs, const char *folder,
const char *filename, GPContext *context);
@@ -318,6 +318,7 @@ int gp_filesystem_delete_file (CameraFilesystem *fs, const char *folder,
/* Folders */
typedef int (*CameraFilesystemPutFileFunc) (CameraFilesystem *fs,
const char *folder,
+ const char *filename,
CameraFile *file, void *data,
GPContext *context);
typedef int (*CameraFilesystemDeleteAllFunc) (CameraFilesystem *fs,
@@ -365,7 +366,7 @@ struct _CameraFilesystemFuncs {
int gp_filesystem_set_funcs (CameraFilesystem *fs,
CameraFilesystemFuncs *funcs,
void *data);
-int gp_filesystem_put_file (CameraFilesystem *fs, const char *folder,
+int gp_filesystem_put_file (CameraFilesystem *fs, const char *folder, const char *filename,
CameraFile *file, GPContext *context);
int gp_filesystem_delete_all (CameraFilesystem *fs, const char *folder,
GPContext *context);
diff --git a/libgphoto2/gphoto2-camera.c b/libgphoto2/gphoto2-camera.c
index 5dcf2338d..a4ecb69f9 100644
--- a/libgphoto2/gphoto2-camera.c
+++ b/libgphoto2/gphoto2-camera.c
@@ -1145,7 +1145,8 @@ gp_camera_folder_delete_all (Camera *camera, const char *folder,
*
**/
int
-gp_camera_folder_put_file (Camera *camera, const char *folder,
+gp_camera_folder_put_file (Camera *camera,
+ const char *folder, const char *filename,
CameraFile *file, GPContext *context)
{
gp_log (GP_LOG_DEBUG, "gphoto2-camera", "Uploading file into '%s'...",
@@ -1155,7 +1156,7 @@ gp_camera_folder_put_file (Camera *camera, const char *folder,
CHECK_INIT (camera, context);
CHECK_RESULT_OPEN_CLOSE (camera, gp_filesystem_put_file (camera->fs,
- folder, file, context), context);
+ folder, filename, file, context), context);
CAMERA_UNUSED (camera, context);
return (GP_OK);
@@ -1224,11 +1225,6 @@ gp_camera_file_get_info (Camera *camera, const char *folder,
}
gp_file_unref (cfile);
- /* We don't trust the camera libraries */
- info->file.fields |= GP_FILE_INFO_NAME;
- strncpy (info->file.name, file, sizeof (info->file.name));
- info->preview.fields &= ~GP_FILE_INFO_NAME;
-
CAMERA_UNUSED (camera, context);
return (GP_OK);
}
diff --git a/libgphoto2/gphoto2-filesys.c b/libgphoto2/gphoto2-filesys.c
index 77a18b9c9..d571ab082 100644
--- a/libgphoto2/gphoto2-filesys.c
+++ b/libgphoto2/gphoto2-filesys.c
@@ -570,14 +570,12 @@ append_folder (CameraFilesystem *fs,
}
static int
-append_file (CameraFilesystem *fs, CameraFilesystemFolder *folder, CameraFile *file, GPContext *context)
+append_file (CameraFilesystem *fs, CameraFilesystemFolder *folder, const char *name, CameraFile *file, GPContext *context)
{
CameraFilesystemFile *new;
- const char *name;
CHECK_NULL (fs && file);
- CR (gp_file_get_name (file, &name));
gp_log (GP_LOG_DEBUG, "gphoto2-filesystem", "Appending file %s...", name);
new = folder->files;
@@ -1228,7 +1226,8 @@ gp_filesystem_remove_dir (CameraFilesystem *fs, const char *folder,
* \return a gphoto2 error code.
**/
int
-gp_filesystem_put_file (CameraFilesystem *fs, const char *folder,
+gp_filesystem_put_file (CameraFilesystem *fs,
+ const char *folder, const char *filename,
CameraFile *file, GPContext *context)
{
CameraFilesystemFolder *f;
@@ -1249,9 +1248,9 @@ gp_filesystem_put_file (CameraFilesystem *fs, const char *folder,
if (!f) return (GP_ERROR_DIRECTORY_NOT_FOUND);
/* Upload the file */
- CR (fs->put_file_func (fs, folder, file, fs->folder_data, context));
+ CR (fs->put_file_func (fs, folder, filename, file, fs->folder_data, context));
/* And upload it to internal structure too */
- return append_file (fs, f, file, context);
+ return append_file (fs, f, filename, file, context);
}
/**
@@ -1631,7 +1630,7 @@ gp_filesystem_get_file_impl (CameraFilesystem *fs, const char *folder,
CR (gp_file_set_name (file, filename));
/* Cache this file */
- CR (gp_filesystem_set_file_noop (fs, folder, file, context));
+ CR (gp_filesystem_set_file_noop (fs, folder, filename, file, context));
/*
* Often, thumbnails are of a different mime type than the normal
@@ -1719,7 +1718,7 @@ gp_filesystem_get_file (CameraFilesystem *fs, const char *folder,
CR (gp_file_set_type (file, GP_FILE_TYPE_PREVIEW));
CR (gp_file_set_name (file, filename));
CR (gp_file_set_mime_type (file, GP_MIME_JPEG));
- CR (gp_filesystem_set_file_noop (fs, folder, file, context));
+ CR (gp_filesystem_set_file_noop (fs, folder, filename, file, context));
CR (gp_file_adjust_name_for_mime_type (file));
#else
GP_DEBUG ("Getting previews is not supported and "
@@ -1758,7 +1757,7 @@ gp_filesystem_get_file (CameraFilesystem *fs, const char *folder,
CR (gp_file_set_type (file, GP_FILE_TYPE_EXIF));
CR (gp_file_set_name (file, filename));
CR (gp_file_set_mime_type (file, GP_MIME_EXIF));
- CR (gp_filesystem_set_file_noop (fs, folder, file, context));
+ CR (gp_filesystem_set_file_noop (fs, folder, filename, file, context));
CR (gp_file_adjust_name_for_mime_type (file));
#else
GP_DEBUG ("Getting EXIF data is not supported and libgphoto2 "
@@ -2039,21 +2038,20 @@ gp_filesystem_lru_count (CameraFilesystem *fs)
}
static int
-gp_filesystem_lru_update (CameraFilesystem *fs, const char *folder,
+gp_filesystem_lru_update (CameraFilesystem *fs,
+ const char *folder, const char *filename,
CameraFile *file, GPContext *context)
{
CameraFilesystemFolder *f;
CameraFilesystemFile *xfile;
CameraFileType type;
CameraFile *oldfile = NULL;
- const char *filename;
unsigned long int size;
int x;
char cached_images[1024];
CHECK_NULL (fs && folder && file);
- CR (gp_file_get_name (file, &filename));
CR (gp_file_get_type (file, &type));
CR (gp_file_get_data_and_size (file, NULL, &size));
@@ -2199,14 +2197,14 @@ gp_filesystem_lru_check (CameraFilesystem *fs)
* \return a gphoto2 error code.
**/
int
-gp_filesystem_set_file_noop (CameraFilesystem *fs, const char *folder,
+gp_filesystem_set_file_noop (CameraFilesystem *fs,
+ const char *folder, const char *filename,
CameraFile *file, GPContext *context)
{
CameraFileType type;
CameraFileInfo info;
CameraFilesystemFolder *f;
CameraFilesystemFile *xfile;
- const char *filename;
int r;
time_t t;
@@ -2214,7 +2212,6 @@ gp_filesystem_set_file_noop (CameraFilesystem *fs, const char *folder,
CC (context);
CA (folder, context);
- CR (gp_file_get_name (file, &filename));
CR (gp_file_get_type (file, &type));
GP_DEBUG ("Adding file '%s' to folder '%s' (type %i)...",
filename, folder, type);
@@ -2230,7 +2227,7 @@ gp_filesystem_set_file_noop (CameraFilesystem *fs, const char *folder,
*/
if ((type == GP_FILE_TYPE_RAW) || (type == GP_FILE_TYPE_NORMAL) ||
(type == GP_FILE_TYPE_AUDIO))
- CR (gp_filesystem_lru_update (fs, folder, file, context));
+ CR (gp_filesystem_lru_update (fs, folder, filename, file, context));
/* Redundant sanity check. */
CR (gp_filesystem_lru_check (fs));
@@ -2337,7 +2334,8 @@ gp_filesystem_set_file_noop (CameraFilesystem *fs, const char *folder,
* \return a gphoto2 error code
**/
int
-gp_filesystem_set_info_noop (CameraFilesystem *fs, const char *folder,
+gp_filesystem_set_info_noop (CameraFilesystem *fs,
+ const char *folder, const char *filename,
CameraFileInfo info, GPContext *context)
{
CameraFilesystemFolder *f;
@@ -2348,7 +2346,7 @@ gp_filesystem_set_info_noop (CameraFilesystem *fs, const char *folder,
CA (folder, context);
/* Search folder and file */
- CR (lookup_folder_file (fs, folder, info.file.name, &f, &xfile, context));
+ CR (lookup_folder_file (fs, folder, filename, &f, &xfile, context));
memcpy (&xfile->info, &info, sizeof (CameraFileInfo));
xfile->info_dirty = 0;
@@ -2372,7 +2370,7 @@ gp_filesystem_set_info (CameraFilesystem *fs, const char *folder,
const char *filename, CameraFileInfo info,
GPContext *context)
{
- int result, name, e;
+ int result;
CameraFilesystemFolder *f;
CameraFilesystemFile *xfile;
@@ -2412,11 +2410,7 @@ gp_filesystem_set_info (CameraFilesystem *fs, const char *folder,
/*
* Set the info. If anything goes wrong, mark info as dirty,
* because the operation could have been partially successful.
- *
- * Handle name changes in a separate round.
*/
- name = (info.file.fields & GP_FILE_INFO_NAME);
- info.file.fields &= ~GP_FILE_INFO_NAME;
result = fs->set_info_func (fs, folder, filename, info, fs->info_data,
context);
if (result < 0) {
@@ -2426,28 +2420,6 @@ gp_filesystem_set_info (CameraFilesystem *fs, const char *folder,
if (info.file.fields & GP_FILE_INFO_PERMISSIONS)
xfile->info.file.permissions = info.file.permissions;
- /* Handle name change */
- if (name) {
- char *xname;
- /* Make sure the file does not exist */
- e = gp_filesystem_number (fs, folder, info.file.name, context);
- if (e != GP_ERROR_FILE_NOT_FOUND)
- return (e);
-
- info.preview.fields = GP_FILE_INFO_NONE;
- info.file.fields = GP_FILE_INFO_NAME;
- info.audio.fields = GP_FILE_INFO_NONE;
- CR (fs->set_info_func (fs, folder, filename, info,
- fs->info_data, context));
- strncpy (xfile->info.file.name, info.file.name,
- sizeof (xfile->info.file.name));
- xname = strdup(info.file.name);
- if (xname) {
- free (xfile->name);
- xfile->name = xname;
- }
- }
-
return (GP_OK);
}
diff --git a/tests/test-filesys.c b/tests/test-filesys.c
index 531cc02d0..88c37ac78 100644
--- a/tests/test-filesys.c
+++ b/tests/test-filesys.c
@@ -75,9 +75,7 @@ get_info_func (CameraFilesystem __unused__ *fs, const char __unused__ *folder,
printf (" -> The camera will get the file info here.\n");
info->preview.fields = GP_FILE_INFO_NONE;
- info->file.fields = GP_FILE_INFO_NAME;
- strcpy (info->file.name, file);
-
+ info->file.fields = GP_FILE_INFO_NONE;
return (GP_OK);
}