summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorMatthias Vogelgesang <matthias.vogelgesang@ipe.fzk.de>2011-03-16 08:58:55 +0100
committerMatthias Vogelgesang <matthias.vogelgesang@ipe.fzk.de>2011-03-16 08:58:55 +0100
commit54a229b3864fe7867da69ef7427877094a256f1c (patch)
tree44b314944e24f3ef522360d76255bbc21ea36e12 /test
parent98511f7a77e7b37f9508b66298d99d7d1103e422 (diff)
downloadlibuca-54a229b3864fe7867da69ef7427877094a256f1c.tar.gz
libuca-54a229b3864fe7867da69ef7427877094a256f1c.tar.bz2
libuca-54a229b3864fe7867da69ef7427877094a256f1c.tar.xz
libuca-54a229b3864fe7867da69ef7427877094a256f1c.zip
Pass target string size when calling uca_get_property
Diffstat (limited to 'test')
-rw-r--r--test/control.c15
-rw-r--r--test/enum.c9
-rw-r--r--test/grab.c6
3 files changed, 16 insertions, 14 deletions
diff --git a/test/control.c b/test/control.c
index a8c7079..6024c08 100644
--- a/test/control.c
+++ b/test/control.c
@@ -206,7 +206,8 @@ void fill_tree_store(GtkTreeStore *tree_store, struct uca_camera_t *cam)
{
GtkTreeIter iter, child;
struct uca_property_t *property;
- gchar *value_string = g_malloc(256);
+ const size_t num_bytes = 256;
+ gchar *value_string = g_malloc(num_bytes);
guint8 value_8;
guint32 value_32;
@@ -215,16 +216,16 @@ void fill_tree_store(GtkTreeStore *tree_store, struct uca_camera_t *cam)
uint32_t result = UCA_NO_ERROR;
switch (property->type) {
case uca_string:
- result = cam->get_property(cam, prop_id, value_string);
+ result = cam->get_property(cam, prop_id, value_string, num_bytes);
break;
case uca_uint8t:
- result = cam->get_property(cam, prop_id, &value_8);
+ result = cam->get_property(cam, prop_id, &value_8, 0);
g_sprintf(value_string, "%d", value_8);
break;
case uca_uint32t:
- result = cam->get_property(cam, prop_id, &value_32);
+ result = cam->get_property(cam, prop_id, &value_32, 0);
g_sprintf(value_string, "%d", value_32);
break;
}
@@ -281,9 +282,9 @@ int main(int argc, char *argv[])
int width, height, bits_per_sample;
struct uca_camera_t *cam = uca->cameras;
- cam->get_property(cam, UCA_PROP_WIDTH, &width);
- cam->get_property(cam, UCA_PROP_HEIGHT, &height);
- cam->get_property(cam, UCA_PROP_BITDEPTH, &bits_per_sample);
+ cam->get_property(cam, UCA_PROP_WIDTH, &width, 0);
+ cam->get_property(cam, UCA_PROP_HEIGHT, &height, 0);
+ cam->get_property(cam, UCA_PROP_BITDEPTH, &bits_per_sample, 0);
g_thread_init(NULL);
gdk_threads_init();
diff --git a/test/enum.c b/test/enum.c
index 8803ec4..1164399 100644
--- a/test/enum.c
+++ b/test/enum.c
@@ -30,7 +30,8 @@ int main(int argc, char *argv[])
/* take first camera */
struct uca_camera_t *cam = uca->cameras;
- char string_value[256];
+ const size_t num_bytes = 256;
+ char string_value[num_bytes];
uint32_t uint32_value;
uint8_t uint8_value;
@@ -41,21 +42,21 @@ int main(int argc, char *argv[])
printf("%s = ", prop->name);
switch (prop->type) {
case uca_string:
- if (cam->get_property(cam, i, string_value) != UCA_ERR_PROP_INVALID) {
+ if (cam->get_property(cam, i, string_value, num_bytes) != UCA_ERR_PROP_INVALID) {
printf("%s ", string_value);
}
else
printf("n/a");
break;
case uca_uint32t:
- if (cam->get_property(cam, i, &uint32_value) != UCA_ERR_PROP_INVALID) {
+ if (cam->get_property(cam, i, &uint32_value, 0) != UCA_ERR_PROP_INVALID) {
printf("%i %s", uint32_value, uca_unit_map[prop->unit]);
}
else
printf("n/a");
break;
case uca_uint8t:
- if (cam->get_property(cam, i, &uint8_value) != UCA_ERR_PROP_INVALID) {
+ if (cam->get_property(cam, i, &uint8_value, 0) != UCA_ERR_PROP_INVALID) {
printf("%i %s", uint8_value, uca_unit_map[prop->unit]);
}
else
diff --git a/test/grab.c b/test/grab.c
index 5ae44f1..6f646c7 100644
--- a/test/grab.c
+++ b/test/grab.c
@@ -21,9 +21,9 @@ int main(int argc, char *argv[])
cam->set_property(cam, UCA_PROP_DELAY, &val);
uint32_t width, height, bits;
- cam->get_property(cam, UCA_PROP_WIDTH, &width);
- cam->get_property(cam, UCA_PROP_HEIGHT, &height);
- cam->get_property(cam, UCA_PROP_BITDEPTH, &bits);
+ cam->get_property(cam, UCA_PROP_WIDTH, &width, 0);
+ cam->get_property(cam, UCA_PROP_HEIGHT, &height, 0);
+ cam->get_property(cam, UCA_PROP_BITDEPTH, &bits, 0);
uca_cam_alloc(cam, 10);