summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarcus Meissner <marcus@jet.franken.de>2014-03-22 07:51:16 +0000
committerMarcus Meissner <marcus@jet.franken.de>2014-03-22 07:51:16 +0000
commit84e690f0c1be232d222c11bca4c340de62d5dde9 (patch)
treee6bb483b1ae492b2b3a93705d9f475e2ebacb8b8
parent961aa0d0eb3187943946f88c12718f80e44af923 (diff)
downloadlibgphoto2-84e690f0c1be232d222c11bca4c340de62d5dde9.tar.gz
Fixed duplicate_DevicePropDesc to handle strings
Fixed devicepropdesc cacher in the generic case to work at all... git-svn-id: https://svn.code.sf.net/p/gphoto/code/trunk/libgphoto2@14834 67ed7778-7388-44ab-90cf-0a291f65f57c
-rw-r--r--camlibs/ptp2/ptp-pack.c13
-rw-r--r--camlibs/ptp2/ptp.c2
2 files changed, 11 insertions, 4 deletions
diff --git a/camlibs/ptp2/ptp-pack.c b/camlibs/ptp2/ptp-pack.c
index f52128a1c..2a9cecec1 100644
--- a/camlibs/ptp2/ptp-pack.c
+++ b/camlibs/ptp2/ptp-pack.c
@@ -930,6 +930,14 @@ outofmemory:
static inline void
duplicate_PropertyValue (const PTPPropertyValue *src, PTPPropertyValue *dst, uint16_t type) {
+ if (type == PTP_DTC_STR) {
+ if (src->str)
+ dst->str = strdup(src->str);
+ else
+ dst->str = NULL;
+ return;
+ }
+
if (type & PTP_DTC_ARRAY_MASK) {
unsigned int i;
@@ -952,7 +960,6 @@ duplicate_PropertyValue (const PTPPropertyValue *src, PTPPropertyValue *dst, uin
case PTP_DTC_INT128: dst->i128 = src->i128; break;
case PTP_DTC_UINT128: dst->u128 = src->u128; break;
#endif
- case PTP_DTC_STR: dst->str = strdup(src->str); break;
default: break;
}
return;
@@ -966,8 +973,8 @@ duplicate_DevicePropDesc(const PTPDevicePropDesc *src, PTPDevicePropDesc *dst) {
dst->DataType = src->DataType;
dst->GetSet = src->GetSet;
- duplicate_PropertyValue (&src->FactoryDefaultValue, &dst->FactoryDefaultValue, dst->DataType);
- duplicate_PropertyValue (&src->CurrentValue, &dst->CurrentValue, dst->DataType);
+ duplicate_PropertyValue (&src->FactoryDefaultValue, &dst->FactoryDefaultValue, src->DataType);
+ duplicate_PropertyValue (&src->CurrentValue, &dst->CurrentValue, src->DataType);
dst->FormFlag = src->FormFlag;
switch (src->FormFlag) {
diff --git a/camlibs/ptp2/ptp.c b/camlibs/ptp2/ptp.c
index a55e18655..bcdbebe3c 100644
--- a/camlibs/ptp2/ptp.c
+++ b/camlibs/ptp2/ptp.c
@@ -3093,7 +3093,7 @@ ptp_generic_getdevicepropdesc (PTPParams *params, uint16_t propcode, PTPDevicePr
time(&now);
params->deviceproperties[i].timestamp = now;
- duplicate_DevicePropDesc(dpd, &params->deviceproperties[i].desc);
+ duplicate_DevicePropDesc(&params->deviceproperties[i].desc, dpd);
return PTP_RC_OK;
}