[Digikam-devel] [Bug 129610] digikam: unsupported initialization of CameraList object
Gilles Caulier
caulier.gilles at free.fr
Wed Jun 21 22:31:39 BST 2006
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.
http://bugs.kde.org/show_bug.cgi?id=129610
------- Additional Comments From caulier.gilles free fr 2006-06-21 23:31 -------
SVN commit 553732 by cgilles:
digikam from stable : fix initialization of CameraList object
CCBUGS: 129610
M +57 -36 gpcamera.cpp
--- branches/stable/extragear/graphics/digikam/utilities/cameragui/gpcamera.cpp #553731:553732
@ -18,40 +18,57 @
*
* ============================================================ */
+// C Ansi includes.
+
+extern "C"
+{
+#include <stdio.h>
+#include <gphoto2.h>
+}
+
+// C++ includes.
+
+#include <iostream>
+
+// Qt includes.
+
#include <qstring.h>
#include <qstringlist.h>
#include <qimage.h>
#include <qdom.h>
#include <qfile.h>
-#include <iostream>
+// KDE includes.
-extern "C" {
-#include <stdio.h>
-#include <gphoto2.h>
-}
+#include <kdebug.h>
+// Local includes.
+
#include "gpcamera.h"
class GPCameraPrivate
{
public:
- Camera *camera;
- CameraAbilities cameraAbilities;
+ GPCameraPrivate()
+ {
+ camera = 0;
+ }
- QString model;
- QString port;
- QString globalPath;
-
- bool cameraInitialized;
+ bool cameraInitialized;
- bool thumbnailSupport;
- bool deleteSupport;
- bool uploadSupport;
- bool mkDirSupport;
- bool delDirSupport;
+ bool thumbnailSupport;
+ bool deleteSupport;
+ bool uploadSupport;
+ bool mkDirSupport;
+ bool delDirSupport;
+ QString model;
+ QString port;
+ QString globalPath;
+
+ Camera *camera;
+ CameraAbilities cameraAbilities;
};
class GPStatus
@ -802,38 +819,42 @
int GPCamera::autoDetect(QString& model, QString& port)
{
- CameraList camList;
+ CameraList *camList;
CameraAbilitiesList *abilList;
- GPPortInfoList *infoList;
- const char *camModel_, *camPort_;
- GPContext *context;
+ GPPortInfoList *infoList;
+ const char *camModel_, *camPort_;
+ GPContext *context;
- context = gp_context_new ();
+ context = gp_context_new();
+ gp_list_new(&camList);
- gp_abilities_list_new (&abilList);
- gp_abilities_list_load (abilList, context);
- gp_port_info_list_new (&infoList);
- gp_port_info_list_load (infoList);
- gp_abilities_list_detect (abilList, infoList,
- &camList, context);
- gp_abilities_list_free (abilList);
- gp_port_info_list_free (infoList);
+ gp_abilities_list_new(&abilList);
+ gp_abilities_list_load(abilList, context);
+ gp_port_info_list_new(&infoList);
+ gp_port_info_list_load(infoList);
+ gp_abilities_list_detect(abilList, infoList, camList, context);
+ gp_abilities_list_free(abilList);
+ gp_port_info_list_free(infoList);
- gp_context_unref( context );
+ gp_context_unref(context);
- int count = gp_list_count (&camList);
+ int count = gp_list_count(camList);
- if (count<=0) {
+ if (count <= 0)
+ {
+ gp_list_free(camList);
return -1;
}
- for (int i = 0; i < count; i++) {
- gp_list_get_name (&camList, i, &camModel_);
- gp_list_get_value (&camList, i, &camPort_);
+ for (int i = 0 ; i < count ; i++)
+ {
+ gp_list_get_name (camList, i, &camModel_);
+ gp_list_get_value(camList, i, &camPort_);
}
model = camModel_;
port = camPort_;
+ gp_list_free(camList);
return 0;
}
More information about the Digikam-devel
mailing list