summaryrefslogtreecommitdiff
path: root/camlibs
diff options
context:
space:
mode:
authorMarcus Meissner <marcus@jet.franken.de>2014-06-01 15:53:33 +0000
committerMarcus Meissner <marcus@jet.franken.de>2014-06-01 15:53:33 +0000
commitcce66f195970df5e9847099f31fa0f93ba03dc57 (patch)
treefa033c233bbd67bf662ae68358967375b2b8a5e4 /camlibs
parent30a9d08663b0e53f3b6931fdd0a8a7359bfcd478 (diff)
downloadlibgphoto2-cce66f195970df5e9847099f31fa0f93ba03dc57.tar.gz
avoid duplication of "DevicePropertyCode" in the cache
git-svn-id: https://svn.code.sf.net/p/gphoto/code/trunk/libgphoto2@14982 67ed7778-7388-44ab-90cf-0a291f65f57c
Diffstat (limited to 'camlibs')
-rw-r--r--camlibs/ptp2/ptp.c12
-rw-r--r--camlibs/ptp2/ptp.h1
2 files changed, 5 insertions, 8 deletions
diff --git a/camlibs/ptp2/ptp.c b/camlibs/ptp2/ptp.c
index 672ee5b50..ffe004fe0 100644
--- a/camlibs/ptp2/ptp.c
+++ b/camlibs/ptp2/ptp.c
@@ -743,11 +743,12 @@ parse_9301_prop_tree (PTPParams *params, xmlNodePtr node, PTPDeviceInfo *di) {
sscanf((char*)next->name, "p%04x", &p);
ptp_debug( params, "prop %s / 0x%04x", next->name, p);
parse_9301_propdesc (params, xmlFirstElementChild (next), &dpd);
+ dpd.DevicePropertyCode = p;
di->DevicePropertiesSupported[cnt++] = p;
/* add to cache of device propdesc */
for (i=0;i<params->nrofdeviceproperties;i++)
- if (params->deviceproperties[i].prop == p)
+ if (params->deviceproperties[i].desc.DevicePropertyCode == p)
break;
if (i == params->nrofdeviceproperties) {
if (!i)
@@ -756,7 +757,6 @@ parse_9301_prop_tree (PTPParams *params, xmlNodePtr node, PTPDeviceInfo *di) {
params->deviceproperties = realloc(params->deviceproperties,(i+1)*sizeof(params->deviceproperties[0]));
memset(&params->deviceproperties[i],0,sizeof(params->deviceproperties[0]));
params->nrofdeviceproperties++;
- params->deviceproperties[i].prop = p;
} else {
ptp_free_devicepropdesc (&params->deviceproperties[i].desc);
}
@@ -2992,7 +2992,7 @@ ptp_sony_getalldevicepropdesc (PTPParams* params)
propcode = dpd.DevicePropertyCode;
for (i=0;i<params->nrofdeviceproperties;i++)
- if (params->deviceproperties[i].prop == propcode)
+ if (params->deviceproperties[i].desc.DevicePropertyCode == propcode)
break;
if (i == params->nrofdeviceproperties) {
@@ -3002,7 +3002,6 @@ ptp_sony_getalldevicepropdesc (PTPParams* params)
params->deviceproperties = realloc(params->deviceproperties,(i+1)*sizeof(params->deviceproperties[0]));
memset(&params->deviceproperties[i],0,sizeof(params->deviceproperties[0]));
params->nrofdeviceproperties++;
- params->deviceproperties[i].prop = propcode;
} else {
ptp_free_devicepropdesc (&params->deviceproperties[i].desc);
}
@@ -3103,7 +3102,7 @@ ptp_generic_getdevicepropdesc (PTPParams *params, uint16_t propcode, PTPDevicePr
time_t now;
for (i=0;i<params->nrofdeviceproperties;i++)
- if (params->deviceproperties[i].prop == propcode)
+ if (params->deviceproperties[i].desc.DevicePropertyCode == propcode)
break;
if (i == params->nrofdeviceproperties) {
if (!i)
@@ -3112,7 +3111,6 @@ ptp_generic_getdevicepropdesc (PTPParams *params, uint16_t propcode, PTPDevicePr
params->deviceproperties = realloc(params->deviceproperties,(i+1)*sizeof(params->deviceproperties[0]));
memset(&params->deviceproperties[i],0,sizeof(params->deviceproperties[0]));
params->nrofdeviceproperties++;
- params->deviceproperties[i].prop = propcode;
}
if (params->deviceproperties[i].desc.DataType != PTP_DTC_UNDEF) {
@@ -3133,7 +3131,7 @@ ptp_generic_getdevicepropdesc (PTPParams *params, uint16_t propcode, PTPDevicePr
return ret;
for (i=0;i<params->nrofdeviceproperties;i++)
- if (params->deviceproperties[i].prop == propcode)
+ if (params->deviceproperties[i].desc.DevicePropertyCode == propcode)
break;
time(&now);
params->deviceproperties[i].timestamp = now;
diff --git a/camlibs/ptp2/ptp.h b/camlibs/ptp2/ptp.h
index 910849c04..c0fa6c6aa 100644
--- a/camlibs/ptp2/ptp.h
+++ b/camlibs/ptp2/ptp.h
@@ -2313,7 +2313,6 @@ typedef struct _PTPObject PTPObject;
/* The Device Property Cache */
struct _PTPDeviceProperty {
- uint16_t prop;
time_t timestamp;
PTPDevicePropDesc desc;
PTPPropertyValue value;