summaryrefslogtreecommitdiff
path: root/libgphoto2/gphoto2-widget.c
diff options
context:
space:
mode:
authorMarcus Meissner <marcus@jet.franken.de>2005-09-08 07:05:45 +0000
committerMarcus Meissner <marcus@jet.franken.de>2005-09-08 07:05:45 +0000
commitc9f61bca6a5b01343aab91159051e32019fdde0b (patch)
treef0780ce46744185e7cefb32327c575f24aabc9fa /libgphoto2/gphoto2-widget.c
parent2427d7f2a35067716370d8881ee970181374abb8 (diff)
downloadlibgphoto2-c9f61bca6a5b01343aab91159051e32019fdde0b.tar.gz
bump choices up to 100 max (for now).
should be a linked list or dynamic (will see when I find time). git-svn-id: https://svn.code.sf.net/p/gphoto/code/trunk/libgphoto2@8236 67ed7778-7388-44ab-90cf-0a291f65f57c
Diffstat (limited to 'libgphoto2/gphoto2-widget.c')
-rw-r--r--libgphoto2/gphoto2-widget.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/libgphoto2/gphoto2-widget.c b/libgphoto2/gphoto2-widget.c
index 0c3d725d7..3a6bc0562 100644
--- a/libgphoto2/gphoto2-widget.c
+++ b/libgphoto2/gphoto2-widget.c
@@ -48,7 +48,7 @@ struct _CameraWidget {
float value_float;
/* For Radio and Menu */
- char choice [32] [64];
+ char choice [100] [64];
int choice_count;
/* For Range */
@@ -108,12 +108,12 @@ gp_widget_new (CameraWidgetType type, const char *label,
(*widget)->choice_count = 0;
(*widget)->id = i++;
- /* Alloc 64 children pointers */
- memset ((*widget)->children, 0, sizeof (CameraWidget*) * 64);
+ /* Clear all children pointers */
+ memset ((*widget)->children, 0, sizeof((*widget)->children));
(*widget)->children_count = 0;
/* Clear out the choices */
- for (x = 0; x < 32; x++)
+ for (x = 0; x < sizeof((*widget)->choice)/sizeof((*widget)->choice[0]); x++)
strcpy ((*widget)->choice[x], "");
return (GP_OK);
@@ -730,11 +730,11 @@ gp_widget_add_choice (CameraWidget *widget, const char *choice)
(widget->type != GP_WIDGET_MENU))
return (GP_ERROR_BAD_PARAMETERS);
- /* static list of choices is full (32?) */
+ /* static list of choices is full */
if (widget->choice_count >= sizeof(widget->choice)/sizeof(widget->choice[0]))
return (GP_ERROR);
- strncpy (widget->choice[widget->choice_count], choice, 64);
+ strncpy (widget->choice[widget->choice_count], choice, sizeof(widget->choice[0]));
widget->choice_count += 1;
return (GP_OK);