summaryrefslogtreecommitdiff
path: root/camlibs/canon
diff options
context:
space:
mode:
authorMarcus Meissner <marcus@jet.franken.de>2013-08-24 14:41:48 +0000
committerMarcus Meissner <marcus@jet.franken.de>2013-08-24 14:41:48 +0000
commite43d36dae9f094010a1e23d9f1c83f9dca707894 (patch)
treedfb225e7db1070b532b6efb9e0470a6924453111 /camlibs/canon
parent1a146470e4e1c3b71ab50e575641d28d97b92438 (diff)
downloadlibgphoto2-e43d36dae9f094010a1e23d9f1c83f9dca707894.tar.gz
correct "mark as downloaded" logic
Patch by Wolfram Sang <wolfram@the-dreams.de> git-svn-id: https://svn.code.sf.net/p/gphoto/code/trunk/libgphoto2@14509 67ed7778-7388-44ab-90cf-0a291f65f57c
Diffstat (limited to 'camlibs/canon')
-rw-r--r--camlibs/canon/canon.c14
-rw-r--r--camlibs/canon/canon.h4
-rw-r--r--camlibs/canon/library.c3
3 files changed, 9 insertions, 12 deletions
diff --git a/camlibs/canon/canon.c b/camlibs/canon/canon.c
index 149dd7573..93dccee79 100644
--- a/camlibs/canon/canon.c
+++ b/camlibs/canon/canon.c
@@ -3330,11 +3330,10 @@ canon_int_list_directory (Camera *camera, const char *folder, CameraList *list,
sizeof (info.file.type));
info.file.fields |= GP_FILE_INFO_TYPE;
- if ((dirent_attrs & CANON_ATTR_DOWNLOADED) == 0)
- info.file.status = GP_FILE_STATUS_DOWNLOADED;
+ if (dirent_attrs & CANON_ATTR_NOT_DOWNLOADED)
+ info.file.status = GP_FILE_STATUS_NOT_DOWNLOADED;
else
- info.file.status =
- GP_FILE_STATUS_NOT_DOWNLOADED;
+ info.file.status = GP_FILE_STATUS_DOWNLOADED;
info.file.fields |= GP_FILE_INFO_STATUS;
/* the size is located at offset 2 and is 4
@@ -3894,11 +3893,10 @@ canon_int_get_info_func (Camera *camera, const char *folder,
sizeof (info->file.type));
info->file.fields |= GP_FILE_INFO_TYPE;
- if ((dirent_attrs & CANON_ATTR_DOWNLOADED) == 0)
- info->file.status = GP_FILE_STATUS_DOWNLOADED;
+ if (dirent_attrs & CANON_ATTR_NOT_DOWNLOADED)
+ info->file.status = GP_FILE_STATUS_NOT_DOWNLOADED;
else
- info->file.status =
- GP_FILE_STATUS_NOT_DOWNLOADED;
+ info->file.status = GP_FILE_STATUS_DOWNLOADED;
info->file.fields |= GP_FILE_INFO_STATUS;
/* the size is located at offset 2 and is 4
diff --git a/camlibs/canon/canon.h b/camlibs/canon/canon.h
index 4950d3c20..12d14abe6 100644
--- a/camlibs/canon/canon.h
+++ b/camlibs/canon/canon.h
@@ -570,7 +570,7 @@ typedef enum {
* @CANON_ATTR_UNKNOWN_8:
* @CANON_ATTR_NON_RECURS_ENT_DIR: This entry represents a directory
* that was not entered in this listing.
- * @CANON_ATTR_DOWNLOADED: This file has not yet been downloaded
+ * @CANON_ATTR_NOT_DOWNLOADED: This file has not yet been downloaded
* (the bit is cleared by the host software).
* @CANON_ATTR_UNKNOWN_40:
* @CANON_ATTR_RECURS_ENT_DIR: This entry represents a directory
@@ -588,7 +588,7 @@ typedef enum {
CANON_ATTR_UNKNOWN_4 = 0x04,
CANON_ATTR_UNKNOWN_8 = 0x08,
CANON_ATTR_NON_RECURS_ENT_DIR = 0x10,
- CANON_ATTR_DOWNLOADED = 0x20,
+ CANON_ATTR_NOT_DOWNLOADED = 0x20,
CANON_ATTR_UNKNOWN_40 = 0x40,
CANON_ATTR_RECURS_ENT_DIR = 0x80
} canonDirentAttributeBits;
diff --git a/camlibs/canon/library.c b/camlibs/canon/library.c
index 39fab0b08..b11b134d6 100644
--- a/camlibs/canon/library.c
+++ b/camlibs/canon/library.c
@@ -787,6 +787,7 @@ get_file_func (CameraFilesystem *fs, const char *folder, const char *filename,
ret = canon_int_get_file (camera, canon_path, &data, &datalen,
context);
if (ret == GP_OK) {
+ /* 0 also marks image as downloaded */
uint8_t attr = 0;
/* This should cover all attribute
@@ -796,8 +797,6 @@ get_file_func (CameraFilesystem *fs, const char *folder, const char *filename,
CameraFileInfo info;
gp_filesystem_get_info (fs, folder, filename, &info, context);
- if (info.file.status == GP_FILE_STATUS_NOT_DOWNLOADED)
- attr &= ~CANON_ATTR_DOWNLOADED;
if ((info.file.permissions & GP_FILE_PERM_DELETE) == 0)
attr |= CANON_ATTR_WRITE_PROTECTED;
canon_int_set_file_attributes (camera, filename,