diff options
author | Marcus Meissner <marcus@jet.franken.de> | 2014-03-22 07:51:16 +0000 |
---|---|---|
committer | Marcus Meissner <marcus@jet.franken.de> | 2014-03-22 07:51:16 +0000 |
commit | 84e690f0c1be232d222c11bca4c340de62d5dde9 (patch) | |
tree | e6bb483b1ae492b2b3a93705d9f475e2ebacb8b8 | |
parent | 961aa0d0eb3187943946f88c12718f80e44af923 (diff) | |
download | libgphoto2-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.c | 13 | ||||
-rw-r--r-- | camlibs/ptp2/ptp.c | 2 |
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, ¶ms->deviceproperties[i].desc); + duplicate_DevicePropDesc(¶ms->deviceproperties[i].desc, dpd); return PTP_RC_OK; } |