From: <mar...@us...> - 2010-11-09 08:52:43
|
Revision: 13387 http://gphoto.svn.sourceforge.net/gphoto/?rev=13387&view=rev Author: marcusmeissner Date: 2010-11-09 08:52:37 +0000 (Tue, 09 Nov 2010) Log Message: ----------- fixed fnumber float-decimal conversion issue Modified Paths: -------------- trunk/libgphoto2/camlibs/ptp2/config.c Modified: trunk/libgphoto2/camlibs/ptp2/config.c =================================================================== --- trunk/libgphoto2/camlibs/ptp2/config.c 2010-11-09 08:50:35 UTC (rev 13386) +++ trunk/libgphoto2/camlibs/ptp2/config.c 2010-11-09 08:52:37 UTC (rev 13387) @@ -2113,15 +2113,26 @@ static int _put_FNumber(CONFIG_PUT_ARGS) { - int ret; + int ret, i; char *value; float f; ret = gp_widget_get_value (widget, &value); if (ret != GP_OK) return ret; + if (strstr (value, "f/") == value) + value += strlen("f/"); - if (sscanf(value, "f/%g", &f)) { + for (i=0;i<dpd->FORM.Enum.NumberOfValues; i++) { + char buf[20]; + + sprintf(buf,"%g",(dpd->FORM.Enum.SupportedValue[i].u16*1.0)/100.0); + if (!strcmp (buf, value)) { + propval->u16 = dpd->FORM.Enum.SupportedValue[i].u16; + return GP_OK; + } + } + if (sscanf(value, "%g", &f)) { propval->u16 = f*100; return GP_OK; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |